Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

chore: refresh dependencies, and close the poster half of Phase 6 (#69)

Matthew Kissinger5f67418a0656
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 694b05f9..a82508c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,26 @@
Changes to `@kiln/engine`. Source and installable packages are distributed through
GitHub. The package is not published on the npm registry.
+## Dependency refresh — 2026-09-11
+
+- Patch and minor bumps with no API surface change: `@types/three` 0.185.4,
+ `acorn` 8.18.0, `manifold-3d` 3.5.3, `sharp` 0.35.4, `zod` 4.6.2,
+ `@anthropic-ai/sdk` 0.125.0, `@biomejs/biome` 2.5.13, `@google/genai` 2.22.0,
+ `@strands-agents/sdk` 1.17.0. `biome.json` follows Biome's own version, which
+ the linter checks and which is what actually failed the gate; one test file
+ picks up the new formatter's line fitting.
+- **`@gltf-transform/*` is now pinned to exactly 4.4.1**, joining `three` and
+ `gltf-validator`. 4.5.0 changes the bytes of every exported GLB: all 83
+ recorded `artifactHash` values move, and the gallery build fails on a stale
+ poster. A caret range on the library that serializes the artifact means the
+ artifact's identity can change on an unrelated install, which is not a
+ property this project can have. Taking 4.5.0 is a deliberate act with receipts
+ re-recorded in the same pass, not a refresh.
+- `three` stays at 0.185.1. `@types/three` has no 0.186.x published, and r186
+ renames `Source` to `TextureSource` and makes
+ `BufferGeometryUtils.toTrianglesDrawMode()` mutate in place rather than clone.
+ Taking the runtime without the types would be a net loss.
+
## Toolchain moved to Bun 1.4.2, and the MCP bundle stopped starting itself — 2026-09-11
- Development toolchain pins move to Bun 1.4.2, Node 22.23.2 and npm 12.0.2.
diff --git a/biome.json b/biome.json
index fc3fdf2e..e1c893d7 100644
--- a/biome.json
+++ b/biome.json
@@ -1,5 +1,5 @@
{
- "$schema": "https://biomejs.dev/schemas/2.5.3/schema.json",
+ "$schema": "https://biomejs.dev/schemas/2.5.13/schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": {
"includes": ["src/**/*.ts", "site/src/**/*.{ts,tsx}", "site/*.ts"],
diff --git a/bun.lock b/bun.lock
index 6ca5aeeb..16714ea0 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5,30 +5,30 @@
"": {
"name": "@kiln/engine",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3",
+ "zod": "^4.6.2",
},
"devDependencies": {
"@ai-sdk/provider": "^3.0.14",
- "@anthropic-ai/sdk": "^0.110.0",
+ "@anthropic-ai/sdk": "^0.125.0",
"@aws-sdk/client-bedrock-runtime": "^3.1083.0",
- "@biomejs/biome": "^2.5.3",
- "@google/genai": "^2.17.1",
- "@strands-agents/sdk": "1.13.0",
+ "@biomejs/biome": "^2.5.13",
+ "@google/genai": "^2.22.0",
+ "@strands-agents/sdk": "1.17.0",
"@types/bun": "^1.4.2",
"ai": "^6.0.222",
"openai": "^6.46.0",
@@ -45,7 +45,7 @@
},
},
"overrides": {
- "sharp": "^0.35.3",
+ "sharp": "^0.35.4",
},
"packages": {
"@ai-sdk/gateway": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.14", "@ai-sdk/provider-utils": "4.0.38", "@vercel/oidc": "3.2.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-QK922LzOfGeHdZ9QGvghDizQx/tPOolTQSHvMlnUPeaTW5qpiIqpfbLwYiyxEt5YOGLLM/0t232Dut+95udo/Q=="],
@@ -54,7 +54,7 @@
"@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.14", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-/HHGmtKllqjg1OLc023v9w9kK3laW7Z6TzfZukYQWCsGBbzB9p60zTvvpXFVcs44NZBVXL3viOa1HRKUbeee8g=="],
- "@anthropic-ai/sdk": ["@anthropic-ai/[email protected]", "", { "dependencies": { "json-schema-to-ts": "^3.1.1", "standardwebhooks": "^1.0.0" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-hOP4bNYXDFHDxxiEgzlILXrxZIYCDnhe8sry0RDRKD/QnsEpvZcQpablCdm9X/WuD/YgOiSIkkqsL1mLLlTqJw=="],
+ "@anthropic-ai/sdk": ["@anthropic-ai/[email protected]", "", { "dependencies": { "json-schema-to-ts": "^3.1.1", "standardwebhooks": "^1.0.0" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-Hq5wYlXupzJ9M1Fzqjqa3hObcuigEXVZJqSYDgeZGM3wF4qrNERM5Z1OOAeoT9rlod8awJ3uYyJjbQXp1ckIGg=="],
"@aws-sdk/client-bedrock-runtime": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.975.1", "@aws-sdk/credential-provider-node": "^3.972.66", "@aws-sdk/eventstream-handler-node": "^3.972.26", "@aws-sdk/middleware-eventstream": "^3.972.22", "@aws-sdk/middleware-websocket": "^3.972.39", "@aws-sdk/token-providers": "3.1083.0", "@aws-sdk/types": "^3.974.0", "@smithy/core": "^3.29.2", "@smithy/fetch-http-handler": "^5.6.4", "@smithy/node-http-handler": "^4.9.4", "@smithy/types": "^4.16.0", "tslib": "^2.6.2" } }, "sha512-1mc2lW5uKpyTQWmRdC4AEF4LOAg5XpMmwqRmPVLx4M/VaVL5c3bxaZSaJeHfMVNeRRt/mk08dWXm7WWf+7G9IQ=="],
@@ -96,27 +96,27 @@
"@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw=="],
- "@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.3", "@biomejs/cli-darwin-x64": "2.5.3", "@biomejs/cli-linux-arm64": "2.5.3", "@biomejs/cli-linux-arm64-musl": "2.5.3", "@biomejs/cli-linux-x64": "2.5.3", "@biomejs/cli-linux-x64-musl": "2.5.3", "@biomejs/cli-win32-arm64": "2.5.3", "@biomejs/cli-win32-x64": "2.5.3" }, "bin": { "biome": "bin/biome" } }, "sha512-MrJswFdei9EfDwwUy2tQrPDpK0AO+RmMFvBoaaJ6ayBc3sUbHdCE+XG5N8vp+5So41ZupZJQm0roHFFhMGVD7A=="],
+ "@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.13", "@biomejs/cli-darwin-x64": "2.5.13", "@biomejs/cli-linux-arm64": "2.5.13", "@biomejs/cli-linux-arm64-musl": "2.5.13", "@biomejs/cli-linux-x64": "2.5.13", "@biomejs/cli-linux-x64-musl": "2.5.13", "@biomejs/cli-win32-arm64": "2.5.13", "@biomejs/cli-win32-x64": "2.5.13" }, "bin": { "biome": "bin/biome" } }, "sha512-+SEC/mFk1a+5mvUANZgbZTaiZXs1nj4iMhL/PHiqDT5TPUEPFIlliEtkKKZB4N862yylHC3UI+/Sj2I0HJEqhA=="],
- "@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QhYP9muVQ0nUO5zztFuPbEwi4+94sJWVjaZds9aMi1l/KNZBiUjdiSUrGHsTaMGDXrYl+r4AS2sUKfgH3w+V3g=="],
+ "@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-nYSuDJ6zgVqZUkAkJkvhXxsF2PYIrUk/g638K4voCXz7foI9f7b6C2/7+oAihsHQlivZNMUrm/y8ywlcHQtZOw=="],
- "@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-NC1Ss13UaW7QZX+y8j44bF7AP0jSJdBl6iRhe0MAkvaSqZy+mWg3GaXsrb+eSoHoGDBtaXWEbMVV0iVN2cZ7cQ=="],
+ "@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-KVy1ceEDuJ3AzFxjT9kkxbVy+UANw1pjEMUS6lvKfxjJ+fmkRvc7sQn1Xo6ETgseEI7wUQoV03KSga3XfE8YRQ=="],
- "@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-ksx1KWeyYW18ILL04msF/J4ZBtBDN33znYK8Z/aNv/vlBVxL9/g3mGP+omgHJKy4+KWbK87vcmmpmurfNjSgiA=="],
+ "@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-VlNMtoxOqs0dUR6drxxHr18SNUvI7xxAuHZlH4s/dstYSf3g6RaqVgo8JRnhcOhKz9afWrvtJTboNG1JuYlIDQ=="],
- "@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-fccix0w6xp6csCXgxeC0dU/3ecgRQal0y+cv2SP9ajNlhe7Yrk2Ug7UDe2j9AT9ZDYitkXpvUKgZjjuoYeP4Vg=="],
+ "@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-CH32xpep3dNS5EVJpAHlYchkBYznxyVZQrx0b6YYYlPL9u9ZeD2NtqiK/6s64+HFS2a7hGnryLlqqZAOh8ax5g=="],
- "@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-yMkJtilsgvILDcVkh187aVLTb64xYsrxYajx5kym+r1ULkO5HUOfu9AYKLGQbOVLwJtT2utNw7hhFNg+17mUYA=="],
+ "@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-Fi6gIxbUaJ3ZCIXeG3ggIBPF76O2DjDN67WrPX/ODRv54GeXPm2gbEPC96Yb0yrJoiH0Eax1JLx1Pi0XbsNFZQ=="],
- "@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-O/yU9YKRUiHhmcjF2f38PSjseVk3G4VLWYc0G2HWpzdBVREV6G8IGWIVEFf7MFPfWIzNUIvPsEjeAZQIOgnLcQ=="],
+ "@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-F3pmwl+VHoUuVJN/tbNLKeLt0SVK3EIyN1jXlMcNyQGYRQQTVqXF+GgkP0/CjGXFN87e/mv0sBfUnWqWza5PKQ=="],
- "@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-cX5z+GYwRcqEok0AH3KSfQGgqYd0Nomfp6Fbe1uiTtELE38hdH2k842wQ9wLNaF/JJ7r4rjJQ4VR+ce+fRmQbw=="],
+ "@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-+WD13qshXrr0Icv4BfsAdzm8Fs3TL+nZ59zEQxsYNd8lcgZJ0A5+OrlwsL1PipVCmWeRpxgIPD6DAcEd7smkCQ=="],
- "@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-ExSaJWi4/u6+GXCszlSKpWSjKNbDseAYqqkCznsCsZ/4uidZ/BEqsCc5/3ctlq6dfIubdIIRSVLC/PG9xPl70Q=="],
+ "@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-VOofU/nW761XWzUeUNE8zzYNyPrxuMuNFMizL0qz7J75yeV8N7WFheUlk1/K6dOkaFpH9wJ+lDKlwjAbw0346w=="],
"@dimforge/rapier3d-compat": ["@dimforge/[email protected]", "", {}, "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow=="],
- "@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="],
+ "@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="],
"@gltf-transform/core": ["@gltf-transform/[email protected]", "", { "dependencies": { "property-graph": "^4.1.0" } }, "sha512-ygWWFOrj1HnfvBimHF1yHTY4abbeBjn3CvljijaWKoRLMRV/a8pWYQu9rfMFQhfpT5kYZTD5Mp+dizAXPbiTDQ=="],
@@ -124,63 +124,63 @@
"@gltf-transform/functions": ["@gltf-transform/[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.4.1", "@gltf-transform/extensions": "^4.4.1", "ktx-parse": "^1.1.0", "ndarray": "^1.0.19", "ndarray-lanczos": "^0.3.0", "ndarray-pixels": "^5.0.1" } }, "sha512-CAU6hczuRz7NIEtpn7BARuwVEwRawwIcGqmoMCaEwA4XC+CSUi3xptXuf2zDG/5AftFO7IeQxXl/56rDsck0GQ=="],
- "@google/genai": ["@google/[email protected]", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-CdZ3M/titoH81hXXkvOikrOW26bC9IXh9iYT7u+r+5p7wi1LnMEnB0AbJfDeWAkjuneP4oJ299BtCt6twmORWg=="],
+ "@google/genai": ["@google/[email protected]", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-NE90Nl0AP75YZ2tGxXjQQs6Gkunma7a1JmPCx5g5CxvjHXshmuI2aNoPJ1xLrRixjkNxog898oylM+MyNudUQw=="],
"@hono/node-server": ["@hono/[email protected]", "", { "peerDependencies": { "hono": "^4" } }, "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw=="],
"@img/colour": ["@img/[email protected]", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="],
- "@img/sharp-darwin-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.2" }, "os": "darwin", "cpu": "arm64" }, "sha512-RMnFX7YQsMoh7lWfcM4NEHHymBX/rLuKNPVM84XE9ONPcaSCDgE7CHIHpSgPcO2xcRthgBy1HfNO319mwhIAkg=="],
+ "@img/sharp-darwin-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.3" }, "os": "darwin", "cpu": "arm64" }, "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA=="],
- "@img/sharp-darwin-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.2" }, "os": "darwin", "cpu": "x64" }, "sha512-Xo+5uFBtLN0BKqieTxiFzFPQAUlBbbH5iBKyRX/z1JrbnYsHTfKJnUfL8+p2TPXr1pXqao4eeL4Rl144uDpK9w=="],
+ "@img/sharp-darwin-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.3" }, "os": "darwin", "cpu": "x64" }, "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw=="],
- "@img/sharp-freebsd-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "os": "freebsd" }, "sha512-lUxcqWIj2wMQ9BrwNjngcr1gWUr5xgaGThBRqPPalIC2n67Cqj1uPh8NnA/ZhAg8hUbKl+kVHKwgUIwe6ZYPrg=="],
+ "@img/sharp-freebsd-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "os": "freebsd" }, "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA=="],
- "@img/sharp-libvips-darwin-arm64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-9J6ypZFpQBj4YnePGoq/S38w6nz+vqg5WZLrLGY4YuSemdMq47GMLBPO42MzwdGwpg/agZ7xzZcFHa48xlywfg=="],
+ "@img/sharp-libvips-darwin-arm64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="],
- "@img/sharp-libvips-darwin-x64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-m2pW1n6cns9VaubNwsZ+c3CRYjxNQWgJ5gPlnL1nbBcpkBvFm6SCFN5o0psFHI8w9n11NKhFkeEDns98tiqbEw=="],
+ "@img/sharp-libvips-darwin-x64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="],
- "@img/sharp-libvips-linux-arm": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-1eMLzy92I4J6rmi4mAT8yC3HxOtniyGELlzGbNMLLeqe052ahFQ0h6LFq+lh5DsDIdYViIDst08abvSbcEdLXQ=="],
+ "@img/sharp-libvips-linux-arm": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA=="],
- "@img/sharp-libvips-linux-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-dqVSFynCox4C/J8kT16V7SIFAns0IjgLwkvYT7p8LQVmJ5OS5b6tI9IGflxTeuBS//zXeFIUbwt5dwxyZ17cnA=="],
+ "@img/sharp-libvips-linux-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A=="],
- "@img/sharp-libvips-linux-ppc64": ["@img/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-3z0NHDxD6n5I9gc05U1eW1AyRm+Gznzq3naMrthPNqE6oYykcogW0l/jfpJdjYnuNl8R7yI9pNbE1XiUeyq0Aw=="],
+ "@img/sharp-libvips-linux-ppc64": ["@img/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w=="],
- "@img/sharp-libvips-linux-riscv64": ["@img/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-bsb4rI+NldGOsXuej2r8OdSS8+zXDVaCWxyWrcv6kneTOlgAHtZABRzBBCwdsPiD90J4myNJuHpg6kA20ImW/w=="],
+ "@img/sharp-libvips-linux-riscv64": ["@img/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ=="],
- "@img/sharp-libvips-linux-s390x": ["@img/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-/ABshyj8gCpyIrNXnHn4LorDJ0HHm1VhXPBlxZ8zAtfVPAaSafXPGn+sUSIRiwaSBy0mmFjSjiXI5mkcwdChKQ=="],
+ "@img/sharp-libvips-linux-s390x": ["@img/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q=="],
- "@img/sharp-libvips-linux-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-ITPEtgffGJ0S6G9dRyw/366tJQqFRcHWPHhC+Stpg3Z8AEMrDrTr2lhdz4f/Y/HMbRh//7Z5mBzEpVdi62Oc3w=="],
+ "@img/sharp-libvips-linux-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA=="],
- "@img/sharp-libvips-linuxmusl-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-zE9EdiUzUmg5mDT5a1rk5fYJ6GWPloTwWBYDS14naqHsL+EaMpDj1AWnpLgh3u0YCORv2Tt50wrcrpYqkP97Kw=="],
+ "@img/sharp-libvips-linuxmusl-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="],
- "@img/sharp-libvips-linuxmusl-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-m0lrLiUt+lBYnCFr8qV/65yMR4E/c7/wf78I5eKTdkEakFAlZ9QlzEM3QIhhAwVeUhLAHLcCq7a7Vszq/oFNZQ=="],
+ "@img/sharp-libvips-linuxmusl-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw=="],
- "@img/sharp-linux-arm": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.2" }, "os": "linux", "cpu": "arm" }, "sha512-affVWCTLooy8TSxbDx2qkzuDeaWLNVBA+P//FNBirHsXpP2fuBhk5AuboYUnrDnzoXes8GFjpTx0SBFOCRg+FA=="],
+ "@img/sharp-linux-arm": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.3" }, "os": "linux", "cpu": "arm" }, "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A=="],
- "@img/sharp-linux-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-QgKDspHPnrU+GQ55XPhGwyhC8acLVOOSyAvo1oVfFmrIXLkDNmGWzAfDZ4xK8oSA1qBQrALcHX0G5UZni/SuFQ=="],
+ "@img/sharp-linux-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64" }, "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ=="],
- "@img/sharp-linux-ppc64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.2" }, "os": "linux", "cpu": "ppc64" }, "sha512-sMd8rDxmpLOwv/7N44klFjOD5DUO7FLdjiXDI0hoxYaf7Ar262dQIEkosE98bps+5HPLtp/EvNqeqQtOycP/IA=="],
+ "@img/sharp-linux-ppc64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.3" }, "os": "linux", "cpu": "ppc64" }, "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ=="],
- "@img/sharp-linux-riscv64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.2" }, "os": "linux", "cpu": "none" }, "sha512-0Eob78yjlYPfL5vMNWAW55l3R9Y6BQS/gOfe0ZcP9mEz9ohhKSt4im1hayiknXgf8AWrFqMvJcKIdmLmEe7yeQ=="],
+ "@img/sharp-linux-riscv64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.3" }, "os": "linux", "cpu": "none" }, "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA=="],
- "@img/sharp-linux-s390x": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.2" }, "os": "linux", "cpu": "s390x" }, "sha512-KgAxQ0DxpNOq1rG2t5cgTgShJFGSuU7XO45cqC+1NVOuZnP6tlgZRuSYOfNupGkHID0o3cJOsw4DVeJpMovcGw=="],
+ "@img/sharp-linux-s390x": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.3" }, "os": "linux", "cpu": "s390x" }, "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ=="],
- "@img/sharp-linux-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-8pqvxubL2PGdhlPy6GLqzDYMUjyRmKAwKHYKixpdJYBUK7PJ0C029XdsnpFIdgRZG68fZiGdHVWcKPvtiPB4cA=="],
+ "@img/sharp-linux-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.3" }, "os": "linux", "cpu": "x64" }, "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA=="],
- "@img/sharp-linuxmusl-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-Vz0iQjzzcSX3HCbfwFfCSG/9SCIqyO0mH2sXyiHaAYfBk0cRsCWXRyQYX0ovCK/PAQBbTzQ0dsPQHh5MAFL59w=="],
+ "@img/sharp-linuxmusl-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64" }, "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA=="],
- "@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg=="],
+ "@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.3" }, "os": "linux", "cpu": "x64" }, "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg=="],
- "@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],
+ "@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA=="],
- "@img/sharp-webcontainers-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "cpu": "none" }, "sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q=="],
+ "@img/sharp-webcontainers-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "cpu": "none" }, "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA=="],
- "@img/sharp-win32-arm64": ["@img/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-4bPwFdMbeC4JQ8L8LOyWp6nsHcboP5fxkp6iPOXz2Vg49R42TuMs2whkJ5OAP4/Ul035qOzy0AecOF9VOscn4w=="],
+ "@img/sharp-win32-arm64": ["@img/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="],
- "@img/sharp-win32-ia32": ["@img/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-r53mXsBN6lFUDiST764SvgwUdHAqM4rPAiDzAmf4fLoB6X/rkfyTrLCg6+g17wJJiCmB3JYgHuUldCWUIRFSXw=="],
+ "@img/sharp-win32-ia32": ["@img/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="],
- "@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-D4y1vNeZrIIJCN+uHaWVtH86B+aCrdMYYjicy9pXHvbGZeGYLLSd3wdVuC37FxVXlU1ARsk84eKWfWMXGYEqvA=="],
+ "@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="],
"@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
@@ -238,7 +238,7 @@
"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
- "@strands-agents/sdk": ["@strands-agents/[email protected]", "", { "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.1097.0", "@smithy/fetch-http-handler": "^5.6.10", "@types/json-schema": "^7.0.15", "uuid": "^14.0.1", "yaml": "^2.8.3" }, "peerDependencies": { "@a2a-js/sdk": "^0.3.10", "@ai-sdk/provider": "^3.0.0", "@anthropic-ai/sdk": "^0.109.1", "@aws-sdk/client-bedrock-agent": "^3.1078.0", "@aws-sdk/client-bedrock-agent-runtime": "^3.1078.0", "@aws-sdk/client-s3": "^3.1078.0", "@aws/bedrock-token-generator": "^1.1.0", "@cedar-policy/cedar-wasm": "^4.0.0", "@cedar-policy/mcp-schema-generator-wasm": "^0.6.0", "@google/genai": "^2.6.0", "@modelcontextprotocol/sdk": "^1.25.2", "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-metrics-otlp-http": "^0.219.0", "@opentelemetry/exporter-trace-otlp-http": "^0.219.0", "@opentelemetry/resources": "^2.8.0", "@opentelemetry/sdk-metrics": "^2.6.1", "@opentelemetry/sdk-trace-base": "^2.6.1", "@opentelemetry/sdk-trace-node": "^2.6.1", "@smithy/types": "^4.15.1", "express": "^5.1.0", "openai": "^6.45.0", "zod": "^4.1.12" }, "optionalPeers": ["@a2a-js/sdk", "@ai-sdk/provider", "@anthropic-ai/sdk", "@aws-sdk/client-bedrock-agent", "@aws-sdk/client-bedrock-agent-runtime", "@aws-sdk/client-s3", "@aws/bedrock-token-generator", "@cedar-policy/cedar-wasm", "@cedar-policy/mcp-schema-generator-wasm", "@google/genai", "@opentelemetry/exporter-metrics-otlp-http", "@opentelemetry/exporter-trace-otlp-http", "@opentelemetry/resources", "@opentelemetry/sdk-metrics", "@opentelemetry/sdk-trace-base", "@opentelemetry/sdk-trace-node", "@smithy/types", "express", "openai"] }, "sha512-3GhZ8iJTaNqJbc1L0euZSPKbAxIUOJZjGjasMi2Gn9dS7KNCjj95EOWnXPTaYcAR2dycBySZSlDIyDKuYi8lVw=="],
+ "@strands-agents/sdk": ["@strands-agents/[email protected]", "", { "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.1112.0", "@smithy/fetch-http-handler": "^5.7.2", "@types/json-schema": "^7.0.15", "uuid": "^14.0.2", "yaml": "^2.8.3" }, "peerDependencies": { "@a2a-js/sdk": "^0.3.10", "@ai-sdk/provider": "^3.0.0", "@anthropic-ai/sdk": "^0.109.1", "@aws-sdk/client-bedrock-agent": "^3.1078.0", "@aws-sdk/client-bedrock-agent-runtime": "^3.1078.0", "@aws-sdk/client-s3": "^3.1078.0", "@aws/bedrock-token-generator": "^1.1.0", "@cedar-policy/cedar-wasm": "^4.0.0", "@cedar-policy/mcp-schema-generator-wasm": "^0.6.0", "@google/genai": "^2.6.0", "@modelcontextprotocol/sdk": "^1.25.2", "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-metrics-otlp-http": "^0.219.0", "@opentelemetry/exporter-trace-otlp-http": "^0.219.0", "@opentelemetry/resources": "^2.8.0", "@opentelemetry/sdk-metrics": "^2.6.1", "@opentelemetry/sdk-trace-base": "^2.6.1", "@opentelemetry/sdk-trace-node": "^2.6.1", "@smithy/types": "^4.15.1", "@tobilu/qmd": "^2.8.0", "express": "^5.1.0", "openai": "^6.45.0", "zod": "^4.1.12" }, "optionalPeers": ["@a2a-js/sdk", "@ai-sdk/provider", "@anthropic-ai/sdk", "@aws-sdk/client-bedrock-agent", "@aws-sdk/client-bedrock-agent-runtime", "@aws-sdk/client-s3", "@aws/bedrock-token-generator", "@cedar-policy/cedar-wasm", "@cedar-policy/mcp-schema-generator-wasm", "@google/genai", "@opentelemetry/exporter-metrics-otlp-http", "@opentelemetry/exporter-trace-otlp-http", "@opentelemetry/resources", "@opentelemetry/sdk-metrics", "@opentelemetry/sdk-trace-base", "@opentelemetry/sdk-trace-node", "@smithy/types", "@tobilu/qmd", "express", "openai"] }, "sha512-+P2LsdTP0sF2s0hQtQ3KNPjAMAbU8sOGzNYicLtunDYxS0hkn0ZXU26utCkdP/3Rwnu5BFxCSvhrsp3H1jldCQ=="],
"@tweenjs/tween.js": ["@tweenjs/[email protected]", "", {}, "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA=="],
@@ -254,7 +254,7 @@
"@types/stats.js": ["@types/[email protected]", "", {}, "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA=="],
- "@types/three": ["@types/[email protected]", "", { "dependencies": { "@dimforge/rapier3d-compat": "~0.12.0", "@tweenjs/tween.js": "~23.1.3", "@types/stats.js": "*", "@types/webxr": ">=0.5.17", "fflate": "~0.8.2", "meshoptimizer": "~1.1.1" } }, "sha512-db1xTb+EgYF2didW+eudSvVPtn75zo+fGsY8ShQrJY/B5ZBmC2Fiaykv3aImHAlCNEGuMPkPGXBJGLwzu5mC7A=="],
+ "@types/three": ["@types/[email protected]", "", { "dependencies": { "@dimforge/rapier3d-compat": "~0.12.0", "@tweenjs/tween.js": "~23.1.3", "@types/stats.js": "*", "@types/webxr": ">=0.5.17", "fflate": "~0.8.2", "meshoptimizer": "~1.1.1" } }, "sha512-gAsBIC07NIFrxjbf7tH2t71c38uulFfk/RFoC7FNBSjMRAQ8J1x/RBvusX0N5PJouaYFJawXQqfCQ0RKUx/1nA=="],
"@types/webxr": ["@types/[email protected]", "", {}, "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg=="],
@@ -302,7 +302,7 @@
"accepts": ["[email protected]", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
- "acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg=="],
+ "acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="],
"acorn-walk": ["[email protected]", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw=="],
@@ -482,7 +482,7 @@
"magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
- "manifold-3d": ["[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.2.0", "@gltf-transform/extensions": "^4.2.0", "@gltf-transform/functions": "^4.2.0", "@jridgewell/resolve-uri": "^3.1.2", "@jridgewell/trace-mapping": "^0.3.31", "@jscadui/3mf-export": "^0.5.0", "commander": "^13.1.0", "convert-source-map": "^2.0.0", "fast-xml-parser": "^5.4.2", "fflate": "^0.8.0", "magic-string": "^0.30.21" }, "peerDependencies": { "esbuild-wasm": "^0.27.3" }, "bin": { "manifold-cad": "bin/manifold-cad" } }, "sha512-/+m6kxYMMhnPutcQ5oSmFJiJ+gyP/0fmuUCb9Qeaunvecm/bfqogKYDDJarsnWiFioSMtKheF+lGmSlnYCik9g=="],
+ "manifold-3d": ["[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.2.0", "@gltf-transform/extensions": "^4.2.0", "@gltf-transform/functions": "^4.2.0", "@jridgewell/resolve-uri": "^3.1.2", "@jridgewell/trace-mapping": "^0.3.31", "@jscadui/3mf-export": "^0.5.0", "commander": "^13.1.0", "convert-source-map": "^2.0.0", "fast-xml-parser": "^5.4.2", "fflate": "^0.8.0", "magic-string": "^0.30.21" }, "peerDependencies": { "esbuild-wasm": "^0.27.3" }, "bin": { "manifold-cad": "bin/manifold-cad" } }, "sha512-u00Dc4IKm6W6VyVCAs6eFWNOW9V1w9/QM+xdwS/0TQKXLDtMIauxH5RXUwhOGDnvXa9uciKKYMUD2At76ffsaA=="],
"math-intrinsics": ["[email protected]", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
@@ -504,7 +504,7 @@
"ndarray-ops": ["[email protected]", "", { "dependencies": { "cwise-compiler": "^1.0.0" } }, "sha512-BppWAFRjMYF7N/r6Ie51q6D4fs0iiGmeXIACKY66fLpnwIui3Wc3CXiD/30mgLbDjPpSLrsqcp3Z62+IcHZsDw=="],
- "ndarray-pixels": ["[email protected]", "", { "dependencies": { "@types/ndarray": "^1.0.14", "ndarray": "^1.0.19", "ndarray-ops": "^1.2.2", "sharp": "^0.34.0" } }, "sha512-IBtrpefpqlI8SPDCGjXk4v5NV5z7r3JSuCbfuEEXaM0vrOJtNGgYUa4C3Lt5H+qWdYF4BCPVFsnXhNC7QvZwkw=="],
+ "ndarray-pixels": ["[email protected]", "", { "dependencies": { "@types/ndarray": "^1.0.14", "ndarray": "^1.0.19", "ndarray-ops": "^1.2.2", "sharp": "^0.35.0" } }, "sha512-lTh4tFKziAatVTa9crIsidUyn+lqujVOQpzfdBWvdFu2wo9Uo6z261lVX7SgMyP89xGmj3TMTPbbxl9YDnV4SA=="],
"negotiator": ["[email protected]", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
@@ -564,7 +564,7 @@
"setprototypeof": ["[email protected]", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
- "sharp": ["[email protected]", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.3", "@img/sharp-darwin-x64": "0.35.3", "@img/sharp-freebsd-wasm32": "0.35.3", "@img/sharp-libvips-darwin-arm64": "1.3.2", "@img/sharp-libvips-darwin-x64": "1.3.2", "@img/sharp-libvips-linux-arm": "1.3.2", "@img/sharp-libvips-linux-arm64": "1.3.2", "@img/sharp-libvips-linux-ppc64": "1.3.2", "@img/sharp-libvips-linux-riscv64": "1.3.2", "@img/sharp-libvips-linux-s390x": "1.3.2", "@img/sharp-libvips-linux-x64": "1.3.2", "@img/sharp-libvips-linuxmusl-arm64": "1.3.2", "@img/sharp-libvips-linuxmusl-x64": "1.3.2", "@img/sharp-linux-arm": "0.35.3", "@img/sharp-linux-arm64": "0.35.3", "@img/sharp-linux-ppc64": "0.35.3", "@img/sharp-linux-riscv64": "0.35.3", "@img/sharp-linux-s390x": "0.35.3", "@img/sharp-linux-x64": "0.35.3", "@img/sharp-linuxmusl-arm64": "0.35.3", "@img/sharp-linuxmusl-x64": "0.35.3", "@img/sharp-webcontainers-wasm32": "0.35.3", "@img/sharp-win32-arm64": "0.35.3", "@img/sharp-win32-ia32": "0.35.3", "@img/sharp-win32-x64": "0.35.3" } }, "sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q=="],
+ "sharp": ["[email protected]", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.4", "@img/sharp-darwin-x64": "0.35.4", "@img/sharp-freebsd-wasm32": "0.35.4", "@img/sharp-libvips-darwin-arm64": "1.3.3", "@img/sharp-libvips-darwin-x64": "1.3.3", "@img/sharp-libvips-linux-arm": "1.3.3", "@img/sharp-libvips-linux-arm64": "1.3.3", "@img/sharp-libvips-linux-ppc64": "1.3.3", "@img/sharp-libvips-linux-riscv64": "1.3.3", "@img/sharp-libvips-linux-s390x": "1.3.3", "@img/sharp-libvips-linux-x64": "1.3.3", "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", "@img/sharp-libvips-linuxmusl-x64": "1.3.3", "@img/sharp-linux-arm": "0.35.4", "@img/sharp-linux-arm64": "0.35.4", "@img/sharp-linux-ppc64": "0.35.4", "@img/sharp-linux-riscv64": "0.35.4", "@img/sharp-linux-s390x": "0.35.4", "@img/sharp-linux-x64": "0.35.4", "@img/sharp-linuxmusl-arm64": "0.35.4", "@img/sharp-linuxmusl-x64": "0.35.4", "@img/sharp-webcontainers-wasm32": "0.35.4", "@img/sharp-win32-arm64": "0.35.4", "@img/sharp-win32-ia32": "0.35.4", "@img/sharp-win32-x64": "0.35.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA=="],
"shebang-command": ["[email protected]", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
@@ -604,7 +604,7 @@
"unpipe": ["[email protected]", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
- "uuid": ["[email protected]", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew=="],
+ "uuid": ["[email protected]", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ=="],
"vary": ["[email protected]", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
@@ -622,85 +622,93 @@
"yaml": ["[email protected]", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
- "zod": ["[email protected]", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
+ "zod": ["[email protected]", "", {}, "sha512-lh5RCAGFa1Cm2hjtNwLQhSs/AsqdWnTQaBER9fEwN/88pSh7KOtJavtBx/0VlkN/uFd61SwYmljLMDAsHlvzBQ=="],
"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/credential-provider-node": "^3.972.80", "@aws-sdk/eventstream-handler-node": "^3.972.33", "@aws-sdk/middleware-eventstream": "^3.972.28", "@aws-sdk/middleware-websocket": "^3.972.51", "@aws-sdk/token-providers": "3.1111.0", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-+HHZEehmRaGo1F7YVACor/xARM+m1j8YloFaXfoWn4TIPRojUQId/wyItH2jXyro8JoL78CRRZSI1Z8StX0ldQ=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/credential-provider-node": "^3.972.83", "@aws-sdk/eventstream-handler-node": "^3.972.34", "@aws-sdk/middleware-eventstream": "^3.972.29", "@aws-sdk/middleware-websocket": "^3.972.53", "@aws-sdk/token-providers": "3.1130.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-+PInS/B3O4ONObqLVVTZMtRylkOTFtHi6AOFhENYvkEHiQCngcPnmQxN+1eIFkWd4aVeiniqaG0fZgd+JAgqzA=="],
- "@strands-agents/sdk/@smithy/fetch-http-handler": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-W/exA8T0LEzCQtJ02w4IzaEQPIspgarqZprb7W8FwnYiDowgCrjl2fTQ6FvuSSUnJORuepBF81abmBJwqh+0XQ=="],
+ "@strands-agents/sdk/@smithy/fetch-http-handler": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
"body-parser/content-type": ["[email protected]", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
- "manifold-3d/@gltf-transform/core": ["@gltf-transform/[email protected]", "", { "dependencies": { "property-graph": "^4.1.0" } }, "sha512-cOPxOhHFFz5hwmix+li1+Nnq5qMV/QD3fTCsVlApxxFACtFdjkt2R/juseD4gvZ7D2c/yl6OilKH0pvI735YyQ=="],
-
- "manifold-3d/@gltf-transform/extensions": ["@gltf-transform/[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.4.0", "ktx-parse": "^1.1.0" } }, "sha512-ZwEgFkkqnUR7d4m6roK9BycxxdoqJNtVyo7w5ShJ9syKBoQiXw2QrTSLwXaUAImSrEIl9Jh/wZTtvSVyviQuXg=="],
-
- "manifold-3d/@gltf-transform/functions": ["@gltf-transform/[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.4.0", "@gltf-transform/extensions": "^4.4.0", "ktx-parse": "^1.1.0", "ndarray": "^1.0.19", "ndarray-lanczos": "^0.3.0", "ndarray-pixels": "^5.0.1" } }, "sha512-CaSTAVAd2NXNWsxdgvq090rKHqy7AQlcNWV4ec7xtQyS8WEv3S3gVN27ikWmdB8nWEsXUbOIDhtPMLbXI6xDJg=="],
-
"type-is/content-type": ["[email protected]", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@aws-sdk/xml-builder": "^3.972.39", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.31.1", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-7+Kcrkvrk9lM/m7jRhHpT4jCdvzGHsuaSRbF8TdzzkY1mRzp/Ogwf9c7H29k4gGhey0BBWhCWr16+t0J61gwmg=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@aws-sdk/xml-builder": "^3.972.40", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.33.3", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-2yX9LUmxPklVjSGTb8dfnWRJSiFQ3TeH2nn7G1mdKHTfnabzF0+gfrS8rYfLWmZrQ8A3mEcxMJjRc51dL5KWaA=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.69", "@aws-sdk/credential-provider-http": "^3.972.71", "@aws-sdk/credential-provider-ini": "^3.973.14", "@aws-sdk/credential-provider-process": "^3.972.69", "@aws-sdk/credential-provider-sso": "^3.973.13", "@aws-sdk/credential-provider-web-identity": "^3.972.75", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bE2qh8ww4iClO1jHsBXdOE8FUgzDbdxbyorNjSCoPSkQd51k3jODItuPZfuwcLHZqDXsH+bI4AMHhqtuyR7mSg=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.71", "@aws-sdk/credential-provider-http": "^3.972.73", "@aws-sdk/credential-provider-ini": "^3.973.16", "@aws-sdk/credential-provider-process": "^3.972.71", "@aws-sdk/credential-provider-sso": "^3.973.15", "@aws-sdk/credential-provider-web-identity": "^3.972.77", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jdso7ejzfRnatxMUZK4S/U6KbaDPCvfIV4XL+IQAPFDBt5rj5Fq595euqlK8Le4lNCMFR9oUpt+1l0aMgaayOQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/eventstream-handler-node": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-1Dd5WyEE2Kb3HvY44u7Ob16ST2W6iutOqsQ8Y2hUmsL2mAH/STlGS1dS9h3IOE6L7Ld3AR2HzKJ6XeCMOw8Peg=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/eventstream-handler-node": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-cTeVzpu1xEAkryTZBYhGwnQ6gOGyp8ZYZvmn0Sg/nI/ABmy/CRHHxPDJDUi9PxwxUtGGaatvfRUB3FCgT/rSWw=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-eventstream": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-Z1EDXnS01P7H5jVrUx+/dBqV0m7dta7bSxLclkOuDuS93pNNQm0IcT4YLUbuvWKPYNxbI8aTG0p5Br30GSKDgA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-eventstream": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-dlRzHCgyB8W6hLuDC5pcT5q+ziPt00n4QGgGBE17ucLVU4zMa6lsbuUdQ2Pm75Z5VA8GF+R/+SgrRcaTdIzSIQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-websocket": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-jdgP3jR5Q96j1jjZ98GGwpGg1CBNFIO2YE+vXg8cg8PvNY4NvgQNYJsqDaRX2PYv5gSUX/+C0D58Fhspj9ELMQ=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-websocket": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-bIrDaMENQmYRBHntOiOheqkiw5+fhKW4Lqb+mS1uqF0VwvdWI22fW2HFgWrng66CmYd+4k8ePlpj38sEfTuMLQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-JfljgoVtl+s3Qy21n9a7Z48uCQaOXcN74KJ3TEQfPoB293GrXFSt6HSQJF1sTZ8c/5QedEvd3NjJQMO4u9qa5A=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-JYWQa89/lGNUaw39eP1nfGctusq2fBcUEqjRawHRiU7CUebbwMOQI/BzEM3cLb0kdrVNILFUz5zlBfLwP21EoA=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/types": ["@aws-sdk/[email protected]", "", { "dependencies": { "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-dSFDNG00MEz0/xl5gxL62giLd1iYyJsTxZ1I1DOj6lC+bbgLB4TRsYClJg3b62dhXT1uATzsTNXPnC+33EJV3A=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/types": ["@aws-sdk/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-LkwLL2BLbC6wNNm4JaH9mbEqBMdOZCct6VAYqhdN4U1xrWM+fUJQEfbHwQgDypapOWTRtlk25akb5afM0P8CIQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-YvlfAEyHmuWpwjEKgq4FBaXhLEoSEwS/nNbyCF/ef05ZvSuwMDB4NIMgXqkJojzYyQWjhVDapPHXfhkz/tZYlg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/node-http-handler": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.33.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-ssHIZsadPUA3lGdnoByxfnjtb9xPYQLvdfJRLKIwxOoa6tO1suG4sLFSsgd7D/CsvYd8QbBIuKTImuJha5l6aQ=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/node-http-handler": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ThMkboGeONWXAelq9FvGsuJC4rOi+qyC4/zhUF58xYpxUg5sQKx2VXZYJmtNjr4dSuBJ1HeJXETQILCz3wOHvw=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-CgB6HHWer/vrKps24ulRIbpcpb7K4xAU7SkZ7YHzBPlwHsvsrCJFEXK421s+cJzX+ZrqtA/TuU5w1HzI7k9N8A=="],
- "@strands-agents/sdk/@smithy/fetch-http-handler/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+ "@strands-agents/sdk/@smithy/fetch-http-handler/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-YvlfAEyHmuWpwjEKgq4FBaXhLEoSEwS/nNbyCF/ef05ZvSuwMDB4NIMgXqkJojzYyQWjhVDapPHXfhkz/tZYlg=="],
- "@strands-agents/sdk/@smithy/fetch-http-handler/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+ "@strands-agents/sdk/@smithy/fetch-http-handler/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-CgB6HHWer/vrKps24ulRIbpcpb7K4xAU7SkZ7YHzBPlwHsvsrCJFEXK421s+cJzX+ZrqtA/TuU5w1HzI7k9N8A=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/[email protected]", "", { "dependencies": { "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-FTti8DS5MMWXNUWiRwXAJeYS+0GHHiMy0+7XOhcwk63ILHmfS2UFy2z/HNpZCSOJJ3P3dnWY6hfYNW3DF0nXUA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-wlFmCIGUlwF4zx/kncw+bmxTQh1HeSJq4mYV/V5cZUSJadDP3kXvGW8Rn21cimj/7y9ju+47oYWXi97vF7czaA=="],
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core/@smithy/signature-v4": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-hCynhm22wMJ8wTF9crcwu8mxggtUrSLLJgDcGUvYFBqpofxycYJCGKOMYg4xtPPFtgNiDJSYmhsWLTrcU/g59Q=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-AreCFzcB4kH2HF9031Ot0jSJr3KXvRg6e8uDeub20JEVdZU3Bv0sTq1plc7VsT3KiqutlzH7l0j50UcCWHUioA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-JN+JHruYZw3GUZB8YGAlDk4wTDPOEAEEdEzj5nS0xodWR4smzHsN7PnK2j6IeOsDIj2aqua5DSbhXl9Gtf90FQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-A8ObcqVmDMnk4F9NozZ7JwmUu9Q4xyBJkmyq1C5U+wNM9ht9J7+EuuyabsLWXZnOoTqFaJuYBYTKf5CTipkEjA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-uyYYnJOnlis8uQzaYGPd7N1JoioCoNpXgnkXYixsWJXHXgXyYi8WXJSDfofxJeWfQIGWLe2Nwyq60Uc7MZdVOg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/credential-provider-env": "^3.972.69", "@aws-sdk/credential-provider-http": "^3.972.71", "@aws-sdk/credential-provider-login": "^3.972.76", "@aws-sdk/credential-provider-process": "^3.972.69", "@aws-sdk/credential-provider-sso": "^3.973.13", "@aws-sdk/credential-provider-web-identity": "^3.972.75", "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-7c+Wti2LsERNWMfm7ySz3/6RPopFW3Nmn7s63Xpcq6R/tRuY5hpvkHA2xVgi5ukJbvok9l0IDtVEvqTtg+X7dw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/credential-provider-env": "^3.972.71", "@aws-sdk/credential-provider-http": "^3.972.73", "@aws-sdk/credential-provider-login": "^3.972.78", "@aws-sdk/credential-provider-process": "^3.972.71", "@aws-sdk/credential-provider-sso": "^3.973.15", "@aws-sdk/credential-provider-web-identity": "^3.972.77", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-i++ly+0Uxa+u3ebSSyr0S/3CFhFJDxCXT3+Zj+mW2bXenEx5bKGCdTIKFu39SgXBNhWDjex/8cXUx9MUTMCrTw=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-9kpTNdZTrcqXTfhxM7fgl9Z68ek3Fu5oe3Yf+A/pJGibEqpgZxz2tSY7SinmyCIU2PJ+ygY4FPoBBnLpocMtrQ=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-lYmXJa4gvq4xN1lrT5NiP5vIYYKcGWAdj8y+8o6dlcateB5eF3Dn8DtmjjHKfMBrTPAMr2pebIiX/UOj8c1/UA=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/token-providers": "3.1111.0", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-Oc81qauMPzUoTnAS2YKpNwY6sY/LUyQTEeaf6yP197WMxkEBQfcKLR1MFpD7+pNTubXnfkH6gwpji+Gc7iyD2Q=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/token-providers": "3.1129.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-6Jhcf4v0pSFdjk1EW2kvzuEBKD+UZ2uNcHUIglKKLndD20YhvkL2kdmDOV5/j4mYuWWwe/a1FQ1aomU86/Cg5Q=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-YPN6uoGDgjjjeVFZrcOeCJqmB6zpXoeeNgIjqe+DexJaWqdjVfCCe+VAZwli9Z2h8KhFW8oxkO39emQ1tyz/Mw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-uylIQSUWpfLuH2LovxEEfwzJGM/SabLOfLMg6YXu/E8jJEKUdpdILCVCQCdFvHyu/7dLJOHPMfrSwduxO56NkQ=="],
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/credential-provider-imds": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-2jsPi+7Zv2hSzD9IXR9D7DTqSn7mv4XalzRm+bESh53jiaUS3NKEUbpQFTJP0HhQy9qzZvluxQ3yS24zdRrqsA=="],
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-websocket/@smithy/signature-v4": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-hCynhm22wMJ8wTF9crcwu8mxggtUrSLLJgDcGUvYFBqpofxycYJCGKOMYg4xtPPFtgNiDJSYmhsWLTrcU/g59Q=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/signature-v4-multi-region": "^3.996.45", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bit+VpqWNyi3wHxFoTsTliNXimCSL2r2OeDTm7ZrG+YsTZ2D7ofDJ6r/t9PVBn80i6/v0X2h9Tgw6QP2MAKfPw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/core/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-eUtswnXu0+Ii9ieRK+0L7aPFV3Z/dnW2VntJzjBP9xs8s+8p5nBNuymIXtXwZ+5r5+XJP3e32nMkuZ/r0HozEA=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/nested-clients": "^3.997.45", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Sbl3rpzQdsG4ZK2zh0JWUYyZPKKorJlVOddA2T0DVbKJFrsW8J6wgnslxxUH04+WaBMr4A1HzJZvZX0xUvkniA=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-LVixwOnEJfrrfKHeZjBA8pIMTZjNDq8ak8VpcoWUuCJDrSnBNU8POJksULMgvN089P0MXtQYH2Zs627/MK1K0g=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/signature-v4-multi-region": "^3.996.45", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bit+VpqWNyi3wHxFoTsTliNXimCSL2r2OeDTm7ZrG+YsTZ2D7ofDJ6r/t9PVBn80i6/v0X2h9Tgw6QP2MAKfPw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/credential-provider-imds/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/signature-v4-multi-region": "^3.996.45", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bit+VpqWNyi3wHxFoTsTliNXimCSL2r2OeDTm7ZrG+YsTZ2D7ofDJ6r/t9PVBn80i6/v0X2h9Tgw6QP2MAKfPw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/credential-provider-imds/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/signature-v4-multi-region": "^3.996.45", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bit+VpqWNyi3wHxFoTsTliNXimCSL2r2OeDTm7ZrG+YsTZ2D7ofDJ6r/t9PVBn80i6/v0X2h9Tgw6QP2MAKfPw=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-websocket/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bBuyztukzXq6plzFGHAWiQt0QXo+HL8b8lX5cFTzkez/74PtS1c0qPFCIVuHkyoT+miH2qOjAcm1/yoro2ESPA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/middleware-websocket/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bBuyztukzXq6plzFGHAWiQt0QXo+HL8b8lX5cFTzkez/74PtS1c0qPFCIVuHkyoT+miH2qOjAcm1/yoro2ESPA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bBuyztukzXq6plzFGHAWiQt0QXo+HL8b8lX5cFTzkez/74PtS1c0qPFCIVuHkyoT+miH2qOjAcm1/yoro2ESPA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="],
- "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-bBuyztukzXq6plzFGHAWiQt0QXo+HL8b8lX5cFTzkez/74PtS1c0qPFCIVuHkyoT+miH2qOjAcm1/yoro2ESPA=="],
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="],
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-hCynhm22wMJ8wTF9crcwu8mxggtUrSLLJgDcGUvYFBqpofxycYJCGKOMYg4xtPPFtgNiDJSYmhsWLTrcU/g59Q=="],
@@ -709,5 +717,21 @@
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-hCynhm22wMJ8wTF9crcwu8mxggtUrSLLJgDcGUvYFBqpofxycYJCGKOMYg4xtPPFtgNiDJSYmhsWLTrcU/g59Q=="],
"@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/core": "^3.32.0", "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-hCynhm22wMJ8wTF9crcwu8mxggtUrSLLJgDcGUvYFBqpofxycYJCGKOMYg4xtPPFtgNiDJSYmhsWLTrcU/g59Q=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/token-providers/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/core": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/types": "^4.17.0", "tslib": "^2.6.2" } }, "sha512-uKbkxgqLyepQDZoq8aRSdUqD1ID//rOqG96ixBhp++O7vBtmwYM6fwldGhr9HJP0iYrdc7GP/AlgzPWEZIrNRg=="],
+
+ "@strands-agents/sdk/@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Aw4joiM0ZdErpo39lCj8phT2lxoiKZV+KZzBxnnQhWVtU2Is/WffQSL04uUWRcXUse9Ln8vXZK6V/FwqRVnQpg=="],
}
}
diff --git a/dist/build.json b/dist/build.json
index 1b26704f..28cbe5e0 100644
--- a/dist/build.json
+++ b/dist/build.json
@@ -2,140 +2,140 @@
"schemaVersion": 1,
"entries": {
"mcp": {
- "identity": "sha256:af2a6684f46ede84dfc4e6fd6767dcdd9c328ba67e15eeccbce8772d3da9febc",
+ "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
"sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
- "dependencyHash": "f18af97c1af621530742984fe6d5c51b351c11664bb61584cb3a7af91f68a541",
+ "dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"target": "node",
"file": "mcp-server.mjs",
"bundleHash": "sha256:639f5984ce3bd837a1ffe6415430c0feb5366e8b8d1d4cc9cd6493209ccc616d"
},
"cli": {
- "identity": "sha256:af2a6684f46ede84dfc4e6fd6767dcdd9c328ba67e15eeccbce8772d3da9febc",
+ "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
"sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
- "dependencyHash": "f18af97c1af621530742984fe6d5c51b351c11664bb61584cb3a7af91f68a541",
+ "dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"target": "node",
"file": "cli.mjs",
"bundleHash": "sha256:0eb6b7077598c1d61761e6391f2c776980dd8aed1ebaf5f584aa54fcd8e53e2f"
},
"worker": {
- "identity": "sha256:af2a6684f46ede84dfc4e6fd6767dcdd9c328ba67e15eeccbce8772d3da9febc",
+ "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
"sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
- "dependencyHash": "f18af97c1af621530742984fe6d5c51b351c11664bb61584cb3a7af91f68a541",
+ "dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"target": "node",
"file": "evaluator-worker.mjs",
"bundleHash": "sha256:c8d8e432a5ae29b4f6621bf64bb4b7f6f7b77cf9fd4d8094779c6c5749f811f2"
},
"agent-run": {
- "identity": "sha256:af2a6684f46ede84dfc4e6fd6767dcdd9c328ba67e15eeccbce8772d3da9febc",
+ "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
"sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
- "dependencyHash": "f18af97c1af621530742984fe6d5c51b351c11664bb61584cb3a7af91f68a541",
+ "dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"target": "node",
"file": "agent-run.mjs",
"bundleHash": "sha256:4253f648f9c8395aaecfa2201a69feeaa503e5c58b81a891fbd5a41df0277f6c"
},
"agent-providers": {
- "identity": "sha256:af2a6684f46ede84dfc4e6fd6767dcdd9c328ba67e15eeccbce8772d3da9febc",
+ "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
"sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
- "dependencyHash": "f18af97c1af621530742984fe6d5c51b351c11664bb61584cb3a7af91f68a541",
+ "dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"target": "node",
"file": "agent-providers.mjs",
diff --git a/dist/viewer/app.js b/dist/viewer/app.js
index b58eea1c..9115e58f 100644
--- a/dist/viewer/app.js
+++ b/dist/viewer/app.js
@@ -1,78 +1,71 @@
-var Th;function q(e,t,n){function i(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=o.prototype,u=Object.keys(l);for(let f=0;f<u.length;f++){let h=u[f];if(!(h in a))a[h]=l[h].bind(a)}}let r=n?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function o(a){var c;let l=n?.Parent?new s:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}var dE=Symbol("zod_brand");class ii extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ds extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Th=globalThis).__zod_globalConfig??(Th.__zod_globalConfig={});var Er=globalThis.__zod_globalConfig;function Tn(e){if(e)Object.assign(Er,e);return Er}function yo(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function ms(e,t){if(typeof t==="bigint")return t.toString();return t}function bo(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function So(e){return e===null||e===void 0}function Mo(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ah(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-i)<r)return 0;return n-i}var Eh=Symbol("evaluating");function it(e,t,n){let i=void 0;Object.defineProperty(e,t,{get(){if(i===Eh)return;if(i===void 0)i=Eh,i=n();return i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Ji(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bi(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function sc(e){return JSON.stringify(e)}function Rh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var oc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ps(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ch=bo(()=>{if(Er.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ki(e){if(ps(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(ps(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function ac(e){if(Ki(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Ih=new Set(["string","number","symbol"]);function Si(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gn(e,t,n){let i=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)i._zod.parent=e;return i}function Te(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Ph(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Lh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Q0(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=bi(e._zod.def,{get shape(){let o={};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;o[a]=n.shape[a]}return Ji(this,"shape",o),o},checks:[]});return Gn(e,s)}function ex(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=bi(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete o[a]}return Ji(this,"shape",o),o},checks:[]});return Gn(e,s)}function tx(e,t){if(!Ki(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let s=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=bi(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Ji(this,"shape",s),s}});return Gn(e,r)}function nx(e,t){if(!Ki(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=bi(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Ji(this,"shape",i),i}});return Gn(e,n)}function ix(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=bi(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Ji(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Gn(e,n)}function rx(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let o=bi(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!n[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Ji(this,"shape",c),c},checks:[]});return Gn(t,o)}function sx(e,t,n){let i=bi(t._zod.def,{get shape(){let r=t._zod.def.shape,s={...r};if(n)for(let o in n){if(!(o in s))throw Error(`Unrecognized key: "${o}"`);if(!n[o])continue;s[o]=new e({type:"nonoptional",innerType:r[o]})}else for(let o in r)s[o]=new e({type:"nonoptional",innerType:r[o]});return Ji(this,"shape",s),s}});return Gn(t,i)}function Qi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Nh(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Mi(e,t){return t.map((n)=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function vo(e){return typeof e==="string"?e:e?.message}function En(e,t,n){let i=e.message?e.message:vo(e.inst?._zod.def?.error?.(e))??vo(t?.error?.(e))??vo(n.customError?.(e))??vo(n.localeError?.(e))??"Invalid input",{inst:r,continue:s,input:o,...a}=e;if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=o;return a}function wo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function er(...e){let[t,n,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:i};return{...t}}var Dh=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ms,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},To=q("$ZodError",Dh),cc=q("$ZodError",Dh,{Parent:Error});function Uh(e,t=(n)=>n.message){let n={},i=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else i.push(t(r));return{formErrors:i,fieldErrors:n}}function Oh(e,t=(n)=>n.message){let n={_errors:[]},i=(r,s=[])=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map((a)=>i({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...s,...o.path]);else{let a=[...s,...o.path];if(a.length===0)n._errors.push(t(o));else{let c=n,l=0;while(l<a.length){let u=a[l];if(l!==a.length-1)c[u]=c[u]||{_errors:[]};else c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o));c=c[u],l++}}}};return i(e),n}var Eo=(e)=>(t,n,i,r)=>{let s=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new ii;if(o.issues.length){let a=new(r?.Err??e)(o.issues.map((c)=>En(c,s,Tn())));throw oc(a,r?.callee),a}return o.value};var Ao=(e)=>async(t,n,i,r)=>{let s=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)o=await o;if(o.issues.length){let a=new(r?.Err??e)(o.issues.map((c)=>En(c,s,Tn())));throw oc(a,r?.callee),a}return o.value};var gs=(e)=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new ii;return s.issues.length?{success:!1,error:new(e??To)(s.issues.map((o)=>En(o,r,Tn())))}:{success:!0,data:s.value}},Fh=gs(cc),_s=(e)=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((o)=>En(o,r,Tn())))}:{success:!0,data:s.value}},zh=_s(cc),kh=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Eo(e)(t,n,r)};var Bh=(e)=>(t,n,i)=>Eo(e)(t,n,i);var Gh=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ao(e)(t,n,r)};var Hh=(e)=>async(t,n,i)=>Ao(e)(t,n,i);var Vh=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return gs(e)(t,n,r)};var Wh=(e)=>(t,n,i)=>gs(e)(t,n,i);var $h=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return _s(e)(t,n,r)};var Zh=(e)=>async(t,n,i)=>_s(e)(t,n,i);var Xh=/^[cC][0-9a-z]{6,}$/,qh=/^[0-9a-z]+$/,Yh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jh=/^[0-9a-vA-V]{20}$/,Jh=/^[A-Za-z0-9]{27}$/,Kh=/^[a-zA-Z0-9_-]{21}$/,Qh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ef=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lc=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var tf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ax="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function nf(){return new RegExp(ax,"u")}var rf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var of=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,af=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uc=/^[A-Za-z0-9_-]*$/;var lf=/^https?$/,uf=/^\+[1-9]\d{6,14}$/,hf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ff=new RegExp(`^${hf}$`);function df(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function pf(e){return new RegExp(`^${df(e)}$`)}function mf(e){let t=df({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${hf}T(?:${i})$`)}var gf=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var _f=/^-?\d+$/,hc=/^-?\d+(?:\.\d+)?$/,xf=/^(?:true|false)$/i;var vf=/^[^A-Z]*$/,yf=/^[^a-z]*$/;var Vt=q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bf={number:"number",bigint:"bigint",object:"date"},fc=q("$ZodCheckLessThan",(e,t)=>{Vt.init(e,t);let n=bf[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dc=q("$ZodCheckGreaterThan",(e,t)=>{Vt.init(e,t);let n=bf[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sf=q("$ZodCheckMultipleOf",(e,t)=>{Vt.init(e,t),e._zod.onattach.push((n)=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):Ah(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Mf=q("$ZodCheckNumberFormat",(e,t)=>{Vt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=Lh[t.format];e._zod.onattach.push((o)=>{let a=o._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=s,n)a.pattern=_f}),e._zod.check=(o)=>{let a=o.value;if(n){if(!Number.isInteger(a)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});else o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}if(a<r)o.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>s)o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var wf=q("$ZodCheckMaxLength",(e,t)=>{var n;Vt.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!So(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)i._zod.bag.maximum=t.maximum}),e._zod.check=(i)=>{let r=i.value;if(r.length<=t.maximum)return;let o=wo(r);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tf=q("$ZodCheckMinLength",(e,t)=>{var n;Vt.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!So(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)i._zod.bag.minimum=t.minimum}),e._zod.check=(i)=>{let r=i.value;if(r.length>=t.minimum)return;let o=wo(r);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ef=q("$ZodCheckLengthEquals",(e,t)=>{var n;Vt.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!So(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(i)=>{let r=i.value,s=r.length;if(s===t.length)return;let o=wo(r),a=s>t.length;i.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),xs=q("$ZodCheckStringFormat",(e,t)=>{var n,i;if(Vt.init(e,t),e._zod.onattach.push((r)=>{let s=r._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),Af=q("$ZodCheckRegex",(e,t)=>{xs.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Rf=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vf),xs.init(e,t)}),Cf=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=yf),xs.init(e,t)}),If=q("$ZodCheckIncludes",(e,t)=>{Vt.init(e,t);let n=Si(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((r)=>{let s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Pf=q("$ZodCheckStartsWith",(e,t)=>{Vt.init(e,t);let n=new RegExp(`^${Si(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Lf=q("$ZodCheckEndsWith",(e,t)=>{Vt.init(e,t);let n=new RegExp(`.*${Si(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});var Nf=q("$ZodCheckOverwrite",(e,t)=>{Vt.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class pc{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
-`).filter((s)=>s),i=Math.min(...n.map((s)=>s.length-s.trimStart().length)),r=n.map((s)=>s.slice(i)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of r)this.content.push(s)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map((r)=>` ${r}`)];return new e(...t,i.join(`
-`))}}var Uf={major:4,minor:4,patch:3};var xt=q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Uf;let i=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))i.unshift(e);for(let r of i)for(let s of r._zod.onattach)s(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(o,a,c)=>{let l=Qi(o),u;for(let f of a){if(f._zod.def.when){if(Nh(o))continue;if(!f._zod.def.when(o))continue}else if(l)continue;let h=o.issues.length,d=f._zod.check(o);if(d instanceof Promise&&c?.async===!1)throw new ii;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await d,o.issues.length===h)return;if(!l)l=Qi(o,h)});else{if(o.issues.length===h)continue;if(!l)l=Qi(o,h)}}if(u)return u.then(()=>o);return o},s=(o,a,c)=>{if(Qi(o))return o.aborted=!0,o;let l=r(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new ii;return l.then((u)=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if(a.direction==="backward"){let l=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((u)=>s(u,o,a));return s(l,o,a)}let c=e._zod.parse(o,a);if(c instanceof Promise){if(a.async===!1)throw new ii;return c.then((l)=>r(l,i,a))}return r(c,i,a)}}it(e,"~standard",()=>({validate:(r)=>{try{let s=Fh(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return zh(e,r).then((o)=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),Po=q("$ZodString",(e,t)=>{xt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gf(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),_t=q("$ZodStringFormat",(e,t)=>{xs.init(e,t),Po.init(e,t)}),Wf=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ef),_t.init(e,t)}),$f=q("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lc(i))}else t.pattern??(t.pattern=lc());_t.init(e,t)}),Zf=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tf),_t.init(e,t)}),Xf=q("$ZodURL",(e,t)=>{_t.init(e,t),e._zod.check=(n)=>{try{let i=n.value.trim();if(!t.normalize&&t.protocol?.source===lf.source){if(!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}}let r=new URL(i);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(r.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=r.href;else n.value=i;return}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),qf=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nf()),_t.init(e,t)}),Yf=q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Kh),_t.init(e,t)}),jf=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Xh),_t.init(e,t)}),Jf=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qh),_t.init(e,t)}),Kf=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Yh),_t.init(e,t)}),Qf=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jh),_t.init(e,t)}),ed=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Jh),_t.init(e,t)}),td=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mf(t)),_t.init(e,t)}),nd=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ff),_t.init(e,t)}),id=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pf(t)),_t.init(e,t)}),rd=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Qh),_t.init(e,t)}),sd=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rf),_t.init(e,t),e._zod.bag.format="ipv4"}),od=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=sf),_t.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}});var ad=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=of),_t.init(e,t)}),cd=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=af),_t.init(e,t),e._zod.check=(n)=>{let i=n.value.split("/");try{if(i.length!==2)throw Error();let[r,s]=i;if(!s)throw Error();let o=Number(s);if(`${o}`!==s)throw Error();if(o<0||o>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ld(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ud=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cf),_t.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(n)=>{if(ld(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function cx(e){if(!uc.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ld(n)}var hd=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uc),_t.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(n)=>{if(cx(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),fd=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=uf),_t.init(e,t)});function lx(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var dd=q("$ZodJWT",(e,t)=>{_t.init(e,t),e._zod.check=(n)=>{if(lx(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var gc=q("$ZodNumber",(e,t)=>{xt.init(e,t),e._zod.pattern=e._zod.bag.pattern??hc,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let s=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),pd=q("$ZodNumberFormat",(e,t)=>{Mf.init(e,t),gc.init(e,t)}),md=q("$ZodBoolean",(e,t)=>{xt.init(e,t),e._zod.pattern=xf,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var gd=q("$ZodUnknown",(e,t)=>{xt.init(e,t),e._zod.parse=(n)=>n}),_d=q("$ZodNever",(e,t)=>{xt.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Of(e,t,n){if(e.issues.length)t.issues.push(...Mi(n,e.issues));t.value[n]=e.value}var xd=q("$ZodArray",(e,t)=>{xt.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let s=[];for(let o=0;o<r.length;o++){let a=r[o],c=t.element._zod.run({value:a,issues:[]},i);if(c instanceof Promise)s.push(c.then((l)=>Of(l,n,o)));else Of(c,n,o)}if(s.length)return Promise.all(s).then(()=>n);return n}});function Io(e,t,n,i,r,s){let o=n in i;if(e.issues.length){if(r&&s&&!o)return;t.issues.push(...Mi(n,e.issues))}if(!o&&!r){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(o)t.value[n]=void 0}else t.value[n]=e.value}function vd(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${i}": expected a Zod schema`);let n=Ph(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function yd(e,t,n,i,r,s){let o=[],a=r.keySet,c=r.catchall._zod,l=c.def.type,u=c.optin==="optional",f=c.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(a.has(h))continue;if(l==="never"){o.push(h);continue}let d=c.run({value:t[h],issues:[]},i);if(d instanceof Promise)e.push(d.then((g)=>Io(g,n,h,t,u,f)));else Io(d,n,h,t,u,f)}if(o.length)n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s});if(!e.length)return n;return Promise.all(e).then(()=>n)}var ux=q("$ZodObject",(e,t)=>{if(xt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let i=bo(()=>vd(t));it(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let f of u.values)c[l].add(f)}}return c});let r=ps,s=t.catchall,o;e._zod.parse=(a,c)=>{o??(o=i.value);let l=a.value;if(!r(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],f=o.shape;for(let h of o.keys){let d=f[h],g=d._zod.optin==="optional",y=d._zod.optout==="optional",p=d._zod.run({value:l[h],issues:[]},c);if(p instanceof Promise)u.push(p.then((m)=>Io(m,a,h,l,g,y)));else Io(p,a,h,l,g,y)}if(!s)return u.length?Promise.all(u).then(()=>a):a;return yd(u,l,a,c,i.value,e)}}),bd=q("$ZodObjectJIT",(e,t)=>{ux.init(e,t);let n=e._zod.parse,i=bo(()=>vd(t)),r=(h)=>{let d=new pc(["shape","payload","ctx"]),g=i.value,y=(T)=>{let v=sc(T);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");let p=Object.create(null),m=0;for(let T of g.keys)p[T]=`key_${m++}`;d.write("const newResult = {};");for(let T of g.keys){let v=p[T],w=sc(T),E=h[T],R=E?._zod?.optin==="optional",_=E?._zod?.optout==="optional";if(d.write(`const ${v} = ${y(T)};`),R&&_)d.write(`
- if (${v}.issues.length) {
- if (${w} in input) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+function Ms(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function Ac(e,t="|"){return e.map((n)=>Ic(n)).join(t)}function ws(e,t){if(typeof t==="bigint")return t.toString();return t}class df{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Po(e){return new df(e)}function pf(e){return e===null||e===void 0}function Lo(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function mf(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-i)<r)return 0;return n-i}function Cn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function No(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ui(e){return No(e._zod.def)??e._zod.def.shape}function gf(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return Cn(this,t,i),i},enumerable:!0,configurable:!0})}function _f(e,t,n){if(t in e)Cn(e,t,n);else e[t]=n}function sr(e,t,n,i){let r=ui(t);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);if(!o.enumerable)continue;if(o.get)gf(e,s,()=>{let a=t._zod.def.shape[s];return i?i(a,s):a});else _f(e,s,i?i(o.value,s):o.value)}}function vv(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);if(!i.enumerable)continue;if(i.get)gf(e,n,()=>t[n]);else _f(e,n,i.value)}}function cn(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function xf(e){return JSON.stringify(e)}function vf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Rc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ss(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var yf=Po(()=>{if(Kt.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function or(e){if(Ss(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(Ss(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Cc(e){if(or(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var bf=new Set(["string","number","symbol"]);function Li(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wn(e,t,n){let i=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)i._zod.parent=e;return i}function Te(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Ic(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Sf(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Do=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Pc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yv(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return sr(s,e,Oo(e,t)),Wn(e,cn(n,{shape:s,checks:[]}))}function Oo(e,t){let n=ui(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw Error(`Unrecognized key: "${String(r)}"`);if(t[r])i.push(r)}return i}function bv(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Oo(e,t)),o={};return sr(o,e,Reflect.ownKeys(ui(e)).filter((a)=>!s.has(a))),Wn(e,cn(n,{shape:o,checks:[]}))}function Sv(e,t){if(!or(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=ui(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Wn(e,cn(e._zod.def,{shape:Mf(e,t)}))}function Mf(e,t){let n={};return sr(n,e,Reflect.ownKeys(ui(e))),vv(n,t),n}function Mv(e,t){if(!or(t))throw Error("Invalid input to safeExtend: expected a plain object");return Wn(e,cn(e._zod.def,{shape:Mf(e,t)}))}function wv(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};sr(n,e,Reflect.ownKeys(ui(e))),sr(n,t,Reflect.ownKeys(ui(t)));let i=cn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Wn(e,i)}function wf(e,t,n,i="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let a=n?new Set(Oo(t,n)):void 0,c={};return sr(c,t,Reflect.ownKeys(ui(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),Wn(t,cn(t._zod.def,{shape:c,checks:[]}))}function Tv(e,t,n){let i=n?new Set(Oo(t,n)):void 0,r={};return sr(r,t,Reflect.ownKeys(ui(t)),(s,o)=>i&&!i.has(o)?s:new e({type:"nonoptional",innerType:s})),Wn(t,cn(t._zod.def,{shape:r}))}function Zn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Tf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function fi(e,t){return t.map((n)=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function bs(e){return typeof e==="string"?e:e?.message}function Lc(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function Xn(e,t,n){var i;let r=e.inst?._zod?.traits;if(r?.has("$ZodType"))if(r.has("$ZodCheck"))(i=e).schema??(i.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:bs(e.inst?._zod.def?.error?.(e))??bs(s?.(e))??bs(t?.error?.(e))??bs(n.customError?.(e))??bs(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=e.input;return a}var Ev=/[\uD800-\uDBFF]/;function Uo(e){let t=e.length;if(!Ev.test(e))return t;let n=t;for(let i=0;i<t-1;i++)if((e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320)n--,i++;return n}function Fo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ef(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function ar(...e){let[t,n,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:i};return{...t}}function Af(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);if(i.get)Object.defineProperty(e,n,{...i,enumerable:!1});else ff(e,n,i.value)}for(let n of Object.getOwnPropertySymbols(t))ff(e,n,t[n])}function hi(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function Nc(e,t,n){return hi(e,t,n,!1)}function Rf(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return hi(this,n,i(this))},set(r){hi(this,n,r)}})}return t}function ff(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:hi(this,t,n.bind(this))},set(i){hi(this,t,i)}})}function Av(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ec,Pi=!1,Rv={configurable:!0,get(){Pi=!0;return}};function nt(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&Ec!==e._zod){Ec=void 0;return}Ec=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,Rv);let r=Pi;Pi=!1;try{let s=n(this);if(Pi)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Pi=Pi||r,s}catch(s){throw delete this[t],Pi=Pi||r,s}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function Cv(e,t,n,i){let r=Av(e,t);if(!r)return;Object.defineProperty(r,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:s})}})}var Iv="~constantCatch";function Cf(e){let t=()=>e;return t[Iv]=!0,t}var If;var Dc={value:void 0,enumerable:!1},Pf="captureStackTrace"in Error?Error:null;function Pv(e){let t=Pf;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Pf=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,i){let r={};function s(f){this.def=f,this.constr=h,this.traits=new Set}s.prototype=r;let o=n,a=o&&new WeakSet;function c(f,d){if(!f._zod){Dc.value=new s(d);try{Object.defineProperty(f,"_zod",Dc)}finally{Dc.value=void 0}}if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,d),a){let x=Object.getPrototypeOf(f),p=f._zod.constr.prototype,g=x;while(g&&g!==p)g=Object.getPrototypeOf(g);let A=g??x;if(!a.has(A))a.add(A),Af(A,o)}let m=h.prototype;for(let x in m){if(!Object.prototype.hasOwnProperty.call(m,x))continue;if(!(x in f))f[x]=m[x].bind(f)}}let l=i?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function h(f){let d=i?.Parent?Pv(u):this;c(d,f);let m=d._zod.deferred;if(m){for(let p of m)p();d._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;if(x)x(d);return d}return Object.defineProperty(h,"init",{value:c}),Object.defineProperty(h,Symbol.hasInstance,{value:(f)=>{if(i?.Parent&&f instanceof i.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(h,"name",{value:e}),h}class qn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ts extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(If=globalThis).__zod_globalConfig??(If.__zod_globalConfig={});var Kt=globalThis.__zod_globalConfig;function ln(e){if(e)Object.assign(Kt,e);return Kt}function Lv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ws,2)),e.message}function Nv(e){this._zod.message=e}var Dv={get:Lv,set:Nv,enumerable:!0,configurable:!0},Uc={value:void 0,enumerable:!1},Lf=new WeakSet([Object.prototype,Error.prototype]),Nf=(e,t)=>{e.name="$ZodError",Uc.value=t,Object.defineProperty(e,"issues",Uc),Uc.value=void 0,Object.defineProperty(e,"message",Dv);let n=Object.getPrototypeOf(e);if(!Lf.has(n))Lf.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}})},Df=q("$ZodError",Nf),d1=q("$ZodError",Nf,void 0,{Parent:Error});function Ov(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function Of(e,t=(n)=>n.message){let n={},i=[];for(let r of e.issues)if(r.path.length>0)Ov(n,r.path[0],()=>[]).push(t(r));else i.push(t(r));return{formErrors:i,fieldErrors:n}}function Uf(e,t=(n)=>n.message){let n={_errors:[]},i=(r,s=[])=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map((a)=>i({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...s,...o.path]);else{let a=[...s,...o.path];if(a.length===0)n._errors.push(t(o));else{let c=n,l=0;while(l<a.length){let u=a[l],h=l===a.length-1;if(u==="_errors"){if(h)c._errors.push(t(o));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[u];if(h)f._errors.push(t(o));c=f,l++}}}};return i(e),n}function zo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ko=(e)=>{let t=(n,i,r,s)=>{let o=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new qn;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((l)=>Xn(l,o,ln())));throw Rc(c,s?.callee??t),c}return a.value};return t};var Bo=(e)=>{let t=async(n,i,r,s)=>{let o=r?{...r,async:!0}:{async:!0},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((l)=>Xn(l,o,ln())));throw Rc(c,s?.callee??t),c}return a.value};return t};var Go=(e)=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new qn;return s.issues.length?Ff(e,s.issues,r):{success:!0,data:s.value}};function Ff(e,t,n){let i;return{success:!1,get error(){if(!i)i=new e(t.map((r)=>Xn(r,n,ln()))),t=void 0,n=void 0;return i},set error(r){i=r,t=void 0,n=void 0}}}var Ho=(e)=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)s=await s;return s.issues.length?Ff(e,s.issues,r):{success:!0,data:s.value}};var Uv=Symbol.for("zod.compile.invalid"),Fv=Symbol.for("zod.compile.fallback"),Fc=(e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==Uv)return!0;if(i.definite===!0&&n===void 0)return!1}return zv(e,t,n)};function zv(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,s;if(r)i[Fv]=!0,s=r({value:t,issues:[]},i);else s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new qn;return s.issues.length===0}var zc=async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);if(r instanceof Promise)r=await r;return r.issues.length===0},zf=(e)=>{let t=ko(e),n=(i,r,s,o)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(i,r,a,zo(n,o))};return n};var kf=(e)=>{let t=ko(e),n=(i,r,s,o)=>t(i,r,s,zo(n,o));return n};var Bf=(e)=>{let t=Bo(e),n=async(i,r,s,o)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(i,r,a,zo(n,o))};return n};var Gf=(e)=>{let t=Bo(e),n=async(i,r,s,o)=>await t(i,r,s,zo(n,o));return n};var Hf=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Go(e)(t,n,r)};var Vf=(e)=>(t,n,i)=>Go(e)(t,n,i);var $f=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ho(e)(t,n,r)};var Wf=(e)=>async(t,n,i)=>Ho(e)(t,n,i);var Zf=/^[cC][0-9a-z]{6,}$/,Xf=/^[0-9a-z]+$/,qf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Yf=/^[0-9a-vA-V]{20}$/,jf=/^[A-Za-z0-9]{27}$/,Jf=/^[a-zA-Z0-9_-]{21}$/;function Kf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Qf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ed=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bc=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var td=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var kv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function nd(){return new RegExp(kv,"u")}var id=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var sd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,od=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ad=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cd=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var ld=/^https?$/,ud=/^\+[1-9]\d{6,14}$/;var hd="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Bv(e){return new RegExp(`^${e}$`)}var fd=Bv(hd);function kc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function dd(e){return new RegExp(`^${kc(e)}$`)}function pd(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${kc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${kc({precision:e.precision})}`:n;return new RegExp(`^${hd}T(?:${i})$`)}var md=/^[\s\S]{0,}$/;var Gc=/^-?\d+$/,Es=/^-?\d+(?:\.\d+)?$/,gd=/^(?:true|false)$/i;var _d=/^[^A-Z]*$/,xd=/^[^a-z]*$/;var kt=q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var Hc=(e)=>{let t=e.value;return!pf(t)&&t.length!==void 0},Vo={number:"number",bigint:"bigint",object:"date"},Vc=q("$ZodCheckLessThan",(e,t)=>{kt.init(e,t);let n=Vo[typeof t.value];e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:Vo[typeof i.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$c=q("$ZodCheckGreaterThan",(e,t)=>{kt.init(e,t);let n=Vo[typeof t.value];e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:Vo[typeof i.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vd=q("$ZodCheckMultipleOf",(e,t)=>{kt.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):mf(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),yd=q("$ZodCheckNumberFormat",(e,t)=>{kt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=Do[t.format];e._zod.check=(o)=>{let a=o.value;if(n){if(!Number.isInteger(a)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});else o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}if(a<r)o.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>s)o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var bd=q("$ZodCheckMaxLength",(e,t)=>{var n;kt.init(e,t),(n=e._zod.def).when??(n.when=Hc),e._zod.check=(i)=>{let r=i.value,s=r.length;if((typeof r==="string"&&s>t.maximum?Uo(r):s)<=t.maximum)return;let a=Fo(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sd=q("$ZodCheckMinLength",(e,t)=>{var n;kt.init(e,t),(n=e._zod.def).when??(n.when=Hc),e._zod.check=(i)=>{let r=i.value,s=r.length;if((typeof r==="string"&&s>=t.minimum&&s<t.minimum*2?Uo(r):s)>=t.minimum)return;let a=Fo(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Md=q("$ZodCheckLengthEquals",(e,t)=>{var n;kt.init(e,t),(n=e._zod.def).when??(n.when=Hc),e._zod.check=(i)=>{let r=i.value,s=r.length,o=typeof r==="string"&&s>=t.length&&s<=t.length*2?Uo(r):s;if(o===t.length)return;let a=Fo(r),c=o>t.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Rs=q("$ZodCheckStringFormat",(e,t)=>{var n,i;if(kt.init(e,t),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),wd=q("$ZodCheckRegex",(e,t)=>{Rs.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Td=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=_d),Rs.init(e,t)}),Ed=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xd),Rs.init(e,t)}),Ad=q("$ZodCheckIncludes",(e,t)=>{kt.init(e,t);let n=Li(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Rd=q("$ZodCheckStartsWith",(e,t)=>{kt.init(e,t);let n=new RegExp(`^${Li(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Cd=q("$ZodCheckEndsWith",(e,t)=>{kt.init(e,t);let n=new RegExp(`.*${Li(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});var Id=q("$ZodCheckOverwrite",(e,t)=>{kt.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class Wc{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
+`).filter((s)=>s),i=Math.min(...n.map((s)=>s.length-s.trimStart().length)),r=n.map((s)=>s.slice(i)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of r)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
+${t.join(`
+`)}
+};`)(...Object.values(this.closed))}}var Ld={major:4,minor:6,patch:2};var _t=q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ld;let i=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(let s of r)for(let o of s._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,l)=>{if(a.memo)return a;let u=Zn(a),h;for(let f of c){if(f._zod.def.when){if(Tf(a))continue;if(!f._zod.def.when(a))continue}else if(u)continue;let d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&l?.async===!1)throw new qn;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await m,a.issues.length===d)return;if(Lc(a.issues,d,e),!u)u=Zn(a,d)});else{if(a.issues.length===d)continue;if(Lc(a.issues,d,e),!u)u=Zn(a,d)}}if(h)return h.then(()=>a);return a},o=(a,c,l)=>{if(Zn(a))return a.aborted=!0,a;let u=s(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new qn;return u.then((h)=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((h)=>o(h,a,c));return o(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new qn;return l.then((u)=>s(u,r,c))}return s(l,r,c)}}},{get "~standard"(){return Nc(this,"~standard",Xc(this))},set "~standard"(e){hi(this,"~standard",e)}}),Vd=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Xn(n,t,ln()))}:{value:e.value};async function Gv(e,t){let n={async:!0};return Vd(await e._zod.run({value:t,issues:[]},n),n)}function Xc(e){return{validate:(t)=>{let n={async:!1};try{let i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return Vd(i,n)}catch(i){}return Gv(e,t)},vendor:"zod",version:1}}var Zo=q("$ZodString",(e,t)=>{_t.init(e,t),e._zod.pattern=t.pattern??md,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),xt=q("$ZodStringFormat",(e,t)=>{Rs.init(e,t),Zo.init(e,t)}),$d=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ed),xt.init(e,t)}),Wd=q("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bc(i))}else t.pattern??(t.pattern=Bc());xt.init(e,t)}),Zd=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=td),xt.init(e,t)}),Xd=1,qd=2;function Hv(e,t){if(!t.normalize&&t.protocol?.source===ld.source&&!/^https?:\/\//i.test(e))return Xd;try{return new URL(e)}catch{return qd}}var Vv=/[\t\n\r]/g;function $v(e){return e.replace(Vv,"")}function Wv(e,t){return t.lastIndex=0,t.test(e.hostname)}function Zv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Yd=q("$ZodURL",(e,t)=>{xt.init(e,t),e._zod.check=(n)=>{try{let i=n.value.trim(),r=Hv(i,t);if(r===Xd){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(r===qd){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(t.hostname&&!Wv(r,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Zv(r,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?r.href:$v(i);return}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),jd=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nd()),xt.init(e,t)}),Jd=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Jf:Kf(t.length)),xt.init(e,t)}),Kd=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Zf),xt.init(e,t)}),Qd=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Xf),xt.init(e,t)}),ep=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=qf),xt.init(e,t)}),tp=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yf),xt.init(e,t)}),np=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=jf),xt.init(e,t)}),ip=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=pd(t)),xt.init(e,t)}),rp=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fd),xt.init(e,t)}),sp=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=dd(t)),xt.init(e,t)}),op=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Qf),xt.init(e,t)}),ap=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=id),xt.init(e,t)}),Xv=/^[0-9a-fA-F:.]+$/;function cp(e){if(!Xv.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var lp=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rd),xt.init(e,t),e._zod.check=(n)=>{if(!cp(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var up=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=sd),xt.init(e,t)});function qv(e){let t=e.split("/");if(t.length!==2)return!1;let[n,i]=t;if(!i)return!1;let r=Number(i);if(`${r}`!==i)return!1;if(r<0||r>128)return!1;return cp(n)}var hp=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=od),xt.init(e,t),e._zod.check=(n)=>{if(!qv(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function fp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var qc=/^[0-9a-zA-Z+/]*={0,2}$/,dp=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qc),xt.init(e,t),e._zod.check=(n)=>{if(fp(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Xo=/^[A-Za-z0-9_-]*$/;function Yv(e){if(!Xo.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return fp(n)}var pp=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xo),xt.init(e,t),e._zod.check=(n)=>{if(Yv(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),mp=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ud),xt.init(e,t)});function jv(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var gp=q("$ZodJWT",(e,t)=>{xt.init(e,t),e._zod.check=(n)=>{if(jv(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var Yc=q("$ZodNumber",(e,t)=>{_t.init(e,t),e._zod.pattern=Es,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let s=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?String(r):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),_p=q("$ZodNumberFormat",(e,t)=>{yd.init(e,t),Yc.init(e,t)}),xp=q("$ZodBoolean",(e,t)=>{_t.init(e,t),e._zod.pattern=gd,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var vp=q("$ZodUnknown",(e,t)=>{_t.init(e,t),e._zod.parse=(n)=>n}),yp=q("$ZodNever",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Nd(e,t,n){if(e.issues.length)t.issues.push(...fi(n,e.issues));t.value[n]=e.value}var bp=q("$ZodArray",(e,t)=>{_t.init(e,t);let n=Kt.memoizer;n?.attach(e),e._zod.parse=(i,r)=>{let s=i.value;if(!Array.isArray(s))return i.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),i;i.value=n?n.alloc(e,i,Array(s.length),r):Array(s.length);let o=[],a=r?.abortEarly;for(let c=0;c<s.length;c++){let l=s[c],u=t.element._zod.run({value:l,issues:[]},r);if(u instanceof Promise)o.push(u.then((h)=>Nd(h,i,c)));else if(Nd(u,i,c),a&&u.issues.length!==0&&Zn(u))break}if(o.length)return Promise.all(o).then(()=>i);return i}});function Wo(e,t,n,i,r,s){let o=n in i,a=s==="optional";if(!o&&a&&r==="optional")return;if(e.issues.length){if(r!==void 0&&a&&!o)return;t.issues.push(...fi(n,e.issues))}if(!o&&r===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(o||r==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var Jv=[];function Sp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:Jv,r=i.length?[...t,...i]:t;for(let o of r)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(o)}": expected a Zod schema`);let s=Sf(e.shape);return{...e,allKeys:r,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Mp(e,t,n,i,r,s,o){let a=[],c=r.keySet,l=r.catchall._zod,u=l.def.type,{optin:h,optout:f}=l,d=0;for(let m in t){if(o&&n.issues.length!==d){if(Zn(n,d))break;d=n.issues.length}if(c.has(m))continue;if(m==="__proto__"){if(u==="never")a.push(m);continue}if(u==="never"){a.push(m);continue}let x=l.run({value:t[m],issues:[]},i);if(x instanceof Promise)e.push(x.then((p)=>Wo(p,n,m,t,h,f)));else Wo(x,n,m,t,h,f)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Kv=q("$ZodObject",(e,t)=>{_t.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){let l=()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(t,"shape",{get:l})}let r=Po(()=>Sp(t));nt(e,"propValues",(l)=>{let u=l.def.shape,h={};for(let f in u){let d=u[f]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(h,f))Cn(h,f,new Set);for(let m of d.values)h[f].add(m);if(d.optin!==void 0)h[f].add(void 0)}}return h});let s=Ss,o=t.catchall,a,c=Kt.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=r.value);let h=l.value;if(!s(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let f=[],d=a.shape,m=u?.abortEarly,x=l.issues.length;for(let p of a.allKeys){if(m&&l.issues.length!==x){if(Zn(l,x))break;x=l.issues.length}if(p==="__proto__")continue;let g=d[p],A=g._zod.optin,E=g._zod.optout,y=g._zod.run({value:h[p],issues:[]},u);if(y instanceof Promise)f.push(y.then((w)=>Wo(w,l,p,h,A,E)));else Wo(y,l,p,h,A,E)}if(!o)return f.length?Promise.all(f).then(()=>l):l;return Mp(f,h,l,u,r.value,e,m===!0)}}),wp=q("$ZodObjectJIT",(e,t)=>{Kv.init(e,t);let n=e._zod.parse,i=Po(()=>Sp(t)),r=Kt.memoizer,s=(d)=>{let m=i.value,x=m.symbolKeys,p=new Wc(["payload","ctx"],{shape:d,inst:e,memo:r,syms:x}),g=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,A=(w,T)=>`
+ let ${w}_ab = false;
+ for (let i = 0; i < ${w}.issues.length; i++) {
+ const iss = ${w}.issues[i];
+ iss.path = iss.path ? [${T}, ...iss.path] : [${T}];
+ payload.issues.push(iss);
+ if (iss.continue !== true) ${w}_ab = true;
}
- }
-
- if (${v}.value === undefined) {
- if (${w} in input) {
- newResult[${w}] = undefined;
+ if (${w}_ab && ctx && ctx.abortEarly) {
+ payload.value = newResult;
+ return payload;
+ }`;p.write("const input = payload.value;");let E=Object.create(null),y=0;for(let w of m.allKeys)E[w]=`key_${y++}`;p.write(r?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of m.allKeys){if(w==="__proto__")continue;let T=E[w],R=typeof w==="symbol"?`syms[${x.indexOf(w)}]`:xf(w),_=`${R} in input`,S=d[w],U=S?._zod?.optin,C=U!==void 0,z=S?._zod?.optout==="optional";if(p.write(`const ${T} = ${g(R)};`),C&&z){let j=U==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;p.write(`
+ const ${T}_present = ${_};
+ if (!${T}.issues.length || ${T}_present) {
+ if (${T}.issues.length) {${A(T,R)}
+ }
+
+ if (${j}) {
+ newResult[${R}] = ${T}.value;
}
- } else {
- newResult[${w}] = ${v}.value;
}
-
- `);else if(!R)d.write(`
- const ${v}_present = ${w} in input;
- if (${v}.issues.length) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+
+ `)}else if(!C)p.write(`
+ const ${T}_present = ${_};
+ if (${T}.issues.length) {${A(T,R)}
}
- if (!${v}_present && !${v}.issues.length) {
+ if (!${T}_present && !${T}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
- path: [${w}]
+ path: [${R}]
});
+ if (ctx && ctx.abortEarly) {
+ payload.value = newResult;
+ return payload;
+ }
}
- if (${v}_present) {
- if (${v}.value === undefined) {
- newResult[${w}] = undefined;
- } else {
- newResult[${w}] = ${v}.value;
- }
+ if (${T}_present) {
+ newResult[${R}] = ${T}.value;
}
- `);else d.write(`
- if (${v}.issues.length) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+ `);else if(p.write(`
+ if (${T}.issues.length) {${A(T,R)}
}
-
- if (${v}.value === undefined) {
- if (${w} in input) {
- newResult[${w}] = undefined;
- }
- } else {
- newResult[${w}] = ${v}.value;
+ `),U==="defaulted")p.write(`newResult[${R}] = ${T}.value;`);else p.write(`
+ if (${T}.value !== undefined || ${_}) {
+ newResult[${R}] = ${T}.value;
}
-
- `)}d.write("payload.value = newResult;"),d.write("return payload;");let A=d.compile();return(T,v)=>A(h,T,v)},s,o=ps,a=!Er.jitless,l=a&&Ch.value,u=t.catchall,f;e._zod.parse=(h,d)=>{f??(f=i.value);let g=h.value;if(!o(g))return h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h;if(a&&l&&d?.async===!1&&d.jitless!==!0){if(!s)s=r(t.shape);if(h=s(h,d),!u)return h;return yd([],g,h,d,f,e)}return n(h,d)}});function Ff(e,t,n,i){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let r=e.filter((s)=>!Qi(s));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((o)=>En(o,i,Tn())))}),t}var Sd=q("$ZodUnion",(e,t)=>{xt.init(e,t),it(e._zod,"optin",()=>t.options.some((i)=>i._zod.optin==="optional")?"optional":void 0),it(e._zod,"optout",()=>t.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),it(e._zod,"values",()=>{if(t.options.every((i)=>i._zod.values))return new Set(t.options.flatMap((i)=>Array.from(i._zod.values)));return}),it(e._zod,"pattern",()=>{if(t.options.every((i)=>i._zod.pattern)){let i=t.options.map((r)=>r._zod.pattern);return new RegExp(`^(${i.map((r)=>Mo(r.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let s=!1,o=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},r);if(c instanceof Promise)o.push(c),s=!0;else{if(c.issues.length===0)return c;o.push(c)}}if(!s)return Ff(o,i,e,r);return Promise.all(o).then((a)=>Ff(a,i,e,r))}});var Md=q("$ZodIntersection",(e,t)=>{xt.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,s=t.left._zod.run({value:r,issues:[]},i),o=t.right._zod.run({value:r,issues:[]},i);if(s instanceof Promise||o instanceof Promise)return Promise.all([s,o]).then(([c,l])=>zf(n,c,l));return zf(n,s,o)}});function mc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ki(e)&&Ki(t)){let n=Object.keys(t),i=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),r={...e,...t};for(let s of i){let o=mc(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};r[s]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],s=t[i],o=mc(r,s);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function zf(e,t,n){let i=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let c of a.keys){if(!i.has(c))i.set(c,{});i.get(c).l=!0}}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!i.has(c))i.set(c,{});i.get(c).r=!0}else e.issues.push(a);let s=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r)e.issues.push({...r,keys:s});if(Qi(e))return e;let o=mc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var wd=q("$ZodRecord",(e,t)=>{xt.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Ki(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let s=[],o=t.keyType._zod.values;if(o){n.value={};let a=new Set;for(let l of o)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){a.add(typeof l==="number"?l.toString():l);let u=t.keyType._zod.run({value:l,issues:[]},i);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((d)=>En(d,i,Tn())),input:l,path:[l],inst:e});continue}let f=u.value,h=t.valueType._zod.run({value:r[l],issues:[]},i);if(h instanceof Promise)s.push(h.then((d)=>{if(d.issues.length)n.issues.push(...Mi(l,d.issues));n.value[f]=d.value}));else{if(h.issues.length)n.issues.push(...Mi(l,h.issues));n.value[f]=h.value}}let c;for(let l in r)if(!a.has(l))c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(let a of Reflect.ownKeys(r)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(r,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},i);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&hc.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},i);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")n.value[a]=r[a];else n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>En(f,i,Tn())),input:a,path:[a],inst:e});continue}let u=t.valueType._zod.run({value:r[a],issues:[]},i);if(u instanceof Promise)s.push(u.then((f)=>{if(f.issues.length)n.issues.push(...Mi(a,f.issues));n.value[c.value]=f.value}));else{if(u.issues.length)n.issues.push(...Mi(a,u.issues));n.value[c.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>n);return n}});var Td=q("$ZodEnum",(e,t)=>{xt.init(e,t);let n=yo(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((r)=>Ih.has(typeof r)).map((r)=>typeof r==="string"?Si(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{let o=r.value;if(i.has(o))return r;return r.issues.push({code:"invalid_value",values:n,input:o,inst:e}),r}}),Ed=q("$ZodLiteral",(e,t)=>{if(xt.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((i)=>typeof i==="string"?Si(i):i?Si(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,r)=>{let s=i.value;if(n.has(s))return i;return i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});var Ad=q("$ZodTransform",(e,t)=>{xt.init(e,t),e._zod.optin="optional",e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ds(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then((o)=>(n.value=o,n.fallback=!0,n));if(r instanceof Promise)throw new ii;return n.value=r,n.fallback=!0,n}});function kf(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var _c=q("$ZodOptional",(e,t)=>{xt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",it(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),it(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Mo(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){let r=n.value,s=t.innerType._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>kf(o,r));return kf(s,r)}if(n.value===void 0)return n;return t.innerType._zod.run(n,i)}}),Rd=q("$ZodExactOptional",(e,t)=>{_c.init(e,t),it(e._zod,"values",()=>t.innerType._zod.values),it(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),Cd=q("$ZodNullable",(e,t)=>{xt.init(e,t),it(e._zod,"optin",()=>t.innerType._zod.optin),it(e._zod,"optout",()=>t.innerType._zod.optout),it(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Mo(n.source)}|null)$`):void 0}),it(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>{if(n.value===null)return n;return t.innerType._zod.run(n,i)}}),Id=q("$ZodDefault",(e,t)=>{xt.init(e,t),e._zod.optin="optional",it(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Bf(s,t));return Bf(r,t)}});function Bf(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Pd=q("$ZodPrefault",(e,t)=>{xt.init(e,t),e._zod.optin="optional",it(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,i)}}),Ld=q("$ZodNonOptional",(e,t)=>{xt.init(e,t),it(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Gf(s,e));return Gf(r,e)}});function Gf(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Nd=q("$ZodCatch",(e,t)=>{xt.init(e,t),e._zod.optin="optional",it(e._zod,"optout",()=>t.innerType._zod.optout),it(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>{if(n.value=s.value,s.issues.length)n.value=t.catchValue({...n,error:{issues:s.issues.map((o)=>En(o,i,Tn()))},input:n.value}),n.issues=[],n.fallback=!0;return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((s)=>En(s,i,Tn()))},input:n.value}),n.issues=[],n.fallback=!0;return n}});var Dd=q("$ZodPipe",(e,t)=>{xt.init(e,t),it(e._zod,"values",()=>t.in._zod.values),it(e._zod,"optin",()=>t.in._zod.optin),it(e._zod,"optout",()=>t.out._zod.optout),it(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let s=t.out._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>Co(o,t.in,i));return Co(s,t.in,i)}let r=t.in._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Co(s,t.out,i));return Co(r,t.out,i)}});function Co(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Ud=q("$ZodReadonly",(e,t)=>{xt.init(e,t),it(e._zod,"propValues",()=>t.innerType._zod.propValues),it(e._zod,"values",()=>t.innerType._zod.values),it(e._zod,"optin",()=>t.innerType?._zod?.optin),it(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then(Hf);return Hf(r)}});function Hf(e){return e.value=Object.freeze(e.value),e}var Od=q("$ZodCustom",(e,t)=>{Vt.init(e,t),xt.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=(n)=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then((s)=>Vf(s,n,i,e));Vf(r,n,i,e);return}});function Vf(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)r.params=i._zod.def.params;t.issues.push(er(r))}}var Fd,DE=Symbol("ZodOutput"),UE=Symbol("ZodInput");class zd{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function hx(){return new zd}(Fd=globalThis).__zod_globalRegistry??(Fd.__zod_globalRegistry=hx());var tr=globalThis.__zod_globalRegistry;function kd(e,t){return new e({type:"string",...Te(t)})}function Bd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function xc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function Gd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function Hd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function Vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function Wd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function $d(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function Zd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function Xd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function qd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function Yd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function jd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function Jd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function Kd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function Qd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function ep(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function tp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function np(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function ip(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function rp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function sp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function op(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function ap(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function cp(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function lp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function up(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function hp(e,t){return new e({type:"number",checks:[],...Te(t)})}function fp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function dp(e,t){return new e({type:"boolean",...Te(t)})}function pp(e){return new e({type:"unknown"})}function mp(e,t){return new e({type:"never",...Te(t)})}function Lo(e,t){return new fc({check:"less_than",...Te(t),value:e,inclusive:!1})}function vs(e,t){return new fc({check:"less_than",...Te(t),value:e,inclusive:!0})}function No(e,t){return new dc({check:"greater_than",...Te(t),value:e,inclusive:!1})}function ys(e,t){return new dc({check:"greater_than",...Te(t),value:e,inclusive:!0})}function Do(e,t){return new Sf({check:"multiple_of",...Te(t),value:e})}function Uo(e,t){return new wf({check:"max_length",...Te(t),maximum:e})}function Ar(e,t){return new Tf({check:"min_length",...Te(t),minimum:e})}function Oo(e,t){return new Ef({check:"length_equals",...Te(t),length:e})}function vc(e,t){return new Af({check:"string_format",format:"regex",...Te(t),pattern:e})}function yc(e){return new Rf({check:"string_format",format:"lowercase",...Te(e)})}function bc(e){return new Cf({check:"string_format",format:"uppercase",...Te(e)})}function Sc(e,t){return new If({check:"string_format",format:"includes",...Te(t),includes:e})}function Mc(e,t){return new Pf({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function wc(e,t){return new Lf({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Ti(e){return new Nf({check:"overwrite",tx:e})}function Tc(e){return Ti((t)=>t.normalize(e))}function Ec(){return Ti((e)=>e.trim())}function Ac(){return Ti((e)=>e.toLowerCase())}function Rc(){return Ti((e)=>e.toUpperCase())}function Cc(){return Ti((e)=>Rh(e))}function gp(e,t,n){return new e({type:"array",element:t,...Te(n)})}function _p(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Te(n)})}function xp(e,t){let n=fx((i)=>(i.addIssue=(r)=>{if(typeof r==="string")i.issues.push(er(r,i.value,n._zod.def));else{let s=r;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),i.issues.push(er(s))}},e(i.value,i)),t);return n}function fx(e,t){let n=new Vt({check:"custom",...Te(t)});return n._zod.check=e,n}function Ic(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??tr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function At(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let h=o.schema,d=t.processors[r.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);d(e,t,h,u)}let f=e._zod.parent;if(f){if(!o.ref)o.ref=f;At(f,t,u),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(o.schema,c);if(t.io==="input"&&Jt(e))delete o.schema.examples,delete o.schema.default;if(t.io==="input"&&"_prefault"in o.schema)(i=o.schema).default??(i.default=o.schema._prefault);return delete o.schema._prefault,t.seen.get(e).schema}function Pc(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let o of e.seen.entries()){let a=e.metadataRegistry.get(o[0])?.id;if(a){let c=i.get(a);if(c&&c!==o[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=(o)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(o[0])?.id,h=e.external.uri??((g)=>g);if(f)return{ref:h(f)};let d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${h("__shared")}#/${a}/${d}`}}if(o[1]===n)return{ref:"#"};let l=`${"#"}/${a}/`,u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},s=(o)=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=r(o);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let f in u)delete u[f];u.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let a=o[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
+ `)}return p.write("payload.value = newResult;"),p.write("return payload;"),p.compile()},o,a=Ss,c=!Kt.jitless,u=c&&yf.value,h=t.catchall,f;e._zod.parse=(d,m)=>{f??(f=i.value);let x=d.value;if(!a(x))return d.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),d;if(c&&u&&m?.async===!1&&m.jitless!==!0){if(!o)o=s(t.shape);if(d=o(d,m),!h)return d;return Mp([],x,d,m,f,e,m?.abortEarly===!0)}return n(d,m)}});function Dd(e,t,n,i){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let r=e.filter((s)=>!Zn(s));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((o)=>Xn(o,i,ln())))}),t}var Tp=q("$ZodUnion",(e,t)=>{_t.init(e,t),nt(e,"optin",(i)=>i.def.options.some((r)=>r._zod.optin==="defaulted")?"defaulted":i.def.options.some((r)=>r._zod.optin!==void 0)?"optional":void 0),nt(e,"optout",(i)=>i.def.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),nt(e,"values",(i)=>{if(i.def.options.every((r)=>r._zod.values))return new Set(i.def.options.flatMap((r)=>Array.from(r._zod.values)));return}),nt(e,"pattern",(i)=>{if(i.def.options.every((r)=>r._zod.pattern)){let r=i.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${r.map((s)=>Lo(s.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let s=!1,o=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},r);if(c instanceof Promise)o.push(c),s=!0;else{if(c.issues.length===0)return c;o.push(c)}}if(!s)return Dd(o,i,e,r);return Promise.all(o).then((a)=>Dd(a,i,e,r))}});var Ep=q("$ZodIntersection",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,s=t.left._zod.run({value:r,issues:[]},i),o=t.right._zod.run({value:r,issues:[]},i);if(s instanceof Promise||o instanceof Promise)return Promise.all([s,o]).then(([c,l])=>Od(n,c,l));return Od(n,s,o)}});function Zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(or(e)&&or(t)){let n=Object.keys(t),i=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),r={...e,...t};if(Object.prototype.hasOwnProperty.call(r,"__proto__"))delete r.__proto__;for(let s of i){if(s==="__proto__")continue;let o=Zc(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};r[s]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],s=t[i],o=Zc(r,s);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Od(e,t,n){let i=new Map,r,s=new Map,o=(l,u)=>{let h;if(l.code==="unrecognized_keys"&&!l.path?.length)r??(r=l),h=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let f=String(l.path[0]);if(!s.has(f))s.set(f,l);h=[f]}else return!1;for(let f of h){if(!i.has(f))i.set(f,{});i.get(f)[u]=!0}return!0};for(let l of t.issues)if(!o(l,"l"))e.issues.push(l);for(let l of n.issues)if(!o(l,"r"))e.issues.push(l);let a=[...i].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=r?a.filter((u)=>r.keys.includes(u)):[];if(l.length)e.issues.push({...r,keys:l});for(let u of a)if(!l.includes(u)&&s.has(u))e.issues.push(s.get(u))}let c=Zc(t.value,n.value);if(!c.valid){if(Zn(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ap=q("$ZodRecord",(e,t)=>{_t.init(e,t);let n=Kt.memoizer;n?.attach(e),e._zod.parse=(i,r)=>{let s=i.value;if(!or(s))return i.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),i;let o=[],a=t.keyType._zod.values;if(a&&!t.partial){i.value=n?n.alloc(e,i,{},r):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let h=t.keyType._zod.run({value:u,issues:[]},r);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((m)=>Xn(m,r,ln())),input:u,path:[u],inst:e});continue}let f=h.value;if(f==="__proto__")continue;let d=t.valueType._zod.run({value:s[u],issues:[]},r);if(d instanceof Promise)o.push(d.then((m)=>{if(m.issues.length)i.issues.push(...fi(u,m.issues));i.value[f]=m.value}));else{if(d.issues.length)i.issues.push(...fi(u,d.issues));i.value[f]=d.value}}let l;for(let u in s)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;i.value[u]=s[u]}else l=l??[],l.push(u);if(l&&l.length>0)i.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l,continue:!0})}else{i.value=n?n.alloc(e,i,{},r):{};let c;for(let l of Reflect.ownKeys(s)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Es.test(l)&&u.issues.length){let m=t.keyType._zod.run({value:Number(l),issues:[]},r);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)u=m}if(u.issues.length){if(t.mode==="loose")i.value[l]=s[l];else if(a)c=c??[],c.push(l);else i.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((m)=>Xn(m,r,ln())),input:l,path:[l],inst:e});continue}let f=u.value;if(f==="__proto__")continue;let d=t.valueType._zod.run({value:s[l],issues:[]},r);if(d instanceof Promise)o.push(d.then((m)=>{if(m.issues.length)i.issues.push(...fi(l,m.issues));i.value[f]=m.value}));else{if(d.issues.length)i.issues.push(...fi(l,d.issues));i.value[f]=d.value}}if(c&&c.length>0)i.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(o.length)return Promise.all(o).then(()=>i);return i}});var Rp=q("$ZodEnum",(e,t)=>{_t.init(e,t);let n=Ms(t.entries),i=new Set(n);e._zod.values=i,nt(e,"pattern",(r)=>{let s=Ms(r.def.entries).filter((o)=>bf.has(typeof o));return new RegExp(s.length?`^(${s.map((o)=>Li(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,s)=>{let o=r.value;if(i.has(o))return r;return r.issues.push({code:"invalid_value",values:n,input:o,inst:e}),r}}),Cp=q("$ZodLiteral",(e,t)=>{_t.init(e,t);let n=new Set(t.values);e._zod.values=n,nt(e,"pattern",(i)=>{let r=i.def.values;return new RegExp(r.length?`^(${r.map((s)=>typeof s==="string"?Li(s):s?Li(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,r)=>{let s=i.value;if(n.has(s))return i;return i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});var Ip=q("$ZodTransform",(e,t)=>{_t.init(e,t),e._zod.optin="optional",Kt.memoizer?.guard(e),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Ts(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then((o)=>(n.value=o,n));if(r instanceof Promise)throw new qn;return n.value=r,n}});function Ud(e,t){return e.value=t.issues.length?void 0:t.value,e}var jc=q("$ZodOptional",(e,t)=>{_t.init(e,t),nt(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",nt(e,"values",(n)=>{let i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),nt(e,"pattern",(n)=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Lo(i.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let r=t.innerType._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)return r.then((s)=>Ud(n,s));return Ud(n,r)}return t.innerType._zod.run(n,i)}}),Pp=q("$ZodExactOptional",(e,t)=>{jc.init(e,t),nt(e,"values",(n)=>n.def.innerType._zod.values),nt(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),Lp=q("$ZodNullable",(e,t)=>{_t.init(e,t),nt(e,"optin",(n)=>n.def.innerType._zod.optin),nt(e,"optout",(n)=>n.def.innerType._zod.optout),nt(e,"pattern",(n)=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Lo(i.source)}|null)$`):void 0}),nt(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>{if(n.value===null)return n;return t.innerType._zod.run(n,i)}}),Np=q("$ZodDefault",(e,t)=>{_t.init(e,t),e._zod.optin="defaulted",nt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Fd(s,t));return Fd(r,t)}});function Fd(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Dp=q("$ZodPrefault",(e,t)=>{_t.init(e,t),e._zod.optin="defaulted",nt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,i)}}),Op=q("$ZodNonOptional",(e,t)=>{_t.init(e,t),nt(e,"values",(n)=>{let i=n.def.innerType._zod.values;return i?new Set([...i].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>zd(s,e));return zd(r,e)}});function zd(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function kd(e,t,n,i){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((r)=>Xn(r,i,ln()))},input:e.value}),e}var Up=q("$ZodCatch",(e,t)=>{_t.init(e,t),nt(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),nt(e,"optout",(n)=>n.def.innerType._zod.optout),nt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)return r.then((s)=>kd(n,s,t,i));return kd(n,r,t,i)}});var Fp=q("$ZodPipe",(e,t)=>{_t.init(e,t),nt(e,"values",(n)=>n.def.in._zod.values),nt(e,"optin",(n)=>n.def.in._zod.optin),nt(e,"optout",(n)=>n.def.out._zod.optout),nt(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let s=t.out._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>$o(o,t.in,i));return $o(s,t.in,i)}let r=t.in._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>$o(s,t.out,i));return $o(r,t.out,i)}});function $o(e,t,n){if(e.issues.some((i)=>i.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var zp=q("$ZodReadonly",(e,t)=>{_t.init(e,t),nt(e,"propValues",(n)=>n.def.innerType._zod.propValues),nt(e,"values",(n)=>n.def.innerType._zod.values),nt(e,"optin",(n)=>n.def.innerType?._zod?.optin),nt(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then(Bd);return Bd(r)}});function Bd(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var kp=q("$ZodCustom",(e,t)=>{kt.init(e,t),_t.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=(n)=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then((s)=>Gd(s,n,i,e));Gd(r,n,i,e);return}});function Gd(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)r.params=i._zod.def.params;t.issues.push(ar(r))}}function Hd(e,t,n){if(e.issues.length)t.issues.push(...fi(n,e.issues))}var Qv=q("$ZodProperties",(e,t)=>{_t.init(e,t),kt.init(e,t);let n=Kt.memoizer;n?.attach(e);let i,r=(s,o)=>{i??(i=Reflect.ownKeys(t.shape).map((l)=>[l,t.shape[l]]));let a=s.value,c;for(let[l,u]of i){let h=u._zod.run({value:a[l],issues:[]},o);if(h instanceof Promise)c??(c=[]),c.push(h.then((f)=>Hd(f,s,l)));else Hd(h,s,l)}if(c)return Promise.all(c).then(()=>{return});return};e._zod.parse=(s,o)=>{let a=s.value;if(a===null||typeof a!=="object"&&typeof a!=="function")return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;if(o.direction==="backward")o={...o,direction:"forward"};if(n)n.alloc(e,s,a,o);let c=r(s,o);return c instanceof Promise?c.then(()=>s):s},e._zod.check=(s)=>{if(s.value==null){s.issues.push({expected:"object",code:"invalid_type",input:s.value,inst:e});return}return r(s,{})}},{*[Symbol.iterator](){yield this}});class Gp extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Kc="~memo",Bp=[];function Hp(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function Jc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Vp=new WeakMap,Cs=0,jo=1,Is=2;function Jo(e,t,n){let i=Vp.get(e);if(i!==void 0)return i?Is:Cs;if(t.has(e))return Is;t.add(e);let r=Cs,s=(u)=>{if(r!==Is&&u?._zod){let h=Jo(u,t,n);if(h>r)r=h}},o=(u,h)=>{let f=Cs;for(let d of Reflect.ownKeys(u)){let m=Object.getOwnPropertyDescriptor(u,d);if(h&&!m.enumerable)continue;let x=m.get?jo:m.value?._zod?Jo(m.value,t,n):Cs;if(x>f)f=x}return f},a=(u)=>{if(u>r)r=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=No(c);a(u?o(u,!0):jo),s(c.catchall);break}case"properties":a(o(c.shape,!1));break;case"array":s(c.element);break;case"tuple":for(let u of c.items)s(u);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let u of c.options)s(u);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let u=c._cachedInner??(n?e._zod.innerType:void 0);a(u?Jo(u,t,!1):jo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let h=Object.getOwnPropertyDescriptor(c,u);if(!h||h.get)continue;let f=h.value;if(!f||typeof f!=="object")continue;if(f._zod)s(f);else if(Array.isArray(f))for(let d of f)s(d)}}return t.delete(e),ey(e,r)}function ey(e,t){if(t!==jo)Vp.set(e,t===Is);return t}function ty(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var qo,Yo=[],ny={alloc(e,t,n){let i=qo;if(!i)return n;qo=void 0;let r={value:n,issues:null};return i.set(t.value,r),Yo.push(r),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,i=(r,s)=>{if(s.direction!=="backward"&&iy(s,r.value))throw new Gp;return n(r,s)};if(e._zod.parse=i,e._zod.run===n)e._zod.run=i})},attach(e){var t;let n,i=!1,r,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let o=e._zod.parse,a=(c,l)=>{if(n===void 0){let g=Jo(e,new Set,!1);if(g===Cs){if(e._zod.parse=o,e._zod.run===a)e._zod.run=o;return o(c,l)}if(g===Is||i)n=!0;else i=!0}let u=c.value;if(!Hp(u))return o(c,l);let h=l[Kc];if(!h)h={buckets:new WeakMap,backEdges:void 0},l[Kc]=h;let f;if(r===l)f=s;else f=ty(h,e),r=l,s=f;let d=f.get(u);if(d){if(c.value=d.value,d.issues){if(d.issues.length)c.issues.push(...Jc(d.issues))}else c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value);return c}qo=f;let m=Yo.length,x=o(c,l);qo=void 0;let p=Yo.length>m?Yo.pop():void 0;if(x instanceof Promise)return x.then((g)=>{if(p)p.issues=g.issues.length?Jc(g.issues):Bp;return g});if(p)p.issues=x.issues.length?Jc(x.issues):Bp;return x};if(e._zod.parse=a,e._zod.run===o)e._zod.run=a})}};function $p(){return ny}function iy(e,t){let n=e[Kc]?.backEdges;return n!==void 0&&Hp(t)&&n.has(t)}var ry=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function r(s,o){if(s==="number"&&typeof o==="number"&&!Number.isFinite(o))return String(o);return i[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let o=r(s.expected),a=Ef(s.input),c=r(a,s.input);return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Ic(s.values[0])}`;return`Invalid option: expected one of ${Ac(s.values,"|")}`;case"too_big":{let o=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{let o=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{let o=s;if(o.format==="starts_with")return`Invalid string: must start with "${o.prefix}"`;if(o.format==="ends_with")return`Invalid string: must end with "${o.suffix}"`;if(o.format==="includes")return`Invalid string: must include "${o.includes}"`;if(o.format==="regex")return`Invalid string: must match pattern ${o.pattern}`;return`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ac(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Qc(){return{localeError:ry()}}var Wp;class Zp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function sy(){return new Zp}(Wp=globalThis).__zod_globalRegistry??(Wp.__zod_globalRegistry=sy());var cr=globalThis.__zod_globalRegistry;function Xp(e,t){return new e({type:"string",...Te(t)})}function qp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function Yp(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function jp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function Jp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function Kp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function Qp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function em(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function tm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function nm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function im(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function rm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function sm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function om(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function am(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function cm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function lm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function um(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function hm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function fm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function dm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function pm(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function mm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function gm(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function _m(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function xm(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function vm(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function ym(e,t){return new e({type:"number",checks:[],...Te(t)})}function bm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function Sm(e,t){return new e({type:"boolean",...Te(t)})}function Mm(e){return new e({type:"unknown"})}function wm(e,t){return new e({type:"never",...Te(t)})}function Ko(e,t){return new Vc({check:"less_than",...Te(t),value:e,inclusive:!1})}function Ps(e,t){return new Vc({check:"less_than",...Te(t),value:e,inclusive:!0})}function Qo(e,t){return new $c({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Ls(e,t){return new $c({check:"greater_than",...Te(t),value:e,inclusive:!0})}function ea(e,t){return new vd({check:"multiple_of",...Te(t),value:e})}function ta(e,t){return new bd({check:"max_length",...Te(t),maximum:e})}function Nr(e,t){return new Sd({check:"min_length",...Te(t),minimum:e})}function na(e,t){return new Md({check:"length_equals",...Te(t),length:e})}function el(e,t){return new wd({check:"string_format",format:"regex",...Te(t),pattern:e})}function tl(e){return new Td({check:"string_format",format:"lowercase",...Te(e)})}function nl(e){return new Ed({check:"string_format",format:"uppercase",...Te(e)})}function il(e,t){return new Ad({check:"string_format",format:"includes",...Te(t),includes:e})}function rl(e,t){return new Rd({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function sl(e,t){return new Cd({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Ni(e){return new Id({check:"overwrite",tx:e})}function ol(e){return Ni((t)=>t.normalize(e))}function al(){return Ni((e)=>e.trim())}function cl(){return Ni((e)=>e.toLowerCase())}function ll(){return Ni((e)=>e.toUpperCase())}function ul(){return Ni((e)=>vf(e))}function Tm(e,t,n){return new e({type:"array",element:t,...Te(n)})}function Em(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Te(n)})}function Am(e,t){let n=oy((i)=>(i.addIssue=(r)=>{if(typeof r==="string")i.issues.push(ar(r,i.value,n._zod.def));else{let s=r;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=i.value;s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),i.issues.push(ar(s))}},e(i.value,i)),t);return n}function oy(e,t){let n=new kt({check:"custom",...Te(t)});return n._zod.check=e,n}function Ns(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,i))Cn(e,i,n[i]);return e}function fl(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??cr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function di(e,t,n,i,r){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(r);return Object.assign(n,s),!0}function At(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let f=o.schema,d=t.processors[r.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);d(e,t,f,u)}let h=e._zod.parent;if(h){if(!o.ref)o.ref=h;At(h,t,u),t.seen.get(h).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Ns(o.schema,c);if(t.io==="input"&&Zt(e))delete o.schema.examples,delete o.schema.default;if(t.io==="input"&&"_prefault"in o.schema)(i=o.schema).default??(i.default=o.schema._prefault);return delete o.schema._prefault,t.seen.get(e).schema}function Rm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function dl(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let o of e.seen.entries()){let a=e.metadataRegistry.get(o[0])?.id;if(a){let c=i.get(a);if(c&&c!==o[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=(o)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let h=e.external.registry.get(o[0])?.id,f=e.external.uri??((m)=>m);if(h)return{ref:f(h)};let d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${f("__shared")}#/${a}/${Rm(d)}`}}let c="#",l=`${c}/${a}/`;if(o[1]===n&&!o[1].schema.id)return{ref:c};let u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Rm(u)}},s=(o)=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=r(o);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let h in u)delete u[h];u.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let a=o[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
-Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1){if(e.reused==="ref"){s(o);continue}}}}function Lc(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){i(f);let d=e.seen.get(f),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Object.assign(l,g);if(Object.assign(l,u),a._zod.parent===f)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(!(p in u))delete l[p]}if(g.$ref&&d.def)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(p in d.def&&JSON.stringify(l[p])===JSON.stringify(d.def[p]))delete l[p]}}let h=a._zod.parent;if(h&&h!==f){i(h);let d=e.seen.get(h);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in d.def&&JSON.stringify(l[g])===JSON.stringify(d.def[g]))delete l[g]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())i(a[0]);let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Object.assign(r,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&r.id===s)delete r.id;let o=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;o[c.defId]=c.def}}if(e.external);else if(Object.keys(o).length>0)if(e.target==="draft-2020-12")r.$defs=o;else r.definitions=o;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:bs(t,"input",e.processors),output:bs(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Jt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Jt(i.element,n);if(i.type==="set")return Jt(i.valueType,n);if(i.type==="lazy")return Jt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Jt(i.innerType,n);if(i.type==="intersection")return Jt(i.left,n)||Jt(i.right,n);if(i.type==="record"||i.type==="map")return Jt(i.keyType,n)||Jt(i.valueType,n);if(i.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Jt(i.in,n)||Jt(i.out,n)}if(i.type==="object"){for(let r in i.shape)if(Jt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Jt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Jt(r,n))return!0;if(i.rest&&Jt(i.rest,n))return!0;return!1}return!1}var vp=(e,t={})=>(n)=>{let i=Ic({...n,processors:t});return At(e,i),Pc(i,e),Lc(i,e)},bs=(e,t,n={})=>(i)=>{let{libraryOptions:r,target:s}=i??{},o=Ic({...r??{},target:s,io:t,processors:n});return At(e,o),Pc(o,e),Lc(o,e)};var dx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yp=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s==="number")r.minLength=s;if(typeof o==="number")r.maxLength=o;if(a){if(r.format=dx[a]??a,r.format==="")delete r.format;if(a==="time")delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let u=[...c];if(u.length===1)r.pattern=u[0].source;else if(u.length>1)r.allOf=[...u.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},bp=(e,t,n,i)=>{let r=n,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))r.type="integer";else r.type="number";let f=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)r.minimum=u,r.exclusiveMinimum=!0;else r.exclusiveMinimum=u;else if(typeof s==="number")r.minimum=s;if(h)if(d)r.maximum=l,r.exclusiveMaximum=!0;else r.exclusiveMaximum=l;else if(typeof o==="number")r.maximum=o;if(typeof c==="number")r.multipleOf=c},Sp=(e,t,n,i)=>{n.type="boolean"};var Mp=(e,t,n,i)=>{n.not={}};var wp=(e,t,n,i)=>{};var Tp=(e,t,n,i)=>{let r=e._zod.def,s=yo(r.entries);if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";n.enum=s},Ep=(e,t,n,i)=>{let r=e._zod.def,s=[];for(let o of r.values)if(o===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(o));else s.push(o);if(s.length===0);else if(s.length===1){let o=s[0];if(n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[o];else n.const=o}else{if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";if(s.every((o)=>typeof o==="boolean"))n.type="boolean";if(s.every((o)=>o===null))n.type="null";n.enum=s}};var Ap=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var Rp=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var Cp=(e,t,n,i)=>{let r=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;if(typeof o==="number")r.minItems=o;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=At(s.element,t,{...i,path:[...i.path,"items"]})},Ip=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object",r.properties={};let o=s.shape;for(let l in o)r.properties[l]=At(o[l],t,{...i,path:[...i.path,"properties",l]});let a=new Set(Object.keys(o)),c=new Set([...a].filter((l)=>{let u=s.shape[l]._zod;if(t.io==="input")return u.optin===void 0;else return u.optout===void 0}));if(c.size>0)r.required=Array.from(c);if(s.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")r.additionalProperties=!1}else if(s.catchall)r.additionalProperties=At(s.catchall,t,{...i,path:[...i.path,"additionalProperties"]})},Pp=(e,t,n,i)=>{let r=e._zod.def,s=r.inclusive===!1,o=r.options.map((a,c)=>At(a,t,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));if(s)n.oneOf=o;else n.anyOf=o},Lp=(e,t,n,i)=>{let r=e._zod.def,s=At(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=At(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=c};var Np=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object";let o=s.keyType,c=o._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let u=At(s.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let f of c)r.patternProperties[f.source]=u}else{if(t.target==="draft-07"||t.target==="draft-2020-12")r.propertyNames=At(s.keyType,t,{...i,path:[...i.path,"propertyNames"]});r.additionalProperties=At(s.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values;if(l){let u=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(u.length>0)r.required=u}},Dp=(e,t,n,i)=>{let r=e._zod.def,s=At(r.innerType,t,i),o=t.seen.get(e);if(t.target==="openapi-3.0")o.ref=r.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},Up=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType},Op=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},Fp=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);if(s.ref=r.innerType,t.io==="input")n._prefault=JSON.parse(JSON.stringify(r.defaultValue))},zp=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},kp=(e,t,n,i)=>{let r=e._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?r.out:r.in:r.out;At(o,t,i);let a=t.seen.get(e);a.ref=o},Bp=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0};var Nc=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType};var yx=q("ZodISODateTime",(e,t)=>{td.init(e,t),vt.init(e,t)});function Gp(e){return ap(yx,e)}var bx=q("ZodISODate",(e,t)=>{nd.init(e,t),vt.init(e,t)});function Hp(e){return cp(bx,e)}var Sx=q("ZodISOTime",(e,t)=>{id.init(e,t),vt.init(e,t)});function Vp(e){return lp(Sx,e)}var Mx=q("ZodISODuration",(e,t)=>{rd.init(e,t),vt.init(e,t)});function Wp(e){return up(Mx,e)}var Ex=(e,t)=>{To.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>Oh(e,n)},flatten:{value:(n)=>Uh(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ms,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ms,2)}},isEmpty:{get(){return e.issues.length===0}}})};var an=q("ZodError",Ex,{Parent:Error});var $p=Eo(an),Zp=Ao(an),Xp=gs(an),qp=_s(an),Yp=kh(an),jp=Bh(an),Jp=Gh(an),Kp=Hh(an),Qp=Vh(an),em=Wh(an),tm=$h(an),nm=Zh(an);var im=new WeakMap;function Ss(e,t,n){let i=Object.getPrototypeOf(e),r=im.get(i);if(!r)r=new Set,im.set(i,r);if(r.has(t))return;r.add(t);for(let s in n){let o=n[s];Object.defineProperty(i,s,{configurable:!0,enumerable:!1,get(){let a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var yt=q("ZodType",(e,t)=>(xt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:bs(e,"input"),output:bs(e,"output")}}),e.toJSONSchema=vp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>$p(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Xp(e,n,i),e.parseAsync=async(n,i)=>Zp(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>qp(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>Yp(e,n,i),e.decode=(n,i)=>jp(e,n,i),e.encodeAsync=async(n,i)=>Jp(e,n,i),e.decodeAsync=async(n,i)=>Kp(e,n,i),e.safeEncode=(n,i)=>Qp(e,n,i),e.safeDecode=(n,i)=>em(e,n,i),e.safeEncodeAsync=async(n,i)=>tm(e,n,i),e.safeDecodeAsync=async(n,i)=>nm(e,n,i),Ss(e,"ZodType",{check(...n){let i=this.def;return this.clone(bi(i,{checks:[...i.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return Gn(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(Mv(n,i))},superRefine(n,i){return this.check(wv(n,i))},overwrite(n){return this.check(Ti(n))},optional(){return am(this)},exactOptional(){return uv(this)},nullable(){return cm(this)},nullish(){return am(cm(this))},nonoptional(n){return gv(this,n)},array(){return ko(this)},or(n){return nv([this,n])},and(n){return rv(this,n)},transform(n){return lm(this,cv(n))},default(n){return dv(this,n)},prefault(n){return mv(this,n)},catch(n){return xv(this,n)},pipe(n){return lm(this,n)},readonly(){return bv(this)},describe(n){let i=this.clone();return tr.add(i,{description:n}),i},meta(...n){if(n.length===0)return tr.get(this);let i=this.clone();return tr.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return tr.get(e)?.description},configurable:!0}),e)),um=q("_ZodString",(e,t)=>{Po.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>yp(e,i,r,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ss(e,"_ZodString",{regex(...i){return this.check(vc(...i))},includes(...i){return this.check(Sc(...i))},startsWith(...i){return this.check(Mc(...i))},endsWith(...i){return this.check(wc(...i))},min(...i){return this.check(Ar(...i))},max(...i){return this.check(Uo(...i))},length(...i){return this.check(Oo(...i))},nonempty(...i){return this.check(Ar(1,...i))},lowercase(i){return this.check(yc(i))},uppercase(i){return this.check(bc(i))},trim(){return this.check(Ec())},normalize(...i){return this.check(Tc(...i))},toLowerCase(){return this.check(Ac())},toUpperCase(){return this.check(Rc())},slugify(){return this.check(Cc())}})}),Rx=q("ZodString",(e,t)=>{Po.init(e,t),um.init(e,t),e.email=(n)=>e.check(Bd(Cx,n)),e.url=(n)=>e.check($d(Ix,n)),e.jwt=(n)=>e.check(op($x,n)),e.emoji=(n)=>e.check(Zd(Px,n)),e.guid=(n)=>e.check(xc(rm,n)),e.uuid=(n)=>e.check(Gd(zo,n)),e.uuidv4=(n)=>e.check(Hd(zo,n)),e.uuidv6=(n)=>e.check(Vd(zo,n)),e.uuidv7=(n)=>e.check(Wd(zo,n)),e.nanoid=(n)=>e.check(Xd(Lx,n)),e.guid=(n)=>e.check(xc(rm,n)),e.cuid=(n)=>e.check(qd(Nx,n)),e.cuid2=(n)=>e.check(Yd(Dx,n)),e.ulid=(n)=>e.check(jd(Ux,n)),e.base64=(n)=>e.check(ip(Hx,n)),e.base64url=(n)=>e.check(rp(Vx,n)),e.xid=(n)=>e.check(Jd(Ox,n)),e.ksuid=(n)=>e.check(Kd(Fx,n)),e.ipv4=(n)=>e.check(Qd(zx,n)),e.ipv6=(n)=>e.check(ep(kx,n)),e.cidrv4=(n)=>e.check(tp(Bx,n)),e.cidrv6=(n)=>e.check(np(Gx,n)),e.e164=(n)=>e.check(sp(Wx,n)),e.datetime=(n)=>e.check(Gp(n)),e.date=(n)=>e.check(Hp(n)),e.time=(n)=>e.check(Vp(n)),e.duration=(n)=>e.check(Wp(n))});function Zt(e){return kd(Rx,e)}var vt=q("ZodStringFormat",(e,t)=>{_t.init(e,t),um.init(e,t)}),Cx=q("ZodEmail",(e,t)=>{Zf.init(e,t),vt.init(e,t)});var rm=q("ZodGUID",(e,t)=>{Wf.init(e,t),vt.init(e,t)});var zo=q("ZodUUID",(e,t)=>{$f.init(e,t),vt.init(e,t)});var Ix=q("ZodURL",(e,t)=>{Xf.init(e,t),vt.init(e,t)});var Px=q("ZodEmoji",(e,t)=>{qf.init(e,t),vt.init(e,t)});var Lx=q("ZodNanoID",(e,t)=>{Yf.init(e,t),vt.init(e,t)});var Nx=q("ZodCUID",(e,t)=>{jf.init(e,t),vt.init(e,t)});var Dx=q("ZodCUID2",(e,t)=>{Jf.init(e,t),vt.init(e,t)});var Ux=q("ZodULID",(e,t)=>{Kf.init(e,t),vt.init(e,t)});var Ox=q("ZodXID",(e,t)=>{Qf.init(e,t),vt.init(e,t)});var Fx=q("ZodKSUID",(e,t)=>{ed.init(e,t),vt.init(e,t)});var zx=q("ZodIPv4",(e,t)=>{sd.init(e,t),vt.init(e,t)});var kx=q("ZodIPv6",(e,t)=>{od.init(e,t),vt.init(e,t)});var Bx=q("ZodCIDRv4",(e,t)=>{ad.init(e,t),vt.init(e,t)});var Gx=q("ZodCIDRv6",(e,t)=>{cd.init(e,t),vt.init(e,t)});var Hx=q("ZodBase64",(e,t)=>{ud.init(e,t),vt.init(e,t)});var Vx=q("ZodBase64URL",(e,t)=>{hd.init(e,t),vt.init(e,t)});var Wx=q("ZodE164",(e,t)=>{fd.init(e,t),vt.init(e,t)});var $x=q("ZodJWT",(e,t)=>{dd.init(e,t),vt.init(e,t)});var hm=q("ZodNumber",(e,t)=>{gc.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>bp(e,i,r,s),Ss(e,"ZodNumber",{gt(i,r){return this.check(No(i,r))},gte(i,r){return this.check(ys(i,r))},min(i,r){return this.check(ys(i,r))},lt(i,r){return this.check(Lo(i,r))},lte(i,r){return this.check(vs(i,r))},max(i,r){return this.check(vs(i,r))},int(i){return this.check(sm(i))},safe(i){return this.check(sm(i))},positive(i){return this.check(No(0,i))},nonnegative(i){return this.check(ys(0,i))},negative(i){return this.check(Lo(0,i))},nonpositive(i){return this.check(vs(0,i))},multipleOf(i,r){return this.check(Do(i,r))},step(i,r){return this.check(Do(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Zx(e){return hp(hm,e)}var Xx=q("ZodNumberFormat",(e,t)=>{pd.init(e,t),hm.init(e,t)});function sm(e){return fp(Xx,e)}var qx=q("ZodBoolean",(e,t)=>{md.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Sp(e,n,i,r)});function Yx(e){return dp(qx,e)}var jx=q("ZodUnknown",(e,t)=>{gd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wp(e,n,i,r)});function nr(){return pp(jx)}var Jx=q("ZodNever",(e,t)=>{_d.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Mp(e,n,i,r)});function Kx(e){return mp(Jx,e)}var Qx=q("ZodArray",(e,t)=>{xd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cp(e,n,i,r),e.element=t.element,Ss(e,"ZodArray",{min(n,i){return this.check(Ar(n,i))},nonempty(n){return this.check(Ar(1,n))},max(n,i){return this.check(Uo(n,i))},length(n,i){return this.check(Oo(n,i))},unwrap(){return this.element}})});function ko(e,t){return gp(Qx,e,t)}var ev=q("ZodObject",(e,t)=>{bd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ip(e,n,i,r),it(e,"shape",()=>t.shape),Ss(e,"ZodObject",{keyof(){return dm(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:nr()})},loose(){return this.clone({...this._zod.def,catchall:nr()})},strict(){return this.clone({...this._zod.def,catchall:Kx()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return tx(this,n)},safeExtend(n){return nx(this,n)},merge(n){return ix(this,n)},pick(n){return Q0(this,n)},omit(n){return ex(this,n)},partial(...n){return rx(pm,this,n[0])},required(...n){return sx(mm,this,n[0])}})});function Ms(e,t){let n={type:"object",shape:e??{},...Te(t)};return new ev(n)}var tv=q("ZodUnion",(e,t)=>{Sd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Pp(e,n,i,r),e.options=t.options});function nv(e,t){return new tv({type:"union",options:e,...Te(t)})}var iv=q("ZodIntersection",(e,t)=>{Md.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Lp(e,n,i,r)});function rv(e,t){return new iv({type:"intersection",left:e,right:t})}var om=q("ZodRecord",(e,t)=>{wd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Np(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function fm(e,t,n){if(!t||!t._zod)return new om({type:"record",keyType:Zt(),valueType:e,...Te(t)});return new om({type:"record",keyType:e,valueType:t,...Te(n)})}var Dc=q("ZodEnum",(e,t)=>{Td.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>Tp(e,i,r,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let s={};for(let o of i)if(n.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new Dc({...t,checks:[],...Te(r),entries:s})},e.exclude=(i,r)=>{let s={...t.entries};for(let o of i)if(n.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new Dc({...t,checks:[],...Te(r),entries:s})}});function dm(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((i)=>[i,i])):e;return new Dc({type:"enum",entries:n,...Te(t)})}var sv=q("ZodLiteral",(e,t)=>{Ed.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ep(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ov(e,t){return new sv({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}var av=q("ZodTransform",(e,t)=>{Ad.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Rp(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ds(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(er(s,n.value,t));else{let o=s;if(o.fatal)o.continue=!1;o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(er(o))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((s)=>(n.value=s,n.fallback=!0,n));return n.value=r,n.fallback=!0,n}});function cv(e){return new av({type:"transform",transform:e})}var pm=q("ZodOptional",(e,t)=>{_c.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Nc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function am(e){return new pm({type:"optional",innerType:e})}var lv=q("ZodExactOptional",(e,t)=>{Rd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Nc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function uv(e){return new lv({type:"optional",innerType:e})}var hv=q("ZodNullable",(e,t)=>{Cd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Dp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function cm(e){return new hv({type:"nullable",innerType:e})}var fv=q("ZodDefault",(e,t)=>{Id.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Op(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dv(e,t){return new fv({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ac(t)}})}var pv=q("ZodPrefault",(e,t)=>{Pd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Fp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function mv(e,t){return new pv({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ac(t)}})}var mm=q("ZodNonOptional",(e,t)=>{Ld.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Up(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function gv(e,t){return new mm({type:"nonoptional",innerType:e,...Te(t)})}var _v=q("ZodCatch",(e,t)=>{Nd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xv(e,t){return new _v({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var vv=q("ZodPipe",(e,t)=>{Dd.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kp(e,n,i,r),e.in=t.in,e.out=t.out});function lm(e,t){return new vv({type:"pipe",in:e,out:t})}var yv=q("ZodReadonly",(e,t)=>{Ud.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Bp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function bv(e){return new yv({type:"readonly",innerType:e})}var Sv=q("ZodCustom",(e,t)=>{Od.init(e,t),yt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ap(e,n,i,r)});function Mv(e,t={}){return _p(Sv,e,t)}function wv(e,t){return xp(e,t)}/*!
+Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1){if(e.reused==="ref")s(o)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Pm(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!=="object")return;Pm(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let s=i.type;for(let o of Array.isArray(s)?s:[s]){if(typeof o!=="string")return;if(!n.includes(o))n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Lm=new Set(["type","properties","required","additionalProperties"]),Cm=["oneOf","anyOf"];function Im(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function hl(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let o in s)if(!Lm.has(o))return null;t.push(s)}let n={},i=new Set;for(let s of t){for(let o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let a=[];for(let l of t){let u=l.properties?.[o]??Im(l);if(u===null||u===void 0)continue;if(!a.some((h)=>JSON.stringify(h)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:hl(a)??{allOf:a};Cn(n,o,c)}for(let o of s.required??[])i.add(o)}let r={type:"object",properties:n};if(i.size)r.required=[...i];if(t.every((s)=>s.additionalProperties===!1))r.additionalProperties=!1;else{let s=[];for(let o of t){let a=Im(o);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)r.additionalProperties=s[0];else if(s.length>1)r.additionalProperties={allOf:s}}return r}function ay(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of Lm)if(r in e)return;let n=t.filter((r)=>Cm.some((s)=>Array.isArray(r[s]))),i=null;if(!n.length)i=hl(t);else{let r=n[0],s=Cm.find((c)=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let o=t.filter((c)=>c!==r),a=r[s].map((c)=>hl([...o,c]));if(a.some((c)=>!c))return;i={[s]:a}}if(!i)return;delete e.allOf,Ns(e,i)}function pl(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},h=c.ref;if(c.ref=null,h){i(h);let d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(m);else Ns(l,m);if(Ns(l,u),a._zod.parent===h)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(!(p in u))delete l[p]}if(m.$ref&&d.def)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(p in d.def&&JSON.stringify(l[p])===JSON.stringify(d.def[p]))delete l[p]}}let f=a._zod.parent;if(f&&f!==h){i(f);let d=e.seen.get(f);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let m in l){if(m==="$ref"||m==="allOf")continue;if(m in d.def&&JSON.stringify(l[m])===JSON.stringify(d.def[m]))delete l[m]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Pm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let h=a.get(u);if(h)h.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])ay(l)}}let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Ns(r,n.defId?n.schema:n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&r.id===s)delete r.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Cn(o,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(o).length>0)if(e.target==="draft-2020-12")r.$defs=o;else r.definitions=o;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ds(t,"input",e.processors),output:Ds(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Zt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Zt(i.element,n);if(i.type==="set")return Zt(i.valueType,n);if(i.type==="lazy")return Zt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Zt(i.innerType,n);if(i.type==="intersection")return Zt(i.left,n)||Zt(i.right,n);if(i.type==="record"||i.type==="map")return Zt(i.keyType,n)||Zt(i.valueType,n);if(i.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Zt(i.in,n)||Zt(i.out,n)}if(i.type==="object"){for(let r in i.shape)if(Zt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Zt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Zt(r,n))return!0;if(i.rest&&Zt(i.rest,n))return!0;return!1}return!1}var Nm=(e,t={})=>(n)=>{let i=fl({...n,processors:t});return At(e,i),dl(i,e),pl(i,e)},Ds=(e,t,n={})=>(i)=>{let{libraryOptions:r,target:s}=i??{},o=fl({...r??{},target:s,io:t,processors:n});return At(e,o),dl(o,e),pl(o,e)};var Dr=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},Or=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Dm=(e,t)=>{Dr(e,"minimum",t),Or(e,"maximum",t)},zm=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},km=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Bm=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Gm=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Om=(e,t)=>Dr(e,"minimum",t.minimum),Um=(e,t)=>Or(e,"maximum",t.maximum),Fm=(e)=>(t,n)=>{Gm(t,n.format);let[i,r]=e[n.format];Dr(t,"minimum",i),Or(t,"maximum",r)},cy={greater_than:(e,t)=>Dr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Or(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>zm(e,t.value),number_format:Fm(Do),bigint_format:Fm(Pc),min_length:Om,max_length:Um,length_equals:(e,t)=>Dm(e,t.length),min_size:Om,max_size:Um,size_equals:(e,t)=>Dm(e,t.size),string_format:(e,t)=>{if(Gm(e,t.format),t.pattern)km(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Bm(e,t.mime)};function Sn(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let s of i)cy[s._zod.def.check]?.(t,s._zod.def);let r=e._zod.bag;if(r.minimum!==void 0)Dr(t,"minimum",r.minimum);if(r.exclusiveMinimum!==void 0)Dr(t,"exclusiveMinimum",r.exclusiveMinimum);if(r.maximum!==void 0)Or(t,"maximum",r.maximum);if(r.exclusiveMaximum!==void 0)Or(t,"exclusiveMaximum",r.exclusiveMaximum);if(r.multipleOf!==void 0)zm(t,r.multipleOf);if(r.format!==void 0){if(t.format??(t.format=r.format),r.format.includes("int"))t.isInt=!0}if(r.mime)Bm(t,r.mime);for(let s of r.patterns??[])km(t,s);return t}var ly={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},uy=new Map([[qc,ad],[Xo,cd]]),Hm=(e)=>uy.get(e)??e,Vm=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Sn(e);if(typeof s==="number")r.minLength=s;if(typeof o==="number")r.maxLength=o;if(a){if(r.format=ly[a]??a,r.format==="")delete r.format;if(a==="time"||u)delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let h=[...c].map(Hm);if(h.length===1)r.pattern=h[0].source;else if(h.length>1)r.allOf=[...h.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},$m=(e,t,n,i)=>{let r=n,{minimum:s,maximum:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Sn(e);r.type=u?"integer":"number";let h=typeof l==="number"&&l>=(s??Number.NEGATIVE_INFINITY),f=typeof c==="number"&&c<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h)if(d)r.minimum=l,r.exclusiveMinimum=!0;else r.exclusiveMinimum=l;else if(typeof s==="number")r.minimum=s;if(f)if(d)r.maximum=c,r.exclusiveMaximum=!0;else r.exclusiveMaximum=c;else if(typeof o==="number")r.maximum=o;if(a){let m=new Set;for(let g of a)if(Number.isFinite(g)&&g!==0)m.add(Math.abs(g));else di(e,t,r,i,`A multipleOf divisor of ${g} cannot be represented in JSON Schema`);let[x,...p]=m;if(x!==void 0)r.multipleOf=x;if(p.length)r.allOf=[...r.allOf??[],...p.map((g)=>({multipleOf:g}))]}},Wm=(e,t,n,i)=>{n.type="boolean"};var Zm=(e,t,n,i)=>{n.not={}};var Xm=(e,t,n,i)=>{};var qm=(e,t,n,i)=>{let r=e._zod.def,s=Ms(r.entries);if(s.length===0){n.not={};return}if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";n.enum=s},Ym=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let s=[];for(let o of r.values)if(o===void 0){if(di(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==="bigint"){if(di(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(o))}else s.push(o);if(s.length===0);else if(s.length===1){let o=s[0];if(n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[o];else n.const=o}else{if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";if(s.every((o)=>typeof o==="boolean"))n.type="boolean";if(s.every((o)=>o===null))n.type="null";n.enum=s}};var jm=(e,t,n,i)=>{di(e,t,n,i,"Custom types cannot be represented in JSON Schema")};var Jm=(e,t,n,i)=>{di(e,t,n,i,"Transforms cannot be represented in JSON Schema")};var Km=(e,t,n,i)=>{let r=n,s=e._zod.def,{minimum:o,maximum:a}=Sn(e);if(typeof o==="number")r.minItems=o;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=At(s.element,t,{...i,path:[...i.path,"items"]})};function ia(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return ia(t.out);if(t.type==="catch")return ia(t.innerType);return e._zod.optin}var Qm=(e,t,n,i)=>{let r=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&di(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let u in o)Cn(r.properties,u,At(o[u],t,{...i,path:[...i.path,"properties",u]}));let c=new Set(Object.keys(o)),l=new Set([...c].filter((u)=>{let h=s.shape[u];if(t.io==="input")return ia(h)===void 0;else return h._zod.optout===void 0}));if(l.size>0)r.required=Array.from(l);if(s.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")r.additionalProperties=!1}else if(s.catchall)r.additionalProperties=At(s.catchall,t,{...i,path:[...i.path,"additionalProperties"]})};var eg=(e,t,n,i)=>{let r=e._zod.def,s=r.inclusive===!1,o=r.options.map((a,c)=>At(a,t,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));if(s)n.oneOf=o;else n.anyOf=o},tg=(e,t,n,i)=>{let r=e._zod.def,s=At(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=At(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function ml(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let m=e.get(t)?.def;if(!m)return t;let x=ml(e,m,n);return x===m?t:x}for(let m of["anyOf","oneOf"]){let x=t[m];if(!Array.isArray(x))continue;let p=x.map((g)=>ml(e,g,n));if(p.some((g,A)=>g!==x[A]))t={...t,[m]:p}}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some((m)=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!s?.some((m)=>typeof m==="number"))return t;let{minimum:o,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:h,id:f,...d}=t;if(d.enum)d.enum=d.enum.map((m)=>typeof m==="number"?String(m):m);else if(typeof d.const==="number")d.const=String(d.const);if(!r)return d;if(d.type="string",!s)d.pattern=(i.includes("number")?Es:Gc).source;return d}var gl=new WeakMap;function hy(e){let t=new Map;for(let i of e.seen.values())if(i.def&&!t.has(i.schema))t.set(i.schema,i);let n=new Map;for(let i of gl.get(e)??[]){let r=e.seen.get(i),s=(r?.def??r?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;let o=ml(t,s,new Set);if(o!==s)n.set(s,o)}if(!n.size)return;for(let i of e.seen.values())for(let r of[i.schema,i.def]){let s=r&&n.get(r.propertyNames);if(s)r.propertyNames=s}}var ng=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object";let o=s.keyType,a=Sn(o).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=At(s.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let h of a)Cn(r.patternProperties,Hm(h).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=At(s.keyType,t,{...i,path:[...i.path,"propertyNames"]});let u=gl.get(t);if(!u)u=[],gl.set(t,u),t.deferred.push(()=>hy(t));u.push(e)}r.additionalProperties=At(s.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=o._zod.values,l=t.io==="input"&&ia(s.valueType)!==void 0;if(c&&!s.partial&&!l){let u=[...c].filter((h)=>typeof h==="string"||typeof h==="number");if(u.length>0)r.required=u.map(String)}},ig=(e,t,n,i)=>{let r=e._zod.def,s=At(r.innerType,t,i),o=t.seen.get(e);if(t.target==="openapi-3.0")o.ref=r.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},rg=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType},_l=Symbol();function sg(e,t,n,i,r){let s=!1,o=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(o);return di(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),_l}var og=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o=sg(r.defaultValue,e,t,n,i);if(o!==_l)n.default=o},ag=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);if(s.ref=r.innerType,t.io!=="input")return;let o=sg(r.defaultValue,e,t,n,i);if(o!==_l)n._prefault=o},cg=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{di(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},lg=(e,t,n,i)=>{let r=e._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?r.out:r.in:r.out;At(o,t,i);let a=t.seen.get(e);a.ref=o},ug=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0};var xl=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType};var hg=new WeakSet([Object.prototype,Error.prototype]);function ra(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var xy=(e,t)=>{Df.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(hg.has(n))return;hg.add(n),ra(n,"format",(i)=>(r)=>Uf(i,r)),ra(n,"flatten",(i)=>(r)=>Of(i,r)),ra(n,"addIssue",(i)=>(r)=>{i.issues.push(r),i.message=JSON.stringify(i.issues,ws,2)}),ra(n,"addIssues",(i)=>(r)=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,ws,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var un=q("ZodError",xy,void 0,{Parent:Error});var fg=ko(un),dg=Bo(un),pg=Go(un),mg=Ho(un),gg=zf(un),_g=kf(un),xg=Bf(un),vg=Gf(un),yg=Hf(un),bg=Vf(un),Sg=$f(un),Mg=Wf(un);function yy(){if(!Kt.localeError)ln(Qc())}function oa(){if(!Kt.memoizer)ln({memoizer:$p()})}var vt=q("ZodType",(e,t)=>(yy(),_t.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(cn(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Wn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yb(e,t))},superRefine(e,t){return this.check(bb(e,t))},overwrite(e){return this.check(Ni(e))},optional(){return Eg(this)},exactOptional(){return ab(this)},nullable(){return Ag(this)},nullish(){return Eg(Ag(this))},nonoptional(e){return db(this,e)},array(){return aa(this)},or(e){return eb([this,e])},and(e){return nb(this,e)},transform(e){return Rg(this,ob(e))},default(e){return ub(this,e)},prefault(e){return fb(this,e)},catch(e){return mb(this,e)},pipe(e){return Rg(this,e)},readonly(){return xb(this)},describe(e){let t=this.clone();return cr.add(t,{description:e}),t},meta(...e){if(e.length===0)return cr.get(this);let t=this.clone();return cr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Nc(this,"~standard",{...Xc(this),jsonSchema:{input:Ds(this,"input"),output:Ds(this,"output")}})},set "~standard"(e){hi(this,"~standard",e)},parse:function e(t,n){return fg(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dg(this,t,n,{callee:e})},safeParse(e,t){return pg(this,e,t)},async safeParseAsync(e,t){return mg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){hi(this,"spa",e)},validate(e,t){return Fc(this,e,t)},validateAsync(e,t){return zc(this,e,t)},encode:function e(t,n){return gg(this,t,n,{callee:e})},decode:function e(t,n){return _g(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xg(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vg(this,t,n,{callee:e})},safeEncode(e,t){return yg(this,e,t)},safeDecode(e,t){return bg(this,e,t)},async safeEncodeAsync(e,t){return Sg(this,e,t)},async safeDecodeAsync(e,t){return Mg(this,e,t)},toJSONSchema(e){return Nm(this,{})(e)},get description(){return cr.get(this)?.description},get _def(){return this._zod.def}}),Cg=q("_ZodString",(e,t)=>{Zo.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Vm(e,n,i,r)},Rf({format:(e)=>Sn(e).format??null,minLength:(e)=>Sn(e).minimum??null,maxLength:(e)=>Sn(e).maximum??null},{regex(...e){return this.check(el(...e))},includes(...e){return this.check(il(...e))},startsWith(...e){return this.check(rl(...e))},endsWith(...e){return this.check(sl(...e))},min(...e){return this.check(Nr(...e))},max(...e){return this.check(ta(...e))},length(...e){return this.check(na(...e))},nonempty(...e){return this.check(Nr(1,...e))},lowercase(e){return this.check(tl(e))},uppercase(e){return this.check(nl(e))},trim(){return this.check(al())},normalize(...e){return this.check(ol(...e))},toLowerCase(){return this.check(cl())},toUpperCase(){return this.check(ll())},slugify(){return this.check(ul())}})),by=q("ZodString",(e,t)=>{Zo.init(e,t),Cg.init(e,t)},{email(e){return this.check(qp(Ey,e))},url(e){return this.check(em(Ry,e))},jwt(e){return this.check(mm(Vy,e))},emoji(e){return this.check(tm(Cy,e))},guid(e){return this.check(Yp(Ay,e))},uuid(e){return this.check(jp(sa,e))},uuidv4(e){return this.check(Jp(sa,e))},uuidv6(e){return this.check(Kp(sa,e))},uuidv7(e){return this.check(Qp(sa,e))},nanoid(e){return this.check(nm(Iy,e))},cuid(e){return this.check(im(Py,e))},cuid2(e){return this.check(rm(Ly,e))},ulid(e){return this.check(sm(Ny,e))},base64(e){return this.check(fm(By,e))},base64url(e){return this.check(dm(Gy,e))},xid(e){return this.check(om(Dy,e))},ksuid(e){return this.check(am(Oy,e))},ipv4(e){return this.check(cm(Uy,e))},ipv6(e){return this.check(lm(Fy,e))},cidrv4(e){return this.check(um(zy,e))},cidrv6(e){return this.check(hm(ky,e))},e164(e){return this.check(pm(Hy,e))},datetime(e){return this.check(gm(Sy,e))},date(e){return this.check(_m(My,e))},time(e){return this.check(xm(wy,e))},duration(e){return this.check(vm(Ty,e))}});function Xt(e){return Xp(by,e)}var yt=q("ZodStringFormat",(e,t)=>{xt.init(e,t),Cg.init(e,t)}),Sy=q("ZodISODateTime",(e,t)=>{ip.init(e,t),yt.init(e,t)}),My=q("ZodISODate",(e,t)=>{rp.init(e,t),yt.init(e,t)}),wy=q("ZodISOTime",(e,t)=>{sp.init(e,t),yt.init(e,t)}),Ty=q("ZodISODuration",(e,t)=>{op.init(e,t),yt.init(e,t)}),Ey=q("ZodEmail",(e,t)=>{Zd.init(e,t),yt.init(e,t)});var Ay=q("ZodGUID",(e,t)=>{$d.init(e,t),yt.init(e,t)});var sa=q("ZodUUID",(e,t)=>{Wd.init(e,t),yt.init(e,t)});var Ry=q("ZodURL",(e,t)=>{Yd.init(e,t),yt.init(e,t)});var Cy=q("ZodEmoji",(e,t)=>{jd.init(e,t),yt.init(e,t)});var Iy=q("ZodNanoID",(e,t)=>{Jd.init(e,t),yt.init(e,t)});var Py=q("ZodCUID",(e,t)=>{Kd.init(e,t),yt.init(e,t)});var Ly=q("ZodCUID2",(e,t)=>{Qd.init(e,t),yt.init(e,t)});var Ny=q("ZodULID",(e,t)=>{ep.init(e,t),yt.init(e,t)});var Dy=q("ZodXID",(e,t)=>{tp.init(e,t),yt.init(e,t)});var Oy=q("ZodKSUID",(e,t)=>{np.init(e,t),yt.init(e,t)});var Uy=q("ZodIPv4",(e,t)=>{ap.init(e,t),yt.init(e,t)});var Fy=q("ZodIPv6",(e,t)=>{lp.init(e,t),yt.init(e,t)});var zy=q("ZodCIDRv4",(e,t)=>{up.init(e,t),yt.init(e,t)});var ky=q("ZodCIDRv6",(e,t)=>{hp.init(e,t),yt.init(e,t)});var By=q("ZodBase64",(e,t)=>{dp.init(e,t),yt.init(e,t)});var Gy=q("ZodBase64URL",(e,t)=>{pp.init(e,t),yt.init(e,t)});var Hy=q("ZodE164",(e,t)=>{mp.init(e,t),yt.init(e,t)});var Vy=q("ZodJWT",(e,t)=>{gp.init(e,t),yt.init(e,t)});var Ig=q("ZodNumber",(e,t)=>{Yc.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$m(e,n,i,r),e.isFinite=!0},Rf({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=Sn(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=Sn(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=Sn(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>Sn(e).format??null},{gt(e,t){return this.check(Qo(e,t))},gte(e,t){return this.check(Ls(e,t))},min(e,t){return this.check(Ls(e,t))},lt(e,t){return this.check(Ko(e,t))},lte(e,t){return this.check(Ps(e,t))},max(e,t){return this.check(Ps(e,t))},int(e){return this.check(wg(e))},safe(e){return this.check(wg(e))},positive(e){return this.check(Qo(0,e))},nonnegative(e){return this.check(Ls(0,e))},negative(e){return this.check(Ko(0,e))},nonpositive(e){return this.check(Ps(0,e))},multipleOf(e,t){return this.check(ea(e,t))},step(e,t){return this.check(ea(e,t))},finite(){return this}}));function $y(e){return ym(Ig,e)}var Wy=q("ZodNumberFormat",(e,t)=>{_p.init(e,t),Ig.init(e,t)});function wg(e){return bm(Wy,e)}var Zy=q("ZodBoolean",(e,t)=>{xp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Wm(e,n,i,r)});function Xy(e){return Sm(Zy,e)}var qy=q("ZodUnknown",(e,t)=>{vp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Xm(e,n,i,r)});function lr(){return Mm(qy)}var Yy=q("ZodNever",(e,t)=>{yp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Zm(e,n,i,r)});function jy(e){return wm(Yy,e)}var Jy=q("ZodArray",(e,t)=>{oa(),bp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Km(e,n,i,r),e.element=t.element},{min(e,t){return this.check(Nr(e,t))},nonempty(e){return this.check(Nr(1,e))},max(e,t){return this.check(ta(e,t))},length(e,t){return this.check(na(e,t))},unwrap(){return this.element}});function aa(e,t){return Tm(Jy,e,t)}var Ky=q("ZodObject",(e,t)=>{oa(),wp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Qm(e,n,i,r),Cv(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return Lg(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(cn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(cn(this._zod.def,{catchall:lr()}))},loose(){return this.clone(cn(this._zod.def,{catchall:lr()}))},strict(){return this.clone(cn(this._zod.def,{catchall:jy()}))},strip(){return this.clone(cn(this._zod.def,{catchall:void 0}))},extend(e){return Sv(this,e)},safeExtend(e){return Mv(this,e)},merge(e){return wv(this,e)},pick(e){return yv(this,e)},omit(e){return bv(this,e)},partial(...e){return wf(Ng,this,e[0])},exactPartial(...e){return wf(Dg,this,e[0],"exactPartial")},required(...e){return Tv(Og,this,e[0])}});function Os(e,t){let n={type:"object",shape:e??{},...Te(t)};return new Ky(n)}var Qy=q("ZodUnion",(e,t)=>{Tp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>eg(e,n,i,r),e.options=t.options});function eb(e,t){return new Qy({type:"union",options:e,...Te(t)})}var tb=q("ZodIntersection",(e,t)=>{Ep.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tg(e,n,i,r)});function nb(e,t){return new tb({type:"intersection",left:e,right:t})}var Tg=q("ZodRecord",(e,t)=>{oa(),Ap.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ng(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function Pg(e,t,n){if(!t||!t._zod)return new Tg({type:"record",keyType:Xt(),valueType:e,...Te(t)});return new Tg({type:"record",keyType:e,valueType:t,...Te(n)})}var yl=q("ZodEnum",(e,t)=>{Rp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>qm(e,i,r,s),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let s={};for(let o of i)if(n.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new yl({...t,checks:[],...Te(r),entries:s})},e.exclude=(i,r)=>{let s={...t.entries};for(let o of i)if(n.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new yl({...t,checks:[],...Te(r),entries:s})}});function Lg(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((i)=>[i,i])):e;return new yl({type:"enum",entries:n,...Te(t)})}var ib=q("ZodLiteral",(e,t)=>{Cp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ym(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function rb(e,t){return new ib({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}var sb=q("ZodTransform",(e,t)=>{oa(),Ip.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jm(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Ts(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(ar(s,n.value,t));else{let o=s;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=n.value;o.inst??(o.inst=e),n.issues.push(ar(o))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((s)=>(n.value=s,n));return n.value=r,n}});function ob(e){return new sb({type:"transform",transform:e})}var Ng=q("ZodOptional",(e,t)=>{jc.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xl(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Eg(e){return new Ng({type:"optional",innerType:e})}var Dg=q("ZodExactOptional",(e,t)=>{Pp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xl(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function ab(e){return new Dg({type:"optional",innerType:e})}var cb=q("ZodNullable",(e,t)=>{Lp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ig(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ag(e){return new cb({type:"nullable",innerType:e})}var lb=q("ZodDefault",(e,t)=>{Np.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>og(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ub(e,t){return new lb({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Cc(t)}})}var hb=q("ZodPrefault",(e,t)=>{Dp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ag(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function fb(e,t){return new hb({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Cc(t)}})}var Og=q("ZodNonOptional",(e,t)=>{Op.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rg(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function db(e,t){return new Og({type:"nonoptional",innerType:e,...Te(t)})}var pb=q("ZodCatch",(e,t)=>{Up.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cg(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mb(e,t){return new pb({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Cf(t)})}var gb=q("ZodPipe",(e,t)=>{Fp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lg(e,n,i,r),e.in=t.in,e.out=t.out});function Rg(e,t){return new gb({type:"pipe",in:e,out:t})}var _b=q("ZodReadonly",(e,t)=>{zp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ug(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function xb(e){return new _b({type:"readonly",innerType:e})}var vb=q("ZodCustom",(e,t)=>{kp.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jm(e,n,i,r)});function yb(e,t={}){return Em(vb,e,t)}function bb(e,t){return Am(e,t)}/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
-*/var bt=Uint8Array,cn=Uint16Array,$c=Int32Array,Bo=new bt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Go=new bt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),kc=new bt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sm=function(e,t){var n=new cn(31);for(var i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new $c(n[30]);for(var i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return{b:n,r}},Mm=Sm(Bo,2),{b:wm,r:Bc}=Mm;wm[28]=258,Bc[258]=28;var Tm=Sm(Go,0),{b:Ev,r:gm}=Tm,Gc=new cn(32768);for(je=0;je<32768;++je)Hn=(je&43690)>>1|(je&21845)<<1,Hn=(Hn&52428)>>2|(Hn&13107)<<2,Hn=(Hn&61680)>>4|(Hn&3855)<<4,Gc[je]=((Hn&65280)>>8|(Hn&255)<<8)>>1;var Hn,je,Wn=function(e,t,n){var i=e.length,r=0,s=new cn(t);for(;r<i;++r)if(e[r])++s[e[r]-1];var o=new cn(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(n){a=new cn(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r]){var l=r<<4|e[r],u=t-e[r],f=o[e[r]-1]++<<u;for(var h=f|(1<<u)-1;f<=h;++f)a[Gc[f]>>c]=l}}else{a=new cn(i);for(r=0;r<i;++r)if(e[r])a[r]=Gc[o[e[r]-1]++]>>15-e[r]}return a},Ei=new bt(288);for(je=0;je<144;++je)Ei[je]=8;var je;for(je=144;je<256;++je)Ei[je]=9;var je;for(je=256;je<280;++je)Ei[je]=7;var je;for(je=280;je<288;++je)Ei[je]=8;var je,Es=new bt(32);for(je=0;je<32;++je)Es[je]=5;var je,Av=Wn(Ei,9,0),Rv=Wn(Ei,9,1),Cv=Wn(Es,5,0),Iv=Wn(Es,5,1),Uc=function(e){var t=e[0];for(var n=1;n<e.length;++n)if(e[n]>t)t=e[n];return t},An=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},Oc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Zc=function(e){return(e+7)/8|0},As=function(e,t,n){if(t==null||t<0)t=0;if(n==null||n>e.length)n=e.length;return new bt(e.subarray(t,n))};var Pv=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Kt=function(e,t,n){var i=Error(t||Pv[e]);if(i.code=e,Error.captureStackTrace)Error.captureStackTrace(i,Kt);if(!n)throw i;return i},Lv=function(e,t,n,i){var r=e.length,s=i?i.length:0;if(!r||t.f&&!t.l)return n||new bt(0);var o=!n,a=o||t.i!=2,c=t.i;if(o)n=new bt(r*3);var l=function(Oe){var ke=n.length;if(Oe>ke){var Ke=new bt(Math.max(ke*2,Oe));Ke.set(n),n=Ke}},u=t.f||0,f=t.p||0,h=t.b||0,{l:d,d:g,m:y,n:p}=t,m=r*8;do{if(!d){u=An(e,f,1);var A=An(e,f+1,3);if(f+=3,!A){var T=Zc(f)+4,v=e[T-4]|e[T-3]<<8,w=T+v;if(w>r){if(c)Kt(0);break}if(a)l(h+v);n.set(e.subarray(T,w),h),t.b=h+=v,t.p=f=w*8,t.f=u;continue}else if(A==1)d=Rv,g=Iv,y=9,p=5;else if(A==2){var E=An(e,f,31)+257,R=An(e,f+10,15)+4,_=E+An(e,f+5,31)+1;f+=14;var S=new bt(_),F=new bt(19);for(var C=0;C<R;++C)F[kc[C]]=An(e,f+C*3,7);f+=R*3;var z=Uc(F),J=(1<<z)-1,O=Wn(F,z,1);for(var C=0;C<_;){var H=O[An(e,f,J)];f+=H&15;var T=H>>4;if(T<16)S[C++]=T;else{var V=0,U=0;if(T==16)U=3+An(e,f,3),f+=2,V=S[C-1];else if(T==17)U=3+An(e,f,7),f+=3;else if(T==18)U=11+An(e,f,127),f+=7;while(U--)S[C++]=V}}var K=S.subarray(0,E),Q=S.subarray(E);y=Uc(K),p=Uc(Q),d=Wn(K,y,1),g=Wn(Q,p,1)}else Kt(1);if(f>m){if(c)Kt(0);break}}if(a)l(h+131072);var se=(1<<y)-1,me=(1<<p)-1,_e=f;for(;;_e=f){var V=d[Oc(e,f)&se],qe=V>>4;if(f+=V&15,f>m){if(c)Kt(0);break}if(!V)Kt(2);if(qe<256)n[h++]=qe;else if(qe==256){_e=f,d=null;break}else{var Ge=qe-254;if(qe>264){var C=qe-257,Z=Bo[C];Ge=An(e,f,(1<<Z)-1)+wm[C],f+=Z}var ne=g[Oc(e,f)&me],fe=ne>>4;if(!ne)Kt(3);f+=ne&15;var Q=Ev[fe];if(fe>3){var Z=Go[fe];Q+=Oc(e,f)&(1<<Z)-1,f+=Z}if(f>m){if(c)Kt(0);break}if(a)l(h+131072);var de=h+Ge;if(h<Q){var Re=s-Q,Ze=Math.min(Q,de);if(Re+h<0)Kt(3);for(;h<Ze;++h)n[h]=i[Re+h]}for(;h<de;++h)n[h]=n[h-Q]}}if(t.l=d,t.p=_e,t.b=h,t.f=u,d)u=1,t.m=y,t.d=g,t.n=p}while(!u);return h!=n.length&&o?As(n,0,h):n.subarray(0,h)},ri=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},ws=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},Fc=function(e,t){var n=[];for(var i=0;i<e.length;++i)if(e[i])n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return{t:Am,l:0};if(r==1){var o=new bt(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(w,E){return w.f-E.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,f=2;n[0]={s:-1,f:a.f+c.f,l:a,r:c};while(u!=r-1)a=n[n[l].f<n[f].f?l++:f++],c=n[l!=u&&n[l].f<n[f].f?l++:f++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(var i=1;i<r;++i)if(s[i].s>h)h=s[i].s;var d=new cn(h+1),g=Hc(n[u-1],d,0);if(g>t){var i=0,y=0,p=g-t,m=1<<p;s.sort(function(E,R){return d[R.s]-d[E.s]||E.f-R.f});for(;i<r;++i){var A=s[i].s;if(d[A]>t)y+=m-(1<<g-d[A]),d[A]=t;else break}y>>=p;while(y>0){var T=s[i].s;if(d[T]<t)y-=1<<t-d[T]++-1;else++i}for(;i>=0&&y;--i){var v=s[i].s;if(d[v]==t)--d[v],++y}g=t}return{t:new bt(d),l:g}},Hc=function(e,t,n){return e.s==-1?Math.max(Hc(e.l,t,n+1),Hc(e.r,t,n+1)):t[e.s]=n},_m=function(e){var t=e.length;while(t&&!e[--t]);var n=new cn(++t),i=0,r=e[0],s=1,o=function(c){n[i++]=c};for(var a=1;a<=t;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);if(s>2)o(s>10?s-11<<5|28690:s-3<<5|12305),s=0}else if(s>3){o(r),--s;for(;s>6;s-=6)o(8304);if(s>2)o(s-3<<5|8208),s=0}while(s--)o(r);s=1,r=e[a]}return{c:n.subarray(0,i),n:t}},Ts=function(e,t){var n=0;for(var i=0;i<t.length;++i)n+=e[i]*t[i];return n},Em=function(e,t,n){var i=n.length,r=Zc(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var s=0;s<i;++s)e[r+s+4]=n[s];return(r+4+i)*8},xm=function(e,t,n,i,r,s,o,a,c,l,u){ri(t,u++,n),++r[256];var f=Fc(r,15),{t:h,l:d}=f,g=Fc(s,15),{t:y,l:p}=g,m=_m(h),{c:A,n:T}=m,v=_m(y),{c:w,n:E}=v,R=new cn(19);for(var _=0;_<A.length;++_)++R[A[_]&31];for(var _=0;_<w.length;++_)++R[w[_]&31];var S=Fc(R,7),{t:F,l:C}=S,z=19;for(;z>4&&!F[kc[z-1]];--z);var J=l+5<<3,O=Ts(r,Ei)+Ts(s,Es)+o,H=Ts(r,h)+Ts(s,y)+o+14+3*z+Ts(R,F)+2*R[16]+3*R[17]+7*R[18];if(c>=0&&J<=O&&J<=H)return Em(t,u,e.subarray(c,c+l));var V,U,K,Q;if(ri(t,u,1+(H<O)),u+=2,H<O){V=Wn(h,d,0),U=h,K=Wn(y,p,0),Q=y;var se=Wn(F,C,0);ri(t,u,T-257),ri(t,u+5,E-1),ri(t,u+10,z-4),u+=14;for(var _=0;_<z;++_)ri(t,u+3*_,F[kc[_]]);u+=3*z;var me=[A,w];for(var _e=0;_e<2;++_e){var qe=me[_e];for(var _=0;_<qe.length;++_){var Ge=qe[_]&31;if(ri(t,u,se[Ge]),u+=F[Ge],Ge>15)ri(t,u,qe[_]>>5&127),u+=qe[_]>>12}}}else V=Av,U=Ei,K=Cv,Q=Es;for(var _=0;_<a;++_){var Z=i[_];if(Z>255){var Ge=Z>>18&31;if(ws(t,u,V[Ge+257]),u+=U[Ge+257],Ge>7)ri(t,u,Z>>23&31),u+=Bo[Ge];var ne=Z&31;if(ws(t,u,K[ne]),u+=Q[ne],ne>3)ws(t,u,Z>>5&8191),u+=Go[ne]}else ws(t,u,V[Z]),u+=U[Z]}return ws(t,u,V[256]),u+U[256]},Nv=new $c([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Am=new bt(0),Dv=function(e,t,n,i,r,s){var o=s.z||e.length,a=new bt(i+o+5*(1+Math.ceil(o/7000))+r),c=a.subarray(i,a.length-r),l=s.l,u=(s.r||0)&7;if(t){if(u)c[0]=s.r>>3;var f=Nv[t-1],h=f>>13,d=f&8191,g=(1<<n)-1,y=s.p||new cn(32768),p=s.h||new cn(g+1),m=Math.ceil(n/3),A=2*m,T=function(Ye){return(e[Ye]^e[Ye+1]<<m^e[Ye+2]<<A)&g},v=new $c(25000),w=new cn(288),E=new cn(32),R=0,_=0,S=s.i||0,F=0,C=s.w||0,z=0;for(;S+2<o;++S){var J=T(S),O=S&32767,H=p[J];if(y[O]=H,p[J]=O,C<=S){var V=o-S;if((R>7000||F>24576)&&(V>423||!l)){u=xm(e,c,0,v,w,E,_,F,z,S-z,u),F=R=_=0,z=S;for(var U=0;U<286;++U)w[U]=0;for(var U=0;U<30;++U)E[U]=0}var K=2,Q=0,se=d,me=O-H&32767;if(V>2&&J==T(S-me)){var _e=Math.min(h,V)-1,qe=Math.min(32767,S),Ge=Math.min(258,V);while(me<=qe&&--se&&O!=H){if(e[S+K]==e[S+K-me]){var Z=0;for(;Z<Ge&&e[S+Z]==e[S+Z-me];++Z);if(Z>K){if(K=Z,Q=me,Z>_e)break;var ne=Math.min(me,Z-2),fe=0;for(var U=0;U<ne;++U){var de=S-me+U&32767,Re=y[de],Ze=de-Re&32767;if(Ze>fe)fe=Ze,H=de}}}O=H,H=y[O],me+=O-H&32767}}if(Q){v[F++]=268435456|Bc[K]<<18|gm[Q];var Oe=Bc[K]&31,ke=gm[Q]&31;_+=Bo[Oe]+Go[ke],++w[257+Oe],++E[ke],C=S+K,++R}else v[F++]=e[S],++w[e[S]]}}for(S=Math.max(S,C);S<o;++S)v[F++]=e[S],++w[e[S]];if(u=xm(e,c,l,v,w,E,_,F,z,S-z,u),!l)s.r=u&7|c[u/8|0]<<3,u-=7,s.h=p,s.p=y,s.i=S,s.w=C}else{for(var S=s.w||0;S<o+l;S+=65535){var Ke=S+65535;if(Ke>=o)c[u/8|0]=l,Ke=o;u=Em(c,u+1,e.subarray(S,Ke))}s.i=o}return As(a,0,i+Zc(u)+r)},Uv=function(){var e=new Int32Array(256);for(var t=0;t<256;++t){var n=t,i=9;while(--i)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),Ov=function(){var e=-1;return{p:function(t){var n=e;for(var i=0;i<t.length;++i)n=Uv[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var Fv=function(e,t,n,i,r){if(!r){if(r={l:1},t.dictionary){var s=t.dictionary.subarray(-32768),o=new bt(s.length+e.length);o.set(s),o.set(e,s.length),e=o,r.w=s.length}}return Dv(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},Rm=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var Vn=function(e,t){return e[t]|e[t+1]<<8},Rn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},zc=function(e,t){return Rn(e,t)+Rn(e,t+4)*4294967296},Wt=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function zv(e,t){return Fv(e,t||{},0,0)}function kv(e,t){return Lv(e,{i:2},t&&t.out,t&&t.dictionary)}var Cm=function(e,t,n,i){for(var r in e){var s=e[r],o=t+r,a=i;if(Array.isArray(s))a=Rm(i,s[1]),s=s[0];if(s instanceof bt)n[o]=[s,a];else n[o+="/"]=[new bt(0),a],Cm(s,o,n,i)}},vm=typeof TextEncoder<"u"&&new TextEncoder,Vc=typeof TextDecoder<"u"&&new TextDecoder,Bv=0;try{Vc.decode(Am,{stream:!0}),Bv=1}catch(e){}var Gv=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return{s:t,r:As(e,n-1)};if(!r)t+=String.fromCharCode(i);else if(r==3)i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023);else if(r&1)t+=String.fromCharCode((i&31)<<6|e[n++]&63);else t+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63)}};function ym(e,t){if(t){var n=new bt(e.length);for(var i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(vm)return vm.encode(e);var r=e.length,s=new bt(e.length+(e.length>>1)),o=0,a=function(u){s[o++]=u};for(var i=0;i<r;++i){if(o+5>s.length){var c=new bt(o+8+(r-i<<1));c.set(s),s=c}var l=e.charCodeAt(i);if(l<128||t)a(l);else if(l<2048)a(192|l>>6),a(128|l&63);else if(l>55295&&l<57344)l=65536+(l&1047552)|e.charCodeAt(++i)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63);else a(224|l>>12),a(128|l>>6&63),a(128|l&63)}return As(s,0,o)}function Hv(e,t){if(t){var n="";for(var i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}else if(Vc)return Vc.decode(e);else{var r=Gv(e),{s,r:n}=r;if(n.length)Kt(8);return s}}var Vv=function(e,t){return t+30+Vn(e,t+26)+Vn(e,t+28)},Wv=function(e,t,n){var i=Vn(e,t+28),r=Hv(e.subarray(t+46,t+46+i),!(Vn(e,t+8)&2048)),s=t+46+i,o=Rn(e,t+20),a=n&&o==4294967295?$v(e,s):[o,Rn(e,t+24),Rn(e,t+42)],c=a[0],l=a[1],u=a[2];return[Vn(e,t+10),c,l,r,s+Vn(e,t+30)+Vn(e,t+32),u]},$v=function(e,t){for(;Vn(e,t)!=1;t+=4+Vn(e,t+2));return[zc(e,t+12),zc(e,t+4),zc(e,t+20)]},Wc=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;if(i>65535)Kt(9);t+=i+4}return t},bm=function(e,t,n,i,r,s,o,a){var c=i.length,l=n.extra,u=a&&a.length,f=Wc(l);if(Wt(e,t,o!=null?33639248:67324752),t+=4,o!=null)e[t++]=20,e[t++]=n.os;e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),d=h.getFullYear()-1980;if(d<0||d>119)Kt(10);if(Wt(e,t,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,s!=-1)Wt(e,t,n.crc),Wt(e,t+4,s<0?-s-2:s),Wt(e,t+8,n.size);if(Wt(e,t+12,c),Wt(e,t+14,f),t+=16,o!=null)Wt(e,t,u),Wt(e,t+6,n.attrs),Wt(e,t+10,o),t+=14;if(e.set(i,t),t+=c,f)for(var g in l){var y=l[g],p=y.length;Wt(e,t,+g),Wt(e,t+2,p),e.set(y,t+4),t+=4+p}if(u)e.set(a,t),t+=u;return t},Zv=function(e,t,n,i,r){Wt(e,t,101010256),Wt(e,t+8,n),Wt(e,t+10,n),Wt(e,t+12,i),Wt(e,t+16,r)};function Im(e,t){if(!t)t={};var n={},i=[];Cm(e,"",n,t);var r=0,s=0;for(var o in n){var a=n[o],c=a[0],l=a[1],u=l.level==0?0:8,f=ym(o),h=f.length,d=l.comment,g=d&&ym(d),y=g&&g.length,p=Wc(l.extra);if(h>65535)Kt(11);var m=u?zv(c,l):c,A=m.length,T=Ov();T.p(c),i.push(Rm(l,{size:c.length,crc:T.d(),c:m,f,m:g,u:h!=o.length||g&&d.length!=y,o:r,compression:u})),r+=30+h+p+A,s+=76+2*(h+p)+(y||0)+A}var v=new bt(s+22),w=r,E=s-r;for(var R=0;R<i.length;++R){var f=i[R];bm(v,f.o,f,f.f,f.u,f.c.length);var _=30+f.f.length+Wc(f.extra);v.set(f.c,f.o+_),bm(v,r,f,f.f,f.u,f.c.length,f.o,f.m),r+=16+_+(f.m?f.m.length:0)}return Zv(v,r,i.length,E,w),v}function Pm(e,t){var n={},i=e.length-22;for(;Rn(e,i)!=101010256;--i)if(!i||e.length-i>65558)Kt(13);var r=Vn(e,i+8);if(!r)return{};var s=Rn(e,i+16),o=s==4294967295||r==65535;if(o){var a=Rn(e,i-12);if(o=Rn(e,a)==101075792,o)r=Rn(e,a+32),s=Rn(e,a+48)}var c=t&&t.filter;for(var l=0;l<r;++l){var u=Wv(e,s,o),f=u[0],h=u[1],d=u[2],g=u[3],y=u[4],p=u[5],m=Vv(e,p);if(s=y,!c||c({name:g,size:h,originalSize:d,compression:f}))if(!f)n[g]=As(e,m,m+h);else if(f==8)n[g]=kv(e.subarray(m,m+h),{out:new bt(d)});else Kt(14,"unknown compression type "+f)}return n}var si=67108864,Xc=Zt().regex(/^[a-z][a-z0-9_-]{0,79}$/),Xv=Zt().regex(/^sha256:[a-f0-9]{64}$/),Lm=Ms({version:ov("kiln.asset.v1"),assetId:Xc,revisionId:Xc,parentRevision:Xc.optional(),name:Zt().min(1).max(200),tags:ko(Zt().max(80)).max(30),createdAt:Zt().datetime(),description:Zt().max(4000).optional(),brief:Zt().max(8000).optional(),attribution:Ms({model:Zt().max(200).optional(),harness:Zt().max(200).optional(),author:Zt().max(200).optional()}).optional(),editable:Yx(),files:fm(Zt(),Ms({sha256:Xv,bytes:Zx().int().nonnegative().max(si)})),build:Ms({engine:Zt(),options:fm(Zt(),nr()),warnings:ko(Zt()),integration:nr().optional(),qa:nr().optional(),dependencies:ko(nr()).optional(),rebuild:dm(["engine-required","external-dependencies-required"])}).optional(),preview:Ms({fidelity:nr().optional(),error:Zt().optional()}).optional()}),qv=new Set(["asset.glb","source.kiln.js","preview.png"]);function Nm(e){let t=Lm.parse(e.manifest),n=Object.keys(e.files);if(n.length!==Object.keys(t.files).length||!n.includes("asset.glb"))throw Error("Asset file inventory mismatch");let i=0;for(let r of n){if(!qv.has(r)||!t.files[r]||t.files[r].bytes!==e.files[r].length)throw Error("Invalid asset file inventory");i+=e.files[r].length}if(i>si||t.editable!==n.includes("source.kiln.js"))throw Error("Invalid asset size or source inventory");if((e.files["source.kiln.js"]?.length??0)>1048576)throw Error("Source exceeds 1 MiB");qc(e.files["asset.glb"])}function qc(e){if(e.length<20||e.length>si)throw Error("Invalid GLB size");let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.length||t.getUint32(16,!0)!==1313821514)throw Error("Invalid GLB header");let n=20+t.getUint32(12,!0);if(n>e.length)throw Error("Invalid GLB JSON length");let i=JSON.parse(new TextDecoder().decode(e.subarray(20,n)));for(let r of[...i.buffers??[],...i.images??[]])if(r.uri&&!String(r.uri).startsWith("data:"))throw Error("GLB must embed its resources")}function Yc(e){if(!e.length||e.length>100)throw Error("Bundle requires 1..100 revisions");let t={},n=0;for(let i of e){Nm(i);let r=`${i.manifest.assetId}/${i.manifest.revisionId}/`;if(t[`${r}manifest.json`])throw Error("Duplicate bundle revision");t[`${r}manifest.json`]=new TextEncoder().encode(JSON.stringify(i.manifest,null,2));for(let[s,o]of Object.entries(i.files))t[r+s]=o}for(let i of Object.values(t))n+=i.length;if(n>si)throw Error("Bundle exceeds 64 MiB");return Im(t,{level:0})}function Dm(e){if(e.length>si+1048576)throw Error("Bundle exceeds 64 MiB");let t=0,n=0,i=Pm(e,{filter:(o)=>{if(t+=o.originalSize,n++,t>si||n>400||!/^[a-z][a-z0-9_-]{0,79}\/[a-z][a-z0-9_-]{0,79}\/(manifest\.json|asset\.glb|source\.kiln\.js|preview\.png)$/.test(o.name))throw Error("Unsafe or oversized asset bundle");return!0}}),r=[],s=new Set;for(let[o,a]of Object.entries(i)){if(!o.endsWith("/manifest.json"))continue;if(a.length>1048576)throw Error("Manifest exceeds 1 MiB");let c=Lm.parse(JSON.parse(new TextDecoder().decode(a))),l=`${c.assetId}/${c.revisionId}/`;if(o!==`${l}manifest.json`)throw Error("Bundle identity mismatch");let u={manifest:c,files:{}};s.add(o);for(let f of Object.keys(c.files)){if(!i[l+f])throw Error("Bundle file missing");u.files[f]=i[l+f],s.add(l+f)}Nm(u),r.push(u)}if(!r.length||s.size!==Object.keys(i).length)throw Error("Incomplete asset bundle");return r}var _g="185",Ni={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Di={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},xg=0,Ml=1,vg=2;var ks=1,yg=2,Zr=3,Ui=0,Yt=1,bn=2,Yn=0,Bs=1,wl=2,Tl=3,El=4,bg=5;var Xr=100,Sg=101,Mg=102,wg=103,Tg=104,Eg=200,Ag=201,Rg=202,Cg=203,Ig=204,Pg=205,Lg=206,Ng=207,Dg=208,Ug=209,Og=210,Fg=211,zg=212,kg=213,Bg=214,Gg=0,Hg=1,Vg=2,Al=3,Wg=4,$g=5,Zg=6,Xg=7,qg=0,Yg=1,jg=2,Un=0,Rl=1,Cl=2,Il=3,Gs=4,Pl=5,Ll=6,Nl=7;var qr=301,ur=302,ga=303,_a=304,Hs=306,Yr=1000,jr=1001,xa=1002,On=1003,va=1004;var hr=1005;var Gt=1006,Jr=1007;var jn=1008;var Fn=1009,Jg=1010,Kg=1011,Vs=1012,Dl=1013,Oi=1014,di=1015,pi=1016,Ul=1017,Ol=1018,Kr=1020,Qg=35902,e_=35899,t_=1021,n_=1022,Jn=1023,fr=1026,dr=1027,i_=1028,Fl=1029,pr=1030,zl=1031;var kl=1033,ya=33776,ba=33777,Sa=33778,Ma=33779,Bl=35840,Gl=35841,Hl=35842,Vl=35843,Wl=36196,$l=37492,Zl=37496,Xl=37488,ql=37489,wa=37490,Yl=37491,jl=37808,Jl=37809,Kl=37810,Ql=37811,eu=37812,tu=37813,nu=37814,iu=37815,ru=37816,su=37817,ou=37818,au=37819,cu=37820,lu=37821,uu=36492,hu=36494,fu=36495,du=36283,pu=36284,Ta=36285,mu=36286;var gu=2300,Ea=2301;var _u=0,Ws=1,Qr=2;var xu=0,r_=1,mr="",Fi="srgb",hn="srgb-linear",vu="linear",ht="srgb";var s_=512,o_=513,a_=514,Aa=515,c_=516,l_=517,Ra=518,u_=519;var yu="300 es",bu=2000;function Yv(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function jv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Vr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function h_(){let e=Vr("canvas");return e.style.display="block",e}var Um={},Wr=null;function zs(...e){let t="THREE."+e.shift();if(Wr)Wr("log",t,...e);else console.log(t,...e)}function f_(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Me(...e){e=f_(e);let t="THREE."+e.shift();if(Wr)Wr("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Ne(...e){e=f_(e);let t="THREE."+e.shift();if(Wr)Wr("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function ar(...e){let t=e.join(" ");if(t in Um)return;Um[t]=!0,Me(...e)}function d_(e,t,n){return new Promise(function(i,r){function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}var p_={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class zn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);if(r!==-1)i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e);e.target=null}}}var Xt=["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"],Om=1234567,Os=Math.PI/180,cr=180/Math.PI;function Dn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Xt[e&255]+Xt[e>>8&255]+Xt[e>>16&255]+Xt[e>>24&255]+"-"+Xt[t&255]+Xt[t>>8&255]+"-"+Xt[t>>16&15|64]+Xt[t>>24&255]+"-"+Xt[n&63|128]+Xt[n>>8&255]+"-"+Xt[n>>16&255]+Xt[n>>24&255]+Xt[i&255]+Xt[i>>8&255]+Xt[i>>16&255]+Xt[i>>24&255]).toLowerCase()}function $e(e,t,n){return Math.max(t,Math.min(n,e))}function Su(e,t){return(e%t+t)%t}function Jv(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function Kv(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function Fs(e,t,n){return(1-n)*e+n*t}function Qv(e,t,n,i){return Fs(e,t,1-Math.exp(-n*i))}function ey(e,t=1){return t-Math.abs(Su(e,t*2)-t)}function ty(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function ny(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function iy(e,t){return e+Math.floor(Math.random()*(t-e+1))}function ry(e,t){return e+Math.random()*(t-e)}function sy(e){return e*(0.5-Math.random())}function oy(e){if(e!==void 0)Om=e;let t=Om+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function ay(e){return e*Os}function cy(e){return e*cr}function ly(e){return(e&e-1)===0&&e!==0}function uy(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function hy(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fy(e,t,n,i,r){let{cos:s,sin:o}=Math,a=s(n/2),c=o(n/2),l=s((t+i)/2),u=o((t+i)/2),f=s((t-i)/2),h=o((t-i)/2),d=s((i-t)/2),g=o((i-t)/2);switch(r){case"XYX":e.set(a*u,c*f,c*h,a*l);break;case"YZY":e.set(c*h,a*u,c*f,a*l);break;case"ZXZ":e.set(c*f,c*h,a*u,a*l);break;case"XZX":e.set(a*u,c*g,c*d,a*l);break;case"YXY":e.set(c*d,a*u,c*g,a*l);break;case"ZYZ":e.set(c*g,c*d,a*u,a*l);break;default:Me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Nn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function rt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("THREE.MathUtils: Invalid component type.")}}var $s={DEG2RAD:Os,RAD2DEG:cr,generateUUID:Dn,clamp:$e,euclideanModulo:Su,mapLinear:Jv,inverseLerp:Kv,lerp:Fs,damp:Qv,pingpong:ey,smoothstep:ty,smootherstep:ny,randInt:iy,randFloat:ry,randFloatSpread:sy,seededRandom:oy,degToRad:ay,radToDeg:cy,isPowerOfTwo:ly,ceilPowerOfTwo:uy,floorPowerOfTwo:hy,setQuaternionFromProperEuler:fy,normalize:rt,denormalize:Nn};class Ie{static{Ie.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],f=r[s+0],h=r[s+1],d=r[s+2],g=r[s+3];if(u!==g||a!==f||c!==h||l!==d){let y=a*f+c*h+l*d+u*g;if(y<0)f=-f,h=-h,d=-d,g=-g,y=-y;let p=1-o;if(y<0.9995){let m=Math.acos(y),A=Math.sin(m);p=Math.sin(p*m)/A,o=Math.sin(o*m)/A,a=a*p+f*o,c=c*p+h*o,l=l*p+d*o,u=u*p+g*o}else{a=a*p+f*o,c=c*p+h*o,l=l*p+d*o,u=u*p+g*o;let m=1/Math.sqrt(a*a+c*c+l*l+u*u);a*=m,c*=m,l*=m,u*=m}}e[t]=a,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){let o=n[i],a=n[i+1],c=n[i+2],l=n[i+3],u=r[s],f=r[s+1],h=r[s+2],d=r[s+3];return e[t]=o*d+l*u+a*h-c*f,e[t+1]=a*d+l*f+c*u-o*h,e[t+2]=c*d+l*h+o*f-a*u,e[t+3]=l*d-o*u-a*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:r,_order:s}=e,{cos:o,sin:a}=Math,c=o(n/2),l=o(i/2),u=o(r/2),f=a(n/2),h=a(i/2),d=a(r/2);switch(s){case"XYZ":this._x=f*l*u+c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u-f*h*d;break;case"YXZ":this._x=f*l*u+c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u+f*h*d;break;case"ZXY":this._x=f*l*u-c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u-f*h*d;break;case"ZYX":this._x=f*l*u-c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u+f*h*d;break;case"YZX":this._x=f*l*u+c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u-f*h*d;break;case"XZY":this._x=f*l*u-c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u+f*h*d;break;default:Me("Quaternion: .setFromEuler() encountered an unknown order: "+s)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],c=t[2],l=t[6],u=t[10],f=n+o+u;if(f>0){let h=0.5/Math.sqrt(f+1);this._w=0.25/h,this._x=(l-a)*h,this._y=(r-c)*h,this._z=(s-i)*h}else if(n>o&&n>u){let h=2*Math.sqrt(1+n-o-u);this._w=(l-a)/h,this._x=0.25*h,this._y=(i+s)/h,this._z=(r+c)/h}else if(o>u){let h=2*Math.sqrt(1+o-n-u);this._w=(r-c)/h,this._x=(i+s)/h,this._y=0.25*h,this._z=(a+l)/h}else{let h=2*Math.sqrt(1+u-n-o);this._w=(s-i)/h,this._x=(r+c)/h,this._y=(a+l)/h,this._z=0.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs($e(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,{_x:o,_y:a,_z:c,_w:l}=t;return this._x=n*l+s*o+i*c-r*a,this._y=i*l+s*a+r*o-n*c,this._z=r*l+s*c+n*a-i*o,this._w=s*l-n*o-i*a-r*c,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,o=this.dot(e);if(o<0)n=-n,i=-i,r=-r,s=-s,o=-o;let a=1-t;if(o<0.9995){let c=Math.acos(o),l=Math.sin(c);a=Math.sin(a*c)/l,t=Math.sin(t*c)/l,this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this._onChangeCallback()}else this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{static{N.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Fm.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Fm.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:r,y:s,z:o,w:a}=e,c=2*(s*i-o*n),l=2*(o*t-r*i),u=2*(r*n-s*t);return this.x=t+a*c+s*u-o*l,this.y=n+a*l+o*c-r*u,this.z=i+a*u+r*l-s*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:r}=e,{x:s,y:o,z:a}=t;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return jc.copy(this).projectOnVector(e),this.sub(jc)}reflect(e){return this.sub(jc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var jc=new N,Fm=new Bt;class Ue{static{Ue.prototype.isMatrix3=!0}constructor(e,t,n,i,r,s,o,a,c){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c)}set(e,t,n,i,r,s,o,a,c){let l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=a,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],c=n[1],l=n[4],u=n[7],f=n[2],h=n[5],d=n[8],g=i[0],y=i[3],p=i[6],m=i[1],A=i[4],T=i[7],v=i[2],w=i[5],E=i[8];return r[0]=s*g+o*m+a*v,r[3]=s*y+o*A+a*w,r[6]=s*p+o*T+a*E,r[1]=c*g+l*m+u*v,r[4]=c*y+l*A+u*w,r[7]=c*p+l*T+u*E,r[2]=f*g+h*m+d*v,r[5]=f*y+h*A+d*w,r[8]=f*p+h*T+d*E,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*s*l-t*o*c-n*r*l+n*o*a+i*r*c-i*s*a}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=l*s-o*c,f=o*a-l*r,h=c*r-s*a,d=t*u+n*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=u*g,e[1]=(i*c-l*n)*g,e[2]=(o*n-i*s)*g,e[3]=f*g,e[4]=(l*t-i*a)*g,e[5]=(i*r-o*t)*g,e[6]=h*g,e[7]=(n*a-c*t)*g,e[8]=(s*t-n*r)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){let a=Math.cos(r),c=Math.sin(r);return this.set(n*a,n*c,-n*(a*s+c*o)+s+e,-i*c,i*a,-i*(-c*s+a*o)+o+t,0,0,1),this}scale(e,t){return ar("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Jc.makeScale(e,t)),this}rotate(e){return ar("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Jc.makeRotation(-e)),this}translate(e,t){return ar("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Jc.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}var Jc=new Ue,zm=new Ue().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),km=new Ue().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function dy(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(r,s,o){if(this.enabled===!1||s===o||!s||!o)return r;if(this.spaces[s].transfer==="srgb")r.r=fi(r.r),r.g=fi(r.g),r.b=fi(r.b);if(this.spaces[s].primaries!==this.spaces[o].primaries)r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ);if(this.spaces[o].transfer==="srgb")r.r=Hr(r.r),r.g=Hr(r.g),r.b=Hr(r.b);return r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){if(r==="")return"linear";return this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ar("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ar("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(r,s)}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:zm,fromXYZ:km,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:zm,fromXYZ:km,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}var We=dy();function fi(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function Hr(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}var Rr;class Mu{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(Rr===void 0)Rr=Vr("canvas");Rr.width=e.width,Rr.height=e.height;let i=Rr.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=Rr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Vr("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let s=0;s<r.length;s++)r[s]=fi(r[s]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(fi(t[n]/255)*255);else t[n]=fi(t[n]);return{data:t,width:e.width,height:e.height}}else return Me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}var py=0;class Zs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:py++}),this.uuid=Dn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width,t.height,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let s=0,o=i.length;s<o;s++)if(i[s].isDataTexture)r.push(Kc(i[s].image));else r.push(Kc(i[s]))}else r=Kc(i);n.url=r}if(!t)e.images[this.uuid]=n;return n}}function Kc(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return Mu.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Me("Texture: Unable to serialize Texture."),{}}var my=0,Qc=new N;class wt extends zn{constructor(e=wt.DEFAULT_IMAGE,t=wt.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,a=1009,c=wt.DEFAULT_ANISOTROPY,l=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:my++}),this.uuid=Dn(),this.name="",this.source=new Zs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Ie(0,0),this.repeat=new Ie(1,1),this.center=new Ie(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ue,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Qc).x}get height(){return this.source.getSize(Qc).y}get depth(){return this.source.getSize(Qc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Me(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}}wt.DEFAULT_IMAGE=null;wt.DEFAULT_MAPPING=300;wt.DEFAULT_ANISOTROPY=1;class st{static{st.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,s=0.01,o=0.1,a=e.elements,c=a[0],l=a[4],u=a[8],f=a[1],h=a[5],d=a[9],g=a[2],y=a[6],p=a[10];if(Math.abs(l-f)<0.01&&Math.abs(u-g)<0.01&&Math.abs(d-y)<0.01){if(Math.abs(l+f)<0.1&&Math.abs(u+g)<0.1&&Math.abs(d+y)<0.1&&Math.abs(c+h+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let A=(c+1)/2,T=(h+1)/2,v=(p+1)/2,w=(l+f)/4,E=(u+g)/4,R=(d+y)/4;if(A>T&&A>v)if(A<0.01)n=0,i=0.707106781,r=0.707106781;else n=Math.sqrt(A),i=w/n,r=E/n;else if(T>v)if(T<0.01)n=0.707106781,i=0,r=0.707106781;else i=Math.sqrt(T),n=w/i,r=R/i;else if(v<0.01)n=0.707106781,i=0.707106781,r=0;else r=Math.sqrt(v),n=E/r,i=R/r;return this.set(n,i,r,t),this}let m=Math.sqrt((y-d)*(y-d)+(u-g)*(u-g)+(f-l)*(f-l));if(Math.abs(m)<0.001)m=1;return this.x=(y-d)/m,this.y=(u-g)/m,this.z=(f-l)/m,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this.w=$e(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this.w=$e(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class wu extends zn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new st(0,0,e,t),this.scissorTest=!1,this.viewport=new st(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new wt(i),s=n.count;for(let o=0;o<s;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(e!==null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new Zs(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null)this.depthTexture=e.depthTexture.clone();return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Sn extends wu{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}}class Ca extends wt{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Tu extends wt{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ze{static{ze.prototype.isMatrix4=!0}constructor(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,y){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,y)}set(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,y){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=s,p[9]=o,p[13]=a,p[2]=c,p[6]=l,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=g,p[15]=y,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 ze().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Cr.setFromMatrixColumn(e,0).length(),r=1/Cr.setFromMatrixColumn(e,1).length(),s=1/Cr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:r}=e,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let f=s*l,h=s*u,d=o*l,g=o*u;t[0]=a*l,t[4]=-a*u,t[8]=c,t[1]=h+d*c,t[5]=f-g*c,t[9]=-o*a,t[2]=g-f*c,t[6]=d+h*c,t[10]=s*a}else if(e.order==="YXZ"){let f=a*l,h=a*u,d=c*l,g=c*u;t[0]=f+g*o,t[4]=d*o-h,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-o,t[2]=h*o-d,t[6]=g+f*o,t[10]=s*a}else if(e.order==="ZXY"){let f=a*l,h=a*u,d=c*l,g=c*u;t[0]=f-g*o,t[4]=-s*u,t[8]=d+h*o,t[1]=h+d*o,t[5]=s*l,t[9]=g-f*o,t[2]=-s*c,t[6]=o,t[10]=s*a}else if(e.order==="ZYX"){let f=s*l,h=s*u,d=o*l,g=o*u;t[0]=a*l,t[4]=d*c-h,t[8]=f*c+g,t[1]=a*u,t[5]=g*c+f,t[9]=h*c-d,t[2]=-c,t[6]=o*a,t[10]=s*a}else if(e.order==="YZX"){let f=s*a,h=s*c,d=o*a,g=o*c;t[0]=a*l,t[4]=g-f*u,t[8]=d*u+h,t[1]=u,t[5]=s*l,t[9]=-o*l,t[2]=-c*l,t[6]=h*u+d,t[10]=f-g*u}else if(e.order==="XZY"){let f=s*a,h=s*c,d=o*a,g=o*c;t[0]=a*l,t[4]=-u,t[8]=c*l,t[1]=f*u+g,t[5]=s*l,t[9]=h*u-d,t[2]=d*u-h,t[6]=o*l,t[10]=g*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gy,e,_y)}lookAt(e,t,n){let i=this.elements;if(ln.subVectors(e,t),ln.lengthSq()===0)ln.z=1;if(ln.normalize(),Ai.crossVectors(n,ln),Ai.lengthSq()===0){if(Math.abs(n.z)===1)ln.x+=0.0001;else ln.z+=0.0001;ln.normalize(),Ai.crossVectors(n,ln)}return Ai.normalize(),Ho.crossVectors(ln,Ai),i[0]=Ai.x,i[4]=Ho.x,i[8]=ln.x,i[1]=Ai.y,i[5]=Ho.y,i[9]=ln.y,i[2]=Ai.z,i[6]=Ho.z,i[10]=ln.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],c=n[12],l=n[1],u=n[5],f=n[9],h=n[13],d=n[2],g=n[6],y=n[10],p=n[14],m=n[3],A=n[7],T=n[11],v=n[15],w=i[0],E=i[4],R=i[8],_=i[12],S=i[1],F=i[5],C=i[9],z=i[13],J=i[2],O=i[6],H=i[10],V=i[14],U=i[3],K=i[7],Q=i[11],se=i[15];return r[0]=s*w+o*S+a*J+c*U,r[4]=s*E+o*F+a*O+c*K,r[8]=s*R+o*C+a*H+c*Q,r[12]=s*_+o*z+a*V+c*se,r[1]=l*w+u*S+f*J+h*U,r[5]=l*E+u*F+f*O+h*K,r[9]=l*R+u*C+f*H+h*Q,r[13]=l*_+u*z+f*V+h*se,r[2]=d*w+g*S+y*J+p*U,r[6]=d*E+g*F+y*O+p*K,r[10]=d*R+g*C+y*H+p*Q,r[14]=d*_+g*z+y*V+p*se,r[3]=m*w+A*S+T*J+v*U,r[7]=m*E+A*F+T*O+v*K,r[11]=m*R+A*C+T*H+v*Q,r[15]=m*_+A*z+T*V+v*se,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],c=e[13],l=e[2],u=e[6],f=e[10],h=e[14],d=e[3],g=e[7],y=e[11],p=e[15],m=a*h-c*f,A=o*h-c*u,T=o*f-a*u,v=s*h-c*l,w=s*f-a*l,E=s*u-o*l;return t*(g*m-y*A+p*T)-n*(d*m-y*v+p*w)+i*(d*A-g*v+p*E)-r*(d*T-g*w+y*E)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],s=e[5],o=e[9],a=e[2],c=e[6],l=e[10];return t*(s*l-o*c)-n*(r*l-o*a)+i*(r*c-s*a)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],f=e[10],h=e[11],d=e[12],g=e[13],y=e[14],p=e[15],m=t*o-n*s,A=t*a-i*s,T=t*c-r*s,v=n*a-i*o,w=n*c-r*o,E=i*c-r*a,R=l*g-u*d,_=l*y-f*d,S=l*p-h*d,F=u*y-f*g,C=u*p-h*g,z=f*p-h*y,J=m*z-A*C+T*F+v*S-w*_+E*R;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let O=1/J;return e[0]=(o*z-a*C+c*F)*O,e[1]=(i*C-n*z-r*F)*O,e[2]=(g*E-y*w+p*v)*O,e[3]=(f*w-u*E-h*v)*O,e[4]=(a*S-s*z-c*_)*O,e[5]=(t*z-i*S+r*_)*O,e[6]=(y*T-d*E-p*A)*O,e[7]=(l*E-f*T+h*A)*O,e[8]=(s*C-o*S+c*R)*O,e[9]=(n*S-t*C-r*R)*O,e[10]=(d*w-g*T+p*m)*O,e[11]=(u*T-l*w-h*m)*O,e[12]=(o*_-s*F-a*R)*O,e[13]=(t*F-n*_+i*R)*O,e[14]=(g*A-d*v-y*m)*O,e[15]=(l*v-u*A+f*m)*O,this}scale(e){let t=this.elements,{x:n,y:i,z:r}=e;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,{x:s,y:o,z:a}=e,c=r*s,l=r*o;return this.set(c*s+n,c*o-i*a,c*a+i*o,0,c*o+i*a,l*o+n,l*a-i*s,0,c*a-i*o,l*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:r,_y:s,_z:o,_w:a}=t,c=r+r,l=s+s,u=o+o,f=r*c,h=r*l,d=r*u,g=s*l,y=s*u,p=o*u,m=a*c,A=a*l,T=a*u,{x:v,y:w,z:E}=n;return i[0]=(1-(g+p))*v,i[1]=(h+T)*v,i[2]=(d-A)*v,i[3]=0,i[4]=(h-T)*w,i[5]=(1-(f+p))*w,i[6]=(y+m)*w,i[7]=0,i[8]=(d+A)*E,i[9]=(y-m)*E,i[10]=(1-(f+g))*E,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let s=Cr.set(i[0],i[1],i[2]).length(),o=Cr.set(i[4],i[5],i[6]).length(),a=Cr.set(i[8],i[9],i[10]).length();if(r<0)s=-s;Cn.copy(this);let c=1/s,l=1/o,u=1/a;return Cn.elements[0]*=c,Cn.elements[1]*=c,Cn.elements[2]*=c,Cn.elements[4]*=l,Cn.elements[5]*=l,Cn.elements[6]*=l,Cn.elements[8]*=u,Cn.elements[9]*=u,Cn.elements[10]*=u,t.setFromRotationMatrix(Cn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2*r/(t-e),u=2*r/(n-i),f=(t+e)/(t-e),h=(n+i)/(n-i),d,g;if(a)d=r/(s-r),g=s*r/(s-r);else if(o===2000)d=-(s+r)/(s-r),g=-2*s*r/(s-r);else if(o===2001)d=-s/(s-r),g=-s*r/(s-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=u,c[9]=h,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),h=-(n+i)/(n-i),d,g;if(a)d=1/(s-r),g=s/(s-r);else if(o===2000)d=-2/(s-r),g=-(s+r)/(s-r);else if(o===2001)d=-1/(s-r),g=-r/(s-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=u,c[9]=0,c[13]=h,c[2]=0,c[6]=0,c[10]=d,c[14]=g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}var Cr=new N,Cn=new ze,gy=new N(0,0,0),_y=new N(1,1,1),Ai=new N,Ho=new N,ln=new N,Bm=new ze,Gm=new Bt;class qn{constructor(e=0,t=0,n=0,i=qn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],c=i[5],l=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":if(this._y=Math.asin($e(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-l,h),this._z=Math.atan2(-s,r);else this._x=Math.atan2(f,c),this._z=0;break;case"YXZ":if(this._x=Math.asin(-$e(l,-1,1)),Math.abs(l)<0.9999999)this._y=Math.atan2(o,h),this._z=Math.atan2(a,c);else this._y=Math.atan2(-u,r),this._z=0;break;case"ZXY":if(this._x=Math.asin($e(f,-1,1)),Math.abs(f)<0.9999999)this._y=Math.atan2(-u,h),this._z=Math.atan2(-s,c);else this._y=0,this._z=Math.atan2(a,r);break;case"ZYX":if(this._y=Math.asin(-$e(u,-1,1)),Math.abs(u)<0.9999999)this._x=Math.atan2(f,h),this._z=Math.atan2(a,r);else this._x=0,this._z=Math.atan2(-s,c);break;case"YZX":if(this._z=Math.asin($e(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r);else this._x=0,this._y=Math.atan2(o,h);break;case"XZY":if(this._z=Math.asin(-$e(s,-1,1)),Math.abs(s)<0.9999999)this._x=Math.atan2(f,c),this._y=Math.atan2(o,r);else this._x=Math.atan2(-l,h),this._y=0;break;default:Me("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return Bm.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Bm,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Gm.setFromEuler(this),this.setFromQuaternion(Gm,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qn.DEFAULT_ORDER="XYZ";class Ia{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}var xy=0,Hm=new N,Ir=new Bt,oi=new ze,Vo=new N,Rs=new N,vy=new N,yy=new Bt,Vm=new N(1,0,0),Wm=new N(0,1,0),$m=new N(0,0,1),Zm={type:"added"},by={type:"removed"},Pr={type:"childadded",child:null},el={type:"childremoved",child:null};class at extends zn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:xy++}),this.uuid=Dn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=at.DEFAULT_UP.clone();let e=new N,t=new qn,n=new Bt,i=new N(1,1,1);function r(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ze},normalMatrix:{value:new Ue}}),this.matrix=new ze,this.matrixWorld=new ze,this.matrixAutoUpdate=at.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ia,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ir.setFromAxisAngle(e,t),this.quaternion.multiply(Ir),this}rotateOnWorldAxis(e,t){return Ir.setFromAxisAngle(e,t),this.quaternion.premultiply(Ir),this}rotateX(e){return this.rotateOnAxis(Vm,e)}rotateY(e){return this.rotateOnAxis(Wm,e)}rotateZ(e){return this.rotateOnAxis($m,e)}translateOnAxis(e,t){return Hm.copy(e).applyQuaternion(this.quaternion),this.position.add(Hm.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Vm,e)}translateY(e){return this.translateOnAxis(Wm,e)}translateZ(e){return this.translateOnAxis($m,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(oi.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)Vo.copy(e);else Vo.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),Rs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)oi.lookAt(Rs,Vo,this.up);else oi.lookAt(Vo,Rs,this.up);if(this.quaternion.setFromRotationMatrix(oi),i)oi.extractRotation(i.matrixWorld),Ir.setFromRotationMatrix(oi),this.quaternion.premultiply(Ir.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Ne("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Zm),Pr.child=e,this.dispatchEvent(Pr),Pr.child=null;else Ne("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(by),el.child=e,this.dispatchEvent(el),el.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),oi.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),oi.multiply(e.parent.matrixWorld);return e.applyMatrix4(oi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Zm),Pr.child=e,this.dispatchEvent(Pr),Pr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Rs,e,vy),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Rs,yy,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,this.name!=="")i.name=this.name;if(this.castShadow===!0)i.castShadow=!0;if(this.receiveShadow===!0)i.receiveShadow=!0;if(this.visible===!1)i.visible=!1;if(this.frustumCulled===!1)i.frustumCulled=!1;if(this.renderOrder!==0)i.renderOrder=this.renderOrder;if(this.static!==!1)i.static=this.static;if(Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)i.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((o)=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((o)=>({...o})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function r(o,a){if(o[a.uuid]===void 0)o[a.uuid]=a.toJSON(e);return a.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let c=0,l=a.length;c<l;c++){let u=a[c];r(e.shapes,u)}else r(e.shapes,a)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,c=this.material.length;a<c;a++)o.push(r(e.materials,this.material[a]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(r(e.animations,a))}}if(t){let o=s(e.geometries),a=s(e.materials),c=s(e.textures),l=s(e.images),u=s(e.shapes),f=s(e.skeletons),h=s(e.animations),d=s(e.nodes);if(o.length>0)n.geometries=o;if(a.length>0)n.materials=a;if(c.length>0)n.textures=c;if(l.length>0)n.images=l;if(u.length>0)n.shapes=u;if(f.length>0)n.skeletons=f;if(h.length>0)n.animations=h;if(d.length>0)n.nodes=d}return n.object=i,n;function s(o){let a=[];for(let c in o){let l=o[c];delete l.metadata,a.push(l)}return a}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}}at.DEFAULT_UP=new N(0,1,0);at.DEFAULT_MATRIX_AUTO_UPDATE=!0;at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Zn extends at{constructor(){super();this.isGroup=!0,this.type="Group"}}var Sy={type:"move"};class Xs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Zn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new Zn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Zn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,r=null,s=null,o=this._targetRay,a=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(let g of e.hand.values()){let y=t.getJointPose(g,n),p=this._getHandJoint(c,g);if(y!==null)p.matrix.fromArray(y.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=y.radius;p.visible=y!==null}let l=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=l.position.distanceTo(u.position),h=0.02,d=0.005;if(c.inputState.pinching&&f>h+d)c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!c.inputState.pinching&&f<=h-d)c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(a!==null&&e.gripSpace){if(r=t.getPose(e.gripSpace,n),r!==null){if(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity);else a.hasLinearVelocity=!1;if(r.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity);else a.hasAngularVelocity=!1;if(a.eventsEnabled)a.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(o!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null)i=r;if(i!==null){if(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity);else o.hasLinearVelocity=!1;if(i.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity);else o.hasAngularVelocity=!1;this.dispatchEvent(Sy)}}}if(o!==null)o.visible=i!==null;if(a!==null)a.visible=r!==null;if(c!==null)c.visible=s!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Zn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}var m_={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},Ri={h:0,s:0,l:0},Wo={h:0,s:0,l:0};function tl(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Le{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,We.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=We.workingColorSpace){return this.r=e,this.g=t,this.b=n,We.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=We.workingColorSpace){if(e=Su(e,1),t=$e(t,0,1),n=$e(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=0.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=tl(s,r,e+0.3333333333333333),this.g=tl(s,r,e),this.b=tl(s,r,e-0.3333333333333333)}return We.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(r){if(r===void 0)return;if(parseFloat(r)<1)Me("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Me("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);else if(s===6)return this.setHex(parseInt(r,16),t);else Me("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=m_[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Me("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=Hr(e.r),this.g=Hr(e.g),this.b=Hr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return We.workingToColorSpace(qt.copy(this),e),Math.round($e(qt.r*255,0,255))*65536+Math.round($e(qt.g*255,0,255))*256+Math.round($e(qt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=We.workingColorSpace){We.workingToColorSpace(qt.copy(this),t);let{r:n,g:i,b:r}=qt,s=Math.max(n,i,r),o=Math.min(n,i,r),a,c,l=(o+s)/2;if(o===s)a=0,c=0;else{let u=s-o;switch(c=l<=0.5?u/(s+o):u/(2-s-o),s){case n:a=(i-r)/u+(i<r?6:0);break;case i:a=(r-n)/u+2;break;case r:a=(n-i)/u+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getRGB(e,t=We.workingColorSpace){return We.workingToColorSpace(qt.copy(this),t),e.r=qt.r,e.g=qt.g,e.b=qt.b,e}getStyle(e="srgb"){We.workingToColorSpace(qt.copy(this),e);let{r:t,g:n,b:i}=qt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ri),this.setHSL(Ri.h+e,Ri.s+t,Ri.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ri),e.getHSL(Wo);let n=Fs(Ri.h,Wo.h,t),i=Fs(Ri.s,Wo.s,t),r=Fs(Ri.l,Wo.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var qt=new Le;Le.NAMES=m_;class es extends at{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new qn,this.environmentIntensity=1,this.environmentRotation=new qn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){if(super.copy(e,t),e.background!==null)this.background=e.background.clone();if(e.environment!==null)this.environment=e.environment.clone();if(e.fog!==null)this.fog=e.fog.clone();if(this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null)this.overrideMaterial=e.overrideMaterial.clone();return this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)t.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)t.object.backgroundIntensity=this.backgroundIntensity;if(t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)t.object.environmentIntensity=this.environmentIntensity;return t.object.environmentRotation=this.environmentRotation.toArray(),t}}var In=new N,ai=new N,nl=new N,ci=new N,Lr=new N,Nr=new N,Xm=new N,il=new N,rl=new N,sl=new N,ol=new st,al=new st,cl=new st;class yn{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),In.subVectors(e,t),i.cross(In);let r=i.lengthSq();if(r>0)return i.multiplyScalar(1/Math.sqrt(r));return i.set(0,0,0)}static getBarycoord(e,t,n,i,r){In.subVectors(i,t),ai.subVectors(n,t),nl.subVectors(e,t);let s=In.dot(In),o=In.dot(ai),a=In.dot(nl),c=ai.dot(ai),l=ai.dot(nl),u=s*c-o*o;if(u===0)return r.set(0,0,0),null;let f=1/u,h=(c*a-o*l)*f,d=(s*l-o*a)*f;return r.set(1-h-d,d,h)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,ci)===null)return!1;return ci.x>=0&&ci.y>=0&&ci.x+ci.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){if(this.getBarycoord(e,t,n,i,ci)===null){if(a.x=0,a.y=0,"z"in a)a.z=0;if("w"in a)a.w=0;return null}return a.setScalar(0),a.addScaledVector(r,ci.x),a.addScaledVector(s,ci.y),a.addScaledVector(o,ci.z),a}static getInterpolatedAttribute(e,t,n,i,r,s){return ol.setScalar(0),al.setScalar(0),cl.setScalar(0),ol.fromBufferAttribute(e,t),al.fromBufferAttribute(e,n),cl.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(ol,r.x),s.addScaledVector(al,r.y),s.addScaledVector(cl,r.z),s}static isFrontFacing(e,t,n,i){return In.subVectors(n,t),ai.subVectors(e,t),In.cross(ai).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return In.subVectors(this.c,this.b),ai.subVectors(this.a,this.b),In.cross(ai).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return yn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return yn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return yn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return yn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,s,o;Lr.subVectors(i,n),Nr.subVectors(r,n),il.subVectors(e,n);let a=Lr.dot(il),c=Nr.dot(il);if(a<=0&&c<=0)return t.copy(n);rl.subVectors(e,i);let l=Lr.dot(rl),u=Nr.dot(rl);if(l>=0&&u<=l)return t.copy(i);let f=a*u-l*c;if(f<=0&&a>=0&&l<=0)return s=a/(a-l),t.copy(n).addScaledVector(Lr,s);sl.subVectors(e,r);let h=Lr.dot(sl),d=Nr.dot(sl);if(d>=0&&h<=d)return t.copy(r);let g=h*c-a*d;if(g<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Nr,o);let y=l*d-h*u;if(y<=0&&u-l>=0&&h-d>=0)return Xm.subVectors(r,i),o=(u-l)/(u-l+(h-d)),t.copy(i).addScaledVector(Xm,o);let p=1/(y+g+f);return s=g*p,o=f*p,t.copy(n).addScaledVector(Lr,s).addScaledVector(Nr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class en{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Pn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Pn.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=r.count;s<o;s++){if(e.isMesh===!0)e.getVertexPosition(s,Pn);else Pn.fromBufferAttribute(r,s);Pn.applyMatrix4(e.matrixWorld),this.expandByPoint(Pn)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();$o.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();$o.copy(n.boundingBox)}$o.applyMatrix4(e.matrixWorld),this.union($o)}}let i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Cs),Zo.subVectors(this.max,Cs),Dr.subVectors(e.a,Cs),Ur.subVectors(e.b,Cs),Or.subVectors(e.c,Cs),Ci.subVectors(Ur,Dr),Ii.subVectors(Or,Ur),ir.subVectors(Dr,Or);let t=[0,-Ci.z,Ci.y,0,-Ii.z,Ii.y,0,-ir.z,ir.y,Ci.z,0,-Ci.x,Ii.z,0,-Ii.x,ir.z,0,-ir.x,-Ci.y,Ci.x,0,-Ii.y,Ii.x,0,-ir.y,ir.x,0];if(!ll(t,Dr,Ur,Or,Zo))return!1;if(t=[1,0,0,0,1,0,0,0,1],!ll(t,Dr,Ur,Or,Zo))return!1;return Xo.crossVectors(Ci,Ii),t=[Xo.x,Xo.y,Xo.z],ll(t,Dr,Ur,Or,Zo)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(Pn).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return li[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),li[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),li[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),li[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),li[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),li[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),li[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),li[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(li),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}var li=[new N,new N,new N,new N,new N,new N,new N,new N],Pn=new N,$o=new en,Dr=new N,Ur=new N,Or=new N,Ci=new N,Ii=new N,ir=new N,Cs=new N,Zo=new N,Xo=new N,rr=new N;function ll(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){rr.fromArray(e,s);let a=r.x*Math.abs(rr.x)+r.y*Math.abs(rr.y)+r.z*Math.abs(rr.z),c=t.dot(rr),l=n.dot(rr),u=i.dot(rr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var It=new N,qo=new Ie,My=0;class Nt extends zn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:My++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)qo.fromBufferAttribute(this,t),qo.applyMatrix3(e),this.setXY(t,qo.x,qo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix3(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix4(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyNormalMatrix(e),this.setXYZ(t,It.x,It.y,It.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.transformDirection(e),this.setXYZ(t,It.x,It.y,It.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=Nn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=rt(n,this.array);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=Nn(t,this.array);return t}setX(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=Nn(t,this.array);return t}setY(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=Nn(t,this.array);return t}setZ(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=Nn(t,this.array);return t}setW(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array),r=rt(r,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")e.name=this.name;if(this.usage!==35044)e.usage=this.usage;return e}dispose(){this.dispatchEvent({type:"dispose"})}}class Pa extends Nt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class La extends Nt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nn extends Nt{constructor(e,t,n){super(new Float32Array(e),t,n)}}var wy=new en,Is=new N,ul=new N;class fn{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else wy.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Is.subVectors(e,this.center);let t=Is.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(Is,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else ul.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Is.copy(e.center).add(ul)),this.expandByPoint(Is.copy(e.center).sub(ul));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}var Ty=0,vn=new ze,hl=new at,Fr=new N,un=new en,Ps=new en,kt=new N;class tn extends zn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ty++}),this.uuid=Dn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((Yv(e))?La:Pa)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let r=new Ue().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return vn.makeRotationFromQuaternion(e),this.applyMatrix4(vn),this}rotateX(e){return vn.makeRotationX(e),this.applyMatrix4(vn),this}rotateY(e){return vn.makeRotationY(e),this.applyMatrix4(vn),this}rotateZ(e){return vn.makeRotationZ(e),this.applyMatrix4(vn),this}translate(e,t,n){return vn.makeTranslation(e,t,n),this.applyMatrix4(vn),this}scale(e,t,n){return vn.makeScale(e,t,n),this.applyMatrix4(vn),this}lookAt(e){return hl.lookAt(e),hl.updateMatrix(),this.applyMatrix4(hl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fr).negate(),this.translate(Fr.x,Fr.y,Fr.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];n.push(s.x,s.y,s.z||0)}this.setAttribute("position",new nn(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}if(e.length>t.count)Me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new en;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];if(un.setFromBufferAttribute(r),this.morphTargetsRelative)kt.addVectors(this.boundingBox.min,un.min),this.boundingBox.expandByPoint(kt),kt.addVectors(this.boundingBox.max,un.max),this.boundingBox.expandByPoint(kt);else this.boundingBox.expandByPoint(un.min),this.boundingBox.expandByPoint(un.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Ne('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new fn;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){let n=this.boundingSphere.center;if(un.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];if(Ps.setFromBufferAttribute(o),this.morphTargetsRelative)kt.addVectors(un.min,Ps.min),un.expandByPoint(kt),kt.addVectors(un.max,Ps.max),un.expandByPoint(kt);else un.expandByPoint(Ps.min),un.expandByPoint(Ps.max)}un.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)kt.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(kt));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],a=this.morphTargetsRelative;for(let c=0,l=o.count;c<l;c++){if(kt.fromBufferAttribute(o,c),a)Fr.fromBufferAttribute(e,c),kt.add(Fr);i=Math.max(i,n.distanceToSquared(kt))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Ne('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ne("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:r}=t,s=this.getAttribute("tangent");if(s===void 0||s.count!==n.count)s=new Nt(new Float32Array(4*n.count),4),this.setAttribute("tangent",s);let o=[],a=[];for(let R=0;R<n.count;R++)o[R]=new N,a[R]=new N;let c=new N,l=new N,u=new N,f=new Ie,h=new Ie,d=new Ie,g=new N,y=new N;function p(R,_,S){c.fromBufferAttribute(n,R),l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,S),f.fromBufferAttribute(r,R),h.fromBufferAttribute(r,_),d.fromBufferAttribute(r,S),l.sub(c),u.sub(c),h.sub(f),d.sub(f);let F=1/(h.x*d.y-d.x*h.y);if(!isFinite(F))return;g.copy(l).multiplyScalar(d.y).addScaledVector(u,-h.y).multiplyScalar(F),y.copy(u).multiplyScalar(h.x).addScaledVector(l,-d.x).multiplyScalar(F),o[R].add(g),o[_].add(g),o[S].add(g),a[R].add(y),a[_].add(y),a[S].add(y)}let m=this.groups;if(m.length===0)m=[{start:0,count:e.count}];for(let R=0,_=m.length;R<_;++R){let S=m[R],{start:F,count:C}=S;for(let z=F,J=F+C;z<J;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}let A=new N,T=new N,v=new N,w=new N;function E(R){v.fromBufferAttribute(i,R),w.copy(v);let _=o[R];A.copy(_),A.sub(v.multiplyScalar(v.dot(_))).normalize(),T.crossVectors(w,_);let F=T.dot(a[R])<0?-1:1;s.setXYZW(R,A.x,A.y,A.z,F)}for(let R=0,_=m.length;R<_;++R){let S=m[R],{start:F,count:C}=S;for(let z=F,J=F+C;z<J;z+=3)E(e.getX(z+0)),E(e.getX(z+1)),E(e.getX(z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Nt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,h=n.count;f<h;f++)n.setXYZ(f,0,0,0);let i=new N,r=new N,s=new N,o=new N,a=new N,c=new N,l=new N,u=new N;if(e)for(let f=0,h=e.count;f<h;f+=3){let d=e.getX(f+0),g=e.getX(f+1),y=e.getX(f+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,y),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,y),o.add(l),a.add(l),c.add(l),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(y,c.x,c.y,c.z)}else for(let f=0,h=t.count;f<h;f+=3)i.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),s.fromBufferAttribute(t,f+2),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),n.setXYZ(f+0,l.x,l.y,l.z),n.setXYZ(f+1,l.x,l.y,l.z),n.setXYZ(f+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)kt.fromBufferAttribute(e,t),kt.normalize(),e.setXYZ(t,kt.x,kt.y,kt.z)}toNonIndexed(){function e(o,a){let{array:c,itemSize:l,normalized:u}=o,f=new c.constructor(a.length*l),h=0,d=0;for(let g=0,y=a.length;g<y;g++){if(o.isInterleavedBufferAttribute)h=a[g]*o.data.stride+o.offset;else h=a[g]*l;for(let p=0;p<l;p++)f[d++]=c[h++]}return new Nt(f,l,u)}if(this.index===null)return Me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new tn,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],c=e(a,n);t.setAttribute(o,c)}let r=this.morphAttributes;for(let o in r){let a=[],c=r[o];for(let l=0,u=c.length;l<u;l++){let f=c[l],h=e(f,n);a.push(h)}t.morphAttributes[o]=a}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,a=s.length;o<a;o++){let c=s[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!=="")e.name=this.name;if(Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let a=this.parameters;for(let c in a)if(a[c]!==void 0)e[c]=a[c];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let a in n){let c=n[a];e.data.attributes[a]=c.toJSON(e.data)}let i={},r=!1;for(let a in this.morphAttributes){let c=this.morphAttributes[a],l=[];for(let u=0,f=c.length;u<f;u++){let h=c[u];l.push(h.toJSON(e.data))}if(l.length>0)i[a]=l,r=!0}if(r)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;if(s.length>0)e.data.groups=JSON.parse(JSON.stringify(s));let o=this.boundingSphere;if(o!==null)e.data.boundingSphere=o.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let c in i){let l=i[c];this.setAttribute(c,l.clone(t))}let r=e.morphAttributes;for(let c in r){let l=[],u=r[c];for(let f=0,h=u.length;f<h;f++)l.push(u[f].clone(t));this.morphAttributes[c]=l}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let c=0,l=s.length;c<l;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;if(o!==null)this.boundingBox=o.clone();let a=e.boundingSphere;if(a!==null)this.boundingSphere=a.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class qs{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=Dn()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Dn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Dn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var Qt=new N;class ts{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Qt.fromBufferAttribute(this,t),Qt.applyMatrix4(e),this.setXYZ(t,Qt.x,Qt.y,Qt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Qt.fromBufferAttribute(this,t),Qt.applyNormalMatrix(e),this.setXYZ(t,Qt.x,Qt.y,Qt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Qt.fromBufferAttribute(this,t),Qt.transformDirection(e),this.setXYZ(t,Qt.x,Qt.y,Qt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=Nn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=rt(n,this.array);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=Nn(t,this.array);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=Nn(t,this.array);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=Nn(t,this.array);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=Nn(t,this.array);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array),r=rt(r,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){zs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Nt(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new ts(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){zs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var Ey=0;class rn extends zn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ey++}),this.uuid=Dn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Le(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Me(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!=="")n.name=this.name;if(this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)n.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.shadowSide!==null)n.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)n.blending=this.blending;if(this.side!==0)n.side=this.side;if(this.vertexColors===!0)n.vertexColors=!0;if(this.opacity<1)n.opacity=this.opacity;if(this.transparent===!0)n.transparent=!0;if(this.blendSrc!==204)n.blendSrc=this.blendSrc;if(this.blendDst!==205)n.blendDst=this.blendDst;if(this.blendEquation!==100)n.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)n.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)n.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)n.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)n.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)n.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)n.depthFunc=this.depthFunc;if(this.depthTest===!1)n.depthTest=this.depthTest;if(this.depthWrite===!1)n.depthWrite=this.depthWrite;if(this.colorWrite===!1)n.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)n.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)n.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)n.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)n.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)n.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)n.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)n.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)n.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)n.rotation=this.rotation;if(this.polygonOffset===!0)n.polygonOffset=!0;if(this.polygonOffsetFactor!==0)n.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)n.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)n.linewidth=this.linewidth;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.dithering===!0)n.dithering=!0;if(this.alphaTest>0)n.alphaTest=this.alphaTest;if(this.alphaHash===!0)n.alphaHash=!0;if(this.alphaToCoverage===!0)n.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)n.premultipliedAlpha=!0;if(this.forceSinglePass===!0)n.forceSinglePass=!0;if(this.allowOverride===!1)n.allowOverride=!1;if(this.wireframe===!0)n.wireframe=!0;if(this.wireframeLinewidth>1)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)n.flatShading=!0;if(this.visible===!1)n.visible=!1;if(this.toneMapped===!1)n.toneMapped=!1;if(this.fog===!1)n.fog=!1;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(r){let s=[];for(let o in r){let a=r[o];delete a.metadata,s.push(a)}return s}if(t){let r=i(e.textures),s=i(e.images);if(r.length>0)n.textures=r;if(s.length>0)n.images=s}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Le().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessRange=e.iridescenceThicknessRange;if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new Ie().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new Ie().fromArray(e.clearcoatNormalScale);if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}}var ui=new N,fl=new N,Yo=new N,Pi=new N,dl=new N,jo=new N,pl=new N;class zi{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ui)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ui.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return ui.copy(this.origin).addScaledVector(this.direction,t),ui.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){fl.copy(e).add(t).multiplyScalar(0.5),Yo.copy(t).sub(e).normalize(),Pi.copy(this.origin).sub(fl);let r=e.distanceTo(t)*0.5,s=-this.direction.dot(Yo),o=Pi.dot(this.direction),a=-Pi.dot(Yo),c=Pi.lengthSq(),l=Math.abs(1-s*s),u,f,h,d;if(l>0)if(u=s*a-o,f=s*o-a,d=r*l,u>=0)if(f>=-d)if(f<=d){let g=1/l;u*=g,f*=g,h=u*(u+s*f+2*o)+f*(s*u+f+2*a)+c}else f=r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;else f=-r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;else if(f<=-d)u=Math.max(0,-(-s*r+o)),f=u>0?-r:Math.min(Math.max(-r,-a),r),h=-u*u+f*(f+2*a)+c;else if(f<=d)u=0,f=Math.min(Math.max(-r,-a),r),h=f*(f+2*a)+c;else u=Math.max(0,-(s*r+o)),f=u>0?r:Math.min(Math.max(-r,-a),r),h=-u*u+f*(f+2*a)+c;else f=s>0?-r:r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;if(n)n.copy(this.origin).addScaledVector(this.direction,u);if(i)i.copy(fl).addScaledVector(Yo,f);return h}intersectSphere(e,t){ui.subVectors(e.center,this.origin);let n=ui.dot(this.direction),i=ui.dot(ui)-n*n,r=e.radius*e.radius;if(i>r)return null;let s=Math.sqrt(r-i),o=n-s,a=n+s;if(a<0)return null;if(o<0)return this.at(a,t);return this.at(o,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,r,s,o,a,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,f=this.origin;if(c>=0)n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c;else n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c;if(l>=0)r=(e.min.y-f.y)*l,s=(e.max.y-f.y)*l;else r=(e.max.y-f.y)*l,s=(e.min.y-f.y)*l;if(n>s||r>i)return null;if(r>n||isNaN(n))n=r;if(s<i||isNaN(i))i=s;if(u>=0)o=(e.min.z-f.z)*u,a=(e.max.z-f.z)*u;else o=(e.max.z-f.z)*u,a=(e.min.z-f.z)*u;if(n>a||o>i)return null;if(o>n||n!==n)n=o;if(a<i||i!==i)i=a;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ui)!==null}intersectTriangle(e,t,n,i,r){dl.subVectors(t,e),jo.subVectors(n,e),pl.crossVectors(dl,jo);let s=this.direction.dot(pl),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;Pi.subVectors(this.origin,e);let a=o*this.direction.dot(jo.crossVectors(Pi,jo));if(a<0)return null;let c=o*this.direction.dot(dl.cross(Pi));if(c<0)return null;if(a+c>s)return null;let l=-o*Pi.dot(pl);if(l<0)return null;return this.at(l/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Kn extends rn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new qn,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}var qm=new ze,sr=new zi,Jo=new fn,Ym=new N,Ko=new N,Qo=new N,ea=new N,ml=new N,ta=new N,jm=new N,na=new N;class pt extends at{constructor(e=new tn,t=new Kn){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){ta.set(0,0,0);for(let a=0,c=r.length;a<c;a++){let l=o[a],u=r[a];if(l===0)continue;if(ml.fromBufferAttribute(u,e),s)ta.addScaledVector(ml,l);else ta.addScaledVector(ml.sub(t),l)}t.add(ta)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(Jo.copy(n.boundingSphere),Jo.applyMatrix4(r),sr.copy(e.ray).recast(e.near),Jo.containsPoint(sr.origin)===!1){if(sr.intersectSphere(Jo,Ym)===null)return;if(sr.origin.distanceToSquared(Ym)>(e.far-e.near)**2)return}if(qm.copy(r).invert(),sr.copy(e.ray).applyMatrix4(qm),n.boundingBox!==null){if(sr.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,sr)}_computeIntersections(e,t,n){let i,r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,c=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,{groups:f,drawRange:h}=r;if(o!==null)if(Array.isArray(s))for(let d=0,g=f.length;d<g;d++){let y=f[d],p=s[y.materialIndex],m=Math.max(y.start,h.start),A=Math.min(o.count,Math.min(y.start+y.count,h.start+h.count));for(let T=m,v=A;T<v;T+=3){let w=o.getX(T),E=o.getX(T+1),R=o.getX(T+2);if(i=ia(this,p,e,n,c,l,u,w,E,R),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let d=Math.max(0,h.start),g=Math.min(o.count,h.start+h.count);for(let y=d,p=g;y<p;y+=3){let m=o.getX(y),A=o.getX(y+1),T=o.getX(y+2);if(i=ia(this,s,e,n,c,l,u,m,A,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}else if(a!==void 0)if(Array.isArray(s))for(let d=0,g=f.length;d<g;d++){let y=f[d],p=s[y.materialIndex],m=Math.max(y.start,h.start),A=Math.min(a.count,Math.min(y.start+y.count,h.start+h.count));for(let T=m,v=A;T<v;T+=3){let w=T,E=T+1,R=T+2;if(i=ia(this,p,e,n,c,l,u,w,E,R),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let d=Math.max(0,h.start),g=Math.min(a.count,h.start+h.count);for(let y=d,p=g;y<p;y+=3){let m=y,A=y+1,T=y+2;if(i=ia(this,s,e,n,c,l,u,m,A,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}}}function Ay(e,t,n,i,r,s,o,a){let c;if(t.side===1)c=i.intersectTriangle(o,s,r,!0,a);else c=i.intersectTriangle(r,s,o,t.side===0,a);if(c===null)return null;na.copy(a),na.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(na);if(l<n.near||l>n.far)return null;return{distance:l,point:na.clone(),object:e}}function ia(e,t,n,i,r,s,o,a,c,l){e.getVertexPosition(a,Ko),e.getVertexPosition(c,Qo),e.getVertexPosition(l,ea);let u=Ay(e,t,n,i,Ko,Qo,ea,jm);if(u){let f=new N;if(yn.getBarycoord(jm,Ko,Qo,ea,f),r)u.uv=yn.getInterpolatedAttribute(r,a,c,l,f,new Ie);if(s)u.uv1=yn.getInterpolatedAttribute(s,a,c,l,f,new Ie);if(o){if(u.normal=yn.getInterpolatedAttribute(o,a,c,l,f,new N),u.normal.dot(i.direction)>0)u.normal.multiplyScalar(-1)}let h={a,b:c,c:l,normal:new N,materialIndex:0};yn.getNormal(Ko,Qo,ea,h.normal),u.face=h,u.barycoord=f}return u}var Ls=new st,Jm=new st,Km=new st,Ry=new st,Qm=new ze,ra=new N,gl=new fn,eg=new ze,_l=new zi;class Na extends pt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ze,this.bindMatrixInverse=new ze,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new en;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ra),this.boundingBox.expandByPoint(ra)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new fn;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ra),this.boundingSphere.expandByPoint(ra)}copy(e,t){if(super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(gl.copy(this.boundingSphere),gl.applyMatrix4(i),e.ray.intersectsSphere(gl)===!1)return;if(eg.copy(i).invert(),_l.copy(e.ray).applyMatrix4(eg),this.boundingBox!==null){if(_l.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,_l)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();if(r!==1/0)e.multiplyScalar(r);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Me("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(Jm.fromBufferAttribute(i.attributes.skinIndex,e),Km.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)Ls.copy(t),t.set(0,0,0,0);else Ls.set(...t,1),t.set(0,0,0);Ls.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let s=Km.getComponent(r);if(s!==0){let o=Jm.getComponent(r);Qm.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Ry.copy(Ls).applyMatrix4(Qm),s)}}if(t.isVector4)t.w=Ls.w;return t.applyMatrix4(this.bindMatrixInverse)}}class Ys extends at{constructor(){super();this.isBone=!0,this.type="Bone"}}class js extends wt{constructor(e=null,t=1,n=1,i,r,s,o,a,c=1003,l=1003,u,f){super(null,s,o,a,c,l,i,r,u,f);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var tg=new ze,Cy=new ze;class Js{constructor(e=[],t=[]){this.uuid=Dn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Me("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ze)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new ze;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=e.length;r<s;r++){let o=e[r]?e[r].matrixWorld:Cy;tg.multiplyMatrices(o,t[r]),tg.toArray(n,r*16)}if(i!==null)i.needsUpdate=!0}clone(){return new Js(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new js(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],s=t[r];if(s===void 0)Me("Skeleton: No bone found with UUID:",r),s=new Ys;this.bones.push(s),this.boneInverses.push(new ze().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let s=t[i];e.bones.push(s.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}}class lr extends Nt{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}var zr=new ze,ng=new ze,sa=[],ig=new en,Iy=new ze,Ns=new pt,Ds=new fn;class ns extends pt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new lr(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Iy)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new en;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,zr),ig.copy(e.boundingBox).applyMatrix4(zr),this.boundingBox.union(ig)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new fn;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,zr),Ds.copy(e.boundingSphere).applyMatrix4(zr),this.boundingSphere.union(Ds)}copy(e,t){if(super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null)this.morphTexture=e.morphTexture.clone();if(e.instanceColor!==null)this.instanceColor=e.instanceColor.clone();if(this.count=e.count,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,s=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[s+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Ns.geometry=this.geometry,Ns.material=this.material,Ns.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Ds.copy(this.boundingSphere),Ds.applyMatrix4(n),e.ray.intersectsSphere(Ds)===!1)return;for(let r=0;r<i;r++){this.getMatrixAt(r,zr),ng.multiplyMatrices(n,zr),Ns.matrixWorld=ng,Ns.raycast(e,sa);for(let s=0,o=sa.length;s<o;s++){let a=sa[s];a.instanceId=r,a.object=this,t.push(a)}sa.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new lr(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new js(new Float32Array(i*this.count),i,this.count,1028,1015);let r=this.morphTexture.source.data.data,s=0;for(let c=0;c<n.length;c++)s+=n[c];let o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;return r[a]=o,r.set(n,a+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var xl=new N,Py=new N,Ly=new Ue;class Ln{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=xl.subVectors(n,t).cross(Py.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(xl),r=this.normal.dot(i);if(r===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let s=-(e.start.dot(this.normal)+this.constant)/r;if(n===!0&&(s<0||s>1))return null;return t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Ly.getNormalMatrix(e),i=this.coplanarPoint(xl).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}var or=new fn,Ny=new Ie(0.5,0.5),oa=new N;class Ks{constructor(e=new Ln,t=new Ln,n=new Ln,i=new Ln,r=new Ln,s=new Ln){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],c=r[3],l=r[4],u=r[5],f=r[6],h=r[7],d=r[8],g=r[9],y=r[10],p=r[11],m=r[12],A=r[13],T=r[14],v=r[15];if(i[0].setComponents(c-s,h-l,p-d,v-m).normalize(),i[1].setComponents(c+s,h+l,p+d,v+m).normalize(),i[2].setComponents(c+o,h+u,p+g,v+A).normalize(),i[3].setComponents(c-o,h-u,p-g,v-A).normalize(),n)i[4].setComponents(a,f,y,T).normalize(),i[5].setComponents(c-a,h-f,p-y,v-T).normalize();else if(i[4].setComponents(c-a,h-f,p-y,v-T).normalize(),t===2000)i[5].setComponents(c+a,h+f,p+y,v+T).normalize();else if(t===2001)i[5].setComponents(a,f,y,T).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();or.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();or.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(or)}intersectsSprite(e){or.center.set(0,0,0);let t=Ny.distanceTo(e.center);return or.radius=0.7071067811865476+t,or.applyMatrix4(e.matrixWorld),this.intersectsSphere(or)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(oa.x=i.normal.x>0?e.max.x:e.min.x,oa.y=i.normal.y>0?e.max.y:e.min.y,oa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(oa)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Qs extends rn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}var pa=new N,ma=new N,rg=new ze,Us=new zi,aa=new fn,vl=new N,sg=new N;class ki extends at{constructor(e=new tn,t=new Qs){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)pa.fromBufferAttribute(t,i-1),ma.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=pa.distanceTo(ma);e.setAttribute("lineDistance",new nn(n,1))}else Me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(aa.copy(n.boundingSphere),aa.applyMatrix4(i),aa.radius+=r,e.ray.intersectsSphere(aa)===!1)return;rg.copy(i).invert(),Us.copy(e.ray).applyMatrix4(rg);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=this.isLineSegments?2:1,l=n.index,f=n.attributes.position;if(l!==null){let h=Math.max(0,s.start),d=Math.min(l.count,s.start+s.count);for(let g=h,y=d-1;g<y;g+=c){let p=l.getX(g),m=l.getX(g+1),A=ca(this,e,Us,a,p,m,g);if(A)t.push(A)}if(this.isLineLoop){let g=l.getX(d-1),y=l.getX(h),p=ca(this,e,Us,a,g,y,d-1);if(p)t.push(p)}}else{let h=Math.max(0,s.start),d=Math.min(f.count,s.start+s.count);for(let g=h,y=d-1;g<y;g+=c){let p=ca(this,e,Us,a,g,g+1,g);if(p)t.push(p)}if(this.isLineLoop){let g=ca(this,e,Us,a,d-1,h,d-1);if(g)t.push(g)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function ca(e,t,n,i,r,s,o){let a=e.geometry.attributes.position;if(pa.fromBufferAttribute(a,r),ma.fromBufferAttribute(a,s),n.distanceSqToSegment(pa,ma,vl,sg)>i)return;vl.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(vl);if(l<t.near||l>t.far)return;return{distance:l,point:sg.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var og=new N,ag=new N;class Da extends ki{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)og.fromBufferAttribute(t,i),ag.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+og.distanceTo(ag);e.setAttribute("lineDistance",new nn(n,1))}else Me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ua extends ki{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}}class eo extends rn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}var cg=new ze,Sl=new zi,la=new fn,ua=new N;class is extends at{constructor(e=new tn,t=new eo){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(la.copy(n.boundingSphere),la.applyMatrix4(i),la.radius+=r,e.ray.intersectsSphere(la)===!1)return;cg.copy(i).invert(),Sl.copy(e.ray).applyMatrix4(cg);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=n.index,u=n.attributes.position;if(c!==null){let f=Math.max(0,s.start),h=Math.min(c.count,s.start+s.count);for(let d=f,g=h;d<g;d++){let y=c.getX(d);ua.fromBufferAttribute(u,y),lg(ua,y,a,i,e,t,this)}}else{let f=Math.max(0,s.start),h=Math.min(u.count,s.start+s.count);for(let d=f,g=h;d<g;d++)ua.fromBufferAttribute(u,d),lg(ua,d,a,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function lg(e,t,n,i,r,s,o){let a=Sl.distanceSqToPoint(e);if(a<n){let c=new N;Sl.closestPointToPoint(e,c),c.applyMatrix4(i);let l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class Oa extends wt{constructor(e=[],t=301,n,i,r,s,o,a,c,l){super(e,t,n,i,r,s,o,a,c,l);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Bi extends wt{constructor(e,t,n=1014,i,r,s,o=1003,a=1003,c,l=1026,u=1){if(l!==1026&&l!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let f={width:e,height:t,depth:u};super(f,i,r,s,o,a,l,n,c);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Zs(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);if(this.compareFunction!==null)t.compareFunction=this.compareFunction;return t}}class Eu extends Bi{constructor(e,t=1014,n=301,i,r,s=1003,o=1003,a,c=1026){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,i,r,s,o,a,c);this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Fa extends wt{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Gi extends tn{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};let o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);let a=[],c=[],l=[],u=[],f=0,h=0;d("z","y","x",-1,-1,n,t,e,s,r,0),d("z","y","x",1,-1,n,t,-e,s,r,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new nn(c,3)),this.setAttribute("normal",new nn(l,3)),this.setAttribute("uv",new nn(u,2));function d(g,y,p,m,A,T,v,w,E,R,_){let S=T/E,F=v/R,C=T/2,z=v/2,J=w/2,O=E+1,H=R+1,V=0,U=0,K=new N;for(let Q=0;Q<H;Q++){let se=Q*F-z;for(let me=0;me<O;me++){let _e=me*S-C;K[g]=_e*m,K[y]=se*A,K[p]=J,c.push(K.x,K.y,K.z),K[g]=0,K[y]=0,K[p]=w>0?1:-1,l.push(K.x,K.y,K.z),u.push(me/E),u.push(1-Q/R),V+=1}}for(let Q=0;Q<R;Q++)for(let se=0;se<E;se++){let me=f+se+O*Q,_e=f+se+O*(Q+1),qe=f+(se+1)+O*(Q+1),Ge=f+(se+1)+O*Q;a.push(me,_e,Ge),a.push(_e,qe,Ge),U+=6}o.addGroup(h,U,_),h+=U,f+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class to extends tn{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),c=o+1,l=a+1,u=e/o,f=t/a,h=[],d=[],g=[],y=[];for(let p=0;p<l;p++){let m=p*f-s;for(let A=0;A<c;A++){let T=A*u-r;d.push(T,-m,0),g.push(0,0,1),y.push(A/o),y.push(1-p/a)}}for(let p=0;p<a;p++)for(let m=0;m<o;m++){let A=m+c*p,T=m+c*(p+1),v=m+1+c*(p+1),w=m+1+c*p;h.push(A,T,w),h.push(T,v,w)}this.setIndex(h),this.setAttribute("position",new nn(d,3)),this.setAttribute("normal",new nn(g,3)),this.setAttribute("uv",new nn(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new to(e.width,e.height,e.widthSegments,e.heightSegments)}}function gr(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let r=e[n][i];if(ug(r))if(r.isRenderTargetTexture)Me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=r.clone();else if(Array.isArray(r))if(ug(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();t[n][i]=s}else t[n][i]=r.slice();else t[n][i]=r}}return t}function jt(e){let t={};for(let n=0;n<e.length;n++){let i=gr(e[n]);for(let r in i)t[r]=i[r]}return t}function ug(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Dy(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Au(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return We.workingColorSpace}var g_={clone:gr,merge:jt},Uy=`void main() {
+*/var bt=Uint8Array,hn=Uint16Array,Pl=Int32Array,ca=new bt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),la=new bt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tl=new bt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hg=function(e,t){var n=new hn(31);for(var i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Pl(n[30]);for(var i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return{b:n,r}},Vg=Hg(ca,2),{b:$g,r:El}=Vg;$g[28]=258,El[258]=28;var Wg=Hg(la,0),{b:Mb,r:Ug}=Wg,Al=new hn(32768);for(je=0;je<32768;++je)Yn=(je&43690)>>1|(je&21845)<<1,Yn=(Yn&52428)>>2|(Yn&13107)<<2,Yn=(Yn&61680)>>4|(Yn&3855)<<4,Al[je]=((Yn&65280)>>8|(Yn&255)<<8)>>1;var Yn,je,Jn=function(e,t,n){var i=e.length,r=0,s=new hn(t);for(;r<i;++r)if(e[r])++s[e[r]-1];var o=new hn(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(n){a=new hn(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r]){var l=r<<4|e[r],u=t-e[r],h=o[e[r]-1]++<<u;for(var f=h|(1<<u)-1;h<=f;++h)a[Al[h]>>c]=l}}else{a=new hn(i);for(r=0;r<i;++r)if(e[r])a[r]=Al[o[e[r]-1]++]>>15-e[r]}return a},Di=new bt(288);for(je=0;je<144;++je)Di[je]=8;var je;for(je=144;je<256;++je)Di[je]=9;var je;for(je=256;je<280;++je)Di[je]=7;var je;for(je=280;je<288;++je)Di[je]=8;var je,zs=new bt(32);for(je=0;je<32;++je)zs[je]=5;var je,wb=Jn(Di,9,0),Tb=Jn(Di,9,1),Eb=Jn(zs,5,0),Ab=Jn(zs,5,1),bl=function(e){var t=e[0];for(var n=1;n<e.length;++n)if(e[n]>t)t=e[n];return t},Pn=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},Sl=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Ll=function(e){return(e+7)/8|0},ks=function(e,t,n){if(t==null||t<0)t=0;if(n==null||n>e.length)n=e.length;return new bt(e.subarray(t,n))};var Rb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qt=function(e,t,n){var i=Error(t||Rb[e]);if(i.code=e,Error.captureStackTrace)Error.captureStackTrace(i,Qt);if(!n)throw i;return i},Cb=function(e,t,n,i){var r=e.length,s=i?i.length:0;if(!r||t.f&&!t.l)return n||new bt(0);var o=!n,a=o||t.i!=2,c=t.i;if(o)n=new bt(r*3);var l=function(Ue){var ke=n.length;if(Ue>ke){var Ke=new bt(Math.max(ke*2,Ue));Ke.set(n),n=Ke}},u=t.f||0,h=t.p||0,f=t.b||0,{l:d,d:m,m:x,n:p}=t,g=r*8;do{if(!d){u=Pn(e,h,1);var A=Pn(e,h+1,3);if(h+=3,!A){var E=Ll(h)+4,y=e[E-4]|e[E-3]<<8,w=E+y;if(w>r){if(c)Qt(0);break}if(a)l(f+y);n.set(e.subarray(E,w),f),t.b=f+=y,t.p=h=w*8,t.f=u;continue}else if(A==1)d=Tb,m=Ab,x=9,p=5;else if(A==2){var T=Pn(e,h,31)+257,R=Pn(e,h+10,15)+4,_=T+Pn(e,h+5,31)+1;h+=14;var S=new bt(_),U=new bt(19);for(var C=0;C<R;++C)U[Tl[C]]=Pn(e,h+C*3,7);h+=R*3;var z=bl(U),j=(1<<z)-1,F=Jn(U,z,1);for(var C=0;C<_;){var H=F[Pn(e,h,j)];h+=H&15;var E=H>>4;if(E<16)S[C++]=E;else{var V=0,O=0;if(E==16)O=3+Pn(e,h,3),h+=2,V=S[C-1];else if(E==17)O=3+Pn(e,h,7),h+=3;else if(E==18)O=11+Pn(e,h,127),h+=7;while(O--)S[C++]=V}}var K=S.subarray(0,T),Q=S.subarray(T);x=bl(K),p=bl(Q),d=Jn(K,x,1),m=Jn(Q,p,1)}else Qt(1);if(h>g){if(c)Qt(0);break}}if(a)l(f+131072);var se=(1<<x)-1,me=(1<<p)-1,_e=h;for(;;_e=h){var V=d[Sl(e,h)&se],qe=V>>4;if(h+=V&15,h>g){if(c)Qt(0);break}if(!V)Qt(2);if(qe<256)n[f++]=qe;else if(qe==256){_e=h,d=null;break}else{var Ge=qe-254;if(qe>264){var C=qe-257,Z=ca[C];Ge=Pn(e,h,(1<<Z)-1)+$g[C],h+=Z}var ne=m[Sl(e,h)&me],fe=ne>>4;if(!ne)Qt(3);h+=ne&15;var Q=Mb[fe];if(fe>3){var Z=la[fe];Q+=Sl(e,h)&(1<<Z)-1,h+=Z}if(h>g){if(c)Qt(0);break}if(a)l(f+131072);var de=f+Ge;if(f<Q){var Re=s-Q,Ze=Math.min(Q,de);if(Re+f<0)Qt(3);for(;f<Ze;++f)n[f]=i[Re+f]}for(;f<de;++f)n[f]=n[f-Q]}}if(t.l=d,t.p=_e,t.b=f,t.f=u,d)u=1,t.m=x,t.d=m,t.n=p}while(!u);return f!=n.length&&o?ks(n,0,f):n.subarray(0,f)},pi=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},Us=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},Ml=function(e,t){var n=[];for(var i=0;i<e.length;++i)if(e[i])n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return{t:Xg,l:0};if(r==1){var o=new bt(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(w,T){return w.f-T.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,h=2;n[0]={s:-1,f:a.f+c.f,l:a,r:c};while(u!=r-1)a=n[n[l].f<n[h].f?l++:h++],c=n[l!=u&&n[l].f<n[h].f?l++:h++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var f=s[0].s;for(var i=1;i<r;++i)if(s[i].s>f)f=s[i].s;var d=new hn(f+1),m=Rl(n[u-1],d,0);if(m>t){var i=0,x=0,p=m-t,g=1<<p;s.sort(function(T,R){return d[R.s]-d[T.s]||T.f-R.f});for(;i<r;++i){var A=s[i].s;if(d[A]>t)x+=g-(1<<m-d[A]),d[A]=t;else break}x>>=p;while(x>0){var E=s[i].s;if(d[E]<t)x-=1<<t-d[E]++-1;else++i}for(;i>=0&&x;--i){var y=s[i].s;if(d[y]==t)--d[y],++x}m=t}return{t:new bt(d),l:m}},Rl=function(e,t,n){return e.s==-1?Math.max(Rl(e.l,t,n+1),Rl(e.r,t,n+1)):t[e.s]=n},Fg=function(e){var t=e.length;while(t&&!e[--t]);var n=new hn(++t),i=0,r=e[0],s=1,o=function(c){n[i++]=c};for(var a=1;a<=t;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);if(s>2)o(s>10?s-11<<5|28690:s-3<<5|12305),s=0}else if(s>3){o(r),--s;for(;s>6;s-=6)o(8304);if(s>2)o(s-3<<5|8208),s=0}while(s--)o(r);s=1,r=e[a]}return{c:n.subarray(0,i),n:t}},Fs=function(e,t){var n=0;for(var i=0;i<t.length;++i)n+=e[i]*t[i];return n},Zg=function(e,t,n){var i=n.length,r=Ll(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var s=0;s<i;++s)e[r+s+4]=n[s];return(r+4+i)*8},zg=function(e,t,n,i,r,s,o,a,c,l,u){pi(t,u++,n),++r[256];var h=Ml(r,15),{t:f,l:d}=h,m=Ml(s,15),{t:x,l:p}=m,g=Fg(f),{c:A,n:E}=g,y=Fg(x),{c:w,n:T}=y,R=new hn(19);for(var _=0;_<A.length;++_)++R[A[_]&31];for(var _=0;_<w.length;++_)++R[w[_]&31];var S=Ml(R,7),{t:U,l:C}=S,z=19;for(;z>4&&!U[Tl[z-1]];--z);var j=l+5<<3,F=Fs(r,Di)+Fs(s,zs)+o,H=Fs(r,f)+Fs(s,x)+o+14+3*z+Fs(R,U)+2*R[16]+3*R[17]+7*R[18];if(c>=0&&j<=F&&j<=H)return Zg(t,u,e.subarray(c,c+l));var V,O,K,Q;if(pi(t,u,1+(H<F)),u+=2,H<F){V=Jn(f,d,0),O=f,K=Jn(x,p,0),Q=x;var se=Jn(U,C,0);pi(t,u,E-257),pi(t,u+5,T-1),pi(t,u+10,z-4),u+=14;for(var _=0;_<z;++_)pi(t,u+3*_,U[Tl[_]]);u+=3*z;var me=[A,w];for(var _e=0;_e<2;++_e){var qe=me[_e];for(var _=0;_<qe.length;++_){var Ge=qe[_]&31;if(pi(t,u,se[Ge]),u+=U[Ge],Ge>15)pi(t,u,qe[_]>>5&127),u+=qe[_]>>12}}}else V=wb,O=Di,K=Eb,Q=zs;for(var _=0;_<a;++_){var Z=i[_];if(Z>255){var Ge=Z>>18&31;if(Us(t,u,V[Ge+257]),u+=O[Ge+257],Ge>7)pi(t,u,Z>>23&31),u+=ca[Ge];var ne=Z&31;if(Us(t,u,K[ne]),u+=Q[ne],ne>3)Us(t,u,Z>>5&8191),u+=la[ne]}else Us(t,u,V[Z]),u+=O[Z]}return Us(t,u,V[256]),u+O[256]},Ib=new Pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xg=new bt(0),Pb=function(e,t,n,i,r,s){var o=s.z||e.length,a=new bt(i+o+5*(1+Math.ceil(o/7000))+r),c=a.subarray(i,a.length-r),l=s.l,u=(s.r||0)&7;if(t){if(u)c[0]=s.r>>3;var h=Ib[t-1],f=h>>13,d=h&8191,m=(1<<n)-1,x=s.p||new hn(32768),p=s.h||new hn(m+1),g=Math.ceil(n/3),A=2*g,E=function(Ye){return(e[Ye]^e[Ye+1]<<g^e[Ye+2]<<A)&m},y=new Pl(25000),w=new hn(288),T=new hn(32),R=0,_=0,S=s.i||0,U=0,C=s.w||0,z=0;for(;S+2<o;++S){var j=E(S),F=S&32767,H=p[j];if(x[F]=H,p[j]=F,C<=S){var V=o-S;if((R>7000||U>24576)&&(V>423||!l)){u=zg(e,c,0,y,w,T,_,U,z,S-z,u),U=R=_=0,z=S;for(var O=0;O<286;++O)w[O]=0;for(var O=0;O<30;++O)T[O]=0}var K=2,Q=0,se=d,me=F-H&32767;if(V>2&&j==E(S-me)){var _e=Math.min(f,V)-1,qe=Math.min(32767,S),Ge=Math.min(258,V);while(me<=qe&&--se&&F!=H){if(e[S+K]==e[S+K-me]){var Z=0;for(;Z<Ge&&e[S+Z]==e[S+Z-me];++Z);if(Z>K){if(K=Z,Q=me,Z>_e)break;var ne=Math.min(me,Z-2),fe=0;for(var O=0;O<ne;++O){var de=S-me+O&32767,Re=x[de],Ze=de-Re&32767;if(Ze>fe)fe=Ze,H=de}}}F=H,H=x[F],me+=F-H&32767}}if(Q){y[U++]=268435456|El[K]<<18|Ug[Q];var Ue=El[K]&31,ke=Ug[Q]&31;_+=ca[Ue]+la[ke],++w[257+Ue],++T[ke],C=S+K,++R}else y[U++]=e[S],++w[e[S]]}}for(S=Math.max(S,C);S<o;++S)y[U++]=e[S],++w[e[S]];if(u=zg(e,c,l,y,w,T,_,U,z,S-z,u),!l)s.r=u&7|c[u/8|0]<<3,u-=7,s.h=p,s.p=x,s.i=S,s.w=C}else{for(var S=s.w||0;S<o+l;S+=65535){var Ke=S+65535;if(Ke>=o)c[u/8|0]=l,Ke=o;u=Zg(c,u+1,e.subarray(S,Ke))}s.i=o}return ks(a,0,i+Ll(u)+r)},Lb=function(){var e=new Int32Array(256);for(var t=0;t<256;++t){var n=t,i=9;while(--i)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),Nb=function(){var e=-1;return{p:function(t){var n=e;for(var i=0;i<t.length;++i)n=Lb[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var Db=function(e,t,n,i,r){if(!r){if(r={l:1},t.dictionary){var s=t.dictionary.subarray(-32768),o=new bt(s.length+e.length);o.set(s),o.set(e,s.length),e=o,r.w=s.length}}return Pb(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},qg=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var jn=function(e,t){return e[t]|e[t+1]<<8},Ln=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},wl=function(e,t){return Ln(e,t)+Ln(e,t+4)*4294967296},$t=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ob(e,t){return Db(e,t||{},0,0)}function Ub(e,t){return Cb(e,{i:2},t&&t.out,t&&t.dictionary)}var Yg=function(e,t,n,i){for(var r in e){var s=e[r],o=t+r,a=i;if(Array.isArray(s))a=qg(i,s[1]),s=s[0];if(s instanceof bt)n[o]=[s,a];else n[o+="/"]=[new bt(0),a],Yg(s,o,n,i)}},kg=typeof TextEncoder<"u"&&new TextEncoder,Cl=typeof TextDecoder<"u"&&new TextDecoder,Fb=0;try{Cl.decode(Xg,{stream:!0}),Fb=1}catch(e){}var zb=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return{s:t,r:ks(e,n-1)};if(!r)t+=String.fromCharCode(i);else if(r==3)i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023);else if(r&1)t+=String.fromCharCode((i&31)<<6|e[n++]&63);else t+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63)}};function Bg(e,t){if(t){var n=new bt(e.length);for(var i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(kg)return kg.encode(e);var r=e.length,s=new bt(e.length+(e.length>>1)),o=0,a=function(u){s[o++]=u};for(var i=0;i<r;++i){if(o+5>s.length){var c=new bt(o+8+(r-i<<1));c.set(s),s=c}var l=e.charCodeAt(i);if(l<128||t)a(l);else if(l<2048)a(192|l>>6),a(128|l&63);else if(l>55295&&l<57344)l=65536+(l&1047552)|e.charCodeAt(++i)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63);else a(224|l>>12),a(128|l>>6&63),a(128|l&63)}return ks(s,0,o)}function kb(e,t){if(t){var n="";for(var i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}else if(Cl)return Cl.decode(e);else{var r=zb(e),{s,r:n}=r;if(n.length)Qt(8);return s}}var Bb=function(e,t){return t+30+jn(e,t+26)+jn(e,t+28)},Gb=function(e,t,n){var i=jn(e,t+28),r=kb(e.subarray(t+46,t+46+i),!(jn(e,t+8)&2048)),s=t+46+i,o=Ln(e,t+20),a=n&&o==4294967295?Hb(e,s):[o,Ln(e,t+24),Ln(e,t+42)],c=a[0],l=a[1],u=a[2];return[jn(e,t+10),c,l,r,s+jn(e,t+30)+jn(e,t+32),u]},Hb=function(e,t){for(;jn(e,t)!=1;t+=4+jn(e,t+2));return[wl(e,t+12),wl(e,t+4),wl(e,t+20)]},Il=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;if(i>65535)Qt(9);t+=i+4}return t},Gg=function(e,t,n,i,r,s,o,a){var c=i.length,l=n.extra,u=a&&a.length,h=Il(l);if($t(e,t,o!=null?33639248:67324752),t+=4,o!=null)e[t++]=20,e[t++]=n.os;e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),d=f.getFullYear()-1980;if(d<0||d>119)Qt(10);if($t(e,t,d<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,s!=-1)$t(e,t,n.crc),$t(e,t+4,s<0?-s-2:s),$t(e,t+8,n.size);if($t(e,t+12,c),$t(e,t+14,h),t+=16,o!=null)$t(e,t,u),$t(e,t+6,n.attrs),$t(e,t+10,o),t+=14;if(e.set(i,t),t+=c,h)for(var m in l){var x=l[m],p=x.length;$t(e,t,+m),$t(e,t+2,p),e.set(x,t+4),t+=4+p}if(u)e.set(a,t),t+=u;return t},Vb=function(e,t,n,i,r){$t(e,t,101010256),$t(e,t+8,n),$t(e,t+10,n),$t(e,t+12,i),$t(e,t+16,r)};function jg(e,t){if(!t)t={};var n={},i=[];Yg(e,"",n,t);var r=0,s=0;for(var o in n){var a=n[o],c=a[0],l=a[1],u=l.level==0?0:8,h=Bg(o),f=h.length,d=l.comment,m=d&&Bg(d),x=m&&m.length,p=Il(l.extra);if(f>65535)Qt(11);var g=u?Ob(c,l):c,A=g.length,E=Nb();E.p(c),i.push(qg(l,{size:c.length,crc:E.d(),c:g,f:h,m,u:f!=o.length||m&&d.length!=x,o:r,compression:u})),r+=30+f+p+A,s+=76+2*(f+p)+(x||0)+A}var y=new bt(s+22),w=r,T=s-r;for(var R=0;R<i.length;++R){var h=i[R];Gg(y,h.o,h,h.f,h.u,h.c.length);var _=30+h.f.length+Il(h.extra);y.set(h.c,h.o+_),Gg(y,r,h,h.f,h.u,h.c.length,h.o,h.m),r+=16+_+(h.m?h.m.length:0)}return Vb(y,r,i.length,T,w),y}function Jg(e,t){var n={},i=e.length-22;for(;Ln(e,i)!=101010256;--i)if(!i||e.length-i>65558)Qt(13);var r=jn(e,i+8);if(!r)return{};var s=Ln(e,i+16),o=s==4294967295||r==65535;if(o){var a=Ln(e,i-12);if(o=Ln(e,a)==101075792,o)r=Ln(e,a+32),s=Ln(e,a+48)}var c=t&&t.filter;for(var l=0;l<r;++l){var u=Gb(e,s,o),h=u[0],f=u[1],d=u[2],m=u[3],x=u[4],p=u[5],g=Bb(e,p);if(s=x,!c||c({name:m,size:f,originalSize:d,compression:h}))if(!h)n[m]=ks(e,g,g+f);else if(h==8)n[m]=Ub(e.subarray(g,g+f),{out:new bt(d)});else Qt(14,"unknown compression type "+h)}return n}var mi=67108864,Nl=Xt().regex(/^[a-z][a-z0-9_-]{0,79}$/),$b=Xt().regex(/^sha256:[a-f0-9]{64}$/),Kg=Os({version:rb("kiln.asset.v1"),assetId:Nl,revisionId:Nl,parentRevision:Nl.optional(),name:Xt().min(1).max(200),tags:aa(Xt().max(80)).max(30),createdAt:Xt().datetime(),description:Xt().max(4000).optional(),brief:Xt().max(8000).optional(),attribution:Os({model:Xt().max(200).optional(),harness:Xt().max(200).optional(),author:Xt().max(200).optional()}).optional(),editable:Xy(),files:Pg(Xt(),Os({sha256:$b,bytes:$y().int().nonnegative().max(mi)})),build:Os({engine:Xt(),options:Pg(Xt(),lr()),warnings:aa(Xt()),integration:lr().optional(),qa:lr().optional(),dependencies:aa(lr()).optional(),rebuild:Lg(["engine-required","external-dependencies-required"])}).optional(),preview:Os({fidelity:lr().optional(),error:Xt().optional()}).optional()}),Wb=new Set(["asset.glb","source.kiln.js","preview.png"]);function Qg(e){let t=Kg.parse(e.manifest),n=Object.keys(e.files);if(n.length!==Object.keys(t.files).length||!n.includes("asset.glb"))throw Error("Asset file inventory mismatch");let i=0;for(let r of n){if(!Wb.has(r)||!t.files[r]||t.files[r].bytes!==e.files[r].length)throw Error("Invalid asset file inventory");i+=e.files[r].length}if(i>mi||t.editable!==n.includes("source.kiln.js"))throw Error("Invalid asset size or source inventory");if((e.files["source.kiln.js"]?.length??0)>1048576)throw Error("Source exceeds 1 MiB");Dl(e.files["asset.glb"])}function Dl(e){if(e.length<20||e.length>mi)throw Error("Invalid GLB size");let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.length||t.getUint32(16,!0)!==1313821514)throw Error("Invalid GLB header");let n=20+t.getUint32(12,!0);if(n>e.length)throw Error("Invalid GLB JSON length");let i=JSON.parse(new TextDecoder().decode(e.subarray(20,n)));for(let r of[...i.buffers??[],...i.images??[]])if(r.uri&&!String(r.uri).startsWith("data:"))throw Error("GLB must embed its resources")}function Ol(e){if(!e.length||e.length>100)throw Error("Bundle requires 1..100 revisions");let t={},n=0;for(let i of e){Qg(i);let r=`${i.manifest.assetId}/${i.manifest.revisionId}/`;if(t[`${r}manifest.json`])throw Error("Duplicate bundle revision");t[`${r}manifest.json`]=new TextEncoder().encode(JSON.stringify(i.manifest,null,2));for(let[s,o]of Object.entries(i.files))t[r+s]=o}for(let i of Object.values(t))n+=i.length;if(n>mi)throw Error("Bundle exceeds 64 MiB");return jg(t,{level:0})}function e_(e){if(e.length>mi+1048576)throw Error("Bundle exceeds 64 MiB");let t=0,n=0,i=Jg(e,{filter:(o)=>{if(t+=o.originalSize,n++,t>mi||n>400||!/^[a-z][a-z0-9_-]{0,79}\/[a-z][a-z0-9_-]{0,79}\/(manifest\.json|asset\.glb|source\.kiln\.js|preview\.png)$/.test(o.name))throw Error("Unsafe or oversized asset bundle");return!0}}),r=[],s=new Set;for(let[o,a]of Object.entries(i)){if(!o.endsWith("/manifest.json"))continue;if(a.length>1048576)throw Error("Manifest exceeds 1 MiB");let c=Kg.parse(JSON.parse(new TextDecoder().decode(a))),l=`${c.assetId}/${c.revisionId}/`;if(o!==`${l}manifest.json`)throw Error("Bundle identity mismatch");let u={manifest:c,files:{}};s.add(o);for(let h of Object.keys(c.files)){if(!i[l+h])throw Error("Bundle file missing");u.files[h]=i[l+h],s.add(l+h)}Qg(u),r.push(u)}if(!r.length||s.size!==Object.keys(i).length)throw Error("Incomplete asset bundle");return r}var F_="185",Gi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Hi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},z_=0,lu=1,k_=2;var Js=1,B_=2,es=3,Vi=0,jt=1,Tn=2,ni=0,Ks=1,uu=2,hu=3,fu=4,G_=5;var ts=100,H_=101,V_=102,$_=103,W_=104,Z_=200,X_=201,q_=202,Y_=203,j_=204,J_=205,K_=206,Q_=207,e0=208,t0=209,n0=210,i0=211,r0=212,s0=213,o0=214,a0=0,c0=1,l0=2,du=3,u0=4,h0=5,f0=6,d0=7,p0=0,m0=1,g0=2,kn=0,pu=1,mu=2,gu=3,Qs=4,_u=5,xu=6,vu=7;var ns=301,_r=302,za=303,ka=304,eo=306,is=1000,rs=1001,Ba=1002,Bn=1003,Ga=1004;var xr=1005;var Ht=1006,ss=1007;var ii=1008;var Gn=1009,_0=1010,x0=1011,to=1012,yu=1013,$i=1014,Mi=1015,wi=1016,bu=1017,Su=1018,os=1020,v0=35902,y0=35899,b0=1021,S0=1022,ri=1023,vr=1026,yr=1027,M0=1028,Mu=1029,br=1030,wu=1031;var Tu=1033,Ha=33776,Va=33777,$a=33778,Wa=33779,Eu=35840,Au=35841,Ru=35842,Cu=35843,Iu=36196,Pu=37492,Lu=37496,Nu=37488,Du=37489,Za=37490,Ou=37491,Uu=37808,Fu=37809,zu=37810,ku=37811,Bu=37812,Gu=37813,Hu=37814,Vu=37815,$u=37816,Wu=37817,Zu=37818,Xu=37819,qu=37820,Yu=37821,ju=36492,Ju=36494,Ku=36495,Qu=36283,eh=36284,Xa=36285,th=36286;var nh=2300,qa=2301;var ih=0,no=1,as=2;var rh=0,w0=1,Sr="",Wi="srgb",pn="srgb-linear",sh="linear",ht="srgb";var T0=512,E0=513,A0=514,Ya=515,R0=516,C0=517,ja=518,I0=519;var oh="300 es",ah=2000;function Zb(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Xb(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Jr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function P0(){let e=Jr("canvas");return e.style.display="block",e}var t_={},Kr=null;function js(...e){let t="THREE."+e.shift();if(Kr)Kr("log",t,...e);else console.log(t,...e)}function L0(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Me(...e){e=L0(e);let t="THREE."+e.shift();if(Kr)Kr("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Ne(...e){e=L0(e);let t="THREE."+e.shift();if(Kr)Kr("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function pr(...e){let t=e.join(" ");if(t in t_)return;t_[t]=!0,Me(...e)}function N0(e,t,n){return new Promise(function(i,r){function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}var D0={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class Hn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);if(r!==-1)i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e);e.target=null}}}var qt=["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"],n_=1234567,qs=Math.PI/180,mr=180/Math.PI;function zn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qt[e&255]+qt[e>>8&255]+qt[e>>16&255]+qt[e>>24&255]+"-"+qt[t&255]+qt[t>>8&255]+"-"+qt[t>>16&15|64]+qt[t>>24&255]+"-"+qt[n&63|128]+qt[n>>8&255]+"-"+qt[n>>16&255]+qt[n>>24&255]+qt[i&255]+qt[i>>8&255]+qt[i>>16&255]+qt[i>>24&255]).toLowerCase()}function We(e,t,n){return Math.max(t,Math.min(n,e))}function ch(e,t){return(e%t+t)%t}function qb(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function Yb(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function Ys(e,t,n){return(1-n)*e+n*t}function jb(e,t,n,i){return Ys(e,t,1-Math.exp(-n*i))}function Jb(e,t=1){return t-Math.abs(ch(e,t*2)-t)}function Kb(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function Qb(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function eS(e,t){return e+Math.floor(Math.random()*(t-e+1))}function tS(e,t){return e+Math.random()*(t-e)}function nS(e){return e*(0.5-Math.random())}function iS(e){if(e!==void 0)n_=e;let t=n_+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function rS(e){return e*qs}function sS(e){return e*mr}function oS(e){return(e&e-1)===0&&e!==0}function aS(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function cS(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function lS(e,t,n,i,r){let{cos:s,sin:o}=Math,a=s(n/2),c=o(n/2),l=s((t+i)/2),u=o((t+i)/2),h=s((t-i)/2),f=o((t-i)/2),d=s((i-t)/2),m=o((i-t)/2);switch(r){case"XYX":e.set(a*u,c*h,c*f,a*l);break;case"YZY":e.set(c*f,a*u,c*h,a*l);break;case"ZXZ":e.set(c*h,c*f,a*u,a*l);break;case"XZX":e.set(a*u,c*m,c*d,a*l);break;case"YXY":e.set(c*d,a*u,c*m,a*l);break;case"ZYZ":e.set(c*m,c*d,a*u,a*l);break;default:Me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function rt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("THREE.MathUtils: Invalid component type.")}}var io={DEG2RAD:qs,RAD2DEG:mr,generateUUID:zn,clamp:We,euclideanModulo:ch,mapLinear:qb,inverseLerp:Yb,lerp:Ys,damp:jb,pingpong:Jb,smoothstep:Kb,smootherstep:Qb,randInt:eS,randFloat:tS,randFloatSpread:nS,seededRandom:iS,degToRad:rS,radToDeg:sS,isPowerOfTwo:oS,ceilPowerOfTwo:aS,floorPowerOfTwo:cS,setQuaternionFromProperEuler:lS,normalize:rt,denormalize:Fn};class Ie{static{Ie.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Gt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],h=r[s+0],f=r[s+1],d=r[s+2],m=r[s+3];if(u!==m||a!==h||c!==f||l!==d){let x=a*h+c*f+l*d+u*m;if(x<0)h=-h,f=-f,d=-d,m=-m,x=-x;let p=1-o;if(x<0.9995){let g=Math.acos(x),A=Math.sin(g);p=Math.sin(p*g)/A,o=Math.sin(o*g)/A,a=a*p+h*o,c=c*p+f*o,l=l*p+d*o,u=u*p+m*o}else{a=a*p+h*o,c=c*p+f*o,l=l*p+d*o,u=u*p+m*o;let g=1/Math.sqrt(a*a+c*c+l*l+u*u);a*=g,c*=g,l*=g,u*=g}}e[t]=a,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){let o=n[i],a=n[i+1],c=n[i+2],l=n[i+3],u=r[s],h=r[s+1],f=r[s+2],d=r[s+3];return e[t]=o*d+l*u+a*f-c*h,e[t+1]=a*d+l*h+c*u-o*f,e[t+2]=c*d+l*f+o*h-a*u,e[t+3]=l*d-o*u-a*h-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:r,_order:s}=e,{cos:o,sin:a}=Math,c=o(n/2),l=o(i/2),u=o(r/2),h=a(n/2),f=a(i/2),d=a(r/2);switch(s){case"XYZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"YXZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"ZXY":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"ZYX":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"YZX":this._x=h*l*u+c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u-h*f*d;break;case"XZY":this._x=h*l*u-c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u+h*f*d;break;default:Me("Quaternion: .setFromEuler() encountered an unknown order: "+s)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],c=t[2],l=t[6],u=t[10],h=n+o+u;if(h>0){let f=0.5/Math.sqrt(h+1);this._w=0.25/f,this._x=(l-a)*f,this._y=(r-c)*f,this._z=(s-i)*f}else if(n>o&&n>u){let f=2*Math.sqrt(1+n-o-u);this._w=(l-a)/f,this._x=0.25*f,this._y=(i+s)/f,this._z=(r+c)/f}else if(o>u){let f=2*Math.sqrt(1+o-n-u);this._w=(r-c)/f,this._x=(i+s)/f,this._y=0.25*f,this._z=(a+l)/f}else{let f=2*Math.sqrt(1+u-n-o);this._w=(s-i)/f,this._x=(r+c)/f,this._y=(a+l)/f,this._z=0.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,{_x:o,_y:a,_z:c,_w:l}=t;return this._x=n*l+s*o+i*c-r*a,this._y=i*l+s*a+r*o-n*c,this._z=r*l+s*c+n*a-i*o,this._w=s*l-n*o-i*a-r*c,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,o=this.dot(e);if(o<0)n=-n,i=-i,r=-r,s=-s,o=-o;let a=1-t;if(o<0.9995){let c=Math.acos(o),l=Math.sin(c);a=Math.sin(a*c)/l,t=Math.sin(t*c)/l,this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this._onChangeCallback()}else this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{static{N.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(i_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(i_.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:r,y:s,z:o,w:a}=e,c=2*(s*i-o*n),l=2*(o*t-r*i),u=2*(r*n-s*t);return this.x=t+a*c+s*u-o*l,this.y=n+a*l+o*c-r*u,this.z=i+a*u+r*l-s*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:r}=e,{x:s,y:o,z:a}=t;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ul.copy(this).projectOnVector(e),this.sub(Ul)}reflect(e){return this.sub(Ul.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var Ul=new N,i_=new Gt;class Oe{static{Oe.prototype.isMatrix3=!0}constructor(e,t,n,i,r,s,o,a,c){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c)}set(e,t,n,i,r,s,o,a,c){let l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=a,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],c=n[1],l=n[4],u=n[7],h=n[2],f=n[5],d=n[8],m=i[0],x=i[3],p=i[6],g=i[1],A=i[4],E=i[7],y=i[2],w=i[5],T=i[8];return r[0]=s*m+o*g+a*y,r[3]=s*x+o*A+a*w,r[6]=s*p+o*E+a*T,r[1]=c*m+l*g+u*y,r[4]=c*x+l*A+u*w,r[7]=c*p+l*E+u*T,r[2]=h*m+f*g+d*y,r[5]=h*x+f*A+d*w,r[8]=h*p+f*E+d*T,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*s*l-t*o*c-n*r*l+n*o*a+i*r*c-i*s*a}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=l*s-o*c,h=o*a-l*r,f=c*r-s*a,d=t*u+n*h+i*f;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return e[0]=u*m,e[1]=(i*c-l*n)*m,e[2]=(o*n-i*s)*m,e[3]=h*m,e[4]=(l*t-i*a)*m,e[5]=(i*r-o*t)*m,e[6]=f*m,e[7]=(n*a-c*t)*m,e[8]=(s*t-n*r)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){let a=Math.cos(r),c=Math.sin(r);return this.set(n*a,n*c,-n*(a*s+c*o)+s+e,-i*c,i*a,-i*(-c*s+a*o)+o+t,0,0,1),this}scale(e,t){return pr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Fl.makeScale(e,t)),this}rotate(e){return pr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Fl.makeRotation(-e)),this}translate(e,t){return pr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Fl.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}var Fl=new Oe,r_=new Oe().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),s_=new Oe().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function uS(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(r,s,o){if(this.enabled===!1||s===o||!s||!o)return r;if(this.spaces[s].transfer==="srgb")r.r=Si(r.r),r.g=Si(r.g),r.b=Si(r.b);if(this.spaces[s].primaries!==this.spaces[o].primaries)r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ);if(this.spaces[o].transfer==="srgb")r.r=jr(r.r),r.g=jr(r.g),r.b=jr(r.b);return r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){if(r==="")return"linear";return this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return pr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return pr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(r,s)}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:r_,fromXYZ:s_,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:r_,fromXYZ:s_,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}var $e=uS();function Si(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function jr(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}var Ur;class lh{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(Ur===void 0)Ur=Jr("canvas");Ur.width=e.width,Ur.height=e.height;let i=Ur.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=Ur}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Jr("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let s=0;s<r.length;s++)r[s]=Si(r[s]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(Si(t[n]/255)*255);else t[n]=Si(t[n]);return{data:t,width:e.width,height:e.height}}else return Me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}var hS=0;class ro{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hS++}),this.uuid=zn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width,t.height,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let s=0,o=i.length;s<o;s++)if(i[s].isDataTexture)r.push(zl(i[s].image));else r.push(zl(i[s]))}else r=zl(i);n.url=r}if(!t)e.images[this.uuid]=n;return n}}function zl(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return lh.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Me("Texture: Unable to serialize Texture."),{}}var fS=0,kl=new N;class wt extends Hn{constructor(e=wt.DEFAULT_IMAGE,t=wt.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,a=1009,c=wt.DEFAULT_ANISOTROPY,l=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:fS++}),this.uuid=zn(),this.name="",this.source=new ro(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Ie(0,0),this.repeat=new Ie(1,1),this.center=new Ie(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Oe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(kl).x}get height(){return this.source.getSize(kl).y}get depth(){return this.source.getSize(kl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Me(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}}wt.DEFAULT_IMAGE=null;wt.DEFAULT_MAPPING=300;wt.DEFAULT_ANISOTROPY=1;class st{static{st.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,s=0.01,o=0.1,a=e.elements,c=a[0],l=a[4],u=a[8],h=a[1],f=a[5],d=a[9],m=a[2],x=a[6],p=a[10];if(Math.abs(l-h)<0.01&&Math.abs(u-m)<0.01&&Math.abs(d-x)<0.01){if(Math.abs(l+h)<0.1&&Math.abs(u+m)<0.1&&Math.abs(d+x)<0.1&&Math.abs(c+f+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let A=(c+1)/2,E=(f+1)/2,y=(p+1)/2,w=(l+h)/4,T=(u+m)/4,R=(d+x)/4;if(A>E&&A>y)if(A<0.01)n=0,i=0.707106781,r=0.707106781;else n=Math.sqrt(A),i=w/n,r=T/n;else if(E>y)if(E<0.01)n=0.707106781,i=0,r=0.707106781;else i=Math.sqrt(E),n=w/i,r=R/i;else if(y<0.01)n=0.707106781,i=0.707106781,r=0;else r=Math.sqrt(y),n=T/r,i=R/r;return this.set(n,i,r,t),this}let g=Math.sqrt((x-d)*(x-d)+(u-m)*(u-m)+(h-l)*(h-l));if(Math.abs(g)<0.001)g=1;return this.x=(x-d)/g,this.y=(u-m)/g,this.z=(h-l)/g,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class uh extends Hn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new st(0,0,e,t),this.scissorTest=!1,this.viewport=new st(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new wt(i),s=n.count;for(let o=0;o<s;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(e!==null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ro(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null)this.depthTexture=e.depthTexture.clone();return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class En extends uh{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}}class Ja extends wt{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class hh extends wt{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ze{static{ze.prototype.isMatrix4=!0}constructor(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x)}set(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=s,p[9]=o,p[13]=a,p[2]=c,p[6]=l,p[10]=u,p[14]=h,p[3]=f,p[7]=d,p[11]=m,p[15]=x,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 ze().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Fr.setFromMatrixColumn(e,0).length(),r=1/Fr.setFromMatrixColumn(e,1).length(),s=1/Fr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:r}=e,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let h=s*l,f=s*u,d=o*l,m=o*u;t[0]=a*l,t[4]=-a*u,t[8]=c,t[1]=f+d*c,t[5]=h-m*c,t[9]=-o*a,t[2]=m-h*c,t[6]=d+f*c,t[10]=s*a}else if(e.order==="YXZ"){let h=a*l,f=a*u,d=c*l,m=c*u;t[0]=h+m*o,t[4]=d*o-f,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-o,t[2]=f*o-d,t[6]=m+h*o,t[10]=s*a}else if(e.order==="ZXY"){let h=a*l,f=a*u,d=c*l,m=c*u;t[0]=h-m*o,t[4]=-s*u,t[8]=d+f*o,t[1]=f+d*o,t[5]=s*l,t[9]=m-h*o,t[2]=-s*c,t[6]=o,t[10]=s*a}else if(e.order==="ZYX"){let h=s*l,f=s*u,d=o*l,m=o*u;t[0]=a*l,t[4]=d*c-f,t[8]=h*c+m,t[1]=a*u,t[5]=m*c+h,t[9]=f*c-d,t[2]=-c,t[6]=o*a,t[10]=s*a}else if(e.order==="YZX"){let h=s*a,f=s*c,d=o*a,m=o*c;t[0]=a*l,t[4]=m-h*u,t[8]=d*u+f,t[1]=u,t[5]=s*l,t[9]=-o*l,t[2]=-c*l,t[6]=f*u+d,t[10]=h-m*u}else if(e.order==="XZY"){let h=s*a,f=s*c,d=o*a,m=o*c;t[0]=a*l,t[4]=-u,t[8]=c*l,t[1]=h*u+m,t[5]=s*l,t[9]=f*u-d,t[2]=d*u-f,t[6]=o*l,t[10]=m*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dS,e,pS)}lookAt(e,t,n){let i=this.elements;if(fn.subVectors(e,t),fn.lengthSq()===0)fn.z=1;if(fn.normalize(),Oi.crossVectors(n,fn),Oi.lengthSq()===0){if(Math.abs(n.z)===1)fn.x+=0.0001;else fn.z+=0.0001;fn.normalize(),Oi.crossVectors(n,fn)}return Oi.normalize(),ua.crossVectors(fn,Oi),i[0]=Oi.x,i[4]=ua.x,i[8]=fn.x,i[1]=Oi.y,i[5]=ua.y,i[9]=fn.y,i[2]=Oi.z,i[6]=ua.z,i[10]=fn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],c=n[12],l=n[1],u=n[5],h=n[9],f=n[13],d=n[2],m=n[6],x=n[10],p=n[14],g=n[3],A=n[7],E=n[11],y=n[15],w=i[0],T=i[4],R=i[8],_=i[12],S=i[1],U=i[5],C=i[9],z=i[13],j=i[2],F=i[6],H=i[10],V=i[14],O=i[3],K=i[7],Q=i[11],se=i[15];return r[0]=s*w+o*S+a*j+c*O,r[4]=s*T+o*U+a*F+c*K,r[8]=s*R+o*C+a*H+c*Q,r[12]=s*_+o*z+a*V+c*se,r[1]=l*w+u*S+h*j+f*O,r[5]=l*T+u*U+h*F+f*K,r[9]=l*R+u*C+h*H+f*Q,r[13]=l*_+u*z+h*V+f*se,r[2]=d*w+m*S+x*j+p*O,r[6]=d*T+m*U+x*F+p*K,r[10]=d*R+m*C+x*H+p*Q,r[14]=d*_+m*z+x*V+p*se,r[3]=g*w+A*S+E*j+y*O,r[7]=g*T+A*U+E*F+y*K,r[11]=g*R+A*C+E*H+y*Q,r[15]=g*_+A*z+E*V+y*se,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],c=e[13],l=e[2],u=e[6],h=e[10],f=e[14],d=e[3],m=e[7],x=e[11],p=e[15],g=a*f-c*h,A=o*f-c*u,E=o*h-a*u,y=s*f-c*l,w=s*h-a*l,T=s*u-o*l;return t*(m*g-x*A+p*E)-n*(d*g-x*y+p*w)+i*(d*A-m*y+p*T)-r*(d*E-m*w+x*T)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],s=e[5],o=e[9],a=e[2],c=e[6],l=e[10];return t*(s*l-o*c)-n*(r*l-o*a)+i*(r*c-s*a)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],m=e[13],x=e[14],p=e[15],g=t*o-n*s,A=t*a-i*s,E=t*c-r*s,y=n*a-i*o,w=n*c-r*o,T=i*c-r*a,R=l*m-u*d,_=l*x-h*d,S=l*p-f*d,U=u*x-h*m,C=u*p-f*m,z=h*p-f*x,j=g*z-A*C+E*U+y*S-w*_+T*R;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let F=1/j;return e[0]=(o*z-a*C+c*U)*F,e[1]=(i*C-n*z-r*U)*F,e[2]=(m*T-x*w+p*y)*F,e[3]=(h*w-u*T-f*y)*F,e[4]=(a*S-s*z-c*_)*F,e[5]=(t*z-i*S+r*_)*F,e[6]=(x*E-d*T-p*A)*F,e[7]=(l*T-h*E+f*A)*F,e[8]=(s*C-o*S+c*R)*F,e[9]=(n*S-t*C-r*R)*F,e[10]=(d*w-m*E+p*g)*F,e[11]=(u*E-l*w-f*g)*F,e[12]=(o*_-s*U-a*R)*F,e[13]=(t*U-n*_+i*R)*F,e[14]=(m*A-d*y-x*g)*F,e[15]=(l*y-u*A+h*g)*F,this}scale(e){let t=this.elements,{x:n,y:i,z:r}=e;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,{x:s,y:o,z:a}=e,c=r*s,l=r*o;return this.set(c*s+n,c*o-i*a,c*a+i*o,0,c*o+i*a,l*o+n,l*a-i*s,0,c*a-i*o,l*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:r,_y:s,_z:o,_w:a}=t,c=r+r,l=s+s,u=o+o,h=r*c,f=r*l,d=r*u,m=s*l,x=s*u,p=o*u,g=a*c,A=a*l,E=a*u,{x:y,y:w,z:T}=n;return i[0]=(1-(m+p))*y,i[1]=(f+E)*y,i[2]=(d-A)*y,i[3]=0,i[4]=(f-E)*w,i[5]=(1-(h+p))*w,i[6]=(x+g)*w,i[7]=0,i[8]=(d+A)*T,i[9]=(x-g)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let s=Fr.set(i[0],i[1],i[2]).length(),o=Fr.set(i[4],i[5],i[6]).length(),a=Fr.set(i[8],i[9],i[10]).length();if(r<0)s=-s;Nn.copy(this);let c=1/s,l=1/o,u=1/a;return Nn.elements[0]*=c,Nn.elements[1]*=c,Nn.elements[2]*=c,Nn.elements[4]*=l,Nn.elements[5]*=l,Nn.elements[6]*=l,Nn.elements[8]*=u,Nn.elements[9]*=u,Nn.elements[10]*=u,t.setFromRotationMatrix(Nn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2*r/(t-e),u=2*r/(n-i),h=(t+e)/(t-e),f=(n+i)/(n-i),d,m;if(a)d=r/(s-r),m=s*r/(s-r);else if(o===2000)d=-(s+r)/(s-r),m=-2*s*r/(s-r);else if(o===2001)d=-s/(s-r),m=-s*r/(s-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2/(t-e),u=2/(n-i),h=-(t+e)/(t-e),f=-(n+i)/(n-i),d,m;if(a)d=1/(s-r),m=s/(s-r);else if(o===2000)d=-2/(s-r),m=-(s+r)/(s-r);else if(o===2001)d=-1/(s-r),m=-r/(s-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}var Fr=new N,Nn=new ze,dS=new N(0,0,0),pS=new N(1,1,1),Oi=new N,ua=new N,fn=new N,o_=new ze,a_=new Gt;class ti{constructor(e=0,t=0,n=0,i=ti.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],c=i[5],l=i[9],u=i[2],h=i[6],f=i[10];switch(t){case"XYZ":if(this._y=Math.asin(We(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-l,f),this._z=Math.atan2(-s,r);else this._x=Math.atan2(h,c),this._z=0;break;case"YXZ":if(this._x=Math.asin(-We(l,-1,1)),Math.abs(l)<0.9999999)this._y=Math.atan2(o,f),this._z=Math.atan2(a,c);else this._y=Math.atan2(-u,r),this._z=0;break;case"ZXY":if(this._x=Math.asin(We(h,-1,1)),Math.abs(h)<0.9999999)this._y=Math.atan2(-u,f),this._z=Math.atan2(-s,c);else this._y=0,this._z=Math.atan2(a,r);break;case"ZYX":if(this._y=Math.asin(-We(u,-1,1)),Math.abs(u)<0.9999999)this._x=Math.atan2(h,f),this._z=Math.atan2(a,r);else this._x=0,this._z=Math.atan2(-s,c);break;case"YZX":if(this._z=Math.asin(We(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r);else this._x=0,this._y=Math.atan2(o,f);break;case"XZY":if(this._z=Math.asin(-We(s,-1,1)),Math.abs(s)<0.9999999)this._x=Math.atan2(h,c),this._y=Math.atan2(o,r);else this._x=Math.atan2(-l,f),this._y=0;break;default:Me("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return o_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(o_,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return a_.setFromEuler(this),this.setFromQuaternion(a_,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ti.DEFAULT_ORDER="XYZ";class Ka{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}var mS=0,c_=new N,zr=new Gt,gi=new ze,ha=new N,Bs=new N,gS=new N,_S=new Gt,l_=new N(1,0,0),u_=new N(0,1,0),h_=new N(0,0,1),f_={type:"added"},xS={type:"removed"},kr={type:"childadded",child:null},Bl={type:"childremoved",child:null};class at extends Hn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:mS++}),this.uuid=zn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=at.DEFAULT_UP.clone();let e=new N,t=new ti,n=new Gt,i=new N(1,1,1);function r(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ze},normalMatrix:{value:new Oe}}),this.matrix=new ze,this.matrixWorld=new ze,this.matrixAutoUpdate=at.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ka,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return zr.setFromAxisAngle(e,t),this.quaternion.multiply(zr),this}rotateOnWorldAxis(e,t){return zr.setFromAxisAngle(e,t),this.quaternion.premultiply(zr),this}rotateX(e){return this.rotateOnAxis(l_,e)}rotateY(e){return this.rotateOnAxis(u_,e)}rotateZ(e){return this.rotateOnAxis(h_,e)}translateOnAxis(e,t){return c_.copy(e).applyQuaternion(this.quaternion),this.position.add(c_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(l_,e)}translateY(e){return this.translateOnAxis(u_,e)}translateZ(e){return this.translateOnAxis(h_,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gi.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)ha.copy(e);else ha.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),Bs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)gi.lookAt(Bs,ha,this.up);else gi.lookAt(ha,Bs,this.up);if(this.quaternion.setFromRotationMatrix(gi),i)gi.extractRotation(i.matrixWorld),zr.setFromRotationMatrix(gi),this.quaternion.premultiply(zr.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Ne("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(f_),kr.child=e,this.dispatchEvent(kr),kr.child=null;else Ne("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(xS),Bl.child=e,this.dispatchEvent(Bl),Bl.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),gi.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),gi.multiply(e.parent.matrixWorld);return e.applyMatrix4(gi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(f_),kr.child=e,this.dispatchEvent(kr),kr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,e,gS),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,_S,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,this.name!=="")i.name=this.name;if(this.castShadow===!0)i.castShadow=!0;if(this.receiveShadow===!0)i.receiveShadow=!0;if(this.visible===!1)i.visible=!1;if(this.frustumCulled===!1)i.frustumCulled=!1;if(this.renderOrder!==0)i.renderOrder=this.renderOrder;if(this.static!==!1)i.static=this.static;if(Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)i.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((o)=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((o)=>({...o})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function r(o,a){if(o[a.uuid]===void 0)o[a.uuid]=a.toJSON(e);return a.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let c=0,l=a.length;c<l;c++){let u=a[c];r(e.shapes,u)}else r(e.shapes,a)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,c=this.material.length;a<c;a++)o.push(r(e.materials,this.material[a]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(r(e.animations,a))}}if(t){let o=s(e.geometries),a=s(e.materials),c=s(e.textures),l=s(e.images),u=s(e.shapes),h=s(e.skeletons),f=s(e.animations),d=s(e.nodes);if(o.length>0)n.geometries=o;if(a.length>0)n.materials=a;if(c.length>0)n.textures=c;if(l.length>0)n.images=l;if(u.length>0)n.shapes=u;if(h.length>0)n.skeletons=h;if(f.length>0)n.animations=f;if(d.length>0)n.nodes=d}return n.object=i,n;function s(o){let a=[];for(let c in o){let l=o[c];delete l.metadata,a.push(l)}return a}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}}at.DEFAULT_UP=new N(0,1,0);at.DEFAULT_MATRIX_AUTO_UPDATE=!0;at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Qn extends at{constructor(){super();this.isGroup=!0,this.type="Group"}}var vS={type:"move"};class so{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Qn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new Qn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Qn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,r=null,s=null,o=this._targetRay,a=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(let m of e.hand.values()){let x=t.getJointPose(m,n),p=this._getHandJoint(c,m);if(x!==null)p.matrix.fromArray(x.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=x.radius;p.visible=x!==null}let l=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=l.position.distanceTo(u.position),f=0.02,d=0.005;if(c.inputState.pinching&&h>f+d)c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!c.inputState.pinching&&h<=f-d)c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(a!==null&&e.gripSpace){if(r=t.getPose(e.gripSpace,n),r!==null){if(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity);else a.hasLinearVelocity=!1;if(r.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity);else a.hasAngularVelocity=!1;if(a.eventsEnabled)a.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(o!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null)i=r;if(i!==null){if(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity);else o.hasLinearVelocity=!1;if(i.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity);else o.hasAngularVelocity=!1;this.dispatchEvent(vS)}}}if(o!==null)o.visible=i!==null;if(a!==null)a.visible=r!==null;if(c!==null)c.visible=s!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Qn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}var O0={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},Ui={h:0,s:0,l:0},fa={h:0,s:0,l:0};function Gl(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Le{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=$e.workingColorSpace){return this.r=e,this.g=t,this.b=n,$e.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=$e.workingColorSpace){if(e=ch(e,1),t=We(t,0,1),n=We(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=0.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=Gl(s,r,e+0.3333333333333333),this.g=Gl(s,r,e),this.b=Gl(s,r,e-0.3333333333333333)}return $e.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(r){if(r===void 0)return;if(parseFloat(r)<1)Me("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Me("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);else if(s===6)return this.setHex(parseInt(r,16),t);else Me("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=O0[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Me("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Si(e.r),this.g=Si(e.g),this.b=Si(e.b),this}copyLinearToSRGB(e){return this.r=jr(e.r),this.g=jr(e.g),this.b=jr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return $e.workingToColorSpace(Yt.copy(this),e),Math.round(We(Yt.r*255,0,255))*65536+Math.round(We(Yt.g*255,0,255))*256+Math.round(We(Yt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.workingToColorSpace(Yt.copy(this),t);let{r:n,g:i,b:r}=Yt,s=Math.max(n,i,r),o=Math.min(n,i,r),a,c,l=(o+s)/2;if(o===s)a=0,c=0;else{let u=s-o;switch(c=l<=0.5?u/(s+o):u/(2-s-o),s){case n:a=(i-r)/u+(i<r?6:0);break;case i:a=(r-n)/u+2;break;case r:a=(n-i)/u+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getRGB(e,t=$e.workingColorSpace){return $e.workingToColorSpace(Yt.copy(this),t),e.r=Yt.r,e.g=Yt.g,e.b=Yt.b,e}getStyle(e="srgb"){$e.workingToColorSpace(Yt.copy(this),e);let{r:t,g:n,b:i}=Yt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ui),this.setHSL(Ui.h+e,Ui.s+t,Ui.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ui),e.getHSL(fa);let n=Ys(Ui.h,fa.h,t),i=Ys(Ui.s,fa.s,t),r=Ys(Ui.l,fa.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var Yt=new Le;Le.NAMES=O0;class cs extends at{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ti,this.environmentIntensity=1,this.environmentRotation=new ti,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){if(super.copy(e,t),e.background!==null)this.background=e.background.clone();if(e.environment!==null)this.environment=e.environment.clone();if(e.fog!==null)this.fog=e.fog.clone();if(this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null)this.overrideMaterial=e.overrideMaterial.clone();return this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)t.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)t.object.backgroundIntensity=this.backgroundIntensity;if(t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)t.object.environmentIntensity=this.environmentIntensity;return t.object.environmentRotation=this.environmentRotation.toArray(),t}}var Dn=new N,_i=new N,Hl=new N,xi=new N,Br=new N,Gr=new N,d_=new N,Vl=new N,$l=new N,Wl=new N,Zl=new st,Xl=new st,ql=new st;class wn{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Dn.subVectors(e,t),i.cross(Dn);let r=i.lengthSq();if(r>0)return i.multiplyScalar(1/Math.sqrt(r));return i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Dn.subVectors(i,t),_i.subVectors(n,t),Hl.subVectors(e,t);let s=Dn.dot(Dn),o=Dn.dot(_i),a=Dn.dot(Hl),c=_i.dot(_i),l=_i.dot(Hl),u=s*c-o*o;if(u===0)return r.set(0,0,0),null;let h=1/u,f=(c*a-o*l)*h,d=(s*l-o*a)*h;return r.set(1-f-d,d,f)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,xi)===null)return!1;return xi.x>=0&&xi.y>=0&&xi.x+xi.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){if(this.getBarycoord(e,t,n,i,xi)===null){if(a.x=0,a.y=0,"z"in a)a.z=0;if("w"in a)a.w=0;return null}return a.setScalar(0),a.addScaledVector(r,xi.x),a.addScaledVector(s,xi.y),a.addScaledVector(o,xi.z),a}static getInterpolatedAttribute(e,t,n,i,r,s){return Zl.setScalar(0),Xl.setScalar(0),ql.setScalar(0),Zl.fromBufferAttribute(e,t),Xl.fromBufferAttribute(e,n),ql.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Zl,r.x),s.addScaledVector(Xl,r.y),s.addScaledVector(ql,r.z),s}static isFrontFacing(e,t,n,i){return Dn.subVectors(n,t),_i.subVectors(e,t),Dn.cross(_i).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Dn.subVectors(this.c,this.b),_i.subVectors(this.a,this.b),Dn.cross(_i).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return wn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return wn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return wn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,s,o;Br.subVectors(i,n),Gr.subVectors(r,n),Vl.subVectors(e,n);let a=Br.dot(Vl),c=Gr.dot(Vl);if(a<=0&&c<=0)return t.copy(n);$l.subVectors(e,i);let l=Br.dot($l),u=Gr.dot($l);if(l>=0&&u<=l)return t.copy(i);let h=a*u-l*c;if(h<=0&&a>=0&&l<=0)return s=a/(a-l),t.copy(n).addScaledVector(Br,s);Wl.subVectors(e,r);let f=Br.dot(Wl),d=Gr.dot(Wl);if(d>=0&&f<=d)return t.copy(r);let m=f*c-a*d;if(m<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Gr,o);let x=l*d-f*u;if(x<=0&&u-l>=0&&f-d>=0)return d_.subVectors(r,i),o=(u-l)/(u-l+(f-d)),t.copy(i).addScaledVector(d_,o);let p=1/(x+m+h);return s=m*p,o=h*p,t.copy(n).addScaledVector(Br,s).addScaledVector(Gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class tn{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(On.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(On.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=On.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=r.count;s<o;s++){if(e.isMesh===!0)e.getVertexPosition(s,On);else On.fromBufferAttribute(r,s);On.applyMatrix4(e.matrixWorld),this.expandByPoint(On)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();da.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();da.copy(n.boundingBox)}da.applyMatrix4(e.matrixWorld),this.union(da)}}let i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,On),On.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Gs),pa.subVectors(this.max,Gs),Hr.subVectors(e.a,Gs),Vr.subVectors(e.b,Gs),$r.subVectors(e.c,Gs),Fi.subVectors(Vr,Hr),zi.subVectors($r,Vr),ur.subVectors(Hr,$r);let t=[0,-Fi.z,Fi.y,0,-zi.z,zi.y,0,-ur.z,ur.y,Fi.z,0,-Fi.x,zi.z,0,-zi.x,ur.z,0,-ur.x,-Fi.y,Fi.x,0,-zi.y,zi.x,0,-ur.y,ur.x,0];if(!Yl(t,Hr,Vr,$r,pa))return!1;if(t=[1,0,0,0,1,0,0,0,1],!Yl(t,Hr,Vr,$r,pa))return!1;return ma.crossVectors(Fi,zi),t=[ma.x,ma.y,ma.z],Yl(t,Hr,Vr,$r,pa)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,On).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(On).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return vi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vi),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}var vi=[new N,new N,new N,new N,new N,new N,new N,new N],On=new N,da=new tn,Hr=new N,Vr=new N,$r=new N,Fi=new N,zi=new N,ur=new N,Gs=new N,pa=new N,ma=new N,hr=new N;function Yl(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){hr.fromArray(e,s);let a=r.x*Math.abs(hr.x)+r.y*Math.abs(hr.y)+r.z*Math.abs(hr.z),c=t.dot(hr),l=n.dot(hr),u=i.dot(hr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var It=new N,ga=new Ie,yS=0;class Nt extends Hn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yS++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ga.fromBufferAttribute(this,t),ga.applyMatrix3(e),this.setXY(t,ga.x,ga.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix3(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix4(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyNormalMatrix(e),this.setXYZ(t,It.x,It.y,It.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.transformDirection(e),this.setXYZ(t,It.x,It.y,It.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=Fn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=rt(n,this.array);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=Fn(t,this.array);return t}setX(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=Fn(t,this.array);return t}setY(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=Fn(t,this.array);return t}setZ(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=Fn(t,this.array);return t}setW(e,t){if(this.normalized)t=rt(t,this.array);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e*=this.itemSize,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array),r=rt(r,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")e.name=this.name;if(this.usage!==35044)e.usage=this.usage;return e}dispose(){this.dispatchEvent({type:"dispose"})}}class Qa extends Nt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ec extends Nt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class rn extends Nt{constructor(e,t,n){super(new Float32Array(e),t,n)}}var bS=new tn,Hs=new N,jl=new N;class mn{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else bS.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Hs.subVectors(e,this.center);let t=Hs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(Hs,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else jl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Hs.copy(e.center).add(jl)),this.expandByPoint(Hs.copy(e.center).sub(jl));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}var SS=0,Mn=new ze,Jl=new at,Wr=new N,dn=new tn,Vs=new tn,Bt=new N;class nn extends Hn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:SS++}),this.uuid=zn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((Zb(e))?ec:Qa)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let r=new Oe().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return Mn.makeRotationFromQuaternion(e),this.applyMatrix4(Mn),this}rotateX(e){return Mn.makeRotationX(e),this.applyMatrix4(Mn),this}rotateY(e){return Mn.makeRotationY(e),this.applyMatrix4(Mn),this}rotateZ(e){return Mn.makeRotationZ(e),this.applyMatrix4(Mn),this}translate(e,t,n){return Mn.makeTranslation(e,t,n),this.applyMatrix4(Mn),this}scale(e,t,n){return Mn.makeScale(e,t,n),this.applyMatrix4(Mn),this}lookAt(e){return Jl.lookAt(e),Jl.updateMatrix(),this.applyMatrix4(Jl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wr).negate(),this.translate(Wr.x,Wr.y,Wr.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];n.push(s.x,s.y,s.z||0)}this.setAttribute("position",new rn(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}if(e.length>t.count)Me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new tn;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];if(dn.setFromBufferAttribute(r),this.morphTargetsRelative)Bt.addVectors(this.boundingBox.min,dn.min),this.boundingBox.expandByPoint(Bt),Bt.addVectors(this.boundingBox.max,dn.max),this.boundingBox.expandByPoint(Bt);else this.boundingBox.expandByPoint(dn.min),this.boundingBox.expandByPoint(dn.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Ne('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new mn;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){let n=this.boundingSphere.center;if(dn.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];if(Vs.setFromBufferAttribute(o),this.morphTargetsRelative)Bt.addVectors(dn.min,Vs.min),dn.expandByPoint(Bt),Bt.addVectors(dn.max,Vs.max),dn.expandByPoint(Bt);else dn.expandByPoint(Vs.min),dn.expandByPoint(Vs.max)}dn.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)Bt.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Bt));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],a=this.morphTargetsRelative;for(let c=0,l=o.count;c<l;c++){if(Bt.fromBufferAttribute(o,c),a)Wr.fromBufferAttribute(e,c),Bt.add(Wr);i=Math.max(i,n.distanceToSquared(Bt))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Ne('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ne("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:r}=t,s=this.getAttribute("tangent");if(s===void 0||s.count!==n.count)s=new Nt(new Float32Array(4*n.count),4),this.setAttribute("tangent",s);let o=[],a=[];for(let R=0;R<n.count;R++)o[R]=new N,a[R]=new N;let c=new N,l=new N,u=new N,h=new Ie,f=new Ie,d=new Ie,m=new N,x=new N;function p(R,_,S){c.fromBufferAttribute(n,R),l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,S),h.fromBufferAttribute(r,R),f.fromBufferAttribute(r,_),d.fromBufferAttribute(r,S),l.sub(c),u.sub(c),f.sub(h),d.sub(h);let U=1/(f.x*d.y-d.x*f.y);if(!isFinite(U))return;m.copy(l).multiplyScalar(d.y).addScaledVector(u,-f.y).multiplyScalar(U),x.copy(u).multiplyScalar(f.x).addScaledVector(l,-d.x).multiplyScalar(U),o[R].add(m),o[_].add(m),o[S].add(m),a[R].add(x),a[_].add(x),a[S].add(x)}let g=this.groups;if(g.length===0)g=[{start:0,count:e.count}];for(let R=0,_=g.length;R<_;++R){let S=g[R],{start:U,count:C}=S;for(let z=U,j=U+C;z<j;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}let A=new N,E=new N,y=new N,w=new N;function T(R){y.fromBufferAttribute(i,R),w.copy(y);let _=o[R];A.copy(_),A.sub(y.multiplyScalar(y.dot(_))).normalize(),E.crossVectors(w,_);let U=E.dot(a[R])<0?-1:1;s.setXYZW(R,A.x,A.y,A.z,U)}for(let R=0,_=g.length;R<_;++R){let S=g[R],{start:U,count:C}=S;for(let z=U,j=U+C;z<j;z+=3)T(e.getX(z+0)),T(e.getX(z+1)),T(e.getX(z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Nt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);let i=new N,r=new N,s=new N,o=new N,a=new N,c=new N,l=new N,u=new N;if(e)for(let h=0,f=e.count;h<f;h+=3){let d=e.getX(h+0),m=e.getX(h+1),x=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,m),c.fromBufferAttribute(n,x),o.add(l),a.add(l),c.add(l),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(x,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)i.fromBufferAttribute(t,h+0),r.fromBufferAttribute(t,h+1),s.fromBufferAttribute(t,h+2),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),n.setXYZ(h+0,l.x,l.y,l.z),n.setXYZ(h+1,l.x,l.y,l.z),n.setXYZ(h+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Bt.fromBufferAttribute(e,t),Bt.normalize(),e.setXYZ(t,Bt.x,Bt.y,Bt.z)}toNonIndexed(){function e(o,a){let{array:c,itemSize:l,normalized:u}=o,h=new c.constructor(a.length*l),f=0,d=0;for(let m=0,x=a.length;m<x;m++){if(o.isInterleavedBufferAttribute)f=a[m]*o.data.stride+o.offset;else f=a[m]*l;for(let p=0;p<l;p++)h[d++]=c[f++]}return new Nt(h,l,u)}if(this.index===null)return Me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new nn,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],c=e(a,n);t.setAttribute(o,c)}let r=this.morphAttributes;for(let o in r){let a=[],c=r[o];for(let l=0,u=c.length;l<u;l++){let h=c[l],f=e(h,n);a.push(f)}t.morphAttributes[o]=a}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,a=s.length;o<a;o++){let c=s[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!=="")e.name=this.name;if(Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let a=this.parameters;for(let c in a)if(a[c]!==void 0)e[c]=a[c];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let a in n){let c=n[a];e.data.attributes[a]=c.toJSON(e.data)}let i={},r=!1;for(let a in this.morphAttributes){let c=this.morphAttributes[a],l=[];for(let u=0,h=c.length;u<h;u++){let f=c[u];l.push(f.toJSON(e.data))}if(l.length>0)i[a]=l,r=!0}if(r)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;if(s.length>0)e.data.groups=JSON.parse(JSON.stringify(s));let o=this.boundingSphere;if(o!==null)e.data.boundingSphere=o.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let c in i){let l=i[c];this.setAttribute(c,l.clone(t))}let r=e.morphAttributes;for(let c in r){let l=[],u=r[c];for(let h=0,f=u.length;h<f;h++)l.push(u[h].clone(t));this.morphAttributes[c]=l}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let c=0,l=s.length;c<l;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;if(o!==null)this.boundingBox=o.clone();let a=e.boundingSphere;if(a!==null)this.boundingSphere=a.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class oo{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=zn()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=zn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=zn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var en=new N;class ls{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)en.fromBufferAttribute(this,t),en.applyMatrix4(e),this.setXYZ(t,en.x,en.y,en.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)en.fromBufferAttribute(this,t),en.applyNormalMatrix(e),this.setXYZ(t,en.x,en.y,en.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)en.fromBufferAttribute(this,t),en.transformDirection(e),this.setXYZ(t,en.x,en.y,en.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=Fn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=rt(n,this.array);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=rt(t,this.array);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=Fn(t,this.array);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=Fn(t,this.array);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=Fn(t,this.array);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=Fn(t,this.array);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e=e*this.data.stride+this.offset,this.normalized)t=rt(t,this.array),n=rt(n,this.array),i=rt(i,this.array),r=rt(r,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){js("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Nt(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new ls(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){js("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var MS=0;class sn extends Hn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:MS++}),this.uuid=zn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Le(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Me(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!=="")n.name=this.name;if(this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)n.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.shadowSide!==null)n.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)n.blending=this.blending;if(this.side!==0)n.side=this.side;if(this.vertexColors===!0)n.vertexColors=!0;if(this.opacity<1)n.opacity=this.opacity;if(this.transparent===!0)n.transparent=!0;if(this.blendSrc!==204)n.blendSrc=this.blendSrc;if(this.blendDst!==205)n.blendDst=this.blendDst;if(this.blendEquation!==100)n.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)n.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)n.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)n.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)n.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)n.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)n.depthFunc=this.depthFunc;if(this.depthTest===!1)n.depthTest=this.depthTest;if(this.depthWrite===!1)n.depthWrite=this.depthWrite;if(this.colorWrite===!1)n.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)n.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)n.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)n.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)n.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)n.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)n.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)n.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)n.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)n.rotation=this.rotation;if(this.polygonOffset===!0)n.polygonOffset=!0;if(this.polygonOffsetFactor!==0)n.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)n.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)n.linewidth=this.linewidth;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.dithering===!0)n.dithering=!0;if(this.alphaTest>0)n.alphaTest=this.alphaTest;if(this.alphaHash===!0)n.alphaHash=!0;if(this.alphaToCoverage===!0)n.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)n.premultipliedAlpha=!0;if(this.forceSinglePass===!0)n.forceSinglePass=!0;if(this.allowOverride===!1)n.allowOverride=!1;if(this.wireframe===!0)n.wireframe=!0;if(this.wireframeLinewidth>1)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)n.flatShading=!0;if(this.visible===!1)n.visible=!1;if(this.toneMapped===!1)n.toneMapped=!1;if(this.fog===!1)n.fog=!1;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(r){let s=[];for(let o in r){let a=r[o];delete a.metadata,s.push(a)}return s}if(t){let r=i(e.textures),s=i(e.images);if(r.length>0)n.textures=r;if(s.length>0)n.images=s}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Le().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessRange=e.iridescenceThicknessRange;if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new Ie().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new Ie().fromArray(e.clearcoatNormalScale);if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}}var yi=new N,Kl=new N,_a=new N,ki=new N,Ql=new N,xa=new N,eu=new N;class Zi{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,yi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=yi.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return yi.copy(this.origin).addScaledVector(this.direction,t),yi.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){Kl.copy(e).add(t).multiplyScalar(0.5),_a.copy(t).sub(e).normalize(),ki.copy(this.origin).sub(Kl);let r=e.distanceTo(t)*0.5,s=-this.direction.dot(_a),o=ki.dot(this.direction),a=-ki.dot(_a),c=ki.lengthSq(),l=Math.abs(1-s*s),u,h,f,d;if(l>0)if(u=s*a-o,h=s*o-a,d=r*l,u>=0)if(h>=-d)if(h<=d){let m=1/l;u*=m,h*=m,f=u*(u+s*h+2*o)+h*(s*u+h+2*a)+c}else h=r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;else h=-r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;else if(h<=-d)u=Math.max(0,-(-s*r+o)),h=u>0?-r:Math.min(Math.max(-r,-a),r),f=-u*u+h*(h+2*a)+c;else if(h<=d)u=0,h=Math.min(Math.max(-r,-a),r),f=h*(h+2*a)+c;else u=Math.max(0,-(s*r+o)),h=u>0?r:Math.min(Math.max(-r,-a),r),f=-u*u+h*(h+2*a)+c;else h=s>0?-r:r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;if(n)n.copy(this.origin).addScaledVector(this.direction,u);if(i)i.copy(Kl).addScaledVector(_a,h);return f}intersectSphere(e,t){yi.subVectors(e.center,this.origin);let n=yi.dot(this.direction),i=yi.dot(yi)-n*n,r=e.radius*e.radius;if(i>r)return null;let s=Math.sqrt(r-i),o=n-s,a=n+s;if(a<0)return null;if(o<0)return this.at(a,t);return this.at(o,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,r,s,o,a,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;if(c>=0)n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c;else n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c;if(l>=0)r=(e.min.y-h.y)*l,s=(e.max.y-h.y)*l;else r=(e.max.y-h.y)*l,s=(e.min.y-h.y)*l;if(n>s||r>i)return null;if(r>n||isNaN(n))n=r;if(s<i||isNaN(i))i=s;if(u>=0)o=(e.min.z-h.z)*u,a=(e.max.z-h.z)*u;else o=(e.max.z-h.z)*u,a=(e.min.z-h.z)*u;if(n>a||o>i)return null;if(o>n||n!==n)n=o;if(a<i||i!==i)i=a;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,yi)!==null}intersectTriangle(e,t,n,i,r){Ql.subVectors(t,e),xa.subVectors(n,e),eu.crossVectors(Ql,xa);let s=this.direction.dot(eu),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;ki.subVectors(this.origin,e);let a=o*this.direction.dot(xa.crossVectors(ki,xa));if(a<0)return null;let c=o*this.direction.dot(Ql.cross(ki));if(c<0)return null;if(a+c>s)return null;let l=-o*ki.dot(eu);if(l<0)return null;return this.at(l/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class si extends sn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ti,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}var p_=new ze,fr=new Zi,va=new mn,m_=new N,ya=new N,ba=new N,Sa=new N,tu=new N,Ma=new N,g_=new N,wa=new N;class pt extends at{constructor(e=new nn,t=new si){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){Ma.set(0,0,0);for(let a=0,c=r.length;a<c;a++){let l=o[a],u=r[a];if(l===0)continue;if(tu.fromBufferAttribute(u,e),s)Ma.addScaledVector(tu,l);else Ma.addScaledVector(tu.sub(t),l)}t.add(Ma)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(va.copy(n.boundingSphere),va.applyMatrix4(r),fr.copy(e.ray).recast(e.near),va.containsPoint(fr.origin)===!1){if(fr.intersectSphere(va,m_)===null)return;if(fr.origin.distanceToSquared(m_)>(e.far-e.near)**2)return}if(p_.copy(r).invert(),fr.copy(e.ray).applyMatrix4(p_),n.boundingBox!==null){if(fr.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,fr)}_computeIntersections(e,t,n){let i,r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,c=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,{groups:h,drawRange:f}=r;if(o!==null)if(Array.isArray(s))for(let d=0,m=h.length;d<m;d++){let x=h[d],p=s[x.materialIndex],g=Math.max(x.start,f.start),A=Math.min(o.count,Math.min(x.start+x.count,f.start+f.count));for(let E=g,y=A;E<y;E+=3){let w=o.getX(E),T=o.getX(E+1),R=o.getX(E+2);if(i=Ta(this,p,e,n,c,l,u,w,T,R),i)i.faceIndex=Math.floor(E/3),i.face.materialIndex=x.materialIndex,t.push(i)}}else{let d=Math.max(0,f.start),m=Math.min(o.count,f.start+f.count);for(let x=d,p=m;x<p;x+=3){let g=o.getX(x),A=o.getX(x+1),E=o.getX(x+2);if(i=Ta(this,s,e,n,c,l,u,g,A,E),i)i.faceIndex=Math.floor(x/3),t.push(i)}}else if(a!==void 0)if(Array.isArray(s))for(let d=0,m=h.length;d<m;d++){let x=h[d],p=s[x.materialIndex],g=Math.max(x.start,f.start),A=Math.min(a.count,Math.min(x.start+x.count,f.start+f.count));for(let E=g,y=A;E<y;E+=3){let w=E,T=E+1,R=E+2;if(i=Ta(this,p,e,n,c,l,u,w,T,R),i)i.faceIndex=Math.floor(E/3),i.face.materialIndex=x.materialIndex,t.push(i)}}else{let d=Math.max(0,f.start),m=Math.min(a.count,f.start+f.count);for(let x=d,p=m;x<p;x+=3){let g=x,A=x+1,E=x+2;if(i=Ta(this,s,e,n,c,l,u,g,A,E),i)i.faceIndex=Math.floor(x/3),t.push(i)}}}}function wS(e,t,n,i,r,s,o,a){let c;if(t.side===1)c=i.intersectTriangle(o,s,r,!0,a);else c=i.intersectTriangle(r,s,o,t.side===0,a);if(c===null)return null;wa.copy(a),wa.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(wa);if(l<n.near||l>n.far)return null;return{distance:l,point:wa.clone(),object:e}}function Ta(e,t,n,i,r,s,o,a,c,l){e.getVertexPosition(a,ya),e.getVertexPosition(c,ba),e.getVertexPosition(l,Sa);let u=wS(e,t,n,i,ya,ba,Sa,g_);if(u){let h=new N;if(wn.getBarycoord(g_,ya,ba,Sa,h),r)u.uv=wn.getInterpolatedAttribute(r,a,c,l,h,new Ie);if(s)u.uv1=wn.getInterpolatedAttribute(s,a,c,l,h,new Ie);if(o){if(u.normal=wn.getInterpolatedAttribute(o,a,c,l,h,new N),u.normal.dot(i.direction)>0)u.normal.multiplyScalar(-1)}let f={a,b:c,c:l,normal:new N,materialIndex:0};wn.getNormal(ya,ba,Sa,f.normal),u.face=f,u.barycoord=h}return u}var $s=new st,__=new st,x_=new st,TS=new st,v_=new ze,Ea=new N,nu=new mn,y_=new ze,iu=new Zi;class tc extends pt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ze,this.bindMatrixInverse=new ze,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new tn;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ea),this.boundingBox.expandByPoint(Ea)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new mn;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ea),this.boundingSphere.expandByPoint(Ea)}copy(e,t){if(super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(nu.copy(this.boundingSphere),nu.applyMatrix4(i),e.ray.intersectsSphere(nu)===!1)return;if(y_.copy(i).invert(),iu.copy(e.ray).applyMatrix4(y_),this.boundingBox!==null){if(iu.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,iu)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();if(r!==1/0)e.multiplyScalar(r);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Me("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(__.fromBufferAttribute(i.attributes.skinIndex,e),x_.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)$s.copy(t),t.set(0,0,0,0);else $s.set(...t,1),t.set(0,0,0);$s.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let s=x_.getComponent(r);if(s!==0){let o=__.getComponent(r);v_.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(TS.copy($s).applyMatrix4(v_),s)}}if(t.isVector4)t.w=$s.w;return t.applyMatrix4(this.bindMatrixInverse)}}class ao extends at{constructor(){super();this.isBone=!0,this.type="Bone"}}class co extends wt{constructor(e=null,t=1,n=1,i,r,s,o,a,c=1003,l=1003,u,h){super(null,s,o,a,c,l,i,r,u,h);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var b_=new ze,ES=new ze;class lo{constructor(e=[],t=[]){this.uuid=zn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Me("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ze)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new ze;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=e.length;r<s;r++){let o=e[r]?e[r].matrixWorld:ES;b_.multiplyMatrices(o,t[r]),b_.toArray(n,r*16)}if(i!==null)i.needsUpdate=!0}clone(){return new lo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new co(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],s=t[r];if(s===void 0)Me("Skeleton: No bone found with UUID:",r),s=new ao;this.bones.push(s),this.boneInverses.push(new ze().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let s=t[i];e.bones.push(s.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}}class gr extends Nt{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}var Zr=new ze,S_=new ze,Aa=[],M_=new tn,AS=new ze,Ws=new pt,Zs=new mn;class us extends pt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new gr(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,AS)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new tn;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Zr),M_.copy(e.boundingBox).applyMatrix4(Zr),this.boundingBox.union(M_)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new mn;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Zr),Zs.copy(e.boundingSphere).applyMatrix4(Zr),this.boundingSphere.union(Zs)}copy(e,t){if(super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null)this.morphTexture=e.morphTexture.clone();if(e.instanceColor!==null)this.instanceColor=e.instanceColor.clone();if(this.count=e.count,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,s=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[s+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Ws.geometry=this.geometry,Ws.material=this.material,Ws.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Zs.copy(this.boundingSphere),Zs.applyMatrix4(n),e.ray.intersectsSphere(Zs)===!1)return;for(let r=0;r<i;r++){this.getMatrixAt(r,Zr),S_.multiplyMatrices(n,Zr),Ws.matrixWorld=S_,Ws.raycast(e,Aa);for(let s=0,o=Aa.length;s<o;s++){let a=Aa[s];a.instanceId=r,a.object=this,t.push(a)}Aa.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new gr(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new co(new Float32Array(i*this.count),i,this.count,1028,1015);let r=this.morphTexture.source.data.data,s=0;for(let c=0;c<n.length;c++)s+=n[c];let o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;return r[a]=o,r.set(n,a+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var ru=new N,RS=new N,CS=new Oe;class Un{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=ru.subVectors(n,t).cross(RS.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(ru),r=this.normal.dot(i);if(r===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let s=-(e.start.dot(this.normal)+this.constant)/r;if(n===!0&&(s<0||s>1))return null;return t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||CS.getNormalMatrix(e),i=this.coplanarPoint(ru).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}var dr=new mn,IS=new Ie(0.5,0.5),Ra=new N;class uo{constructor(e=new Un,t=new Un,n=new Un,i=new Un,r=new Un,s=new Un){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],c=r[3],l=r[4],u=r[5],h=r[6],f=r[7],d=r[8],m=r[9],x=r[10],p=r[11],g=r[12],A=r[13],E=r[14],y=r[15];if(i[0].setComponents(c-s,f-l,p-d,y-g).normalize(),i[1].setComponents(c+s,f+l,p+d,y+g).normalize(),i[2].setComponents(c+o,f+u,p+m,y+A).normalize(),i[3].setComponents(c-o,f-u,p-m,y-A).normalize(),n)i[4].setComponents(a,h,x,E).normalize(),i[5].setComponents(c-a,f-h,p-x,y-E).normalize();else if(i[4].setComponents(c-a,f-h,p-x,y-E).normalize(),t===2000)i[5].setComponents(c+a,f+h,p+x,y+E).normalize();else if(t===2001)i[5].setComponents(a,h,x,E).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();dr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();dr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(dr)}intersectsSprite(e){dr.center.set(0,0,0);let t=IS.distanceTo(e.center);return dr.radius=0.7071067811865476+t,dr.applyMatrix4(e.matrixWorld),this.intersectsSphere(dr)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Ra.x=i.normal.x>0?e.max.x:e.min.x,Ra.y=i.normal.y>0?e.max.y:e.min.y,Ra.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ra)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ho extends sn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}var Ua=new N,Fa=new N,w_=new ze,Xs=new Zi,Ca=new mn,su=new N,T_=new N;class Xi extends at{constructor(e=new nn,t=new ho){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Ua.fromBufferAttribute(t,i-1),Fa.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Ua.distanceTo(Fa);e.setAttribute("lineDistance",new rn(n,1))}else Me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Ca.copy(n.boundingSphere),Ca.applyMatrix4(i),Ca.radius+=r,e.ray.intersectsSphere(Ca)===!1)return;w_.copy(i).invert(),Xs.copy(e.ray).applyMatrix4(w_);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=this.isLineSegments?2:1,l=n.index,h=n.attributes.position;if(l!==null){let f=Math.max(0,s.start),d=Math.min(l.count,s.start+s.count);for(let m=f,x=d-1;m<x;m+=c){let p=l.getX(m),g=l.getX(m+1),A=Ia(this,e,Xs,a,p,g,m);if(A)t.push(A)}if(this.isLineLoop){let m=l.getX(d-1),x=l.getX(f),p=Ia(this,e,Xs,a,m,x,d-1);if(p)t.push(p)}}else{let f=Math.max(0,s.start),d=Math.min(h.count,s.start+s.count);for(let m=f,x=d-1;m<x;m+=c){let p=Ia(this,e,Xs,a,m,m+1,m);if(p)t.push(p)}if(this.isLineLoop){let m=Ia(this,e,Xs,a,d-1,f,d-1);if(m)t.push(m)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Ia(e,t,n,i,r,s,o){let a=e.geometry.attributes.position;if(Ua.fromBufferAttribute(a,r),Fa.fromBufferAttribute(a,s),n.distanceSqToSegment(Ua,Fa,su,T_)>i)return;su.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(su);if(l<t.near||l>t.far)return;return{distance:l,point:T_.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var E_=new N,A_=new N;class nc extends Xi{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)E_.fromBufferAttribute(t,i),A_.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+E_.distanceTo(A_);e.setAttribute("lineDistance",new rn(n,1))}else Me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ic extends Xi{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}}class fo extends sn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}var R_=new ze,cu=new Zi,Pa=new mn,La=new N;class hs extends at{constructor(e=new nn,t=new fo){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Pa.copy(n.boundingSphere),Pa.applyMatrix4(i),Pa.radius+=r,e.ray.intersectsSphere(Pa)===!1)return;R_.copy(i).invert(),cu.copy(e.ray).applyMatrix4(R_);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=n.index,u=n.attributes.position;if(c!==null){let h=Math.max(0,s.start),f=Math.min(c.count,s.start+s.count);for(let d=h,m=f;d<m;d++){let x=c.getX(d);La.fromBufferAttribute(u,x),C_(La,x,a,i,e,t,this)}}else{let h=Math.max(0,s.start),f=Math.min(u.count,s.start+s.count);for(let d=h,m=f;d<m;d++)La.fromBufferAttribute(u,d),C_(La,d,a,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function C_(e,t,n,i,r,s,o){let a=cu.distanceSqToPoint(e);if(a<n){let c=new N;cu.closestPointToPoint(e,c),c.applyMatrix4(i);let l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class rc extends wt{constructor(e=[],t=301,n,i,r,s,o,a,c,l){super(e,t,n,i,r,s,o,a,c,l);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qi extends wt{constructor(e,t,n=1014,i,r,s,o=1003,a=1003,c,l=1026,u=1){if(l!==1026&&l!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let h={width:e,height:t,depth:u};super(h,i,r,s,o,a,l,n,c);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ro(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);if(this.compareFunction!==null)t.compareFunction=this.compareFunction;return t}}class fh extends qi{constructor(e,t=1014,n=301,i,r,s=1003,o=1003,a,c=1026){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,i,r,s,o,a,c);this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class sc extends wt{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Yi extends nn{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};let o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);let a=[],c=[],l=[],u=[],h=0,f=0;d("z","y","x",-1,-1,n,t,e,s,r,0),d("z","y","x",1,-1,n,t,-e,s,r,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new rn(c,3)),this.setAttribute("normal",new rn(l,3)),this.setAttribute("uv",new rn(u,2));function d(m,x,p,g,A,E,y,w,T,R,_){let S=E/T,U=y/R,C=E/2,z=y/2,j=w/2,F=T+1,H=R+1,V=0,O=0,K=new N;for(let Q=0;Q<H;Q++){let se=Q*U-z;for(let me=0;me<F;me++){let _e=me*S-C;K[m]=_e*g,K[x]=se*A,K[p]=j,c.push(K.x,K.y,K.z),K[m]=0,K[x]=0,K[p]=w>0?1:-1,l.push(K.x,K.y,K.z),u.push(me/T),u.push(1-Q/R),V+=1}}for(let Q=0;Q<R;Q++)for(let se=0;se<T;se++){let me=h+se+F*Q,_e=h+se+F*(Q+1),qe=h+(se+1)+F*(Q+1),Ge=h+(se+1)+F*Q;a.push(me,_e,Ge),a.push(_e,qe,Ge),O+=6}o.addGroup(f,O,_),f+=O,h+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class po extends nn{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),c=o+1,l=a+1,u=e/o,h=t/a,f=[],d=[],m=[],x=[];for(let p=0;p<l;p++){let g=p*h-s;for(let A=0;A<c;A++){let E=A*u-r;d.push(E,-g,0),m.push(0,0,1),x.push(A/o),x.push(1-p/a)}}for(let p=0;p<a;p++)for(let g=0;g<o;g++){let A=g+c*p,E=g+c*(p+1),y=g+1+c*(p+1),w=g+1+c*p;f.push(A,E,w),f.push(E,y,w)}this.setIndex(f),this.setAttribute("position",new rn(d,3)),this.setAttribute("normal",new rn(m,3)),this.setAttribute("uv",new rn(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new po(e.width,e.height,e.widthSegments,e.heightSegments)}}function Mr(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let r=e[n][i];if(I_(r))if(r.isRenderTargetTexture)Me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=r.clone();else if(Array.isArray(r))if(I_(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();t[n][i]=s}else t[n][i]=r.slice();else t[n][i]=r}}return t}function Jt(e){let t={};for(let n=0;n<e.length;n++){let i=Mr(e[n]);for(let r in i)t[r]=i[r]}return t}function I_(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function PS(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function dh(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return $e.workingColorSpace}var U0={clone:Mr,merge:Jt},LS=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`,Oy=`void main() {
+}`,NS=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
-}`;class Mn extends rn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Uy,this.fragmentShader=Oy,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=gr(e.uniforms),this.uniformsGroups=Dy(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let s=this.uniforms[i].value;if(s&&s.isTexture)t.uniforms[i]={type:"t",value:s.toJSON(e).uuid};else if(s&&s.isColor)t.uniforms[i]={type:"c",value:s.getHex()};else if(s&&s.isVector2)t.uniforms[i]={type:"v2",value:s.toArray()};else if(s&&s.isVector3)t.uniforms[i]={type:"v3",value:s.toArray()};else if(s&&s.isVector4)t.uniforms[i]={type:"v4",value:s.toArray()};else if(s&&s.isMatrix3)t.uniforms[i]={type:"m3",value:s.toArray()};else if(s&&s.isMatrix4)t.uniforms[i]={type:"m4",value:s.toArray()};else t.uniforms[i]={value:s}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Le().setHex(i.value);break;case"v2":this.uniforms[n].value=new Ie().fromArray(i.value);break;case"v3":this.uniforms[n].value=new N().fromArray(i.value);break;case"v4":this.uniforms[n].value=new st().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Ue().fromArray(i.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}}class Ru extends Mn{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class mi extends rn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Le(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 Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ie(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 qn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class dn extends mi{constructor(e){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ie(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return $e(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Le(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class za extends rn{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ie(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new qn,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Cu extends rn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Iu extends rn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function ha(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function Fy(e){function t(r,s){return e[r]-e[s]}let n=e.length,i=Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(t),i}function hg(e,t,n){let i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){let a=n[s]*t;for(let c=0;c!==t;++c)r[o++]=e[a+c]}return r}function zy(e,t,n,i){let r=1,s=e[0];while(s!==void 0&&s[i]===void 0)s=e[r++];if(s===void 0)return;let o=s[i];if(o===void 0)return;if(Array.isArray(o))do{if(o=s[i],o!==void 0)t.push(s.time),n.push(...o);s=e[r++]}while(s!==void 0);else if(o.toArray!==void 0)do{if(o=s[i],o!==void 0)t.push(s.time),o.toArray(n,n.length);s=e[r++]}while(s!==void 0);else do{if(o=s[i],o!==void 0)t.push(s.time),n.push(o);s=e[r++]}while(s!==void 0)}class gi{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){let o=t[1];if(e<o)n=2,r=o;for(let a=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}while(n<s){let o=n+s>>>1;if(e<t[o])s=o;else n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class Pu extends gi{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,s=e+1,o=i[r],a=i[s];if(o===void 0)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case 2401:s=e,a=2*n-t;break;case 2402:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}let c=(n-t)*0.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=s*l}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,h=this._weightNext,d=(n-t)/(i-t),g=d*d,y=g*d,p=-f*y+2*f*g-f*d,m=(1+f)*y+(-1.5-2*f)*g+(-0.5+f)*d+1,A=(-1-h)*y+(1.5+h)*g+0.5*d,T=h*y-h*g;for(let v=0;v!==o;++v)r[v]=p*s[l+v]+m*s[c+v]+A*s[a+v]+T*s[u+v];return r}}class ka extends gi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=(n-t)/(i-t),u=1-l;for(let f=0;f!==o;++f)r[f]=s[c+f]*u+s[a+f]*l;return r}}class Lu extends gi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Nu extends gi{interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let d=(n-t)/(i-t),g=1-d;for(let y=0;y!==o;++y)r[y]=s[c+y]*g+s[a+y]*d;return r}let f=o*2,h=e-1;for(let d=0;d!==o;++d){let g=s[c+d],y=s[a+d],p=h*f+d*2,m=u[p],A=u[p+1],T=e*f+d*2,v=l[T],w=l[T+1],E=(n-t)/(i-t),R,_,S,F,C;for(let z=0;z<8;z++){R=E*E,_=R*E,S=1-E,F=S*S,C=F*S;let O=C*t+3*F*E*m+3*S*R*v+_*i-n;if(Math.abs(O)<0.0000000001)break;let H=3*F*(m-t)+6*S*E*(v-m)+3*R*(i-v);if(Math.abs(H)<0.0000000001)break;E=E-O/H,E=Math.max(0,Math.min(1,E))}r[d]=C*g+3*F*E*A+3*S*R*w+_*y}return r}}class pn{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ha(t,this.TimeBufferType),this.values=ha(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ha(e.times,Array),values:ha(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Lu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ka(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Pu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Nu(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Me("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,s=i-1;while(r!==i&&n[r]<e)++r;while(s!==-1&&n[s]>t)--s;if(++s,r!==0||s!==i){if(r>=s)s=Math.max(s,1),r=s-1;let o=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*o,s*o)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Ne("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,r=n.length;if(r===0)Ne("KeyframeTrack: Track is empty.",this),e=!1;let s=null;for(let o=0;o!==r;o++){let a=n[o];if(typeof a==="number"&&isNaN(a)){Ne("KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(s!==null&&s>a){Ne("KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(i!==void 0){if(jv(i))for(let o=0,a=i.length;o!==a;++o){let c=i[o];if(isNaN(c)){Ne("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,r=e.length-1,s=1;for(let o=1;o<r;++o){let a=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==e[0]))if(!i){let u=o*n,f=u-n,h=u+n;for(let d=0;d!==n;++d){let g=t[u+d];if(g!==t[f+d]||g!==t[h+d]){a=!0;break}}}else a=!0;if(a){if(o!==s){e[s]=e[o];let u=o*n,f=s*n;for(let h=0;h!==n;++h)t[f+h]=t[u+h]}++s}}if(r>0){e[s]=e[r];for(let o=r*n,a=s*n,c=0;c!==n;++c)t[a+c]=t[o+c];++s}if(s!==e.length)this.times=e.slice(0,s),this.values=t.slice(0,s*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}pn.prototype.ValueTypeName="";pn.prototype.TimeBufferType=Float32Array;pn.prototype.ValueBufferType=Float32Array;pn.prototype.DefaultInterpolation=2301;class Hi extends pn{constructor(e,t,n){super(e,t,n)}}Hi.prototype.ValueTypeName="bool";Hi.prototype.ValueBufferType=Array;Hi.prototype.DefaultInterpolation=2300;Hi.prototype.InterpolantFactoryMethodLinear=void 0;Hi.prototype.InterpolantFactoryMethodSmooth=void 0;class Ba extends pn{constructor(e,t,n,i){super(e,t,n,i)}}Ba.prototype.ValueTypeName="color";class Vi extends pn{constructor(e,t,n,i){super(e,t,n,i)}}Vi.prototype.ValueTypeName="number";class Du extends gi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t),c=e*o;for(let l=c+o;c!==l;c+=4)Bt.slerpFlat(r,0,s,c-o,s,c,a);return r}}class Wi extends pn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Du(this.times,this.values,this.getValueSize(),e)}}Wi.prototype.ValueTypeName="quaternion";Wi.prototype.InterpolantFactoryMethodSmooth=void 0;class $i extends pn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="string";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=2300;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class _r extends pn{constructor(e,t,n,i){super(e,t,n,i)}}_r.prototype.ValueTypeName="vector";class $r{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Dn(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,o=n.length;s!==o;++s)t.push(By(n[s]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,s=n.length;r!==s;++r)t.push(pn.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,s=[];for(let o=0;o<r;o++){let a=[],c=[];a.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);let l=Fy(a);if(a=hg(a,1,l),c=hg(c,1,l),!i&&a[0]===0)a.push(r),c.push(c[0]);s.push(new Vi(".morphTargetInfluences["+t[o].name+"]",a,c).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.name.match(r);if(l&&l.length>1){let u=l[1],f=i[u];if(!f)i[u]=f=[];f.push(c)}}let s=[];for(let o in i)s.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return s}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function ky(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Vi;case"vector":case"vector2":case"vector3":case"vector4":return _r;case"color":return Ba;case"quaternion":return Wi;case"bool":case"boolean":return Hi;case"string":return $i}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function By(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=ky(e.type);if(e.times===void 0){let n=[],i=[];zy(e.keys,n,i,"value"),e.times=n,e.values=i}if(t.parse!==void 0)return t.parse(e);else return new t(e.name,e.times,e.values,e.interpolation)}var Xn={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(fg(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(fg(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function fg(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class no{constructor(e,t,n){let i=this,r=!1,s=0,o=0,a=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(l){if(o++,r===!1){if(i.onStart!==void 0)i.onStart(l,s,o)}r=!0},this.itemEnd=function(l){if(s++,i.onProgress!==void 0)i.onProgress(l,s,o);if(s===o){if(r=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(l){if(i.onError!==void 0)i.onError(l)},this.resolveURL=function(l){if(l=l.normalize("NFC"),a)return a(l);return l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){let u=c.indexOf(l);if(u!==-1)c.splice(u,2);return this},this.getHandler=function(l){for(let u=0,f=c.length;u<f;u+=2){let h=c[u],d=c[u+1];if(h.global)h.lastIndex=0;if(h.test(l))return d}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var __=new no;class _i{constructor(e){if(this.manager=e!==void 0?e:__,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}_i.DEFAULT_MATERIAL_NAME="__DEFAULT";var hi={};class x_ extends Error{constructor(e,t){super(e);this.response=t}}class io extends _i{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=Xn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(r);this.manager.itemEnd(e)},0);return}if(hi[e]!==void 0){hi[e].push({onLoad:t,onProgress:n,onError:i});return}hi[e]=[],hi[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,a=this.responseType;fetch(s).then((c)=>{if(c.status===200||c.status===0){if(c.status===0)Me("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let l=hi[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0,g=0,y=new ReadableStream({start(p){m();function m(){u.read().then(({done:A,value:T})=>{if(A)p.close();else{g+=T.byteLength;let v=new ProgressEvent("progress",{lengthComputable:d,loaded:g,total:h});for(let w=0,E=l.length;w<E;w++){let R=l[w];if(R.onProgress)R.onProgress(v)}p.enqueue(T),m()}},(A)=>{p.error(A)})}}});return new Response(y)}else throw new x_(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then((c)=>{switch(a){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then((l)=>new DOMParser().parseFromString(l,o));case"json":return c.json();default:if(o==="")return c.text();else{let u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then((d)=>h.decode(d))}}}).then((c)=>{Xn.add(`file:${e}`,c);let l=hi[e];delete hi[e];for(let u=0,f=l.length;u<f;u++){let h=l[u];if(h.onLoad)h.onLoad(c)}}).catch((c)=>{let l=hi[e];if(l===void 0)throw this.manager.itemError(e),c;delete hi[e];for(let u=0,f=l.length;u<f;u++){let h=l[u];if(h.onError)h.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var kr=new WeakMap;class Uu extends _i{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=Xn.get(`image:${e}`);if(s!==void 0){if(s.complete===!0)r.manager.itemStart(e),setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);else{let u=kr.get(s);if(u===void 0)u=[],kr.set(s,u);u.push({onLoad:t,onError:i})}return s}let o=Vr("img");function a(){if(l(),t)t(this);let u=kr.get(this)||[];for(let f=0;f<u.length;f++){let h=u[f];if(h.onLoad)h.onLoad(this)}kr.delete(this),r.manager.itemEnd(e)}function c(u){if(l(),i)i(u);Xn.remove(`image:${e}`);let f=kr.get(this)||[];for(let h=0;h<f.length;h++){let d=f[h];if(d.onError)d.onError(u)}kr.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1)}if(o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)o.crossOrigin=this.crossOrigin}return Xn.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class Ga extends _i{constructor(e){super(e)}load(e,t,n,i){let r=new wt,s=new Uu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(o){if(r.image=o,r.needsUpdate=!0,t!==void 0)t(r)},n,i),r}}class rs extends at{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class Ha extends rs{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Le(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}var yl=new ze,dg=new N,pg=new N;class Va{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ie(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ks,this._frameExtents=new Ie(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;if(dg.setFromMatrixPosition(e.matrixWorld),t.position.copy(dg),pg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pg),t.updateMatrixWorld(),yl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yl,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth)n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiply(yl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};if(this.intensity!==1)e.intensity=this.intensity;if(this.bias!==0)e.bias=this.bias;if(this.normalBias!==0)e.normalBias=this.normalBias;if(this.radius!==1)e.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)e.mapSize=this.mapSize.toArray();return e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}var fa=new N,da=new Bt,$n=new N;class Wa extends at{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(fa,da,$n),$n.x===1&&$n.y===1&&$n.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(fa,da,$n.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(fa,da,$n),$n.x===1&&$n.y===1&&$n.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(fa,da,$n.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Li=new N,mg=new Ie,gg=new Ie;class Lt extends Wa{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=cr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Os*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return cr*2*Math.atan(Math.tan(Os*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Li.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(Li.x,Li.y).multiplyScalar(-e/Li.z),Li.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(Li.x,Li.y).multiplyScalar(-e/Li.z)}getViewSize(e,t){return this.getViewBounds(e,mg,gg),t.subVectors(gg,mg)}setViewOffset(e,t,n,i,r,s){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Os*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-0.5*i,s=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:a,fullHeight:c}=s;r+=s.offsetX*i/a,t-=s.offsetY*n/c,i*=s.width/a,n*=s.height/c}let o=this.filmOffset;if(o!==0)r+=e*o/this.getFilmWidth();this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class v_ extends Va{constructor(){super(new Lt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=cr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;if(n!==t.fov||i!==t.aspect||r!==t.far)t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class $a extends rs{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new v_}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}}class y_ extends Va{constructor(){super(new Lt(90,1,0.5,500));this.isPointLightShadow=!0}}class ss extends rs{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new y_}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class xr extends Wa{constructor(e=-1,t=1,n=1,i=-1,r=0.1,s=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,s=n+e,o=i+t,a=i-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,s=r+c*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}}class b_ extends Va{constructor(){super(new xr(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class os extends rs{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.shadow=new b_}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Zi{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}var bl=new WeakMap;class Za extends _i{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Me("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Me("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=Xn.get(`image-bitmap:${e}`);if(s!==void 0){if(r.manager.itemStart(e),s.then){s.then((c)=>{if(bl.has(s)===!0){if(i)i(bl.get(s));r.manager.itemError(e),r.manager.itemEnd(e)}else{if(t)t(c);r.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let a=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){if(Xn.add(`image-bitmap:${e}`,c),t)t(c);r.manager.itemEnd(e)}).catch(function(c){if(i)i(c);bl.set(a,c),Xn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Xn.add(`image-bitmap:${e}`,a),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Br=-90,Gr=1;class Ou extends at{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Lt(Br,Gr,e,t);i.layers=this.layers,this.add(i);let r=new Lt(Br,Gr,e,t);r.layers=this.layers,this.add(r);let s=new Lt(Br,Gr,e,t);s.layers=this.layers,this.add(s);let o=new Lt(Br,Gr,e,t);o.layers=this.layers,this.add(o);let a=new Lt(Br,Gr,e,t);a.layers=this.layers,this.add(a);let c=new Lt(Br,Gr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(let c of t)this.remove(c);if(e===2000)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),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(e===2001)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),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[r,s,o,a,c,l]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let y=!1;if(e.isWebGLRenderer===!0)y=e.state.buffers.depth.getReversed();else y=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,1,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,2,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,3,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,4,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),y&&e.autoClear===!1)e.clearDepth();e.render(t,l),e.setRenderTarget(u,f,h),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Fu extends Lt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class zu{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,s;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}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(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,s=this.cumulativeWeight;if(s===0){for(let o=0;o!==i;++o)n[r+o]=n[o];s=t}else{s+=t;let o=t/s;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let a=t*this._origIndex;this._mixBufferRegion(n,i,a,1-r,t)}if(s>0)this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let a=t,c=t+t;a!==c;++a)if(n[a]!==n[a+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=0.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){Bt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let s=this._workIndex*r;Bt.multiplyQuaternionsFlat(e,s,e,t,e,n),Bt.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){let s=1-i;for(let o=0;o!==r;++o){let a=t+o;e[a]=e[a]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){let o=t+s;e[o]=e[o]+e[n+s]*i}}}var ku="\\[\\]\\.:\\/",Gy=new RegExp("["+ku+"]","g"),Bu="[^"+ku+"]",Hy="[^"+ku.replace("\\.","")+"]",Vy=/((?:WC+[\/:])*)/.source.replace("WC",Bu),Wy=/(WCOD+)?/.source.replace("WCOD",Hy),$y=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bu),Zy=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bu),Xy=new RegExp("^"+Vy+Wy+$y+Zy+"$"),qy=["material","materials","bones","map"];class S_{constructor(e,t,n){let i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class tt{constructor(e,t,n){this.path=t,this.parsedPath=n||tt.parseTrackName(t),this.node=tt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new tt(e,t,n);else return new tt.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Gy,"")}static parseTrackName(e){let t=Xy.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);if(qy.indexOf(r)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=r}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let s=0;s<r.length;s++){let o=r[s];if(o.name===t||o.uuid===t)return o;let a=n(o.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:r}=t;if(!e)e=tt.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Me("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ne("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ne("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let l=0;l<e.length;l++)if(e[l].name===c){c=l;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ne("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ne("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ne("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let s=e[i];if(s===void 0){let c=t.nodeName;Ne("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)o=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)o=this.Versioning.MatrixWorldNeedsUpdate;let a=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[r]!==void 0)r=e.morphTargetDictionary[r]}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else if(s.fromArray!==void 0&&s.toArray!==void 0)a=this.BindingType.HasFromToArray,this.resolvedProperty=s;else if(Array.isArray(s))a=this.BindingType.EntireArray,this.resolvedProperty=s;else this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}tt.Composite=S_;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Gu{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,s=r.length,o=Array(s),a={endingStart:2400,endingEnd:2400};for(let c=0;c!==s;++c){let l=r[c].createInterpolant(null);o[c]=l,l.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,s=r/i,o=i/r;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,s,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;if(e!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,s=this.timeScale,o=this._timeScaleInterpolant;if(o===null)o=i._lendControlInterpolant(),this._timeScaleInterpolant=o;let a=o.parameterPositions,c=o.sampleValues;return a[0]=r,a[1]=r+n,c[0]=e/s,c[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;if(e!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let a=(e-r)*n;if(a<0||n===0)t=0;else this._startTime=null,t=n*a}t*=this._updateTimeScale(e);let s=this._updateTime(t),o=this._updateWeight(e);if(o>0){let a=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulateAdditive(o);break;case 2500:default:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(this.stopFading(),i===0)this.enabled=!1}}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(t===0)this.paused=!0;else{if(this._restoreTimeScale!==null)t=this._restoreTimeScale;this.timeScale=t}this.stopWarping()}}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,s=n===2202;if(e===0){if(r===-1)return i;return s&&(r&1)===1?t-i:i}if(n===2200){if(r===-1)this._loopCount=0,this._setEndings(!0,!0,!1);e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1)if(e>=0)r=0,this._setEndings(!0,this.repetitions===0,s);else this._setEndings(this.repetitions===0,!0,s);if(i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let a=this.repetitions-r;if(a<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1})}else{if(a===1){let c=e<0;this._setEndings(c,!c,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(s&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;if(n)i.endingStart=2401,i.endingEnd=2401;else{if(e)i.endingStart=this.zeroSlopeAtStart?2401:2400;else i.endingStart=2402;if(t)i.endingEnd=this.zeroSlopeAtEnd?2401:2400;else i.endingEnd=2402}}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,s=this._weightInterpolant;if(s===null)s=i._lendControlInterpolant(),this._weightInterpolant=s;let o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}var Yy=new Float32Array(1);class Xa extends zn{constructor(e){super();if(this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,{_propertyBindings:s,_interpolants:o}=e,a=n.uuid,c=this._bindingsByRootAndName,l=c[a];if(l===void 0)l={},c[a]=l;for(let u=0;u!==r;++u){let f=i[u],h=f.name,d=l[h];if(d!==void 0)++d.referenceCount,s[u]=d;else{if(d=s[u],d!==void 0){if(d._cacheIndex===null)++d.referenceCount,this._addInactiveBinding(d,a,h);continue}let g=t&&t._propertyBindings[u].binding.parsedPath;d=new zu(tt.create(n,h,g),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,a,h),s[u]=d}o[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(r.useCount++===0)this._lendBinding(r),r.saveOriginalState()}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.useCount===0)r.restoreOriginalState(),this._takeBackBinding(r)}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{let o=s.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,c=a[a.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,f=(e._localRoot||this._root).uuid;if(delete u[f],a.length===0)delete s[r];this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.referenceCount===0)this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,s=i[t];if(s===void 0)s={},i[t]=s;s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],c=e._cacheIndex;if(a._cacheIndex=c,t[c]=a,t.pop(),delete o[r],Object.keys(o).length===0)delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];if(n===void 0)n=new ka(new Float32Array(2),new Float32Array(2),1,Yy),n.__cacheIndex=t,e[t]=n;return n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,s=typeof e==="string"?$r.findByName(i,e):e,o=s!==null?s.uuid:e,a=this._actionsByClip[o],c=null;if(n===void 0)if(s!==null)n=s.blendMode;else n=2500;if(a!==void 0){let u=a.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;if(c=a.knownActions[0],s===null)s=c._clip}if(s===null)return null;let l=new Gu(this,s,t,n);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e==="string"?$r.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];if(o!==void 0)return o.actionByRoot[i]||null;return null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,s);let o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let s=r.knownActions;for(let o=0,a=s.length;o!==a;++o){let c=s[o];this._deactivateAction(c);let l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let o=n[s].actionByRoot,a=o[t];if(a!==void 0)this._deactivateAction(a),this._removeInactiveAction(a)}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let s in r){let o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);if(n!==null)this._deactivateAction(n),this._removeInactiveAction(n)}}class ro{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=$e(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){if(this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(e,n),this.phi=Math.acos($e(t/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class Hu{static{Hu.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}class qa extends zn{constructor(e,t=null){super();this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Me("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=e}disconnect(){}dispose(){}update(){}}function Vu(e,t,n,i){let r=jy(i);switch(n){case 1021:return e*t;case 1028:return e*t/r.components*r.byteLength;case 1029:return e*t/r.components*r.byteLength;case 1030:return e*t*2/r.components*r.byteLength;case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:return e*t*4/r.components*r.byteLength;case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function jy(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));if(typeof window<"u")if(window.__THREE__)Me("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="185";function $_(){let e=null,t=!1,n=null,i=null;function r(s,o){n(s,o),i=e.requestAnimationFrame(r)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(r),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function Jy(e){let t=new WeakMap;function n(a,c){let{array:l,usage:u}=a,f=l.byteLength,h=e.createBuffer();e.bindBuffer(c,h),e.bufferData(c,l,u),a.onUploadCallback();let d;if(l instanceof Float32Array)d=e.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=e.HALF_FLOAT;else if(l instanceof Uint16Array)if(a.isFloat16BufferAttribute)d=e.HALF_FLOAT;else d=e.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=e.SHORT;else if(l instanceof Uint32Array)d=e.UNSIGNED_INT;else if(l instanceof Int32Array)d=e.INT;else if(l instanceof Int8Array)d=e.BYTE;else if(l instanceof Uint8Array)d=e.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:h,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,c,l){let{array:u,updateRanges:f}=c;if(e.bindBuffer(l,a),f.length===0)e.bufferSubData(l,0,u);else{f.sort((d,g)=>d.start-g.start);let h=0;for(let d=1;d<f.length;d++){let g=f[h],y=f[d];if(y.start<=g.start+g.count+1)g.count=Math.max(g.count,y.start+y.count-g.start);else++h,f[h]=y}f.length=h+1;for(let d=0,g=f.length;d<g;d++){let y=f[d];e.bufferSubData(l,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(a){if(a.isInterleavedBufferAttribute)a=a.data;return t.get(a)}function s(a){if(a.isInterleavedBufferAttribute)a=a.data;let c=t.get(a);if(c)e.deleteBuffer(c.buffer),t.delete(a)}function o(a,c){if(a.isInterleavedBufferAttribute)a=a.data;if(a.isGLBufferAttribute){let u=t.get(a);if(!u||u.version<a.version)t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=t.get(a);if(l===void 0)t.set(a,n(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:r,remove:s,update:o}}var Ky=`#ifdef USE_ALPHAHASH
+}`;class An extends sn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LS,this.fragmentShader=NS,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Mr(e.uniforms),this.uniformsGroups=PS(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let s=this.uniforms[i].value;if(s&&s.isTexture)t.uniforms[i]={type:"t",value:s.toJSON(e).uuid};else if(s&&s.isColor)t.uniforms[i]={type:"c",value:s.getHex()};else if(s&&s.isVector2)t.uniforms[i]={type:"v2",value:s.toArray()};else if(s&&s.isVector3)t.uniforms[i]={type:"v3",value:s.toArray()};else if(s&&s.isVector4)t.uniforms[i]={type:"v4",value:s.toArray()};else if(s&&s.isMatrix3)t.uniforms[i]={type:"m3",value:s.toArray()};else if(s&&s.isMatrix4)t.uniforms[i]={type:"m4",value:s.toArray()};else t.uniforms[i]={value:s}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Le().setHex(i.value);break;case"v2":this.uniforms[n].value=new Ie().fromArray(i.value);break;case"v3":this.uniforms[n].value=new N().fromArray(i.value);break;case"v4":this.uniforms[n].value=new st().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Oe().fromArray(i.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}}class ph extends An{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ti extends sn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Le(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 Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ie(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 ti,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class gn extends Ti{constructor(e){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ie(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return We(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Le(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class oc extends sn{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ie(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ti,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class mh extends sn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class gh extends sn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Na(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function DS(e){function t(r,s){return e[r]-e[s]}let n=e.length,i=Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(t),i}function P_(e,t,n){let i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){let a=n[s]*t;for(let c=0;c!==t;++c)r[o++]=e[a+c]}return r}function OS(e,t,n,i){let r=1,s=e[0];while(s!==void 0&&s[i]===void 0)s=e[r++];if(s===void 0)return;let o=s[i];if(o===void 0)return;if(Array.isArray(o))do{if(o=s[i],o!==void 0)t.push(s.time),n.push(...o);s=e[r++]}while(s!==void 0);else if(o.toArray!==void 0)do{if(o=s[i],o!==void 0)t.push(s.time),o.toArray(n,n.length);s=e[r++]}while(s!==void 0);else do{if(o=s[i],o!==void 0)t.push(s.time),n.push(o);s=e[r++]}while(s!==void 0)}class Ei{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){let o=t[1];if(e<o)n=2,r=o;for(let a=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}while(n<s){let o=n+s>>>1;if(e<t[o])s=o;else n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class _h extends Ei{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,s=e+1,o=i[r],a=i[s];if(o===void 0)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case 2401:s=e,a=2*n-t;break;case 2402:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}let c=(n-t)*0.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=s*l}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,f=this._weightNext,d=(n-t)/(i-t),m=d*d,x=m*d,p=-h*x+2*h*m-h*d,g=(1+h)*x+(-1.5-2*h)*m+(-0.5+h)*d+1,A=(-1-f)*x+(1.5+f)*m+0.5*d,E=f*x-f*m;for(let y=0;y!==o;++y)r[y]=p*s[l+y]+g*s[c+y]+A*s[a+y]+E*s[u+y];return r}}class ac extends Ei{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=(n-t)/(i-t),u=1-l;for(let h=0;h!==o;++h)r[h]=s[c+h]*u+s[a+h]*l;return r}}class xh extends Ei{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class vh extends Ei{interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let d=(n-t)/(i-t),m=1-d;for(let x=0;x!==o;++x)r[x]=s[c+x]*m+s[a+x]*d;return r}let h=o*2,f=e-1;for(let d=0;d!==o;++d){let m=s[c+d],x=s[a+d],p=f*h+d*2,g=u[p],A=u[p+1],E=e*h+d*2,y=l[E],w=l[E+1],T=(n-t)/(i-t),R,_,S,U,C;for(let z=0;z<8;z++){R=T*T,_=R*T,S=1-T,U=S*S,C=U*S;let F=C*t+3*U*T*g+3*S*R*y+_*i-n;if(Math.abs(F)<0.0000000001)break;let H=3*U*(g-t)+6*S*T*(y-g)+3*R*(i-y);if(Math.abs(H)<0.0000000001)break;T=T-F/H,T=Math.max(0,Math.min(1,T))}r[d]=C*m+3*U*T*A+3*S*R*w+_*x}return r}}class _n{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Na(t,this.TimeBufferType),this.values=Na(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Na(e.times,Array),values:Na(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new xh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ac(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new _h(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new vh(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Me("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,s=i-1;while(r!==i&&n[r]<e)++r;while(s!==-1&&n[s]>t)--s;if(++s,r!==0||s!==i){if(r>=s)s=Math.max(s,1),r=s-1;let o=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*o,s*o)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Ne("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,r=n.length;if(r===0)Ne("KeyframeTrack: Track is empty.",this),e=!1;let s=null;for(let o=0;o!==r;o++){let a=n[o];if(typeof a==="number"&&isNaN(a)){Ne("KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(s!==null&&s>a){Ne("KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(i!==void 0){if(Xb(i))for(let o=0,a=i.length;o!==a;++o){let c=i[o];if(isNaN(c)){Ne("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,r=e.length-1,s=1;for(let o=1;o<r;++o){let a=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==e[0]))if(!i){let u=o*n,h=u-n,f=u+n;for(let d=0;d!==n;++d){let m=t[u+d];if(m!==t[h+d]||m!==t[f+d]){a=!0;break}}}else a=!0;if(a){if(o!==s){e[s]=e[o];let u=o*n,h=s*n;for(let f=0;f!==n;++f)t[h+f]=t[u+f]}++s}}if(r>0){e[s]=e[r];for(let o=r*n,a=s*n,c=0;c!==n;++c)t[a+c]=t[o+c];++s}if(s!==e.length)this.times=e.slice(0,s),this.values=t.slice(0,s*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}_n.prototype.ValueTypeName="";_n.prototype.TimeBufferType=Float32Array;_n.prototype.ValueBufferType=Float32Array;_n.prototype.DefaultInterpolation=2301;class ji extends _n{constructor(e,t,n){super(e,t,n)}}ji.prototype.ValueTypeName="bool";ji.prototype.ValueBufferType=Array;ji.prototype.DefaultInterpolation=2300;ji.prototype.InterpolantFactoryMethodLinear=void 0;ji.prototype.InterpolantFactoryMethodSmooth=void 0;class cc extends _n{constructor(e,t,n,i){super(e,t,n,i)}}cc.prototype.ValueTypeName="color";class Ji extends _n{constructor(e,t,n,i){super(e,t,n,i)}}Ji.prototype.ValueTypeName="number";class yh extends Ei{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t),c=e*o;for(let l=c+o;c!==l;c+=4)Gt.slerpFlat(r,0,s,c-o,s,c,a);return r}}class Ki extends _n{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new yh(this.times,this.values,this.getValueSize(),e)}}Ki.prototype.ValueTypeName="quaternion";Ki.prototype.InterpolantFactoryMethodSmooth=void 0;class Qi extends _n{constructor(e,t,n){super(e,t,n)}}Qi.prototype.ValueTypeName="string";Qi.prototype.ValueBufferType=Array;Qi.prototype.DefaultInterpolation=2300;Qi.prototype.InterpolantFactoryMethodLinear=void 0;Qi.prototype.InterpolantFactoryMethodSmooth=void 0;class wr extends _n{constructor(e,t,n,i){super(e,t,n,i)}}wr.prototype.ValueTypeName="vector";class Qr{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=zn(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,o=n.length;s!==o;++s)t.push(FS(n[s]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,s=n.length;r!==s;++r)t.push(_n.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,s=[];for(let o=0;o<r;o++){let a=[],c=[];a.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);let l=DS(a);if(a=P_(a,1,l),c=P_(c,1,l),!i&&a[0]===0)a.push(r),c.push(c[0]);s.push(new Ji(".morphTargetInfluences["+t[o].name+"]",a,c).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.name.match(r);if(l&&l.length>1){let u=l[1],h=i[u];if(!h)i[u]=h=[];h.push(c)}}let s=[];for(let o in i)s.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return s}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function US(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ji;case"vector":case"vector2":case"vector3":case"vector4":return wr;case"color":return cc;case"quaternion":return Ki;case"bool":case"boolean":return ji;case"string":return Qi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function FS(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=US(e.type);if(e.times===void 0){let n=[],i=[];OS(e.keys,n,i,"value"),e.times=n,e.values=i}if(t.parse!==void 0)return t.parse(e);else return new t(e.name,e.times,e.values,e.interpolation)}var ei={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(L_(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(L_(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function L_(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class mo{constructor(e,t,n){let i=this,r=!1,s=0,o=0,a=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(l){if(o++,r===!1){if(i.onStart!==void 0)i.onStart(l,s,o)}r=!0},this.itemEnd=function(l){if(s++,i.onProgress!==void 0)i.onProgress(l,s,o);if(s===o){if(r=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(l){if(i.onError!==void 0)i.onError(l)},this.resolveURL=function(l){if(l=l.normalize("NFC"),a)return a(l);return l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){let u=c.indexOf(l);if(u!==-1)c.splice(u,2);return this},this.getHandler=function(l){for(let u=0,h=c.length;u<h;u+=2){let f=c[u],d=c[u+1];if(f.global)f.lastIndex=0;if(f.test(l))return d}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var F0=new mo;class Ai{constructor(e){if(this.manager=e!==void 0?e:F0,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Ai.DEFAULT_MATERIAL_NAME="__DEFAULT";var bi={};class z0 extends Error{constructor(e,t){super(e);this.response=t}}class go extends Ai{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=ei.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(r);this.manager.itemEnd(e)},0);return}if(bi[e]!==void 0){bi[e].push({onLoad:t,onProgress:n,onError:i});return}bi[e]=[],bi[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,a=this.responseType;fetch(s).then((c)=>{if(c.status===200||c.status===0){if(c.status===0)Me("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let l=bi[e],u=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=h?parseInt(h):0,d=f!==0,m=0,x=new ReadableStream({start(p){g();function g(){u.read().then(({done:A,value:E})=>{if(A)p.close();else{m+=E.byteLength;let y=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:f});for(let w=0,T=l.length;w<T;w++){let R=l[w];if(R.onProgress)R.onProgress(y)}p.enqueue(E),g()}},(A)=>{p.error(A)})}}});return new Response(x)}else throw new z0(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then((c)=>{switch(a){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then((l)=>new DOMParser().parseFromString(l,o));case"json":return c.json();default:if(o==="")return c.text();else{let u=/charset="?([^;"\s]*)"?/i.exec(o),h=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(h);return c.arrayBuffer().then((d)=>f.decode(d))}}}).then((c)=>{ei.add(`file:${e}`,c);let l=bi[e];delete bi[e];for(let u=0,h=l.length;u<h;u++){let f=l[u];if(f.onLoad)f.onLoad(c)}}).catch((c)=>{let l=bi[e];if(l===void 0)throw this.manager.itemError(e),c;delete bi[e];for(let u=0,h=l.length;u<h;u++){let f=l[u];if(f.onError)f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Xr=new WeakMap;class bh extends Ai{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=ei.get(`image:${e}`);if(s!==void 0){if(s.complete===!0)r.manager.itemStart(e),setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);else{let u=Xr.get(s);if(u===void 0)u=[],Xr.set(s,u);u.push({onLoad:t,onError:i})}return s}let o=Jr("img");function a(){if(l(),t)t(this);let u=Xr.get(this)||[];for(let h=0;h<u.length;h++){let f=u[h];if(f.onLoad)f.onLoad(this)}Xr.delete(this),r.manager.itemEnd(e)}function c(u){if(l(),i)i(u);ei.remove(`image:${e}`);let h=Xr.get(this)||[];for(let f=0;f<h.length;f++){let d=h[f];if(d.onError)d.onError(u)}Xr.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1)}if(o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)o.crossOrigin=this.crossOrigin}return ei.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class lc extends Ai{constructor(e){super(e)}load(e,t,n,i){let r=new wt,s=new bh(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(o){if(r.image=o,r.needsUpdate=!0,t!==void 0)t(r)},n,i),r}}class fs extends at{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class uc extends fs{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Le(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}var ou=new ze,N_=new N,D_=new N;class hc{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ie(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new uo,this._frameExtents=new Ie(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;if(N_.setFromMatrixPosition(e.matrixWorld),t.position.copy(N_),D_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(D_),t.updateMatrixWorld(),ou.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ou,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth)n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiply(ou)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};if(this.intensity!==1)e.intensity=this.intensity;if(this.bias!==0)e.bias=this.bias;if(this.normalBias!==0)e.normalBias=this.normalBias;if(this.radius!==1)e.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)e.mapSize=this.mapSize.toArray();return e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}var Da=new N,Oa=new Gt,Kn=new N;class fc extends at{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(Da,Oa,Kn),Kn.x===1&&Kn.y===1&&Kn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Da,Oa,Kn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Da,Oa,Kn),Kn.x===1&&Kn.y===1&&Kn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Da,Oa,Kn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Bi=new N,O_=new Ie,U_=new Ie;class Lt extends fc{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=mr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(qs*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return mr*2*Math.atan(Math.tan(qs*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Bi.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(Bi.x,Bi.y).multiplyScalar(-e/Bi.z),Bi.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(Bi.x,Bi.y).multiplyScalar(-e/Bi.z)}getViewSize(e,t){return this.getViewBounds(e,O_,U_),t.subVectors(U_,O_)}setViewOffset(e,t,n,i,r,s){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(qs*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-0.5*i,s=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:a,fullHeight:c}=s;r+=s.offsetX*i/a,t-=s.offsetY*n/c,i*=s.width/a,n*=s.height/c}let o=this.filmOffset;if(o!==0)r+=e*o/this.getFilmWidth();this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class k0 extends hc{constructor(){super(new Lt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=mr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;if(n!==t.fov||i!==t.aspect||r!==t.far)t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class dc extends fs{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new k0}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}}class B0 extends hc{constructor(){super(new Lt(90,1,0.5,500));this.isPointLightShadow=!0}}class ds extends fs{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new B0}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Tr extends fc{constructor(e=-1,t=1,n=1,i=-1,r=0.1,s=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,s=n+e,o=i+t,a=i-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,s=r+c*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}}class G0 extends hc{constructor(){super(new Tr(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class ps extends fs{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.shadow=new G0}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class er{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}var au=new WeakMap;class pc extends Ai{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Me("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Me("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=ei.get(`image-bitmap:${e}`);if(s!==void 0){if(r.manager.itemStart(e),s.then){s.then((c)=>{if(au.has(s)===!0){if(i)i(au.get(s));r.manager.itemError(e),r.manager.itemEnd(e)}else{if(t)t(c);r.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let a=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){if(ei.add(`image-bitmap:${e}`,c),t)t(c);r.manager.itemEnd(e)}).catch(function(c){if(i)i(c);au.set(a,c),ei.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});ei.add(`image-bitmap:${e}`,a),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var qr=-90,Yr=1;class Sh extends at{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Lt(qr,Yr,e,t);i.layers=this.layers,this.add(i);let r=new Lt(qr,Yr,e,t);r.layers=this.layers,this.add(r);let s=new Lt(qr,Yr,e,t);s.layers=this.layers,this.add(s);let o=new Lt(qr,Yr,e,t);o.layers=this.layers,this.add(o);let a=new Lt(qr,Yr,e,t);a.layers=this.layers,this.add(a);let c=new Lt(qr,Yr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(let c of t)this.remove(c);if(e===2000)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),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(e===2001)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),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[r,s,o,a,c,l]=this.children,u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let x=!1;if(e.isWebGLRenderer===!0)x=e.state.buffers.depth.getReversed();else x=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,1,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,2,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,3,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,4,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),x&&e.autoClear===!1)e.clearDepth();e.render(t,l),e.setRenderTarget(u,h,f),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Mh extends Lt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class wh{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,s;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}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(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,s=this.cumulativeWeight;if(s===0){for(let o=0;o!==i;++o)n[r+o]=n[o];s=t}else{s+=t;let o=t/s;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let a=t*this._origIndex;this._mixBufferRegion(n,i,a,1-r,t)}if(s>0)this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let a=t,c=t+t;a!==c;++a)if(n[a]!==n[a+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=0.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){Gt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let s=this._workIndex*r;Gt.multiplyQuaternionsFlat(e,s,e,t,e,n),Gt.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){let s=1-i;for(let o=0;o!==r;++o){let a=t+o;e[a]=e[a]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){let o=t+s;e[o]=e[o]+e[n+s]*i}}}var Th="\\[\\]\\.:\\/",zS=new RegExp("["+Th+"]","g"),Eh="[^"+Th+"]",kS="[^"+Th.replace("\\.","")+"]",BS=/((?:WC+[\/:])*)/.source.replace("WC",Eh),GS=/(WCOD+)?/.source.replace("WCOD",kS),HS=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Eh),VS=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Eh),$S=new RegExp("^"+BS+GS+HS+VS+"$"),WS=["material","materials","bones","map"];class H0{constructor(e,t,n){let i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class tt{constructor(e,t,n){this.path=t,this.parsedPath=n||tt.parseTrackName(t),this.node=tt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new tt(e,t,n);else return new tt.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(zS,"")}static parseTrackName(e){let t=$S.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);if(WS.indexOf(r)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=r}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let s=0;s<r.length;s++){let o=r[s];if(o.name===t||o.uuid===t)return o;let a=n(o.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:r}=t;if(!e)e=tt.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Me("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ne("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ne("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let l=0;l<e.length;l++)if(e[l].name===c){c=l;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ne("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ne("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ne("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let s=e[i];if(s===void 0){let c=t.nodeName;Ne("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)o=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)o=this.Versioning.MatrixWorldNeedsUpdate;let a=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[r]!==void 0)r=e.morphTargetDictionary[r]}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else if(s.fromArray!==void 0&&s.toArray!==void 0)a=this.BindingType.HasFromToArray,this.resolvedProperty=s;else if(Array.isArray(s))a=this.BindingType.EntireArray,this.resolvedProperty=s;else this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}tt.Composite=H0;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Ah{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,s=r.length,o=Array(s),a={endingStart:2400,endingEnd:2400};for(let c=0;c!==s;++c){let l=r[c].createInterpolant(null);o[c]=l,l.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,s=r/i,o=i/r;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,s,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;if(e!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,s=this.timeScale,o=this._timeScaleInterpolant;if(o===null)o=i._lendControlInterpolant(),this._timeScaleInterpolant=o;let a=o.parameterPositions,c=o.sampleValues;return a[0]=r,a[1]=r+n,c[0]=e/s,c[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;if(e!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let a=(e-r)*n;if(a<0||n===0)t=0;else this._startTime=null,t=n*a}t*=this._updateTimeScale(e);let s=this._updateTime(t),o=this._updateWeight(e);if(o>0){let a=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulateAdditive(o);break;case 2500:default:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(this.stopFading(),i===0)this.enabled=!1}}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(t===0)this.paused=!0;else{if(this._restoreTimeScale!==null)t=this._restoreTimeScale;this.timeScale=t}this.stopWarping()}}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,s=n===2202;if(e===0){if(r===-1)return i;return s&&(r&1)===1?t-i:i}if(n===2200){if(r===-1)this._loopCount=0,this._setEndings(!0,!0,!1);e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1)if(e>=0)r=0,this._setEndings(!0,this.repetitions===0,s);else this._setEndings(this.repetitions===0,!0,s);if(i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let a=this.repetitions-r;if(a<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1})}else{if(a===1){let c=e<0;this._setEndings(c,!c,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(s&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;if(n)i.endingStart=2401,i.endingEnd=2401;else{if(e)i.endingStart=this.zeroSlopeAtStart?2401:2400;else i.endingStart=2402;if(t)i.endingEnd=this.zeroSlopeAtEnd?2401:2400;else i.endingEnd=2402}}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,s=this._weightInterpolant;if(s===null)s=i._lendControlInterpolant(),this._weightInterpolant=s;let o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}var ZS=new Float32Array(1);class mc extends Hn{constructor(e){super();if(this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,{_propertyBindings:s,_interpolants:o}=e,a=n.uuid,c=this._bindingsByRootAndName,l=c[a];if(l===void 0)l={},c[a]=l;for(let u=0;u!==r;++u){let h=i[u],f=h.name,d=l[f];if(d!==void 0)++d.referenceCount,s[u]=d;else{if(d=s[u],d!==void 0){if(d._cacheIndex===null)++d.referenceCount,this._addInactiveBinding(d,a,f);continue}let m=t&&t._propertyBindings[u].binding.parsedPath;d=new wh(tt.create(n,f,m),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,a,f),s[u]=d}o[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(r.useCount++===0)this._lendBinding(r),r.saveOriginalState()}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.useCount===0)r.restoreOriginalState(),this._takeBackBinding(r)}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{let o=s.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,c=a[a.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,h=(e._localRoot||this._root).uuid;if(delete u[h],a.length===0)delete s[r];this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.referenceCount===0)this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,s=i[t];if(s===void 0)s={},i[t]=s;s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],c=e._cacheIndex;if(a._cacheIndex=c,t[c]=a,t.pop(),delete o[r],Object.keys(o).length===0)delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];if(n===void 0)n=new ac(new Float32Array(2),new Float32Array(2),1,ZS),n.__cacheIndex=t,e[t]=n;return n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,s=typeof e==="string"?Qr.findByName(i,e):e,o=s!==null?s.uuid:e,a=this._actionsByClip[o],c=null;if(n===void 0)if(s!==null)n=s.blendMode;else n=2500;if(a!==void 0){let u=a.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;if(c=a.knownActions[0],s===null)s=c._clip}if(s===null)return null;let l=new Ah(this,s,t,n);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e==="string"?Qr.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];if(o!==void 0)return o.actionByRoot[i]||null;return null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,s);let o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let s=r.knownActions;for(let o=0,a=s.length;o!==a;++o){let c=s[o];this._deactivateAction(c);let l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let o=n[s].actionByRoot,a=o[t];if(a!==void 0)this._deactivateAction(a),this._removeInactiveAction(a)}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let s in r){let o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);if(n!==null)this._deactivateAction(n),this._removeInactiveAction(n)}}class _o{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=We(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){if(this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(e,n),this.phi=Math.acos(We(t/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class Rh{static{Rh.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}class gc extends Hn{constructor(e,t=null){super();this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Me("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=e}disconnect(){}dispose(){}update(){}}function Ch(e,t,n,i){let r=XS(i);switch(n){case 1021:return e*t;case 1028:return e*t/r.components*r.byteLength;case 1029:return e*t/r.components*r.byteLength;case 1030:return e*t*2/r.components*r.byteLength;case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:return e*t*4/r.components*r.byteLength;case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function XS(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));if(typeof window<"u")if(window.__THREE__)Me("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="185";function hx(){let e=null,t=!1,n=null,i=null;function r(s,o){n(s,o),i=e.requestAnimationFrame(r)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(r),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function qS(e){let t=new WeakMap;function n(a,c){let{array:l,usage:u}=a,h=l.byteLength,f=e.createBuffer();e.bindBuffer(c,f),e.bufferData(c,l,u),a.onUploadCallback();let d;if(l instanceof Float32Array)d=e.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=e.HALF_FLOAT;else if(l instanceof Uint16Array)if(a.isFloat16BufferAttribute)d=e.HALF_FLOAT;else d=e.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=e.SHORT;else if(l instanceof Uint32Array)d=e.UNSIGNED_INT;else if(l instanceof Int32Array)d=e.INT;else if(l instanceof Int8Array)d=e.BYTE;else if(l instanceof Uint8Array)d=e.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:f,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,c,l){let{array:u,updateRanges:h}=c;if(e.bindBuffer(l,a),h.length===0)e.bufferSubData(l,0,u);else{h.sort((d,m)=>d.start-m.start);let f=0;for(let d=1;d<h.length;d++){let m=h[f],x=h[d];if(x.start<=m.start+m.count+1)m.count=Math.max(m.count,x.start+x.count-m.start);else++f,h[f]=x}h.length=f+1;for(let d=0,m=h.length;d<m;d++){let x=h[d];e.bufferSubData(l,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(a){if(a.isInterleavedBufferAttribute)a=a.data;return t.get(a)}function s(a){if(a.isInterleavedBufferAttribute)a=a.data;let c=t.get(a);if(c)e.deleteBuffer(c.buffer),t.delete(a)}function o(a,c){if(a.isInterleavedBufferAttribute)a=a.data;if(a.isGLBufferAttribute){let u=t.get(a);if(!u||u.version<a.version)t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=t.get(a);if(l===void 0)t.set(a,n(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:r,remove:s,update:o}}var YS=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`,Qy=`#ifdef USE_ALPHAHASH
+#endif`,jS=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -107,20 +100,20 @@ version 0.8.2
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`,eb=`#ifdef USE_ALPHAMAP
+#endif`,JS=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
-#endif`,tb=`#ifdef USE_ALPHAMAP
+#endif`,KS=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,nb=`#ifdef USE_ALPHATEST
+#endif`,QS=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
-#endif`,ib=`#ifdef USE_ALPHATEST
+#endif`,eM=`#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`,rb=`#ifdef USE_AOMAP
+#endif`,tM=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -133,10 +126,10 @@ version 0.8.2
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`,sb=`#ifdef USE_AOMAP
+#endif`,nM=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`,ob=`#ifdef USE_BATCHING
+#endif`,iM=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -170,15 +163,15 @@ version 0.8.2
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
}
-#endif`,ab=`#ifdef USE_BATCHING
+#endif`,rM=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`,cb=`vec3 transformed = vec3( position );
+#endif`,sM=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`,lb=`vec3 objectNormal = vec3( normal );
+#endif`,oM=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`,ub=`float G_BlinnPhong_Implicit( ) {
+#endif`,aM=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -192,7 +185,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`,hb=`#ifdef USE_IRIDESCENCE
+} // validated`,cM=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -255,7 +248,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`,fb=`#ifdef USE_BUMPMAP
+#endif`,lM=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -276,7 +269,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`,db=`#if NUM_CLIPPING_PLANES > 0
+#endif`,uM=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -322,20 +315,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`,pb=`#if NUM_CLIPPING_PLANES > 0
+#endif`,hM=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
-#endif`,mb=`#if NUM_CLIPPING_PLANES > 0
+#endif`,fM=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
-#endif`,gb=`#if NUM_CLIPPING_PLANES > 0
+#endif`,dM=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`,_b=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,pM=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
-#endif`,xb=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,mM=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
varying vec4 vColor;
-#endif`,vb=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,gM=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec4 vColor;
-#endif`,yb=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,_M=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
@@ -348,7 +341,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#endif
#ifdef USE_BATCHING_COLOR
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
-#endif`,bb=`#define PI 3.141592653589793
+#endif`,xM=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -419,7 +412,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
-} // validated`,Sb=`#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`,vM=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -512,7 +505,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`,Mb=`vec3 transformedNormal = objectNormal;
+#endif`,yM=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -538,21 +531,21 @@ transformedNormal = normalMatrix * transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
-#endif`,wb=`#ifdef USE_DISPLACEMENTMAP
+#endif`,bM=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`,Tb=`#ifdef USE_DISPLACEMENTMAP
+#endif`,SM=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`,Eb=`#ifdef USE_EMISSIVEMAP
+#endif`,MM=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`,Ab=`#ifdef USE_EMISSIVEMAP
+#endif`,wM=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`,Rb="gl_FragColor = linearToOutputTexel( gl_FragColor );",Cb=`vec4 LinearTransferOETF( in vec4 value ) {
+#endif`,TM="gl_FragColor = linearToOutputTexel( gl_FragColor );",EM=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -560,7 +553,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
}
vec4 sRGBTransferOETF( in vec4 value ) {
return 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 );
-}`,Ib=`#ifdef USE_ENVMAP
+}`,AM=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -587,7 +580,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif
-#endif`,Pb=`#ifdef USE_ENVMAP
+#endif`,RM=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
@@ -595,7 +588,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
uniform sampler2D envMap;
#endif
-#endif`,Lb=`#ifdef USE_ENVMAP
+#endif`,CM=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -606,7 +599,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`,Nb=`#ifdef USE_ENVMAP
+#endif`,IM=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -617,7 +610,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`,Db=`#ifdef USE_ENVMAP
+#endif`,PM=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -634,18 +627,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`,Ub=`#ifdef USE_FOG
+#endif`,LM=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
-#endif`,Ob=`#ifdef USE_FOG
+#endif`,NM=`#ifdef USE_FOG
varying float vFogDepth;
-#endif`,Fb=`#ifdef USE_FOG
+#endif`,DM=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
-#endif`,zb=`#ifdef USE_FOG
+#endif`,OM=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -654,7 +647,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`,kb=`#ifdef USE_GRADIENTMAP
+#endif`,UM=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -666,12 +659,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`,Bb=`#ifdef USE_LIGHTMAP
+}`,FM=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`,Gb=`LambertMaterial material;
+#endif`,zM=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`,Hb=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,kM=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -685,7 +678,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Vb=`uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,BM=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -802,7 +795,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
return irradiance;
}
#endif
-#include <lightprobes_pars_fragment>`,Wb=`#ifdef USE_ENVMAP
+#include <lightprobes_pars_fragment>`,GM=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -835,8 +828,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`,$b=`ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`,Zb=`varying vec3 vViewPosition;
+#endif`,HM=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,VM=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -848,11 +841,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Xb=`BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$M=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`,qb=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,WM=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -869,7 +862,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Yb=`PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ZM=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
@@ -959,7 +952,7 @@ material.roughness = min( material.roughness, 1.0 );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
-#endif`,jb=`uniform sampler2D dfgLUT;
+#endif`,XM=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
vec3 diffuseColor;
vec3 diffuseContribution;
@@ -1319,7 +1312,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`,Jb=`
+}`,qM=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1441,7 +1434,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`,Kb=`#if defined( RE_IndirectDiffuse )
+#endif`,YM=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1462,7 +1455,7 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`,Qb=`#if defined( RE_IndirectDiffuse )
+#endif`,jM=`#if defined( RE_IndirectDiffuse )
#if defined( LAMBERT ) || defined( PHONG )
irradiance += iblIrradiance;
#endif
@@ -1470,7 +1463,7 @@ IncidentLight directLight;
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
-#endif`,eS=`#ifdef USE_LIGHT_PROBES_GRID
+#endif`,JM=`#ifdef USE_LIGHT_PROBES_GRID
uniform highp sampler3D probesSH;
uniform vec3 probesMin;
uniform vec3 probesMax;
@@ -1515,27 +1508,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
result += c8 * 0.429043 * ( x * x - y * y );
return max( result, vec3( 0.0 ) );
}
-#endif`,tS=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,KM=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`,nS=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,QM=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,iS=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,ew=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,rS=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,tw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`,sS=`#ifdef USE_MAP
+#endif`,nw=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`,oS=`#ifdef USE_MAP
+#endif`,iw=`#ifdef USE_MAP
uniform sampler2D map;
-#endif`,aS=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`,rw=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -1547,7 +1540,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`,cS=`#if defined( USE_POINTS_UV )
+#endif`,sw=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1559,19 +1552,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,lS=`float metalnessFactor = metalness;
+#endif`,ow=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`,uS=`#ifdef USE_METALNESSMAP
+#endif`,aw=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`,hS=`#ifdef USE_INSTANCING_MORPH
+#endif`,cw=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
-#endif`,fS=`#if defined( USE_MORPHCOLORS )
+#endif`,lw=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -1580,12 +1573,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`,dS=`#ifdef USE_MORPHNORMALS
+#endif`,uw=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,pS=`#ifdef USE_MORPHTARGETS
+#endif`,hw=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1599,12 +1592,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`,mS=`#ifdef USE_MORPHTARGETS
+#endif`,fw=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,gS=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`,dw=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -1645,7 +1638,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`,_S=`#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`,pw=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -1663,19 +1656,19 @@ vec3 nonPerturbedNormal = normal;`,_S=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`,xS=`#ifndef FLAT_SHADED
+#endif`,mw=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,vS=`#ifndef FLAT_SHADED
+#endif`,gw=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,yS=`#ifndef FLAT_SHADED
+#endif`,_w=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
@@ -1684,7 +1677,7 @@ vec3 nonPerturbedNormal = normal;`,_S=`#ifdef USE_NORMALMAP_OBJECTSPACE
vBitangent = - vBitangent;
#endif
#endif
-#endif`,bS=`#ifdef USE_NORMALMAP
+#endif`,xw=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -1706,13 +1699,13 @@ vec3 nonPerturbedNormal = normal;`,_S=`#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`,SS=`#ifdef USE_CLEARCOAT
+#endif`,vw=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`,MS=`#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`,yw=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`,wS=`#ifdef USE_CLEARCOATMAP
+#endif`,bw=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -1721,18 +1714,18 @@ vec3 nonPerturbedNormal = normal;`,_S=`#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`,TS=`#ifdef USE_IRIDESCENCEMAP
+#endif`,Sw=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`,ES=`#ifdef OPAQUE
+#endif`,Mw=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,AS=`vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ww=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1811,9 +1804,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
#else
return ( near * far ) / ( ( far - near ) * depth - far );
#endif
-}`,RS=`#ifdef PREMULTIPLIED_ALPHA
+}`,Tw=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`,CS=`vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`,Ew=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -1821,22 +1814,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`,Aw=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`,PS=`#ifdef DITHERING
+#endif`,Rw=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
-#endif`,LS=`float roughnessFactor = roughness;
+#endif`,Cw=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`,NS=`#ifdef USE_ROUGHNESSMAP
+#endif`,Iw=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`,DS=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,Pw=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -2036,7 +2029,7 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
}
#endif
#endif
-#endif`,US=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,Lw=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -2077,7 +2070,7 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`,OS=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`,Nw=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
#ifdef HAS_NORMAL
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
#else
@@ -2113,7 +2106,7 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`,FS=`float getShadowMask() {
+#endif`,Dw=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2145,12 +2138,12 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
#endif
#endif
return shadow;
-}`,zS=`#ifdef USE_SKINNING
+}`,Ow=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`,kS=`#ifdef USE_SKINNING
+#endif`,Uw=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -2165,7 +2158,7 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`,BS=`#ifdef USE_SKINNING
+#endif`,Fw=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2173,7 +2166,7 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`,GS=`#ifdef USE_SKINNING
+#endif`,zw=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -2184,17 +2177,17 @@ gl_Position = projectionMatrix * mvPosition;`,IS=`#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`,HS=`float specularStrength;
+#endif`,kw=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`,VS=`#ifdef USE_SPECULARMAP
+#endif`,Bw=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`,WS=`#if defined( TONE_MAPPING )
+#endif`,Gw=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`,$S=`#ifndef saturate
+#endif`,Hw=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -2291,7 +2284,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`,Vw=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -2312,7 +2305,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`,XS=`#ifdef USE_TRANSMISSION
+#endif`,$w=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -2438,7 +2431,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`,qS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,Ww=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2508,7 +2501,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,YS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,Zw=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2602,7 +2595,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,jS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,Xw=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -2673,7 +2666,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`,JS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`,qw=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
@@ -2682,12 +2675,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZS=`#ifdef USE_TRANSMISS
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
-#endif`,KS=`varying vec2 vUv;
+#endif`,Yw=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
-}`,QS=`uniform sampler2D t2D;
+}`,jw=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
@@ -2699,14 +2692,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,eM=`varying vec3 vWorldDirection;
+}`,Jw=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`,tM=`#ifdef ENVMAP_TYPE_CUBE
+}`,Kw=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
@@ -2728,14 +2721,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,nM=`varying vec3 vWorldDirection;
+}`,Qw=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`,iM=`uniform samplerCube tCube;
+}`,eT=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -2745,7 +2738,7 @@ void main() {
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,rM=`#include <common>
+}`,tT=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
@@ -2772,7 +2765,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
-}`,sM=`#if DEPTH_PACKING == 3200
+}`,nT=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
@@ -2810,7 +2803,7 @@ void main() {
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
-}`,oM=`#define DISTANCE
+}`,iT=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
@@ -2837,7 +2830,7 @@ void main() {
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
-}`;var aM=`#define DISTANCE
+}`;var rT=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
@@ -2860,13 +2853,13 @@ void main() {
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
-}`,cM=`varying vec3 vWorldDirection;
+}`,sT=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
-}`,lM=`uniform sampler2D tEquirect;
+}`,oT=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
@@ -2875,7 +2868,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,uM=`uniform float scale;
+}`,aT=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
@@ -2897,7 +2890,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`,hM=`uniform vec3 diffuse;
+}`,cT=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
@@ -2925,7 +2918,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,fM=`#include <common>
+}`,lT=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
@@ -2957,7 +2950,7 @@ void main() {
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
-}`,dM=`uniform vec3 diffuse;
+}`,uT=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
@@ -3005,7 +2998,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,pM=`#define LAMBERT
+}`,hT=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3044,7 +3037,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,mM=`#define LAMBERT
+}`,fT=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3102,7 +3095,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,gM=`#define MATCAP
+}`,dT=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3136,7 +3129,7 @@ void main() {
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
-}`,_M=`#define MATCAP
+}`,pT=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
@@ -3182,7 +3175,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,xM=`#define NORMAL
+}`,mT=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
@@ -3215,7 +3208,7 @@ void main() {
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
-}`,vM=`#define NORMAL
+}`,gT=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
@@ -3236,7 +3229,7 @@ void main() {
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
-}`,yM=`#define PHONG
+}`,_T=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3275,7 +3268,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,bM=`#define PHONG
+}`,xT=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
@@ -3335,7 +3328,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,SM=`#define STANDARD
+}`,vT=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
@@ -3378,7 +3371,7 @@ void main() {
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
-}`,MM=`#define STANDARD
+}`,yT=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
@@ -3503,7 +3496,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,wM=`#define TOON
+}`,bT=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3540,7 +3533,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,TM=`#define TOON
+}`,ST=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3592,7 +3585,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,EM=`uniform float size;
+}`,MT=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
@@ -3623,7 +3616,7 @@ void main() {
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
-}`,AM=`uniform vec3 diffuse;
+}`,wT=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
@@ -3648,7 +3641,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,RM=`#include <common>
+}`,TT=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
@@ -3671,7 +3664,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,CM=`uniform vec3 color;
+}`,ET=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
@@ -3687,7 +3680,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,IM=`uniform float rotation;
+}`,AT=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
@@ -3711,7 +3704,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`,PM=`uniform vec3 diffuse;
+}`,RT=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
@@ -3736,7 +3729,7 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`,He={alphahash_fragment:Ky,alphahash_pars_fragment:Qy,alphamap_fragment:eb,alphamap_pars_fragment:tb,alphatest_fragment:nb,alphatest_pars_fragment:ib,aomap_fragment:rb,aomap_pars_fragment:sb,batching_pars_vertex:ob,batching_vertex:ab,begin_vertex:cb,beginnormal_vertex:lb,bsdfs:ub,iridescence_fragment:hb,bumpmap_pars_fragment:fb,clipping_planes_fragment:db,clipping_planes_pars_fragment:pb,clipping_planes_pars_vertex:mb,clipping_planes_vertex:gb,color_fragment:_b,color_pars_fragment:xb,color_pars_vertex:vb,color_vertex:yb,common:bb,cube_uv_reflection_fragment:Sb,defaultnormal_vertex:Mb,displacementmap_pars_vertex:wb,displacementmap_vertex:Tb,emissivemap_fragment:Eb,emissivemap_pars_fragment:Ab,colorspace_fragment:Rb,colorspace_pars_fragment:Cb,envmap_fragment:Ib,envmap_common_pars_fragment:Pb,envmap_pars_fragment:Lb,envmap_pars_vertex:Nb,envmap_physical_pars_fragment:Wb,envmap_vertex:Db,fog_vertex:Ub,fog_pars_vertex:Ob,fog_fragment:Fb,fog_pars_fragment:zb,gradientmap_pars_fragment:kb,lightmap_pars_fragment:Bb,lights_lambert_fragment:Gb,lights_lambert_pars_fragment:Hb,lights_pars_begin:Vb,lights_toon_fragment:$b,lights_toon_pars_fragment:Zb,lights_phong_fragment:Xb,lights_phong_pars_fragment:qb,lights_physical_fragment:Yb,lights_physical_pars_fragment:jb,lights_fragment_begin:Jb,lights_fragment_maps:Kb,lights_fragment_end:Qb,lightprobes_pars_fragment:eS,logdepthbuf_fragment:tS,logdepthbuf_pars_fragment:nS,logdepthbuf_pars_vertex:iS,logdepthbuf_vertex:rS,map_fragment:sS,map_pars_fragment:oS,map_particle_fragment:aS,map_particle_pars_fragment:cS,metalnessmap_fragment:lS,metalnessmap_pars_fragment:uS,morphinstance_vertex:hS,morphcolor_vertex:fS,morphnormal_vertex:dS,morphtarget_pars_vertex:pS,morphtarget_vertex:mS,normal_fragment_begin:gS,normal_fragment_maps:_S,normal_pars_fragment:xS,normal_pars_vertex:vS,normal_vertex:yS,normalmap_pars_fragment:bS,clearcoat_normal_fragment_begin:SS,clearcoat_normal_fragment_maps:MS,clearcoat_pars_fragment:wS,iridescence_pars_fragment:TS,opaque_fragment:ES,packing:AS,premultiplied_alpha_fragment:RS,project_vertex:CS,dithering_fragment:IS,dithering_pars_fragment:PS,roughnessmap_fragment:LS,roughnessmap_pars_fragment:NS,shadowmap_pars_fragment:DS,shadowmap_pars_vertex:US,shadowmap_vertex:OS,shadowmask_pars_fragment:FS,skinbase_vertex:zS,skinning_pars_vertex:kS,skinning_vertex:BS,skinnormal_vertex:GS,specularmap_fragment:HS,specularmap_pars_fragment:VS,tonemapping_fragment:WS,tonemapping_pars_fragment:$S,transmission_fragment:ZS,transmission_pars_fragment:XS,uv_pars_fragment:qS,uv_pars_vertex:YS,uv_vertex:jS,worldpos_vertex:JS,background_vert:KS,background_frag:QS,backgroundCube_vert:eM,backgroundCube_frag:tM,cube_vert:nM,cube_frag:iM,depth_vert:rM,depth_frag:sM,distance_vert:oM,distance_frag:aM,equirect_vert:cM,equirect_frag:lM,linedashed_vert:uM,linedashed_frag:hM,meshbasic_vert:fM,meshbasic_frag:dM,meshlambert_vert:pM,meshlambert_frag:mM,meshmatcap_vert:gM,meshmatcap_frag:_M,meshnormal_vert:xM,meshnormal_frag:vM,meshphong_vert:yM,meshphong_frag:bM,meshphysical_vert:SM,meshphysical_frag:MM,meshtoon_vert:wM,meshtoon_frag:TM,points_vert:EM,points_frag:AM,shadow_vert:RM,shadow_frag:CM,sprite_vert:IM,sprite_frag:PM},he={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ue}},envmap:{envMap:{value:null},envMapRotation:{value:new Ue},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ue}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ue}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ue},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ue},normalScale:{value:new Ie(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ue},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ue}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ue}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ue}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new N},probesMax:{value:new N},probesResolution:{value:new N}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0},uvTransform:{value:new Ue}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Ie(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}}},ei={basic:{uniforms:jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},envMapIntensity:{value:1}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:jt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:jt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Le(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:jt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:jt([he.points,he.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:jt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:jt([he.common,he.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:jt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:He.meshnormal_vert,fragmentShader:He.meshnormal_frag},sprite:{uniforms:jt([he.sprite,he.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new Ue},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:He.background_vert,fragmentShader:He.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ue}},vertexShader:He.backgroundCube_vert,fragmentShader:He.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distance:{uniforms:jt([he.common,he.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:He.distance_vert,fragmentShader:He.distance_frag},shadow:{uniforms:jt([he.lights,he.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};ei.physical={uniforms:jt([ei.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ue},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ue},clearcoatNormalScale:{value:new Ie(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ue},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ue},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ue},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ue},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ue},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ue},transmissionSamplerSize:{value:new Ie},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ue},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ue},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ue},anisotropyVector:{value:new Ie},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ue}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};var Ya={r:0,b:0,g:0},LM=new ze,Z_=new Ue;Z_.set(-1,0,0,0,1,0,0,0,1);function NM(e,t,n,i,r,s){let o=new Le(0),a=r===!0?0:1,c,l,u=null,f=0,h=null;function d(A){let T=A.isScene===!0?A.background:null;if(T&&T.isTexture){let v=A.backgroundBlurriness>0;T=t.get(T,v)}return T}function g(A){let T=!1,v=d(A);if(v===null)p(o,a);else if(v&&v.isColor)p(v,1),T=!0;let w=e.xr.getEnvironmentBlendMode();if(w==="additive")n.buffers.color.setClear(0,0,0,1,s);else if(w==="alpha-blend")n.buffers.color.setClear(0,0,0,0,s);if(e.autoClear||T)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function y(A,T){let v=d(T);if(v&&(v.isCubeTexture||v.mapping===Hs)){if(l===void 0)l=new pt(new Gi(1,1,1),new Mn({name:"BackgroundCubeMaterial",uniforms:gr(ei.backgroundCube.uniforms),vertexShader:ei.backgroundCube.vertexShader,fragmentShader:ei.backgroundCube.fragmentShader,side:Yt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,E,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l);if(l.material.uniforms.envMap.value=v,l.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(LM.makeRotationFromEuler(T.backgroundRotation)).transpose(),v.isCubeTexture&&v.isRenderTargetTexture===!1)l.material.uniforms.backgroundRotation.value.premultiply(Z_);if(l.material.toneMapped=We.getTransfer(v.colorSpace)!==ht,u!==v||f!==v.version||h!==e.toneMapping)l.material.needsUpdate=!0,u=v,f=v.version,h=e.toneMapping;l.layers.enableAll(),A.unshift(l,l.geometry,l.material,0,0,null)}else if(v&&v.isTexture){if(c===void 0)c=new pt(new to(2,2),new Mn({name:"BackgroundMaterial",uniforms:gr(ei.background.uniforms),vertexShader:ei.background.vertexShader,fragmentShader:ei.background.fragmentShader,side:Ui,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c);if(c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=We.getTransfer(v.colorSpace)!==ht,v.matrixAutoUpdate===!0)v.updateMatrix();if(c.material.uniforms.uvTransform.value.copy(v.matrix),u!==v||f!==v.version||h!==e.toneMapping)c.material.needsUpdate=!0,u=v,f=v.version,h=e.toneMapping;c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null)}}function p(A,T){A.getRGB(Ya,Au(e)),n.buffers.color.setClear(Ya.r,Ya.g,Ya.b,T,s)}function m(){if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0;if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0}return{getClearColor:function(){return o},setClearColor:function(A,T=1){o.set(A),a=T,p(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(A){a=A,p(o,a)},render:g,addToRenderList:y,dispose:m}}function DM(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=h(null),s=r,o=!1;function a(C,z,J,O,H){let V=!1,U=f(C,O,J,z);if(s!==U)s=U,l(s.object);if(V=d(C,O,J,H),V)g(C,O,J,H);if(H!==null)t.update(H,e.ELEMENT_ARRAY_BUFFER);if(V||o){if(o=!1,v(C,z,J,O),H!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(H).buffer)}}function c(){return e.createVertexArray()}function l(C){return e.bindVertexArray(C)}function u(C){return e.deleteVertexArray(C)}function f(C,z,J,O){let H=O.wireframe===!0,V=i[z.id];if(V===void 0)V={},i[z.id]=V;let U=C.isInstancedMesh===!0?C.id:0,K=V[U];if(K===void 0)K={},V[U]=K;let Q=K[J.id];if(Q===void 0)Q={},K[J.id]=Q;let se=Q[H];if(se===void 0)se=h(c()),Q[H]=se;return se}function h(C){let z=[],J=[],O=[];for(let H=0;H<n;H++)z[H]=0,J[H]=0,O[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:J,attributeDivisors:O,object:C,attributes:{},index:null}}function d(C,z,J,O){let H=s.attributes,V=z.attributes,U=0,K=J.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=H[Q],_e=V[Q];if(_e===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)_e=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)_e=C.instanceColor}if(me===void 0)return!0;if(me.attribute!==_e)return!0;if(_e&&me.data!==_e.data)return!0;U++}if(s.attributesNum!==U)return!0;if(s.index!==O)return!0;return!1}function g(C,z,J,O){let H={},V=z.attributes,U=0,K=J.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=V[Q];if(me===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)me=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)me=C.instanceColor}let _e={};if(_e.attribute=me,me&&me.data)_e.data=me.data;H[Q]=_e,U++}s.attributes=H,s.attributesNum=U,s.index=O}function y(){let C=s.newAttributes;for(let z=0,J=C.length;z<J;z++)C[z]=0}function p(C){m(C,0)}function m(C,z){let J=s.newAttributes,O=s.enabledAttributes,H=s.attributeDivisors;if(J[C]=1,O[C]===0)e.enableVertexAttribArray(C),O[C]=1;if(H[C]!==z)e.vertexAttribDivisor(C,z),H[C]=z}function A(){let C=s.newAttributes,z=s.enabledAttributes;for(let J=0,O=z.length;J<O;J++)if(z[J]!==C[J])e.disableVertexAttribArray(J),z[J]=0}function T(C,z,J,O,H,V,U){if(U===!0)e.vertexAttribIPointer(C,z,J,H,V);else e.vertexAttribPointer(C,z,J,O,H,V)}function v(C,z,J,O){y();let H=O.attributes,V=J.getAttributes(),U=z.defaultAttributeValues;for(let K in V){let Q=V[K];if(Q.location>=0){let se=H[K];if(se===void 0){if(K==="instanceMatrix"&&C.instanceMatrix)se=C.instanceMatrix;if(K==="instanceColor"&&C.instanceColor)se=C.instanceColor}if(se!==void 0){let me=se.normalized,_e=se.itemSize,qe=t.get(se);if(qe===void 0)continue;let{buffer:Ge,type:Z,bytesPerElement:ne}=qe,fe=Z===e.INT||Z===e.UNSIGNED_INT||se.gpuType===Dl;if(se.isInterleavedBufferAttribute){let de=se.data,Re=de.stride,Ze=se.offset;if(de.isInstancedInterleavedBuffer){for(let Oe=0;Oe<Q.locationSize;Oe++)m(Q.location+Oe,de.meshPerAttribute);if(C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0)O._maxInstanceCount=de.meshPerAttribute*de.count}else for(let Oe=0;Oe<Q.locationSize;Oe++)p(Q.location+Oe);e.bindBuffer(e.ARRAY_BUFFER,Ge);for(let Oe=0;Oe<Q.locationSize;Oe++)T(Q.location+Oe,_e/Q.locationSize,Z,me,Re*ne,(Ze+_e/Q.locationSize*Oe)*ne,fe)}else{if(se.isInstancedBufferAttribute){for(let de=0;de<Q.locationSize;de++)m(Q.location+de,se.meshPerAttribute);if(C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0)O._maxInstanceCount=se.meshPerAttribute*se.count}else for(let de=0;de<Q.locationSize;de++)p(Q.location+de);e.bindBuffer(e.ARRAY_BUFFER,Ge);for(let de=0;de<Q.locationSize;de++)T(Q.location+de,_e/Q.locationSize,Z,me,_e*ne,_e/Q.locationSize*de*ne,fe)}}else if(U!==void 0){let me=U[K];if(me!==void 0)switch(me.length){case 2:e.vertexAttrib2fv(Q.location,me);break;case 3:e.vertexAttrib3fv(Q.location,me);break;case 4:e.vertexAttrib4fv(Q.location,me);break;default:e.vertexAttrib1fv(Q.location,me)}}}}A()}function w(){S();for(let C in i){let z=i[C];for(let J in z){let O=z[J];for(let H in O){let V=O[H];for(let U in V)u(V[U].object),delete V[U];delete O[H]}}delete i[C]}}function E(C){if(i[C.id]===void 0)return;let z=i[C.id];for(let J in z){let O=z[J];for(let H in O){let V=O[H];for(let U in V)u(V[U].object),delete V[U];delete O[H]}}delete i[C.id]}function R(C){for(let z in i){let J=i[z];for(let O in J){let H=J[O];if(H[C.id]===void 0)continue;let V=H[C.id];for(let U in V)u(V[U].object),delete V[U];delete H[C.id]}}}function _(C){for(let z in i){let J=i[z],O=C.isInstancedMesh===!0?C.id:0,H=J[O];if(H===void 0)continue;for(let V in H){let U=H[V];for(let K in U)u(U[K].object),delete U[K];delete H[V]}if(delete J[O],Object.keys(J).length===0)delete i[z]}}function S(){if(F(),o=!0,s===r)return;s=r,l(s.object)}function F(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:S,resetDefaultState:F,dispose:w,releaseStatesOfGeometry:E,releaseStatesOfObject:_,releaseStatesOfProgram:R,initAttributes:y,enableAttribute:p,disableUnusedAttributes:A}}function UM(e,t,n){let i;function r(c){i=c}function s(c,l){e.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){if(u===0)return;e.drawArraysInstanced(i,c,l,u),n.update(l,i,u)}function a(c,l,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let h=0;for(let d=0;d<u;d++)h+=l[d];n.update(h,i,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function OM(e,t,n,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let R=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(R){if(R!==Jn&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function a(R){let _=R===pi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(R!==Fn&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==di&&!_)return!1;return!0}function c(R){if(R==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";R="mediump"}if(R==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let l=n.precision!==void 0?n.precision:"highp",u=c(l);if(u!==l)Me("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u;let f=n.logarithmicDepthBuffer===!0,h=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control");if(n.reversedDepthBuffer===!0&&h===!1)Me("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),g=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),A=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),T=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),w=e.getParameter(e.MAX_SAMPLES),E=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:A,maxVaryings:T,maxFragmentUniforms:v,maxSamples:w,samples:E}}function FM(e){let t=this,n=null,i=0,r=!1,s=!1,o=new Ln,a=new Ue,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let d=f.length!==0||h||i!==0||r;return r=h,i=f.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,d){let{clippingPlanes:g,clipIntersection:y,clipShadows:p}=f,m=e.get(f);if(!r||g===null||g.length===0||s&&!p)if(s)u(null);else l();else{let A=s?0:i,T=A*4,v=m.clippingState||null;c.value=v,v=u(g,h,T,d);for(let w=0;w!==T;++w)v[w]=n[w];m.clippingState=v,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=A}};function l(){if(c.value!==n)c.value=n,c.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function u(f,h,d,g){let y=f!==null?f.length:0,p=null;if(y!==0){if(p=c.value,g!==!0||p===null){let m=d+y*4,A=h.matrixWorldInverse;if(a.getNormalMatrix(A),p===null||p.length<m)p=new Float32Array(m);for(let T=0,v=d;T!==y;++T,v+=4)o.copy(f[T]).applyMatrix4(A,a),o.normal.toArray(p,v),p[v+3]=o.constant}c.value=p,c.needsUpdate=!0}return t.numPlanes=y,t.numIntersection=0,p}}var Xi=4,M_=[0.125,0.215,0.35,0.446,0.526,0.582],vr=20,zM=256,so=new xr,w_=new Le,Wu=null,$u=0,Zu=0,Xu=!1,kM=new N;class lo{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=0.1,i=100,r={}){let{size:s=256,position:o=kM}=r;Wu=this._renderer.getRenderTarget(),$u=this._renderer.getActiveCubeFace(),Zu=this._renderer.getActiveMipmapLevel(),Xu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);let a=this._allocateTargets();if(a.depthBuffer=!0,this._sceneToCubeUV(e,n,i,a,o),t>0)this._blur(a,0,0,t);return this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=A_(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=E_(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Wu,$u,Zu),this._renderer.xr.enabled=Xu,e.scissorTest=!1,as(e,0,0,e.width,e.height)}_fromTexture(e,t){if(e.mapping===qr||e.mapping===ur)this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);Wu=this._renderer.getRenderTarget(),$u=this._renderer.getActiveCubeFace(),Zu=this._renderer.getActiveMipmapLevel(),Xu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Gt,minFilter:Gt,generateMipmaps:!1,type:pi,format:Jn,colorSpace:hn,depthBuffer:!1},i=T_(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=T_(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=BM(r)),this._blurMaterial=HM(r,e,t),this._ggxMaterial=GM(r,e,t)}return i}_compileMaterial(e){let t=new pt(new tn,e);this._renderer.compile(t,so)}_sceneToCubeUV(e,t,n,i,r){let a=new Lt(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,{autoClear:f,toneMapping:h}=u;if(u.getClearColor(w_),u.toneMapping=Un,u.autoClear=!1,u.state.buffers.depth.getReversed())u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new pt(new Gi,new Kn({name:"PMREM.Background",side:Yt,depthWrite:!1,depthTest:!1}));let g=this._backgroundBox,y=g.material,p=!1,m=e.background;if(m){if(m.isColor)y.color.copy(m),e.background=null,p=!0}else y.color.copy(w_),p=!0;for(let A=0;A<6;A++){let T=A%3;if(T===0)a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+l[A],r.y,r.z);else if(T===1)a.up.set(0,0,c[A]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+l[A],r.z);else a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+l[A]);let v=this._cubeSize;if(as(i,T*v,A>2?v:0,v,v),u.setRenderTarget(i),p)u.render(g,a);u.render(e,a)}u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===qr||e.mapping===ur;if(i){if(this._cubemapMaterial===null)this._cubemapMaterial=A_();this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=E_();let r=i?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r;let o=r.uniforms;o.envMap.value=e;let a=this._cubeSize;as(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,so)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,o=this._lodMeshes[n];o.material=s;let a=s.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l),f=0+c*1.25,h=u*f,{_lodMax:d}=this,g=this._sizeLods[n],y=3*g*(n>d-Xi?n-d+Xi:0),p=4*(this._cubeSize-g);a.envMap.value=e.texture,a.roughness.value=h,a.mipInt.value=d-t,as(r,y,p,3*g,2*g),i.setRenderTarget(r),i.render(o,so),a.envMap.value=r.texture,a.roughness.value=0,a.mipInt.value=d-n,as(e,y,p,3*g,2*g),i.setRenderTarget(e),i.render(o,so)}_blur(e,t,n,i,r){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){let a=this._renderer,c=this._blurMaterial;if(s!=="latitudinal"&&s!=="longitudinal")Ne("blur direction must be either latitudinal or longitudinal!");let l=3,u=this._lodMeshes[i];u.material=c;let f=c.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/(2*vr-1),g=r/d,y=isFinite(r)?1+Math.floor(l*g):vr;if(y>vr)Me(`sigmaRadians, ${r}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${vr}`);let p=[],m=0;for(let E=0;E<vr;++E){let R=E/g,_=Math.exp(-R*R/2);if(p.push(_),E===0)m+=_;else if(E<y)m+=2*_}for(let E=0;E<p.length;E++)p[E]=p[E]/m;if(f.envMap.value=e.texture,f.samples.value=y,f.weights.value=p,f.latitudinal.value=s==="latitudinal",o)f.poleAxis.value=o;let{_lodMax:A}=this;f.dTheta.value=d,f.mipInt.value=A-n;let T=this._sizeLods[i],v=3*T*(i>A-Xi?i-A+Xi:0),w=4*(this._cubeSize-T);as(t,v,w,3*T,2*T),a.setRenderTarget(t),a.render(u,so)}}function BM(e){let t=[],n=[],i=[],r=e,s=e-Xi+1+M_.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);t.push(a);let c=1/a;if(o>e-Xi)c=M_[o-e+Xi-1];else if(o===0)c=0;n.push(c);let l=1/(a-2),u=-l,f=1+l,h=[u,u,f,u,f,f,u,u,f,f,u,f],d=6,g=6,y=3,p=2,m=1,A=new Float32Array(y*g*d),T=new Float32Array(p*g*d),v=new Float32Array(m*g*d);for(let E=0;E<d;E++){let R=E%3*2/3-1,_=E>2?0:-1,S=[R,_,0,R+0.6666666666666666,_,0,R+0.6666666666666666,_+1,0,R,_,0,R+0.6666666666666666,_+1,0,R,_+1,0];A.set(S,y*g*E),T.set(h,p*g*E);let F=[E,E,E,E,E,E];v.set(F,m*g*E)}let w=new tn;if(w.setAttribute("position",new Nt(A,y)),w.setAttribute("uv",new Nt(T,p)),w.setAttribute("faceIndex",new Nt(v,m)),i.push(new pt(w,null)),r>Xi)r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}function T_(e,t,n){let i=new Sn(e,t,n);return i.texture.mapping=Hs,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function as(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function GM(e,t,n){return new Mn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:zM,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ja(),fragmentShader:`
+}`,He={alphahash_fragment:YS,alphahash_pars_fragment:jS,alphamap_fragment:JS,alphamap_pars_fragment:KS,alphatest_fragment:QS,alphatest_pars_fragment:eM,aomap_fragment:tM,aomap_pars_fragment:nM,batching_pars_vertex:iM,batching_vertex:rM,begin_vertex:sM,beginnormal_vertex:oM,bsdfs:aM,iridescence_fragment:cM,bumpmap_pars_fragment:lM,clipping_planes_fragment:uM,clipping_planes_pars_fragment:hM,clipping_planes_pars_vertex:fM,clipping_planes_vertex:dM,color_fragment:pM,color_pars_fragment:mM,color_pars_vertex:gM,color_vertex:_M,common:xM,cube_uv_reflection_fragment:vM,defaultnormal_vertex:yM,displacementmap_pars_vertex:bM,displacementmap_vertex:SM,emissivemap_fragment:MM,emissivemap_pars_fragment:wM,colorspace_fragment:TM,colorspace_pars_fragment:EM,envmap_fragment:AM,envmap_common_pars_fragment:RM,envmap_pars_fragment:CM,envmap_pars_vertex:IM,envmap_physical_pars_fragment:GM,envmap_vertex:PM,fog_vertex:LM,fog_pars_vertex:NM,fog_fragment:DM,fog_pars_fragment:OM,gradientmap_pars_fragment:UM,lightmap_pars_fragment:FM,lights_lambert_fragment:zM,lights_lambert_pars_fragment:kM,lights_pars_begin:BM,lights_toon_fragment:HM,lights_toon_pars_fragment:VM,lights_phong_fragment:$M,lights_phong_pars_fragment:WM,lights_physical_fragment:ZM,lights_physical_pars_fragment:XM,lights_fragment_begin:qM,lights_fragment_maps:YM,lights_fragment_end:jM,lightprobes_pars_fragment:JM,logdepthbuf_fragment:KM,logdepthbuf_pars_fragment:QM,logdepthbuf_pars_vertex:ew,logdepthbuf_vertex:tw,map_fragment:nw,map_pars_fragment:iw,map_particle_fragment:rw,map_particle_pars_fragment:sw,metalnessmap_fragment:ow,metalnessmap_pars_fragment:aw,morphinstance_vertex:cw,morphcolor_vertex:lw,morphnormal_vertex:uw,morphtarget_pars_vertex:hw,morphtarget_vertex:fw,normal_fragment_begin:dw,normal_fragment_maps:pw,normal_pars_fragment:mw,normal_pars_vertex:gw,normal_vertex:_w,normalmap_pars_fragment:xw,clearcoat_normal_fragment_begin:vw,clearcoat_normal_fragment_maps:yw,clearcoat_pars_fragment:bw,iridescence_pars_fragment:Sw,opaque_fragment:Mw,packing:ww,premultiplied_alpha_fragment:Tw,project_vertex:Ew,dithering_fragment:Aw,dithering_pars_fragment:Rw,roughnessmap_fragment:Cw,roughnessmap_pars_fragment:Iw,shadowmap_pars_fragment:Pw,shadowmap_pars_vertex:Lw,shadowmap_vertex:Nw,shadowmask_pars_fragment:Dw,skinbase_vertex:Ow,skinning_pars_vertex:Uw,skinning_vertex:Fw,skinnormal_vertex:zw,specularmap_fragment:kw,specularmap_pars_fragment:Bw,tonemapping_fragment:Gw,tonemapping_pars_fragment:Hw,transmission_fragment:Vw,transmission_pars_fragment:$w,uv_pars_fragment:Ww,uv_pars_vertex:Zw,uv_vertex:Xw,worldpos_vertex:qw,background_vert:Yw,background_frag:jw,backgroundCube_vert:Jw,backgroundCube_frag:Kw,cube_vert:Qw,cube_frag:eT,depth_vert:tT,depth_frag:nT,distance_vert:iT,distance_frag:rT,equirect_vert:sT,equirect_frag:oT,linedashed_vert:aT,linedashed_frag:cT,meshbasic_vert:lT,meshbasic_frag:uT,meshlambert_vert:hT,meshlambert_frag:fT,meshmatcap_vert:dT,meshmatcap_frag:pT,meshnormal_vert:mT,meshnormal_frag:gT,meshphong_vert:_T,meshphong_frag:xT,meshphysical_vert:vT,meshphysical_frag:yT,meshtoon_vert:bT,meshtoon_frag:ST,points_vert:MT,points_frag:wT,shadow_vert:TT,shadow_frag:ET,sprite_vert:AT,sprite_frag:RT},he={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oe}},envmap:{envMap:{value:null},envMapRotation:{value:new Oe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oe},normalScale:{value:new Ie(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new N},probesMax:{value:new N},probesResolution:{value:new N}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Ie(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},ai={basic:{uniforms:Jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:Jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},envMapIntensity:{value:1}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:Jt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:Jt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:Jt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Le(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:Jt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:Jt([he.points,he.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:Jt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:Jt([he.common,he.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:Jt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:He.meshnormal_vert,fragmentShader:He.meshnormal_frag},sprite:{uniforms:Jt([he.sprite,he.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:He.background_vert,fragmentShader:He.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Oe}},vertexShader:He.backgroundCube_vert,fragmentShader:He.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distance:{uniforms:Jt([he.common,he.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:He.distance_vert,fragmentShader:He.distance_frag},shadow:{uniforms:Jt([he.lights,he.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};ai.physical={uniforms:Jt([ai.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new Ie(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oe},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oe},transmissionSamplerSize:{value:new Ie},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new Ie},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};var _c={r:0,b:0,g:0},CT=new ze,fx=new Oe;fx.set(-1,0,0,0,1,0,0,0,1);function IT(e,t,n,i,r,s){let o=new Le(0),a=r===!0?0:1,c,l,u=null,h=0,f=null;function d(A){let E=A.isScene===!0?A.background:null;if(E&&E.isTexture){let y=A.backgroundBlurriness>0;E=t.get(E,y)}return E}function m(A){let E=!1,y=d(A);if(y===null)p(o,a);else if(y&&y.isColor)p(y,1),E=!0;let w=e.xr.getEnvironmentBlendMode();if(w==="additive")n.buffers.color.setClear(0,0,0,1,s);else if(w==="alpha-blend")n.buffers.color.setClear(0,0,0,0,s);if(e.autoClear||E)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function x(A,E){let y=d(E);if(y&&(y.isCubeTexture||y.mapping===eo)){if(l===void 0)l=new pt(new Yi(1,1,1),new An({name:"BackgroundCubeMaterial",uniforms:Mr(ai.backgroundCube.uniforms),vertexShader:ai.backgroundCube.vertexShader,fragmentShader:ai.backgroundCube.fragmentShader,side:jt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,T,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l);if(l.material.uniforms.envMap.value=y,l.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(CT.makeRotationFromEuler(E.backgroundRotation)).transpose(),y.isCubeTexture&&y.isRenderTargetTexture===!1)l.material.uniforms.backgroundRotation.value.premultiply(fx);if(l.material.toneMapped=$e.getTransfer(y.colorSpace)!==ht,u!==y||h!==y.version||f!==e.toneMapping)l.material.needsUpdate=!0,u=y,h=y.version,f=e.toneMapping;l.layers.enableAll(),A.unshift(l,l.geometry,l.material,0,0,null)}else if(y&&y.isTexture){if(c===void 0)c=new pt(new po(2,2),new An({name:"BackgroundMaterial",uniforms:Mr(ai.background.uniforms),vertexShader:ai.background.vertexShader,fragmentShader:ai.background.fragmentShader,side:Vi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c);if(c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=$e.getTransfer(y.colorSpace)!==ht,y.matrixAutoUpdate===!0)y.updateMatrix();if(c.material.uniforms.uvTransform.value.copy(y.matrix),u!==y||h!==y.version||f!==e.toneMapping)c.material.needsUpdate=!0,u=y,h=y.version,f=e.toneMapping;c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null)}}function p(A,E){A.getRGB(_c,dh(e)),n.buffers.color.setClear(_c.r,_c.g,_c.b,E,s)}function g(){if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0;if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0}return{getClearColor:function(){return o},setClearColor:function(A,E=1){o.set(A),a=E,p(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(A){a=A,p(o,a)},render:m,addToRenderList:x,dispose:g}}function PT(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=f(null),s=r,o=!1;function a(C,z,j,F,H){let V=!1,O=h(C,F,j,z);if(s!==O)s=O,l(s.object);if(V=d(C,F,j,H),V)m(C,F,j,H);if(H!==null)t.update(H,e.ELEMENT_ARRAY_BUFFER);if(V||o){if(o=!1,y(C,z,j,F),H!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(H).buffer)}}function c(){return e.createVertexArray()}function l(C){return e.bindVertexArray(C)}function u(C){return e.deleteVertexArray(C)}function h(C,z,j,F){let H=F.wireframe===!0,V=i[z.id];if(V===void 0)V={},i[z.id]=V;let O=C.isInstancedMesh===!0?C.id:0,K=V[O];if(K===void 0)K={},V[O]=K;let Q=K[j.id];if(Q===void 0)Q={},K[j.id]=Q;let se=Q[H];if(se===void 0)se=f(c()),Q[H]=se;return se}function f(C){let z=[],j=[],F=[];for(let H=0;H<n;H++)z[H]=0,j[H]=0,F[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:j,attributeDivisors:F,object:C,attributes:{},index:null}}function d(C,z,j,F){let H=s.attributes,V=z.attributes,O=0,K=j.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=H[Q],_e=V[Q];if(_e===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)_e=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)_e=C.instanceColor}if(me===void 0)return!0;if(me.attribute!==_e)return!0;if(_e&&me.data!==_e.data)return!0;O++}if(s.attributesNum!==O)return!0;if(s.index!==F)return!0;return!1}function m(C,z,j,F){let H={},V=z.attributes,O=0,K=j.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=V[Q];if(me===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)me=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)me=C.instanceColor}let _e={};if(_e.attribute=me,me&&me.data)_e.data=me.data;H[Q]=_e,O++}s.attributes=H,s.attributesNum=O,s.index=F}function x(){let C=s.newAttributes;for(let z=0,j=C.length;z<j;z++)C[z]=0}function p(C){g(C,0)}function g(C,z){let j=s.newAttributes,F=s.enabledAttributes,H=s.attributeDivisors;if(j[C]=1,F[C]===0)e.enableVertexAttribArray(C),F[C]=1;if(H[C]!==z)e.vertexAttribDivisor(C,z),H[C]=z}function A(){let C=s.newAttributes,z=s.enabledAttributes;for(let j=0,F=z.length;j<F;j++)if(z[j]!==C[j])e.disableVertexAttribArray(j),z[j]=0}function E(C,z,j,F,H,V,O){if(O===!0)e.vertexAttribIPointer(C,z,j,H,V);else e.vertexAttribPointer(C,z,j,F,H,V)}function y(C,z,j,F){x();let H=F.attributes,V=j.getAttributes(),O=z.defaultAttributeValues;for(let K in V){let Q=V[K];if(Q.location>=0){let se=H[K];if(se===void 0){if(K==="instanceMatrix"&&C.instanceMatrix)se=C.instanceMatrix;if(K==="instanceColor"&&C.instanceColor)se=C.instanceColor}if(se!==void 0){let me=se.normalized,_e=se.itemSize,qe=t.get(se);if(qe===void 0)continue;let{buffer:Ge,type:Z,bytesPerElement:ne}=qe,fe=Z===e.INT||Z===e.UNSIGNED_INT||se.gpuType===yu;if(se.isInterleavedBufferAttribute){let de=se.data,Re=de.stride,Ze=se.offset;if(de.isInstancedInterleavedBuffer){for(let Ue=0;Ue<Q.locationSize;Ue++)g(Q.location+Ue,de.meshPerAttribute);if(C.isInstancedMesh!==!0&&F._maxInstanceCount===void 0)F._maxInstanceCount=de.meshPerAttribute*de.count}else for(let Ue=0;Ue<Q.locationSize;Ue++)p(Q.location+Ue);e.bindBuffer(e.ARRAY_BUFFER,Ge);for(let Ue=0;Ue<Q.locationSize;Ue++)E(Q.location+Ue,_e/Q.locationSize,Z,me,Re*ne,(Ze+_e/Q.locationSize*Ue)*ne,fe)}else{if(se.isInstancedBufferAttribute){for(let de=0;de<Q.locationSize;de++)g(Q.location+de,se.meshPerAttribute);if(C.isInstancedMesh!==!0&&F._maxInstanceCount===void 0)F._maxInstanceCount=se.meshPerAttribute*se.count}else for(let de=0;de<Q.locationSize;de++)p(Q.location+de);e.bindBuffer(e.ARRAY_BUFFER,Ge);for(let de=0;de<Q.locationSize;de++)E(Q.location+de,_e/Q.locationSize,Z,me,_e*ne,_e/Q.locationSize*de*ne,fe)}}else if(O!==void 0){let me=O[K];if(me!==void 0)switch(me.length){case 2:e.vertexAttrib2fv(Q.location,me);break;case 3:e.vertexAttrib3fv(Q.location,me);break;case 4:e.vertexAttrib4fv(Q.location,me);break;default:e.vertexAttrib1fv(Q.location,me)}}}}A()}function w(){S();for(let C in i){let z=i[C];for(let j in z){let F=z[j];for(let H in F){let V=F[H];for(let O in V)u(V[O].object),delete V[O];delete F[H]}}delete i[C]}}function T(C){if(i[C.id]===void 0)return;let z=i[C.id];for(let j in z){let F=z[j];for(let H in F){let V=F[H];for(let O in V)u(V[O].object),delete V[O];delete F[H]}}delete i[C.id]}function R(C){for(let z in i){let j=i[z];for(let F in j){let H=j[F];if(H[C.id]===void 0)continue;let V=H[C.id];for(let O in V)u(V[O].object),delete V[O];delete H[C.id]}}}function _(C){for(let z in i){let j=i[z],F=C.isInstancedMesh===!0?C.id:0,H=j[F];if(H===void 0)continue;for(let V in H){let O=H[V];for(let K in O)u(O[K].object),delete O[K];delete H[V]}if(delete j[F],Object.keys(j).length===0)delete i[z]}}function S(){if(U(),o=!0,s===r)return;s=r,l(s.object)}function U(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:S,resetDefaultState:U,dispose:w,releaseStatesOfGeometry:T,releaseStatesOfObject:_,releaseStatesOfProgram:R,initAttributes:x,enableAttribute:p,disableUnusedAttributes:A}}function LT(e,t,n){let i;function r(c){i=c}function s(c,l){e.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){if(u===0)return;e.drawArraysInstanced(i,c,l,u),n.update(l,i,u)}function a(c,l,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let f=0;for(let d=0;d<u;d++)f+=l[d];n.update(f,i,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function NT(e,t,n,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let R=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(R){if(R!==ri&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function a(R){let _=R===wi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(R!==Gn&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Mi&&!_)return!1;return!0}function c(R){if(R==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";R="mediump"}if(R==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let l=n.precision!==void 0?n.precision:"highp",u=c(l);if(u!==l)Me("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u;let h=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control");if(n.reversedDepthBuffer===!0&&f===!1)Me("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),g=e.getParameter(e.MAX_VERTEX_ATTRIBS),A=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),E=e.getParameter(e.MAX_VARYING_VECTORS),y=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),w=e.getParameter(e.MAX_SAMPLES),T=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:p,maxAttributes:g,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:y,maxSamples:w,samples:T}}function DT(e){let t=this,n=null,i=0,r=!1,s=!1,o=new Un,a=new Oe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let d=h.length!==0||f||i!==0||r;return r=f,i=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){n=u(h,f,0)},this.setState=function(h,f,d){let{clippingPlanes:m,clipIntersection:x,clipShadows:p}=h,g=e.get(h);if(!r||m===null||m.length===0||s&&!p)if(s)u(null);else l();else{let A=s?0:i,E=A*4,y=g.clippingState||null;c.value=y,y=u(m,f,E,d);for(let w=0;w!==E;++w)y[w]=n[w];g.clippingState=y,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=A}};function l(){if(c.value!==n)c.value=n,c.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function u(h,f,d,m){let x=h!==null?h.length:0,p=null;if(x!==0){if(p=c.value,m!==!0||p===null){let g=d+x*4,A=f.matrixWorldInverse;if(a.getNormalMatrix(A),p===null||p.length<g)p=new Float32Array(g);for(let E=0,y=d;E!==x;++E,y+=4)o.copy(h[E]).applyMatrix4(A,a),o.normal.toArray(p,y),p[y+3]=o.constant}c.value=p,c.needsUpdate=!0}return t.numPlanes=x,t.numIntersection=0,p}}var tr=4,V0=[0.125,0.215,0.35,0.446,0.526,0.582],Er=20,OT=256,xo=new Tr,$0=new Le,Ih=null,Ph=0,Lh=0,Nh=!1,UT=new N;class So{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=0.1,i=100,r={}){let{size:s=256,position:o=UT}=r;Ih=this._renderer.getRenderTarget(),Ph=this._renderer.getActiveCubeFace(),Lh=this._renderer.getActiveMipmapLevel(),Nh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);let a=this._allocateTargets();if(a.depthBuffer=!0,this._sceneToCubeUV(e,n,i,a,o),t>0)this._blur(a,0,0,t);return this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=X0(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=Z0(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ih,Ph,Lh),this._renderer.xr.enabled=Nh,e.scissorTest=!1,ms(e,0,0,e.width,e.height)}_fromTexture(e,t){if(e.mapping===ns||e.mapping===_r)this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);Ih=this._renderer.getRenderTarget(),Ph=this._renderer.getActiveCubeFace(),Lh=this._renderer.getActiveMipmapLevel(),Nh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ht,minFilter:Ht,generateMipmaps:!1,type:wi,format:ri,colorSpace:pn,depthBuffer:!1},i=W0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=W0(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=FT(r)),this._blurMaterial=kT(r,e,t),this._ggxMaterial=zT(r,e,t)}return i}_compileMaterial(e){let t=new pt(new nn,e);this._renderer.compile(t,xo)}_sceneToCubeUV(e,t,n,i,r){let a=new Lt(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,{autoClear:h,toneMapping:f}=u;if(u.getClearColor($0),u.toneMapping=kn,u.autoClear=!1,u.state.buffers.depth.getReversed())u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new pt(new Yi,new si({name:"PMREM.Background",side:jt,depthWrite:!1,depthTest:!1}));let m=this._backgroundBox,x=m.material,p=!1,g=e.background;if(g){if(g.isColor)x.color.copy(g),e.background=null,p=!0}else x.color.copy($0),p=!0;for(let A=0;A<6;A++){let E=A%3;if(E===0)a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+l[A],r.y,r.z);else if(E===1)a.up.set(0,0,c[A]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+l[A],r.z);else a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+l[A]);let y=this._cubeSize;if(ms(i,E*y,A>2?y:0,y,y),u.setRenderTarget(i),p)u.render(m,a);u.render(e,a)}u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===ns||e.mapping===_r;if(i){if(this._cubemapMaterial===null)this._cubemapMaterial=X0();this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=Z0();let r=i?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r;let o=r.uniforms;o.envMap.value=e;let a=this._cubeSize;ms(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,xo)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,o=this._lodMeshes[n];o.material=s;let a=s.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l),h=0+c*1.25,f=u*h,{_lodMax:d}=this,m=this._sizeLods[n],x=3*m*(n>d-tr?n-d+tr:0),p=4*(this._cubeSize-m);a.envMap.value=e.texture,a.roughness.value=f,a.mipInt.value=d-t,ms(r,x,p,3*m,2*m),i.setRenderTarget(r),i.render(o,xo),a.envMap.value=r.texture,a.roughness.value=0,a.mipInt.value=d-n,ms(e,x,p,3*m,2*m),i.setRenderTarget(e),i.render(o,xo)}_blur(e,t,n,i,r){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){let a=this._renderer,c=this._blurMaterial;if(s!=="latitudinal"&&s!=="longitudinal")Ne("blur direction must be either latitudinal or longitudinal!");let l=3,u=this._lodMeshes[i];u.material=c;let h=c.uniforms,f=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Er-1),m=r/d,x=isFinite(r)?1+Math.floor(l*m):Er;if(x>Er)Me(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Er}`);let p=[],g=0;for(let T=0;T<Er;++T){let R=T/m,_=Math.exp(-R*R/2);if(p.push(_),T===0)g+=_;else if(T<x)g+=2*_}for(let T=0;T<p.length;T++)p[T]=p[T]/g;if(h.envMap.value=e.texture,h.samples.value=x,h.weights.value=p,h.latitudinal.value=s==="latitudinal",o)h.poleAxis.value=o;let{_lodMax:A}=this;h.dTheta.value=d,h.mipInt.value=A-n;let E=this._sizeLods[i],y=3*E*(i>A-tr?i-A+tr:0),w=4*(this._cubeSize-E);ms(t,y,w,3*E,2*E),a.setRenderTarget(t),a.render(u,xo)}}function FT(e){let t=[],n=[],i=[],r=e,s=e-tr+1+V0.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);t.push(a);let c=1/a;if(o>e-tr)c=V0[o-e+tr-1];else if(o===0)c=0;n.push(c);let l=1/(a-2),u=-l,h=1+l,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,x=3,p=2,g=1,A=new Float32Array(x*m*d),E=new Float32Array(p*m*d),y=new Float32Array(g*m*d);for(let T=0;T<d;T++){let R=T%3*2/3-1,_=T>2?0:-1,S=[R,_,0,R+0.6666666666666666,_,0,R+0.6666666666666666,_+1,0,R,_,0,R+0.6666666666666666,_+1,0,R,_+1,0];A.set(S,x*m*T),E.set(f,p*m*T);let U=[T,T,T,T,T,T];y.set(U,g*m*T)}let w=new nn;if(w.setAttribute("position",new Nt(A,x)),w.setAttribute("uv",new Nt(E,p)),w.setAttribute("faceIndex",new Nt(y,g)),i.push(new pt(w,null)),r>tr)r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}function W0(e,t,n){let i=new En(e,t,n);return i.texture.mapping=eo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ms(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function zT(e,t,n){return new An({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:OT,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:vc(),fragmentShader:`
precision highp float;
precision highp int;
@@ -3840,7 +3833,7 @@ void main() {
gl_FragColor = vec4(prefilteredColor, 1.0);
}
- `,blending:Yn,depthTest:!1,depthWrite:!1})}function HM(e,t,n){let i=new Float32Array(vr),r=new N(0,1,0);return new Mn({name:"SphericalGaussianBlur",defines:{n:vr,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ja(),fragmentShader:`
+ `,blending:ni,depthTest:!1,depthWrite:!1})}function kT(e,t,n){let i=new Float32Array(Er),r=new N(0,1,0);return new An({name:"SphericalGaussianBlur",defines:{n:Er,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:vc(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3900,7 +3893,7 @@ void main() {
}
}
- `,blending:Yn,depthTest:!1,depthWrite:!1})}function E_(){return new Mn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ja(),fragmentShader:`
+ `,blending:ni,depthTest:!1,depthWrite:!1})}function Z0(){return new An({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:vc(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3919,7 +3912,7 @@ void main() {
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
- `,blending:Yn,depthTest:!1,depthWrite:!1})}function A_(){return new Mn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ja(),fragmentShader:`
+ `,blending:ni,depthTest:!1,depthWrite:!1})}function X0(){return new An({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:vc(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3935,7 +3928,7 @@ void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
- `,blending:Yn,depthTest:!1,depthWrite:!1})}function Ja(){return`
+ `,blending:ni,depthTest:!1,depthWrite:!1})}function vc(){return`
precision mediump float;
precision mediump int;
@@ -3990,7 +3983,7 @@ void main() {
gl_Position = vec4( position, 1.0 );
}
- `}class Ku extends Sn{constructor(e=1,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Oa(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
+ `}class zh extends En{constructor(e=1,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new rc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
@@ -4025,7 +4018,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
}
- `},i=new Gi(5,5,5),r=new Mn({name:"CubemapFromEquirect",uniforms:gr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Yt,blending:Yn});r.uniforms.tEquirect.value=t;let s=new pt(i,r),o=t.minFilter;if(t.minFilter===jn)t.minFilter=Gt;return new Ou(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}}function VM(e){let t=new WeakMap,n=new WeakMap,i=null;function r(h,d=!1){if(h===null||h===void 0)return null;if(d)return o(h);return s(h)}function s(h){if(h&&h.isTexture){let d=h.mapping;if(d===ga||d===_a)if(t.has(h)){let g=t.get(h).texture;return a(g,h.mapping)}else{let g=h.image;if(g&&g.height>0){let y=new Ku(g.height);return y.fromEquirectangularTexture(e,h),t.set(h,y),h.addEventListener("dispose",l),a(y.texture,h.mapping)}else return null}}return h}function o(h){if(h&&h.isTexture){let d=h.mapping,g=d===ga||d===_a,y=d===qr||d===ur;if(g||y){let p=n.get(h),m=p!==void 0?p.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==m){if(i===null)i=new lo(e);return p=g?i.fromEquirectangular(h,p):i.fromCubemap(h,p),p.texture.pmremVersion=h.pmremVersion,n.set(h,p),p.texture}else if(p!==void 0)return p.texture;else{let A=h.image;if(g&&A&&A.height>0||y&&A&&c(A)){if(i===null)i=new lo(e);return p=g?i.fromEquirectangular(h):i.fromCubemap(h),p.texture.pmremVersion=h.pmremVersion,n.set(h,p),h.addEventListener("dispose",u),p.texture}else return null}}}return h}function a(h,d){if(d===ga)h.mapping=qr;else if(d===_a)h.mapping=ur;return h}function c(h){let d=0,g=6;for(let y=0;y<g;y++)if(h[y]!==void 0)d++;return d===g}function l(h){let d=h.target;d.removeEventListener("dispose",l);let g=t.get(d);if(g!==void 0)t.delete(d),g.dispose()}function u(h){let d=h.target;d.removeEventListener("dispose",u);let g=n.get(d);if(g!==void 0)n.delete(d),g.dispose()}function f(){if(t=new WeakMap,n=new WeakMap,i!==null)i.dispose(),i=null}return{get:r,dispose:f}}function WM(e){let t={};function n(i){if(t[i]!==void 0)return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(i){return n(i)!==null},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(i){let r=n(i);if(r===null)ar("WebGLRenderer: "+i+" extension not supported.");return r}}}function $M(e,t,n,i){let r={},s=new WeakMap;function o(f){let h=f.target;if(h.index!==null)t.remove(h.index);for(let g in h.attributes)t.remove(h.attributes[g]);h.removeEventListener("dispose",o),delete r[h.id];let d=s.get(h);if(d)t.remove(d),s.delete(h);if(i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0)delete h._maxInstanceCount;n.memory.geometries--}function a(f,h){if(r[h.id]===!0)return h;return h.addEventListener("dispose",o),r[h.id]=!0,n.memory.geometries++,h}function c(f){let h=f.attributes;for(let d in h)t.update(h[d],e.ARRAY_BUFFER)}function l(f){let h=[],d=f.index,g=f.attributes.position,y=0;if(g===void 0)return;if(d!==null){let A=d.array;y=d.version;for(let T=0,v=A.length;T<v;T+=3){let w=A[T+0],E=A[T+1],R=A[T+2];h.push(w,E,E,R,R,w)}}else{let A=g.array;y=g.version;for(let T=0,v=A.length/3-1;T<v;T+=3){let w=T+0,E=T+1,R=T+2;h.push(w,E,E,R,R,w)}}let p=new(g.count>=65535?La:Pa)(h,1);p.version=y;let m=s.get(f);if(m)t.remove(m);s.set(f,p)}function u(f){let h=s.get(f);if(h){let d=f.index;if(d!==null){if(h.version<d.version)l(f)}}else l(f);return s.get(f)}return{get:a,update:c,getWireframeAttribute:u}}function ZM(e,t,n){let i;function r(f){i=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function c(f,h){e.drawElements(i,h,s,f*o),n.update(h,i,1)}function l(f,h,d){if(d===0)return;e.drawElementsInstanced(i,h,s,f*o,d),n.update(h,i,d)}function u(f,h,d){if(d===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,h,0,s,f,0,d);let y=0;for(let p=0;p<d;p++)y+=h[p];n.update(y,i,1)}this.setMode=r,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function XM(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(n.calls++,o){case e.TRIANGLES:n.triangles+=a*(s/3);break;case e.LINES:n.lines+=a*(s/2);break;case e.LINE_STRIP:n.lines+=a*(s-1);break;case e.LINE_LOOP:n.lines+=a*s;break;case e.POINTS:n.points+=a*s;break;default:Ne("WebGLInfo: Unknown draw mode:",o);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function qM(e,t,n){let i=new WeakMap,r=new st;function s(o,a,c){let l=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,h=i.get(a);if(h===void 0||h.count!==f){let S=function(){R.dispose(),i.delete(a),a.removeEventListener("dispose",S)};if(h!==void 0)h.texture.dispose();let d=a.morphAttributes.position!==void 0,g=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],m=a.morphAttributes.normal||[],A=a.morphAttributes.color||[],T=0;if(d===!0)T=1;if(g===!0)T=2;if(y===!0)T=3;let v=a.attributes.position.count*T,w=1;if(v>t.maxTextureSize)w=Math.ceil(v/t.maxTextureSize),v=t.maxTextureSize;let E=new Float32Array(v*w*4*f),R=new Ca(E,v,w,f);R.type=di,R.needsUpdate=!0;let _=T*4;for(let F=0;F<f;F++){let C=p[F],z=m[F],J=A[F],O=v*w*4*F;for(let H=0;H<C.count;H++){let V=H*_;if(d===!0)r.fromBufferAttribute(C,H),E[O+V+0]=r.x,E[O+V+1]=r.y,E[O+V+2]=r.z,E[O+V+3]=0;if(g===!0)r.fromBufferAttribute(z,H),E[O+V+4]=r.x,E[O+V+5]=r.y,E[O+V+6]=r.z,E[O+V+7]=0;if(y===!0)r.fromBufferAttribute(J,H),E[O+V+8]=r.x,E[O+V+9]=r.y,E[O+V+10]=r.z,E[O+V+11]=J.itemSize===4?r.w:1}}h={count:f,texture:R,size:new Ie(v,w)},i.set(a,h),a.addEventListener("dispose",S)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(e,"morphTexture",o.morphTexture,n);else{let d=0;for(let y=0;y<l.length;y++)d+=l[y];let g=a.morphTargetsRelative?1:1-d;c.getUniforms().setValue(e,"morphTargetBaseInfluence",g),c.getUniforms().setValue(e,"morphTargetInfluences",l)}c.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}return{update:s}}function YM(e,t,n,i,r){let s=new WeakMap;function o(l){let u=r.render.frame,f=l.geometry,h=t.get(l,f);if(s.get(h)!==u)t.update(h),s.set(h,u);if(l.isInstancedMesh){if(l.hasEventListener("dispose",c)===!1)l.addEventListener("dispose",c);if(s.get(l)!==u){if(n.update(l.instanceMatrix,e.ARRAY_BUFFER),l.instanceColor!==null)n.update(l.instanceColor,e.ARRAY_BUFFER);s.set(l,u)}}if(l.isSkinnedMesh){let d=l.skeleton;if(s.get(d)!==u)d.update(),s.set(d,u)}return h}function a(){s=new WeakMap}function c(l){let u=l.target;if(u.removeEventListener("dispose",c),i.releaseStatesOfObject(u),n.remove(u.instanceMatrix),u.instanceColor!==null)n.remove(u.instanceColor)}return{update:o,dispose:a}}var jM={[Rl]:"LINEAR_TONE_MAPPING",[Cl]:"REINHARD_TONE_MAPPING",[Il]:"CINEON_TONE_MAPPING",[Gs]:"ACES_FILMIC_TONE_MAPPING",[Ll]:"AGX_TONE_MAPPING",[Nl]:"NEUTRAL_TONE_MAPPING",[Pl]:"CUSTOM_TONE_MAPPING"};function JM(e,t,n,i,r,s){let o=new Sn(t,n,{type:e,depthBuffer:r,stencilBuffer:s,samples:i?4:0,depthTexture:r?new Bi(t,n):void 0}),a=new Sn(t,n,{type:pi,depthBuffer:!1,stencilBuffer:!1}),c=new tn;c.setAttribute("position",new nn([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new nn([0,2,0,0,2,0],2));let l=new Ru({uniforms:{tDiffuse:{value:null}},vertexShader:`
+ `},i=new Yi(5,5,5),r=new An({name:"CubemapFromEquirect",uniforms:Mr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:jt,blending:ni});r.uniforms.tEquirect.value=t;let s=new pt(i,r),o=t.minFilter;if(t.minFilter===ii)t.minFilter=Ht;return new Sh(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}}function BT(e){let t=new WeakMap,n=new WeakMap,i=null;function r(f,d=!1){if(f===null||f===void 0)return null;if(d)return o(f);return s(f)}function s(f){if(f&&f.isTexture){let d=f.mapping;if(d===za||d===ka)if(t.has(f)){let m=t.get(f).texture;return a(m,f.mapping)}else{let m=f.image;if(m&&m.height>0){let x=new zh(m.height);return x.fromEquirectangularTexture(e,f),t.set(f,x),f.addEventListener("dispose",l),a(x.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture){let d=f.mapping,m=d===za||d===ka,x=d===ns||d===_r;if(m||x){let p=n.get(f),g=p!==void 0?p.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==g){if(i===null)i=new So(e);return p=m?i.fromEquirectangular(f,p):i.fromCubemap(f,p),p.texture.pmremVersion=f.pmremVersion,n.set(f,p),p.texture}else if(p!==void 0)return p.texture;else{let A=f.image;if(m&&A&&A.height>0||x&&A&&c(A)){if(i===null)i=new So(e);return p=m?i.fromEquirectangular(f):i.fromCubemap(f),p.texture.pmremVersion=f.pmremVersion,n.set(f,p),f.addEventListener("dispose",u),p.texture}else return null}}}return f}function a(f,d){if(d===za)f.mapping=ns;else if(d===ka)f.mapping=_r;return f}function c(f){let d=0,m=6;for(let x=0;x<m;x++)if(f[x]!==void 0)d++;return d===m}function l(f){let d=f.target;d.removeEventListener("dispose",l);let m=t.get(d);if(m!==void 0)t.delete(d),m.dispose()}function u(f){let d=f.target;d.removeEventListener("dispose",u);let m=n.get(d);if(m!==void 0)n.delete(d),m.dispose()}function h(){if(t=new WeakMap,n=new WeakMap,i!==null)i.dispose(),i=null}return{get:r,dispose:h}}function GT(e){let t={};function n(i){if(t[i]!==void 0)return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(i){return n(i)!==null},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(i){let r=n(i);if(r===null)pr("WebGLRenderer: "+i+" extension not supported.");return r}}}function HT(e,t,n,i){let r={},s=new WeakMap;function o(h){let f=h.target;if(f.index!==null)t.remove(f.index);for(let m in f.attributes)t.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete r[f.id];let d=s.get(f);if(d)t.remove(d),s.delete(f);if(i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0)delete f._maxInstanceCount;n.memory.geometries--}function a(h,f){if(r[f.id]===!0)return f;return f.addEventListener("dispose",o),r[f.id]=!0,n.memory.geometries++,f}function c(h){let f=h.attributes;for(let d in f)t.update(f[d],e.ARRAY_BUFFER)}function l(h){let f=[],d=h.index,m=h.attributes.position,x=0;if(m===void 0)return;if(d!==null){let A=d.array;x=d.version;for(let E=0,y=A.length;E<y;E+=3){let w=A[E+0],T=A[E+1],R=A[E+2];f.push(w,T,T,R,R,w)}}else{let A=m.array;x=m.version;for(let E=0,y=A.length/3-1;E<y;E+=3){let w=E+0,T=E+1,R=E+2;f.push(w,T,T,R,R,w)}}let p=new(m.count>=65535?ec:Qa)(f,1);p.version=x;let g=s.get(h);if(g)t.remove(g);s.set(h,p)}function u(h){let f=s.get(h);if(f){let d=h.index;if(d!==null){if(f.version<d.version)l(h)}}else l(h);return s.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function VT(e,t,n){let i;function r(h){i=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function c(h,f){e.drawElements(i,f,s,h*o),n.update(f,i,1)}function l(h,f,d){if(d===0)return;e.drawElementsInstanced(i,f,s,h*o,d),n.update(f,i,d)}function u(h,f,d){if(d===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,f,0,s,h,0,d);let x=0;for(let p=0;p<d;p++)x+=f[p];n.update(x,i,1)}this.setMode=r,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function $T(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(n.calls++,o){case e.TRIANGLES:n.triangles+=a*(s/3);break;case e.LINES:n.lines+=a*(s/2);break;case e.LINE_STRIP:n.lines+=a*(s-1);break;case e.LINE_LOOP:n.lines+=a*s;break;case e.POINTS:n.points+=a*s;break;default:Ne("WebGLInfo: Unknown draw mode:",o);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function WT(e,t,n){let i=new WeakMap,r=new st;function s(o,a,c){let l=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0,f=i.get(a);if(f===void 0||f.count!==h){let S=function(){R.dispose(),i.delete(a),a.removeEventListener("dispose",S)};if(f!==void 0)f.texture.dispose();let d=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],A=a.morphAttributes.color||[],E=0;if(d===!0)E=1;if(m===!0)E=2;if(x===!0)E=3;let y=a.attributes.position.count*E,w=1;if(y>t.maxTextureSize)w=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize;let T=new Float32Array(y*w*4*h),R=new Ja(T,y,w,h);R.type=Mi,R.needsUpdate=!0;let _=E*4;for(let U=0;U<h;U++){let C=p[U],z=g[U],j=A[U],F=y*w*4*U;for(let H=0;H<C.count;H++){let V=H*_;if(d===!0)r.fromBufferAttribute(C,H),T[F+V+0]=r.x,T[F+V+1]=r.y,T[F+V+2]=r.z,T[F+V+3]=0;if(m===!0)r.fromBufferAttribute(z,H),T[F+V+4]=r.x,T[F+V+5]=r.y,T[F+V+6]=r.z,T[F+V+7]=0;if(x===!0)r.fromBufferAttribute(j,H),T[F+V+8]=r.x,T[F+V+9]=r.y,T[F+V+10]=r.z,T[F+V+11]=j.itemSize===4?r.w:1}}f={count:h,texture:R,size:new Ie(y,w)},i.set(a,f),a.addEventListener("dispose",S)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(e,"morphTexture",o.morphTexture,n);else{let d=0;for(let x=0;x<l.length;x++)d+=l[x];let m=a.morphTargetsRelative?1:1-d;c.getUniforms().setValue(e,"morphTargetBaseInfluence",m),c.getUniforms().setValue(e,"morphTargetInfluences",l)}c.getUniforms().setValue(e,"morphTargetsTexture",f.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",f.size)}return{update:s}}function ZT(e,t,n,i,r){let s=new WeakMap;function o(l){let u=r.render.frame,h=l.geometry,f=t.get(l,h);if(s.get(f)!==u)t.update(f),s.set(f,u);if(l.isInstancedMesh){if(l.hasEventListener("dispose",c)===!1)l.addEventListener("dispose",c);if(s.get(l)!==u){if(n.update(l.instanceMatrix,e.ARRAY_BUFFER),l.instanceColor!==null)n.update(l.instanceColor,e.ARRAY_BUFFER);s.set(l,u)}}if(l.isSkinnedMesh){let d=l.skeleton;if(s.get(d)!==u)d.update(),s.set(d,u)}return f}function a(){s=new WeakMap}function c(l){let u=l.target;if(u.removeEventListener("dispose",c),i.releaseStatesOfObject(u),n.remove(u.instanceMatrix),u.instanceColor!==null)n.remove(u.instanceColor)}return{update:o,dispose:a}}var XT={[pu]:"LINEAR_TONE_MAPPING",[mu]:"REINHARD_TONE_MAPPING",[gu]:"CINEON_TONE_MAPPING",[Qs]:"ACES_FILMIC_TONE_MAPPING",[xu]:"AGX_TONE_MAPPING",[vu]:"NEUTRAL_TONE_MAPPING",[_u]:"CUSTOM_TONE_MAPPING"};function qT(e,t,n,i,r,s){let o=new En(t,n,{type:e,depthBuffer:r,stencilBuffer:s,samples:i?4:0,depthTexture:r?new qi(t,n):void 0}),a=new En(t,n,{type:wi,depthBuffer:!1,stencilBuffer:!1}),c=new nn;c.setAttribute("position",new rn([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new rn([0,2,0,0,2,0],2));let l=new ph({uniforms:{tDiffuse:{value:null}},vertexShader:`
precision highp float;
uniform mat4 modelViewMatrix;
@@ -4071,17 +4064,17 @@ void main() {
#ifdef SRGB_TRANSFER
gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif
- }`,depthTest:!1,depthWrite:!1}),u=new pt(c,l),f=new xr(-1,1,1,-1,0,1),h=null,d=null,g=!1,y,p=null,m=[],A=!1;this.setSize=function(T,v){o.setSize(T,v),a.setSize(T,v);for(let w=0;w<m.length;w++){let E=m[w];if(E.setSize)E.setSize(T,v)}},this.setEffects=function(T){m=T,A=m.length>0&&m[0].isRenderPass===!0;let{width:v,height:w}=o;for(let E=0;E<m.length;E++){let R=m[E];if(R.setSize)R.setSize(v,w)}},this.begin=function(T,v){if(g)return!1;if(T.toneMapping===Un&&m.length===0)return!1;if(p=v,v!==null){let{width:w,height:E}=v;if(o.width!==w||o.height!==E)this.setSize(w,E)}if(A===!1)T.setRenderTarget(o);return y=T.toneMapping,T.toneMapping=Un,!0},this.hasRenderPass=function(){return A},this.end=function(T,v){T.toneMapping=y,g=!0;let w=o,E=a;for(let R=0;R<m.length;R++){let _=m[R];if(_.enabled===!1)continue;if(_.render(T,E,w,v),_.needsSwap!==!1){let S=w;w=E,E=S}}if(h!==T.outputColorSpace||d!==T.toneMapping){if(h=T.outputColorSpace,d=T.toneMapping,l.defines={},We.getTransfer(h)===ht)l.defines.SRGB_TRANSFER="";let R=jM[d];if(R)l.defines[R]="";l.needsUpdate=!0}l.uniforms.tDiffuse.value=w.texture,T.setRenderTarget(p),T.render(u,f),p=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){if(o.depthTexture)o.depthTexture.dispose();o.dispose(),a.dispose(),c.dispose(),l.dispose()}}var X_=new wt,ju=new Bi(1,1),q_=new Ca,Y_=new Tu,j_=new Oa,R_=[],C_=[],I_=new Float32Array(16),P_=new Float32Array(9),L_=new Float32Array(4);function cs(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,s=R_[r];if(s===void 0)s=new Float32Array(r),R_[r]=s;if(t!==0){i.toArray(s,0);for(let o=1,a=0;o!==t;++o)a+=n,e[o].toArray(s,a)}return s}function Dt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Ut(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function Ka(e,t){let n=C_[t];if(n===void 0)n=new Int32Array(t),C_[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function KM(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function QM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2fv(this.addr,t),Ut(n,t)}}function ew(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(Dt(n,t))return;e.uniform3fv(this.addr,t),Ut(n,t)}}function tw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4fv(this.addr,t),Ut(n,t)}}function nw(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ut(n,t)}else{if(Dt(n,i))return;L_.set(i),e.uniformMatrix2fv(this.addr,!1,L_),Ut(n,i)}}function iw(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ut(n,t)}else{if(Dt(n,i))return;P_.set(i),e.uniformMatrix3fv(this.addr,!1,P_),Ut(n,i)}}function rw(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ut(n,t)}else{if(Dt(n,i))return;I_.set(i),e.uniformMatrix4fv(this.addr,!1,I_),Ut(n,i)}}function sw(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function ow(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2iv(this.addr,t),Ut(n,t)}}function aw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Dt(n,t))return;e.uniform3iv(this.addr,t),Ut(n,t)}}function cw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4iv(this.addr,t),Ut(n,t)}}function lw(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function uw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2uiv(this.addr,t),Ut(n,t)}}function hw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Dt(n,t))return;e.uniform3uiv(this.addr,t),Ut(n,t)}}function fw(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4uiv(this.addr,t),Ut(n,t)}}function dw(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;let s;if(this.type===e.SAMPLER_2D_SHADOW)ju.compareFunction=n.isReversedDepthBuffer()?Ra:Aa,s=ju;else s=X_;n.setTexture2D(t||s,r)}function pw(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture3D(t||Y_,r)}function mw(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTextureCube(t||j_,r)}function gw(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture2DArray(t||q_,r)}function _w(e){switch(e){case 5126:return KM;case 35664:return QM;case 35665:return ew;case 35666:return tw;case 35674:return nw;case 35675:return iw;case 35676:return rw;case 5124:case 35670:return sw;case 35667:case 35671:return ow;case 35668:case 35672:return aw;case 35669:case 35673:return cw;case 5125:return lw;case 36294:return uw;case 36295:return hw;case 36296:return fw;case 35678:case 36198:case 36298:case 36306:case 35682:return dw;case 35679:case 36299:case 36307:return pw;case 35680:case 36300:case 36308:case 36293:return mw;case 36289:case 36303:case 36311:case 36292:return gw}}function xw(e,t){e.uniform1fv(this.addr,t)}function vw(e,t){let n=cs(t,this.size,2);e.uniform2fv(this.addr,n)}function yw(e,t){let n=cs(t,this.size,3);e.uniform3fv(this.addr,n)}function bw(e,t){let n=cs(t,this.size,4);e.uniform4fv(this.addr,n)}function Sw(e,t){let n=cs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Mw(e,t){let n=cs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function ww(e,t){let n=cs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Tw(e,t){e.uniform1iv(this.addr,t)}function Ew(e,t){e.uniform2iv(this.addr,t)}function Aw(e,t){e.uniform3iv(this.addr,t)}function Rw(e,t){e.uniform4iv(this.addr,t)}function Cw(e,t){e.uniform1uiv(this.addr,t)}function Iw(e,t){e.uniform2uiv(this.addr,t)}function Pw(e,t){e.uniform3uiv(this.addr,t)}function Lw(e,t){e.uniform4uiv(this.addr,t)}function Nw(e,t,n){let i=this.cache,r=t.length,s=Ka(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ut(i,s);let o;if(this.type===e.SAMPLER_2D_SHADOW)o=ju;else o=X_;for(let a=0;a!==r;++a)n.setTexture2D(t[a]||o,s[a])}function Dw(e,t,n){let i=this.cache,r=t.length,s=Ka(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ut(i,s);for(let o=0;o!==r;++o)n.setTexture3D(t[o]||Y_,s[o])}function Uw(e,t,n){let i=this.cache,r=t.length,s=Ka(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ut(i,s);for(let o=0;o!==r;++o)n.setTextureCube(t[o]||j_,s[o])}function Ow(e,t,n){let i=this.cache,r=t.length,s=Ka(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ut(i,s);for(let o=0;o!==r;++o)n.setTexture2DArray(t[o]||q_,s[o])}function Fw(e){switch(e){case 5126:return xw;case 35664:return vw;case 35665:return yw;case 35666:return bw;case 35674:return Sw;case 35675:return Mw;case 35676:return ww;case 5124:case 35670:return Tw;case 35667:case 35671:return Ew;case 35668:case 35672:return Aw;case 35669:case 35673:return Rw;case 5125:return Cw;case 36294:return Iw;case 36295:return Pw;case 36296:return Lw;case 35678:case 36198:case 36298:case 36306:case 35682:return Nw;case 35679:case 36299:case 36307:return Dw;case 35680:case 36300:case 36308:case 36293:return Uw;case 36289:case 36303:case 36311:case 36292:return Ow}}class J_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=_w(t.type)}}class K_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Fw(t.type)}}class Q_{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,s=i.length;r!==s;++r){let o=i[r];o.setValue(e,t[o.id],n)}}}var qu=/(\w+)(\])?(\[|\.)?/g;function N_(e,t){e.seq.push(t),e.map[t.id]=t}function zw(e,t,n){let i=e.name,r=i.length;qu.lastIndex=0;while(!0){let s=qu.exec(i),o=qu.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c)a=a|0;if(l===void 0||l==="["&&o+2===r){N_(n,l===void 0?new J_(a,e,t):new K_(a,e,t));break}else{let f=n.map[a];if(f===void 0)f=new Q_(a),N_(n,f);n=f}}}class co{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let o=e.getActiveUniform(t,s),a=e.getUniformLocation(t,o.name);zw(o,a,this)}let i=[],r=[];for(let s of this.seq)if(s.type===e.SAMPLER_2D_SHADOW||s.type===e.SAMPLER_CUBE_SHADOW||s.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(s);else r.push(s);if(i.length>0)this.seq=i.concat(r)}setValue(e,t,n,i){let r=this.map[t];if(r!==void 0)r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){let o=t[r],a=n[o.id];if(a.needsUpdate!==!1)o.setValue(e,a.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let s=e[i];if(s.id in t)n.push(s)}return n}}function D_(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var kw=37297,Bw=0;function Gw(e,t){let n=e.split(`
+ }`,depthTest:!1,depthWrite:!1}),u=new pt(c,l),h=new Tr(-1,1,1,-1,0,1),f=null,d=null,m=!1,x,p=null,g=[],A=!1;this.setSize=function(E,y){o.setSize(E,y),a.setSize(E,y);for(let w=0;w<g.length;w++){let T=g[w];if(T.setSize)T.setSize(E,y)}},this.setEffects=function(E){g=E,A=g.length>0&&g[0].isRenderPass===!0;let{width:y,height:w}=o;for(let T=0;T<g.length;T++){let R=g[T];if(R.setSize)R.setSize(y,w)}},this.begin=function(E,y){if(m)return!1;if(E.toneMapping===kn&&g.length===0)return!1;if(p=y,y!==null){let{width:w,height:T}=y;if(o.width!==w||o.height!==T)this.setSize(w,T)}if(A===!1)E.setRenderTarget(o);return x=E.toneMapping,E.toneMapping=kn,!0},this.hasRenderPass=function(){return A},this.end=function(E,y){E.toneMapping=x,m=!0;let w=o,T=a;for(let R=0;R<g.length;R++){let _=g[R];if(_.enabled===!1)continue;if(_.render(E,T,w,y),_.needsSwap!==!1){let S=w;w=T,T=S}}if(f!==E.outputColorSpace||d!==E.toneMapping){if(f=E.outputColorSpace,d=E.toneMapping,l.defines={},$e.getTransfer(f)===ht)l.defines.SRGB_TRANSFER="";let R=XT[d];if(R)l.defines[R]="";l.needsUpdate=!0}l.uniforms.tDiffuse.value=w.texture,E.setRenderTarget(p),E.render(u,h),p=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){if(o.depthTexture)o.depthTexture.dispose();o.dispose(),a.dispose(),c.dispose(),l.dispose()}}var dx=new wt,Uh=new qi(1,1),px=new Ja,mx=new hh,gx=new rc,q0=[],Y0=[],j0=new Float32Array(16),J0=new Float32Array(9),K0=new Float32Array(4);function gs(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,s=q0[r];if(s===void 0)s=new Float32Array(r),q0[r]=s;if(t!==0){i.toArray(s,0);for(let o=1,a=0;o!==t;++o)a+=n,e[o].toArray(s,a)}return s}function Dt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Ot(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function yc(e,t){let n=Y0[t];if(n===void 0)n=new Int32Array(t),Y0[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function YT(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function jT(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2fv(this.addr,t),Ot(n,t)}}function JT(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(Dt(n,t))return;e.uniform3fv(this.addr,t),Ot(n,t)}}function KT(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4fv(this.addr,t),Ot(n,t)}}function QT(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ot(n,t)}else{if(Dt(n,i))return;K0.set(i),e.uniformMatrix2fv(this.addr,!1,K0),Ot(n,i)}}function eE(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ot(n,t)}else{if(Dt(n,i))return;J0.set(i),e.uniformMatrix3fv(this.addr,!1,J0),Ot(n,i)}}function tE(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Dt(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ot(n,t)}else{if(Dt(n,i))return;j0.set(i),e.uniformMatrix4fv(this.addr,!1,j0),Ot(n,i)}}function nE(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function iE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2iv(this.addr,t),Ot(n,t)}}function rE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Dt(n,t))return;e.uniform3iv(this.addr,t),Ot(n,t)}}function sE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4iv(this.addr,t),Ot(n,t)}}function oE(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function aE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Dt(n,t))return;e.uniform2uiv(this.addr,t),Ot(n,t)}}function cE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Dt(n,t))return;e.uniform3uiv(this.addr,t),Ot(n,t)}}function lE(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Dt(n,t))return;e.uniform4uiv(this.addr,t),Ot(n,t)}}function uE(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;let s;if(this.type===e.SAMPLER_2D_SHADOW)Uh.compareFunction=n.isReversedDepthBuffer()?ja:Ya,s=Uh;else s=dx;n.setTexture2D(t||s,r)}function hE(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture3D(t||mx,r)}function fE(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTextureCube(t||gx,r)}function dE(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture2DArray(t||px,r)}function pE(e){switch(e){case 5126:return YT;case 35664:return jT;case 35665:return JT;case 35666:return KT;case 35674:return QT;case 35675:return eE;case 35676:return tE;case 5124:case 35670:return nE;case 35667:case 35671:return iE;case 35668:case 35672:return rE;case 35669:case 35673:return sE;case 5125:return oE;case 36294:return aE;case 36295:return cE;case 36296:return lE;case 35678:case 36198:case 36298:case 36306:case 35682:return uE;case 35679:case 36299:case 36307:return hE;case 35680:case 36300:case 36308:case 36293:return fE;case 36289:case 36303:case 36311:case 36292:return dE}}function mE(e,t){e.uniform1fv(this.addr,t)}function gE(e,t){let n=gs(t,this.size,2);e.uniform2fv(this.addr,n)}function _E(e,t){let n=gs(t,this.size,3);e.uniform3fv(this.addr,n)}function xE(e,t){let n=gs(t,this.size,4);e.uniform4fv(this.addr,n)}function vE(e,t){let n=gs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function yE(e,t){let n=gs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function bE(e,t){let n=gs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function SE(e,t){e.uniform1iv(this.addr,t)}function ME(e,t){e.uniform2iv(this.addr,t)}function wE(e,t){e.uniform3iv(this.addr,t)}function TE(e,t){e.uniform4iv(this.addr,t)}function EE(e,t){e.uniform1uiv(this.addr,t)}function AE(e,t){e.uniform2uiv(this.addr,t)}function RE(e,t){e.uniform3uiv(this.addr,t)}function CE(e,t){e.uniform4uiv(this.addr,t)}function IE(e,t,n){let i=this.cache,r=t.length,s=yc(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ot(i,s);let o;if(this.type===e.SAMPLER_2D_SHADOW)o=Uh;else o=dx;for(let a=0;a!==r;++a)n.setTexture2D(t[a]||o,s[a])}function PE(e,t,n){let i=this.cache,r=t.length,s=yc(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ot(i,s);for(let o=0;o!==r;++o)n.setTexture3D(t[o]||mx,s[o])}function LE(e,t,n){let i=this.cache,r=t.length,s=yc(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ot(i,s);for(let o=0;o!==r;++o)n.setTextureCube(t[o]||gx,s[o])}function NE(e,t,n){let i=this.cache,r=t.length,s=yc(n,r);if(!Dt(i,s))e.uniform1iv(this.addr,s),Ot(i,s);for(let o=0;o!==r;++o)n.setTexture2DArray(t[o]||px,s[o])}function DE(e){switch(e){case 5126:return mE;case 35664:return gE;case 35665:return _E;case 35666:return xE;case 35674:return vE;case 35675:return yE;case 35676:return bE;case 5124:case 35670:return SE;case 35667:case 35671:return ME;case 35668:case 35672:return wE;case 35669:case 35673:return TE;case 5125:return EE;case 36294:return AE;case 36295:return RE;case 36296:return CE;case 35678:case 36198:case 36298:case 36306:case 35682:return IE;case 35679:case 36299:case 36307:return PE;case 35680:case 36300:case 36308:case 36293:return LE;case 36289:case 36303:case 36311:case 36292:return NE}}class _x{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=pE(t.type)}}class xx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=DE(t.type)}}class vx{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,s=i.length;r!==s;++r){let o=i[r];o.setValue(e,t[o.id],n)}}}var Dh=/(\w+)(\])?(\[|\.)?/g;function Q0(e,t){e.seq.push(t),e.map[t.id]=t}function OE(e,t,n){let i=e.name,r=i.length;Dh.lastIndex=0;while(!0){let s=Dh.exec(i),o=Dh.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c)a=a|0;if(l===void 0||l==="["&&o+2===r){Q0(n,l===void 0?new _x(a,e,t):new xx(a,e,t));break}else{let h=n.map[a];if(h===void 0)h=new vx(a),Q0(n,h);n=h}}}class bo{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let o=e.getActiveUniform(t,s),a=e.getUniformLocation(t,o.name);OE(o,a,this)}let i=[],r=[];for(let s of this.seq)if(s.type===e.SAMPLER_2D_SHADOW||s.type===e.SAMPLER_CUBE_SHADOW||s.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(s);else r.push(s);if(i.length>0)this.seq=i.concat(r)}setValue(e,t,n,i){let r=this.map[t];if(r!==void 0)r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){let o=t[r],a=n[o.id];if(a.needsUpdate!==!1)o.setValue(e,a.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let s=e[i];if(s.id in t)n.push(s)}return n}}function ex(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var UE=37297,FE=0;function zE(e,t){let n=e.split(`
`),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let o=r;o<s;o++){let a=o+1;i.push(`${a===t?">":" "} ${a}: ${n[o]}`)}return i.join(`
-`)}var U_=new Ue;function Hw(e){We._getMatrix(U_,We.workingColorSpace,e);let t=`mat3( ${U_.elements.map((n)=>n.toFixed(4))} )`;switch(We.getTransfer(e)){case vu:return[t,"LinearTransferOETF"];case ht:return[t,"sRGBTransferOETF"];default:return Me("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function O_(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),s=(e.getShaderInfoLog(t)||"").trim();if(i&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return n.toUpperCase()+`
+`)}var tx=new Oe;function kE(e){$e._getMatrix(tx,$e.workingColorSpace,e);let t=`mat3( ${tx.elements.map((n)=>n.toFixed(4))} )`;switch($e.getTransfer(e)){case sh:return[t,"LinearTransferOETF"];case ht:return[t,"sRGBTransferOETF"];default:return Me("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function nx(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),s=(e.getShaderInfoLog(t)||"").trim();if(i&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return n.toUpperCase()+`
`+s+`
-`+Gw(e.getShaderSource(t),a)}else return s}function Vw(e,t){let n=Hw(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
-`)}var Ww={[Rl]:"Linear",[Cl]:"Reinhard",[Il]:"Cineon",[Gs]:"ACESFilmic",[Ll]:"AgX",[Nl]:"Neutral",[Pl]:"Custom"};function $w(e,t){let n=Ww[t];if(n===void 0)return Me("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var ja=new N;function Zw(){We.getLuminanceCoefficients(ja);let e=ja.x.toFixed(4),t=ja.y.toFixed(4),n=ja.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join(`
-`)}function Xw(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ao).join(`
-`)}function qw(e){let t=[];for(let n in e){let i=e[n];if(i===!1)continue;t.push("#define "+n+" "+i)}return t.join(`
-`)}function Yw(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let s=e.getActiveAttrib(t,r),o=s.name,a=1;if(s.type===e.FLOAT_MAT2)a=2;if(s.type===e.FLOAT_MAT3)a=3;if(s.type===e.FLOAT_MAT4)a=4;n[o]={type:s.type,location:e.getAttribLocation(t,o),locationSize:a}}return n}function ao(e){return e!==""}function F_(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function z_(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var jw=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ju(e){return e.replace(jw,Kw)}var Jw=new Map;function Kw(e,t){let n=He[t];if(n===void 0){let i=Jw.get(t);if(i!==void 0)n=He[i],Me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return Ju(n)}var Qw=/#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 k_(e){return e.replace(Qw,eT)}function eT(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function B_(e){let t=`precision ${e.precision} float;
+`+zE(e.getShaderSource(t),a)}else return s}function BE(e,t){let n=kE(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
+`)}var GE={[pu]:"Linear",[mu]:"Reinhard",[gu]:"Cineon",[Qs]:"ACESFilmic",[xu]:"AgX",[vu]:"Neutral",[_u]:"Custom"};function HE(e,t){let n=GE[t];if(n===void 0)return Me("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var xc=new N;function VE(){$e.getLuminanceCoefficients(xc);let e=xc.x.toFixed(4),t=xc.y.toFixed(4),n=xc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join(`
+`)}function $E(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(yo).join(`
+`)}function WE(e){let t=[];for(let n in e){let i=e[n];if(i===!1)continue;t.push("#define "+n+" "+i)}return t.join(`
+`)}function ZE(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let s=e.getActiveAttrib(t,r),o=s.name,a=1;if(s.type===e.FLOAT_MAT2)a=2;if(s.type===e.FLOAT_MAT3)a=3;if(s.type===e.FLOAT_MAT4)a=4;n[o]={type:s.type,location:e.getAttribLocation(t,o),locationSize:a}}return n}function yo(e){return e!==""}function ix(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function rx(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var XE=/^[ \t]*#include +<([\w\d./]+)>/gm;function Fh(e){return e.replace(XE,YE)}var qE=new Map;function YE(e,t){let n=He[t];if(n===void 0){let i=qE.get(t);if(i!==void 0)n=He[i],Me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return Fh(n)}var jE=/#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 sx(e){return e.replace(jE,JE)}function JE(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function ox(e){let t=`precision ${e.precision} float;
precision ${e.precision} int;
precision ${e.precision} sampler2D;
precision ${e.precision} samplerCube;
@@ -4101,30 +4094,30 @@ void main() {
`;if(e.precision==="highp")t+=`
#define HIGH_PRECISION`;else if(e.precision==="mediump")t+=`
#define MEDIUM_PRECISION`;else if(e.precision==="lowp")t+=`
-#define LOW_PRECISION`;return t}var tT={[ks]:"SHADOWMAP_TYPE_PCF",[Zr]:"SHADOWMAP_TYPE_VSM"};function nT(e){return tT[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var iT={[qr]:"ENVMAP_TYPE_CUBE",[ur]:"ENVMAP_TYPE_CUBE",[Hs]:"ENVMAP_TYPE_CUBE_UV"};function rT(e){if(e.envMap===!1)return"ENVMAP_TYPE_CUBE";return iT[e.envMapMode]||"ENVMAP_TYPE_CUBE"}var sT={[ur]:"ENVMAP_MODE_REFRACTION"};function oT(e){if(e.envMap===!1)return"ENVMAP_MODE_REFLECTION";return sT[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}var aT={[qg]:"ENVMAP_BLENDING_MULTIPLY",[Yg]:"ENVMAP_BLENDING_MIX",[jg]:"ENVMAP_BLENDING_ADD"};function cT(e){if(e.envMap===!1)return"ENVMAP_BLENDING_NONE";return aT[e.combine]||"ENVMAP_BLENDING_NONE"}function lT(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function uT(e,t,n,i){let r=e.getContext(),{defines:s,vertexShader:o,fragmentShader:a}=n,c=nT(n),l=rT(n),u=oT(n),f=cT(n),h=lT(n),d=Xw(n),g=qw(s),y=r.createProgram(),p,m,A=n.glslVersion?"#version "+n.glslVersion+`
-`:"";if(n.isRawShaderMaterial){if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(ao).join(`
+#define LOW_PRECISION`;return t}var KE={[Js]:"SHADOWMAP_TYPE_PCF",[es]:"SHADOWMAP_TYPE_VSM"};function QE(e){return KE[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var eA={[ns]:"ENVMAP_TYPE_CUBE",[_r]:"ENVMAP_TYPE_CUBE",[eo]:"ENVMAP_TYPE_CUBE_UV"};function tA(e){if(e.envMap===!1)return"ENVMAP_TYPE_CUBE";return eA[e.envMapMode]||"ENVMAP_TYPE_CUBE"}var nA={[_r]:"ENVMAP_MODE_REFRACTION"};function iA(e){if(e.envMap===!1)return"ENVMAP_MODE_REFLECTION";return nA[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}var rA={[p0]:"ENVMAP_BLENDING_MULTIPLY",[m0]:"ENVMAP_BLENDING_MIX",[g0]:"ENVMAP_BLENDING_ADD"};function sA(e){if(e.envMap===!1)return"ENVMAP_BLENDING_NONE";return rA[e.combine]||"ENVMAP_BLENDING_NONE"}function oA(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function aA(e,t,n,i){let r=e.getContext(),{defines:s,vertexShader:o,fragmentShader:a}=n,c=QE(n),l=tA(n),u=iA(n),h=sA(n),f=oA(n),d=$E(n),m=WE(s),x=r.createProgram(),p,g,A=n.glslVersion?"#version "+n.glslVersion+`
+`:"";if(n.isRawShaderMaterial){if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(yo).join(`
`),p.length>0)p+=`
-`;if(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(ao).join(`
-`),m.length>0)m+=`
-`}else p=[B_(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,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 "+u:"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",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&&n.flatShading===!1?"#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 "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
-`].filter(ao).join(`
-`),m=[B_(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,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 "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Un?"#define TONE_MAPPING":"",n.toneMapping!==Un?He.tonemapping_pars_fragment:"",n.toneMapping!==Un?$w("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",He.colorspace_pars_fragment,Vw("linearToOutputTexel",n.outputColorSpace),Zw(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
-`].filter(ao).join(`
-`);if(o=Ju(o),o=F_(o,n),o=z_(o,n),a=Ju(a),a=F_(a,n),a=z_(a,n),o=k_(o),a=k_(a),n.isRawShaderMaterial!==!0)A=`#version 300 es
+`;if(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(yo).join(`
+`),g.length>0)g+=`
+`}else p=[ox(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,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 "+u:"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",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&&n.flatShading===!1?"#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 "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
+`].filter(yo).join(`
+`),g=[ox(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,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 "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==kn?"#define TONE_MAPPING":"",n.toneMapping!==kn?He.tonemapping_pars_fragment:"",n.toneMapping!==kn?HE("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",He.colorspace_pars_fragment,BE("linearToOutputTexel",n.outputColorSpace),VE(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
+`].filter(yo).join(`
+`);if(o=Fh(o),o=ix(o,n),o=rx(o,n),a=Fh(a),a=ix(a,n),a=rx(a,n),o=sx(o),a=sx(a),n.isRawShaderMaterial!==!0)A=`#version 300 es
`,p=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
-`+p,m=["#define varying in",n.glslVersion===yu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===yu?"":"#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(`
+`+p,g=["#define varying in",n.glslVersion===oh?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===oh?"":"#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(`
`)+`
-`+m;let T=A+p+o,v=A+m+a,w=D_(r,r.VERTEX_SHADER,T),E=D_(r,r.FRAGMENT_SHADER,v);if(r.attachShader(y,w),r.attachShader(y,E),n.index0AttributeName!==void 0)r.bindAttribLocation(y,0,n.index0AttributeName);else if(n.hasPositionAttribute===!0)r.bindAttribLocation(y,0,"position");r.linkProgram(y);function R(C){if(e.debug.checkShaderErrors){let z=r.getProgramInfoLog(y)||"",J=r.getShaderInfoLog(w)||"",O=r.getShaderInfoLog(E)||"",H=z.trim(),V=J.trim(),U=O.trim(),K=!0,Q=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(K=!1,typeof e.debug.onShaderError==="function")e.debug.onShaderError(r,y,w,E);else{let se=O_(r,w,"vertex"),me=O_(r,E,"fragment");Ne("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
+`+g;let E=A+p+o,y=A+g+a,w=ex(r,r.VERTEX_SHADER,E),T=ex(r,r.FRAGMENT_SHADER,y);if(r.attachShader(x,w),r.attachShader(x,T),n.index0AttributeName!==void 0)r.bindAttribLocation(x,0,n.index0AttributeName);else if(n.hasPositionAttribute===!0)r.bindAttribLocation(x,0,"position");r.linkProgram(x);function R(C){if(e.debug.checkShaderErrors){let z=r.getProgramInfoLog(x)||"",j=r.getShaderInfoLog(w)||"",F=r.getShaderInfoLog(T)||"",H=z.trim(),V=j.trim(),O=F.trim(),K=!0,Q=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(K=!1,typeof e.debug.onShaderError==="function")e.debug.onShaderError(r,x,w,T);else{let se=nx(r,w,"vertex"),me=nx(r,T,"fragment");Ne("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
Material Name: `+C.name+`
Material Type: `+C.type+`
Program Info Log: `+H+`
`+se+`
-`+me)}else if(H!=="")Me("WebGLProgram: Program Info Log:",H);else if(V===""||U==="")Q=!1;if(Q)C.diagnostics={runnable:K,programLog:H,vertexShader:{log:V,prefix:p},fragmentShader:{log:U,prefix:m}}}r.deleteShader(w),r.deleteShader(E),_=new co(r,y),S=Yw(r,y)}let _;this.getUniforms=function(){if(_===void 0)R(this);return _};let S;this.getAttributes=function(){if(S===void 0)R(this);return S};let F=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(F===!1)F=r.getProgramParameter(y,kw);return F},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Bw++,this.cacheKey=t,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=E,this}var hT=0;class e0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new t0(e),t.set(e,n);return n}}class t0{constructor(e){this.id=hT++,this.code=e,this.usedTimes=0}}function fT(e){return e===pr||e===wa||e===Ta}function dT(e,t,n,i,r,s){let o=new Ia,a=new e0,c=new Set,l=[],u=new Map,{logarithmicDepthBuffer:f,precision:h}=i,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 g(_){if(c.add(_),_===0)return"uv";return`uv${_}`}function y(_,S,F,C,z,J){let O=C.fog,H=z.geometry,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?C.environment:null,U=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,K=t.get(_.envMap||V,U),Q=!!K&&K.mapping===Hs?K.image.height:null,se=d[_.type];if(_.precision!==null){if(h=i.getMaxPrecision(_.precision),h!==_.precision)Me("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead.")}let me=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,_e=me!==void 0?me.length:0,qe=0;if(H.morphAttributes.position!==void 0)qe=1;if(H.morphAttributes.normal!==void 0)qe=2;if(H.morphAttributes.color!==void 0)qe=3;let Ge,Z,ne,fe;if(se){let Fe=ei[se];Ge=Fe.vertexShader,Z=Fe.fragmentShader}else{Ge=_.vertexShader,Z=_.fragmentShader;let Fe=a.getVertexShaderStage(_),St=a.getFragmentShaderStage(_);a.update(_,Fe,St),ne=Fe.id,fe=St.id}let de=e.getRenderTarget(),Re=e.state.buffers.depth.getReversed(),Ze=z.isInstancedMesh===!0,Oe=z.isBatchedMesh===!0,ke=!!_.map,Ke=!!_.matcap,Ye=!!K,Je=!!_.aoMap,Ft=!!_.lightMap,gn=!!_.bumpMap&&_.wireframe===!1,mt=!!_.normalMap,Ht=!!_.displacementMap,zt=!!_.emissiveMap,Pt=!!_.metalnessMap,L=!!_.roughnessMap,_n=_.anisotropy>0,nt=_.clearcoat>0,gt=_.dispersion>0,M=_.iridescence>0,x=_.sheen>0,I=_.transmission>0,W=_n&&!!_.anisotropyMap,te=nt&&!!_.clearcoatMap,ie=nt&&!!_.clearcoatNormalMap,le=nt&&!!_.clearcoatRoughnessMap,X=M&&!!_.iridescenceMap,j=M&&!!_.iridescenceThicknessMap,xe=x&&!!_.sheenColorMap,we=x&&!!_.sheenRoughnessMap,ue=!!_.specularMap,re=!!_.specularColorMap,Ce=!!_.specularIntensityMap,Pe=I&&!!_.transmissionMap,et=I&&!!_.thicknessMap,P=!!_.gradientMap,oe=!!_.alphaMap,Y=_.alphaTest>0,ae=!!_.alphaHash,ve=!!_.extensions,ee=Un;if(_.toneMapped){if(de===null||de.isXRRenderTarget===!0)ee=e.toneMapping}let ce={shaderID:se,shaderType:_.type,shaderName:_.name,vertexShader:Ge,fragmentShader:Z,defines:_.defines,customVertexShaderID:ne,customFragmentShaderID:fe,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Oe,batchingColor:Oe&&z._colorsTexture!==null,instancing:Ze,instancingColor:Ze&&z.instanceColor!==null,instancingMorph:Ze&&z.morphTexture!==null,outputColorSpace:de===null?e.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:We.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ke,matcap:Ke,envMap:Ye,envMapMode:Ye&&K.mapping,envMapCubeUVHeight:Q,aoMap:Je,lightMap:Ft,bumpMap:gn,normalMap:mt,displacementMap:Ht,emissiveMap:zt,normalMapObjectSpace:mt&&_.normalMapType===r_,normalMapTangentSpace:mt&&_.normalMapType===xu,packedNormalMap:mt&&_.normalMapType===xu&&fT(_.normalMap.format),metalnessMap:Pt,roughnessMap:L,anisotropy:_n,anisotropyMap:W,clearcoat:nt,clearcoatMap:te,clearcoatNormalMap:ie,clearcoatRoughnessMap:le,dispersion:gt,iridescence:M,iridescenceMap:X,iridescenceThicknessMap:j,sheen:x,sheenColorMap:xe,sheenRoughnessMap:we,specularMap:ue,specularColorMap:re,specularIntensityMap:Ce,transmission:I,transmissionMap:Pe,thicknessMap:et,gradientMap:P,opaque:_.transparent===!1&&_.blending===Bs&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Y,alphaHash:ae,combine:_.combine,mapUv:ke&&g(_.map.channel),aoMapUv:Je&&g(_.aoMap.channel),lightMapUv:Ft&&g(_.lightMap.channel),bumpMapUv:gn&&g(_.bumpMap.channel),normalMapUv:mt&&g(_.normalMap.channel),displacementMapUv:Ht&&g(_.displacementMap.channel),emissiveMapUv:zt&&g(_.emissiveMap.channel),metalnessMapUv:Pt&&g(_.metalnessMap.channel),roughnessMapUv:L&&g(_.roughnessMap.channel),anisotropyMapUv:W&&g(_.anisotropyMap.channel),clearcoatMapUv:te&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:ie&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:le&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:j&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:we&&g(_.sheenRoughnessMap.channel),specularMapUv:ue&&g(_.specularMap.channel),specularColorMapUv:re&&g(_.specularColorMap.channel),specularIntensityMapUv:Ce&&g(_.specularIntensityMap.channel),transmissionMapUv:Pe&&g(_.transmissionMap.channel),thicknessMapUv:et&&g(_.thicknessMap.channel),alphaMapUv:oe&&g(_.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(mt||_n),vertexNormals:!!H.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!H.attributes.uv&&(ke||oe),fog:!!O,useFog:_.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||H.attributes.normal===void 0&&mt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Re,skinning:z.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:qe,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:J.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&F.length>0,shadowMapType:e.shadowMap.type,toneMapping:ee,decodeVideoTexture:ke&&_.map.isVideoTexture===!0&&We.getTransfer(_.map.colorSpace)===ht,decodeVideoTextureEmissive:zt&&_.emissiveMap.isVideoTexture===!0&&We.getTransfer(_.emissiveMap.colorSpace)===ht,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===bn,flipSided:_.side===Yt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ve&&_.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&_.extensions.multiDraw===!0||Oe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ce.vertexUv1s=c.has(1),ce.vertexUv2s=c.has(2),ce.vertexUv3s=c.has(3),c.clear(),ce}function p(_){let S=[];if(_.shaderID)S.push(_.shaderID);else S.push(_.customVertexShaderID),S.push(_.customFragmentShaderID);if(_.defines!==void 0)for(let F in _.defines)S.push(F),S.push(_.defines[F]);if(_.isRawShaderMaterial===!1)m(S,_),A(S,_),S.push(e.outputColorSpace);return S.push(_.customProgramCacheKey),S.join()}function m(_,S){_.push(S.precision),_.push(S.outputColorSpace),_.push(S.envMapMode),_.push(S.envMapCubeUVHeight),_.push(S.mapUv),_.push(S.alphaMapUv),_.push(S.lightMapUv),_.push(S.aoMapUv),_.push(S.bumpMapUv),_.push(S.normalMapUv),_.push(S.displacementMapUv),_.push(S.emissiveMapUv),_.push(S.metalnessMapUv),_.push(S.roughnessMapUv),_.push(S.anisotropyMapUv),_.push(S.clearcoatMapUv),_.push(S.clearcoatNormalMapUv),_.push(S.clearcoatRoughnessMapUv),_.push(S.iridescenceMapUv),_.push(S.iridescenceThicknessMapUv),_.push(S.sheenColorMapUv),_.push(S.sheenRoughnessMapUv),_.push(S.specularMapUv),_.push(S.specularColorMapUv),_.push(S.specularIntensityMapUv),_.push(S.transmissionMapUv),_.push(S.thicknessMapUv),_.push(S.combine),_.push(S.fogExp2),_.push(S.sizeAttenuation),_.push(S.morphTargetsCount),_.push(S.morphAttributeCount),_.push(S.numDirLights),_.push(S.numPointLights),_.push(S.numSpotLights),_.push(S.numSpotLightMaps),_.push(S.numHemiLights),_.push(S.numRectAreaLights),_.push(S.numDirLightShadows),_.push(S.numPointLightShadows),_.push(S.numSpotLightShadows),_.push(S.numSpotLightShadowsWithMaps),_.push(S.numLightProbes),_.push(S.shadowMapType),_.push(S.toneMapping),_.push(S.numClippingPlanes),_.push(S.numClipIntersection),_.push(S.depthPacking)}function A(_,S){if(o.disableAll(),S.instancing)o.enable(0);if(S.instancingColor)o.enable(1);if(S.instancingMorph)o.enable(2);if(S.matcap)o.enable(3);if(S.envMap)o.enable(4);if(S.normalMapObjectSpace)o.enable(5);if(S.normalMapTangentSpace)o.enable(6);if(S.clearcoat)o.enable(7);if(S.iridescence)o.enable(8);if(S.alphaTest)o.enable(9);if(S.vertexColors)o.enable(10);if(S.vertexAlphas)o.enable(11);if(S.vertexUv1s)o.enable(12);if(S.vertexUv2s)o.enable(13);if(S.vertexUv3s)o.enable(14);if(S.vertexTangents)o.enable(15);if(S.anisotropy)o.enable(16);if(S.alphaHash)o.enable(17);if(S.batching)o.enable(18);if(S.dispersion)o.enable(19);if(S.batchingColor)o.enable(20);if(S.gradientMap)o.enable(21);if(S.packedNormalMap)o.enable(22);if(S.vertexNormals)o.enable(23);if(_.push(o.mask),o.disableAll(),S.fog)o.enable(0);if(S.useFog)o.enable(1);if(S.flatShading)o.enable(2);if(S.logarithmicDepthBuffer)o.enable(3);if(S.reversedDepthBuffer)o.enable(4);if(S.skinning)o.enable(5);if(S.morphTargets)o.enable(6);if(S.morphNormals)o.enable(7);if(S.morphColors)o.enable(8);if(S.premultipliedAlpha)o.enable(9);if(S.shadowMapEnabled)o.enable(10);if(S.doubleSided)o.enable(11);if(S.flipSided)o.enable(12);if(S.useDepthPacking)o.enable(13);if(S.dithering)o.enable(14);if(S.transmission)o.enable(15);if(S.sheen)o.enable(16);if(S.opaque)o.enable(17);if(S.pointsUvs)o.enable(18);if(S.decodeVideoTexture)o.enable(19);if(S.decodeVideoTextureEmissive)o.enable(20);if(S.alphaToCoverage)o.enable(21);if(S.numLightProbeGrids>0)o.enable(22);if(S.hasPositionAttribute)o.enable(23);_.push(o.mask)}function T(_){let S=d[_.type],F;if(S){let C=ei[S];F=g_.clone(C.uniforms)}else F=_.uniforms;return F}function v(_,S){let F=u.get(S);if(F!==void 0)++F.usedTimes;else F=new uT(e,S,_,r),l.push(F),u.set(S,F);return F}function w(_){if(--_.usedTimes===0){let S=l.indexOf(_);l[S]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function E(_){a.remove(_)}function R(){a.dispose()}return{getParameters:y,getProgramCacheKey:p,getUniforms:T,acquireProgram:v,releaseProgram:w,releaseShaderCache:E,programs:l,dispose:R}}function pT(){let e=new WeakMap;function t(o){return e.has(o)}function n(o){let a=e.get(o);if(a===void 0)a={},e.set(o,a);return a}function i(o){e.delete(o)}function r(o,a,c){e.get(o)[a]=c}function s(){e=new WeakMap}return{has:t,get:n,remove:i,update:r,dispose:s}}function mT(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function G_(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function H_(){let e=[],t=0,n=[],i=[],r=[];function s(){t=0,n.length=0,i.length=0,r.length=0}function o(h){let d=0;if(h.isInstancedMesh)d+=2;if(h.isSkinnedMesh)d+=1;return d}function a(h,d,g,y,p,m){let A=e[t];if(A===void 0)A={id:h.id,object:h,geometry:d,material:g,materialVariant:o(h),groupOrder:y,renderOrder:h.renderOrder,z:p,group:m},e[t]=A;else A.id=h.id,A.object=h,A.geometry=d,A.material=g,A.materialVariant=o(h),A.groupOrder=y,A.renderOrder=h.renderOrder,A.z=p,A.group=m;return t++,A}function c(h,d,g,y,p,m){let A=a(h,d,g,y,p,m);if(g.transmission>0)i.push(A);else if(g.transparent===!0)r.push(A);else n.push(A)}function l(h,d,g,y,p,m){let A=a(h,d,g,y,p,m);if(g.transmission>0)i.unshift(A);else if(g.transparent===!0)r.unshift(A);else n.unshift(A)}function u(h,d,g){if(n.length>1)n.sort(h||mT);if(i.length>1)i.sort(d||G_);if(r.length>1)r.sort(d||G_);if(g)n.reverse(),i.reverse(),r.reverse()}function f(){for(let h=t,d=e.length;h<d;h++){let g=e[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:c,unshift:l,finish:f,sort:u}}function gT(){let e=new WeakMap;function t(i,r){let s=e.get(i),o;if(s===void 0)o=new H_,e.set(i,[o]);else if(r>=s.length)o=new H_,s.push(o);else o=s[r];return o}function n(){e=new WeakMap}return{get:t,dispose:n}}function _T(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new N,color:new Le};break;case"SpotLight":n={position:new N,direction:new N,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new N,color:new Le,distance:0,decay:0};break;case"HemisphereLight":n={direction:new N,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":n={color:new Le,position:new N,halfWidth:new N,halfHeight:new N};break}return e[t.id]=n,n}}}function xT(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie,shadowCameraNear:1,shadowCameraFar:1000};break}return e[t.id]=n,n}}}var vT=0;function yT(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function bT(e){let t=new _T,n=xT(),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 l=0;l<9;l++)i.probe.push(new N);let r=new N,s=new ze,o=new ze;function a(l){let u=0,f=0,h=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let d=0,g=0,y=0,p=0,m=0,A=0,T=0,v=0,w=0,E=0,R=0;l.sort(yT);for(let S=0,F=l.length;S<F;S++){let C=l[S],{color:z,intensity:J,distance:O}=C,H=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===pr)H=C.shadow.map.texture;else H=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)u+=z.r*J,f+=z.g*J,h+=z.b*J;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],J);R++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let U=C.shadow,K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.directionalShadow[d]=K,i.directionalShadowMap[d]=H,i.directionalShadowMatrix[d]=C.shadow.matrix,A++}i.directional[d]=V,d++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(z).multiplyScalar(J),V.distance=O,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[y]=V;let U=C.shadow;if(C.map){if(i.spotLightMap[w]=C.map,w++,U.updateMatrices(C),C.castShadow)E++}if(i.spotLightMatrix[y]=U.matrix,C.castShadow){let K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.spotShadow[y]=K,i.spotShadowMap[y]=H,v++}y++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(z).multiplyScalar(J),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let U=C.shadow,K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,K.shadowCameraNear=U.camera.near,K.shadowCameraFar=U.camera.far,i.pointShadow[g]=K,i.pointShadowMap[g]=H,i.pointShadowMatrix[g]=C.shadow.matrix,T++}i.point[g]=V,g++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(J),V.groundColor.copy(C.groundColor).multiplyScalar(J),i.hemi[m]=V,m++}}if(p>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2;else i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2;i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;let _=i.hash;if(_.directionalLength!==d||_.pointLength!==g||_.spotLength!==y||_.rectAreaLength!==p||_.hemiLength!==m||_.numDirectionalShadows!==A||_.numPointShadows!==T||_.numSpotShadows!==v||_.numSpotMaps!==w||_.numLightProbes!==R)i.directional.length=d,i.spot.length=y,i.rectArea.length=p,i.point.length=g,i.hemi.length=m,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=T,i.pointShadowMap.length=T,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=T,i.spotLightMatrix.length=v+w-E,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=R,_.directionalLength=d,_.pointLength=g,_.spotLength=y,_.rectAreaLength=p,_.hemiLength=m,_.numDirectionalShadows=A,_.numPointShadows=T,_.numSpotShadows=v,_.numSpotMaps=w,_.numLightProbes=R,i.version=vT++}function c(l,u){let f=0,h=0,d=0,g=0,y=0,p=u.matrixWorldInverse;for(let m=0,A=l.length;m<A;m++){let T=l[m];if(T.isDirectionalLight){let v=i.directional[f];v.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),f++}else if(T.isSpotLight){let v=i.spot[d];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),v.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),d++}else if(T.isRectAreaLight){let v=i.rectArea[g];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),o.identity(),s.copy(T.matrixWorld),s.premultiply(p),o.extractRotation(s),v.halfWidth.set(T.width*0.5,0,0),v.halfHeight.set(0,T.height*0.5,0),v.halfWidth.applyMatrix4(o),v.halfHeight.applyMatrix4(o),g++}else if(T.isPointLight){let v=i.point[h];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),h++}else if(T.isHemisphereLight){let v=i.hemi[y];v.direction.setFromMatrixPosition(T.matrixWorld),v.direction.transformDirection(p),y++}}}return{setup:a,setupView:c,state:i}}function V_(e){let t=new bT(e),n=[],i=[],r=[];function s(h){f.camera=h,n.length=0,i.length=0,r.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function c(h){r.push(h)}function l(){t.setup(n)}function u(h){t.setupView(n,h)}let f={lightsArray:n,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function ST(e){let t=new WeakMap;function n(r,s=0){let o=t.get(r),a;if(o===void 0)a=new V_(e),t.set(r,[a]);else if(s>=o.length)a=new V_(e),o.push(a);else a=o[s];return a}function i(){t=new WeakMap}return{get:n,dispose:i}}var MT=`void main() {
+`+me)}else if(H!=="")Me("WebGLProgram: Program Info Log:",H);else if(V===""||O==="")Q=!1;if(Q)C.diagnostics={runnable:K,programLog:H,vertexShader:{log:V,prefix:p},fragmentShader:{log:O,prefix:g}}}r.deleteShader(w),r.deleteShader(T),_=new bo(r,x),S=ZE(r,x)}let _;this.getUniforms=function(){if(_===void 0)R(this);return _};let S;this.getAttributes=function(){if(S===void 0)R(this);return S};let U=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(U===!1)U=r.getProgramParameter(x,UE);return U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=FE++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=T,this}var cA=0;class yx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new bx(e),t.set(e,n);return n}}class bx{constructor(e){this.id=cA++,this.code=e,this.usedTimes=0}}function lA(e){return e===br||e===Za||e===Xa}function uA(e,t,n,i,r,s){let o=new Ka,a=new yx,c=new Set,l=[],u=new Map,{logarithmicDepthBuffer:h,precision:f}=i,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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(_){if(c.add(_),_===0)return"uv";return`uv${_}`}function x(_,S,U,C,z,j){let F=C.fog,H=z.geometry,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?C.environment:null,O=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,K=t.get(_.envMap||V,O),Q=!!K&&K.mapping===eo?K.image.height:null,se=d[_.type];if(_.precision!==null){if(f=i.getMaxPrecision(_.precision),f!==_.precision)Me("WebGLProgram.getParameters:",_.precision,"not supported, using",f,"instead.")}let me=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,_e=me!==void 0?me.length:0,qe=0;if(H.morphAttributes.position!==void 0)qe=1;if(H.morphAttributes.normal!==void 0)qe=2;if(H.morphAttributes.color!==void 0)qe=3;let Ge,Z,ne,fe;if(se){let Fe=ai[se];Ge=Fe.vertexShader,Z=Fe.fragmentShader}else{Ge=_.vertexShader,Z=_.fragmentShader;let Fe=a.getVertexShaderStage(_),St=a.getFragmentShaderStage(_);a.update(_,Fe,St),ne=Fe.id,fe=St.id}let de=e.getRenderTarget(),Re=e.state.buffers.depth.getReversed(),Ze=z.isInstancedMesh===!0,Ue=z.isBatchedMesh===!0,ke=!!_.map,Ke=!!_.matcap,Ye=!!K,Je=!!_.aoMap,Ft=!!_.lightMap,vn=!!_.bumpMap&&_.wireframe===!1,mt=!!_.normalMap,Vt=!!_.displacementMap,zt=!!_.emissiveMap,Pt=!!_.metalnessMap,L=!!_.roughnessMap,yn=_.anisotropy>0,it=_.clearcoat>0,gt=_.dispersion>0,M=_.iridescence>0,v=_.sheen>0,I=_.transmission>0,W=yn&&!!_.anisotropyMap,te=it&&!!_.clearcoatMap,ie=it&&!!_.clearcoatNormalMap,le=it&&!!_.clearcoatRoughnessMap,X=M&&!!_.iridescenceMap,J=M&&!!_.iridescenceThicknessMap,xe=v&&!!_.sheenColorMap,we=v&&!!_.sheenRoughnessMap,ue=!!_.specularMap,re=!!_.specularColorMap,Ce=!!_.specularIntensityMap,Pe=I&&!!_.transmissionMap,et=I&&!!_.thicknessMap,P=!!_.gradientMap,oe=!!_.alphaMap,Y=_.alphaTest>0,ae=!!_.alphaHash,ve=!!_.extensions,ee=kn;if(_.toneMapped){if(de===null||de.isXRRenderTarget===!0)ee=e.toneMapping}let ce={shaderID:se,shaderType:_.type,shaderName:_.name,vertexShader:Ge,fragmentShader:Z,defines:_.defines,customVertexShaderID:ne,customFragmentShaderID:fe,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:f,batching:Ue,batchingColor:Ue&&z._colorsTexture!==null,instancing:Ze,instancingColor:Ze&&z.instanceColor!==null,instancingMorph:Ze&&z.morphTexture!==null,outputColorSpace:de===null?e.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:$e.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ke,matcap:Ke,envMap:Ye,envMapMode:Ye&&K.mapping,envMapCubeUVHeight:Q,aoMap:Je,lightMap:Ft,bumpMap:vn,normalMap:mt,displacementMap:Vt,emissiveMap:zt,normalMapObjectSpace:mt&&_.normalMapType===w0,normalMapTangentSpace:mt&&_.normalMapType===rh,packedNormalMap:mt&&_.normalMapType===rh&&lA(_.normalMap.format),metalnessMap:Pt,roughnessMap:L,anisotropy:yn,anisotropyMap:W,clearcoat:it,clearcoatMap:te,clearcoatNormalMap:ie,clearcoatRoughnessMap:le,dispersion:gt,iridescence:M,iridescenceMap:X,iridescenceThicknessMap:J,sheen:v,sheenColorMap:xe,sheenRoughnessMap:we,specularMap:ue,specularColorMap:re,specularIntensityMap:Ce,transmission:I,transmissionMap:Pe,thicknessMap:et,gradientMap:P,opaque:_.transparent===!1&&_.blending===Ks&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Y,alphaHash:ae,combine:_.combine,mapUv:ke&&m(_.map.channel),aoMapUv:Je&&m(_.aoMap.channel),lightMapUv:Ft&&m(_.lightMap.channel),bumpMapUv:vn&&m(_.bumpMap.channel),normalMapUv:mt&&m(_.normalMap.channel),displacementMapUv:Vt&&m(_.displacementMap.channel),emissiveMapUv:zt&&m(_.emissiveMap.channel),metalnessMapUv:Pt&&m(_.metalnessMap.channel),roughnessMapUv:L&&m(_.roughnessMap.channel),anisotropyMapUv:W&&m(_.anisotropyMap.channel),clearcoatMapUv:te&&m(_.clearcoatMap.channel),clearcoatNormalMapUv:ie&&m(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:le&&m(_.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&m(_.iridescenceMap.channel),iridescenceThicknessMapUv:J&&m(_.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&m(_.sheenColorMap.channel),sheenRoughnessMapUv:we&&m(_.sheenRoughnessMap.channel),specularMapUv:ue&&m(_.specularMap.channel),specularColorMapUv:re&&m(_.specularColorMap.channel),specularIntensityMapUv:Ce&&m(_.specularIntensityMap.channel),transmissionMapUv:Pe&&m(_.transmissionMap.channel),thicknessMapUv:et&&m(_.thicknessMap.channel),alphaMapUv:oe&&m(_.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(mt||yn),vertexNormals:!!H.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!H.attributes.uv&&(ke||oe),fog:!!F,useFog:_.fog===!0,fogExp2:!!F&&F.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||H.attributes.normal===void 0&&mt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Re,skinning:z.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:qe,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:j.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&U.length>0,shadowMapType:e.shadowMap.type,toneMapping:ee,decodeVideoTexture:ke&&_.map.isVideoTexture===!0&&$e.getTransfer(_.map.colorSpace)===ht,decodeVideoTextureEmissive:zt&&_.emissiveMap.isVideoTexture===!0&&$e.getTransfer(_.emissiveMap.colorSpace)===ht,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Tn,flipSided:_.side===jt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ve&&_.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&_.extensions.multiDraw===!0||Ue)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ce.vertexUv1s=c.has(1),ce.vertexUv2s=c.has(2),ce.vertexUv3s=c.has(3),c.clear(),ce}function p(_){let S=[];if(_.shaderID)S.push(_.shaderID);else S.push(_.customVertexShaderID),S.push(_.customFragmentShaderID);if(_.defines!==void 0)for(let U in _.defines)S.push(U),S.push(_.defines[U]);if(_.isRawShaderMaterial===!1)g(S,_),A(S,_),S.push(e.outputColorSpace);return S.push(_.customProgramCacheKey),S.join()}function g(_,S){_.push(S.precision),_.push(S.outputColorSpace),_.push(S.envMapMode),_.push(S.envMapCubeUVHeight),_.push(S.mapUv),_.push(S.alphaMapUv),_.push(S.lightMapUv),_.push(S.aoMapUv),_.push(S.bumpMapUv),_.push(S.normalMapUv),_.push(S.displacementMapUv),_.push(S.emissiveMapUv),_.push(S.metalnessMapUv),_.push(S.roughnessMapUv),_.push(S.anisotropyMapUv),_.push(S.clearcoatMapUv),_.push(S.clearcoatNormalMapUv),_.push(S.clearcoatRoughnessMapUv),_.push(S.iridescenceMapUv),_.push(S.iridescenceThicknessMapUv),_.push(S.sheenColorMapUv),_.push(S.sheenRoughnessMapUv),_.push(S.specularMapUv),_.push(S.specularColorMapUv),_.push(S.specularIntensityMapUv),_.push(S.transmissionMapUv),_.push(S.thicknessMapUv),_.push(S.combine),_.push(S.fogExp2),_.push(S.sizeAttenuation),_.push(S.morphTargetsCount),_.push(S.morphAttributeCount),_.push(S.numDirLights),_.push(S.numPointLights),_.push(S.numSpotLights),_.push(S.numSpotLightMaps),_.push(S.numHemiLights),_.push(S.numRectAreaLights),_.push(S.numDirLightShadows),_.push(S.numPointLightShadows),_.push(S.numSpotLightShadows),_.push(S.numSpotLightShadowsWithMaps),_.push(S.numLightProbes),_.push(S.shadowMapType),_.push(S.toneMapping),_.push(S.numClippingPlanes),_.push(S.numClipIntersection),_.push(S.depthPacking)}function A(_,S){if(o.disableAll(),S.instancing)o.enable(0);if(S.instancingColor)o.enable(1);if(S.instancingMorph)o.enable(2);if(S.matcap)o.enable(3);if(S.envMap)o.enable(4);if(S.normalMapObjectSpace)o.enable(5);if(S.normalMapTangentSpace)o.enable(6);if(S.clearcoat)o.enable(7);if(S.iridescence)o.enable(8);if(S.alphaTest)o.enable(9);if(S.vertexColors)o.enable(10);if(S.vertexAlphas)o.enable(11);if(S.vertexUv1s)o.enable(12);if(S.vertexUv2s)o.enable(13);if(S.vertexUv3s)o.enable(14);if(S.vertexTangents)o.enable(15);if(S.anisotropy)o.enable(16);if(S.alphaHash)o.enable(17);if(S.batching)o.enable(18);if(S.dispersion)o.enable(19);if(S.batchingColor)o.enable(20);if(S.gradientMap)o.enable(21);if(S.packedNormalMap)o.enable(22);if(S.vertexNormals)o.enable(23);if(_.push(o.mask),o.disableAll(),S.fog)o.enable(0);if(S.useFog)o.enable(1);if(S.flatShading)o.enable(2);if(S.logarithmicDepthBuffer)o.enable(3);if(S.reversedDepthBuffer)o.enable(4);if(S.skinning)o.enable(5);if(S.morphTargets)o.enable(6);if(S.morphNormals)o.enable(7);if(S.morphColors)o.enable(8);if(S.premultipliedAlpha)o.enable(9);if(S.shadowMapEnabled)o.enable(10);if(S.doubleSided)o.enable(11);if(S.flipSided)o.enable(12);if(S.useDepthPacking)o.enable(13);if(S.dithering)o.enable(14);if(S.transmission)o.enable(15);if(S.sheen)o.enable(16);if(S.opaque)o.enable(17);if(S.pointsUvs)o.enable(18);if(S.decodeVideoTexture)o.enable(19);if(S.decodeVideoTextureEmissive)o.enable(20);if(S.alphaToCoverage)o.enable(21);if(S.numLightProbeGrids>0)o.enable(22);if(S.hasPositionAttribute)o.enable(23);_.push(o.mask)}function E(_){let S=d[_.type],U;if(S){let C=ai[S];U=U0.clone(C.uniforms)}else U=_.uniforms;return U}function y(_,S){let U=u.get(S);if(U!==void 0)++U.usedTimes;else U=new aA(e,S,_,r),l.push(U),u.set(S,U);return U}function w(_){if(--_.usedTimes===0){let S=l.indexOf(_);l[S]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function T(_){a.remove(_)}function R(){a.dispose()}return{getParameters:x,getProgramCacheKey:p,getUniforms:E,acquireProgram:y,releaseProgram:w,releaseShaderCache:T,programs:l,dispose:R}}function hA(){let e=new WeakMap;function t(o){return e.has(o)}function n(o){let a=e.get(o);if(a===void 0)a={},e.set(o,a);return a}function i(o){e.delete(o)}function r(o,a,c){e.get(o)[a]=c}function s(){e=new WeakMap}return{has:t,get:n,remove:i,update:r,dispose:s}}function fA(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function ax(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function cx(){let e=[],t=0,n=[],i=[],r=[];function s(){t=0,n.length=0,i.length=0,r.length=0}function o(f){let d=0;if(f.isInstancedMesh)d+=2;if(f.isSkinnedMesh)d+=1;return d}function a(f,d,m,x,p,g){let A=e[t];if(A===void 0)A={id:f.id,object:f,geometry:d,material:m,materialVariant:o(f),groupOrder:x,renderOrder:f.renderOrder,z:p,group:g},e[t]=A;else A.id=f.id,A.object=f,A.geometry=d,A.material=m,A.materialVariant=o(f),A.groupOrder=x,A.renderOrder=f.renderOrder,A.z=p,A.group=g;return t++,A}function c(f,d,m,x,p,g){let A=a(f,d,m,x,p,g);if(m.transmission>0)i.push(A);else if(m.transparent===!0)r.push(A);else n.push(A)}function l(f,d,m,x,p,g){let A=a(f,d,m,x,p,g);if(m.transmission>0)i.unshift(A);else if(m.transparent===!0)r.unshift(A);else n.unshift(A)}function u(f,d,m){if(n.length>1)n.sort(f||fA);if(i.length>1)i.sort(d||ax);if(r.length>1)r.sort(d||ax);if(m)n.reverse(),i.reverse(),r.reverse()}function h(){for(let f=t,d=e.length;f<d;f++){let m=e[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:c,unshift:l,finish:h,sort:u}}function dA(){let e=new WeakMap;function t(i,r){let s=e.get(i),o;if(s===void 0)o=new cx,e.set(i,[o]);else if(r>=s.length)o=new cx,s.push(o);else o=s[r];return o}function n(){e=new WeakMap}return{get:t,dispose:n}}function pA(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new N,color:new Le};break;case"SpotLight":n={position:new N,direction:new N,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new N,color:new Le,distance:0,decay:0};break;case"HemisphereLight":n={direction:new N,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":n={color:new Le,position:new N,halfWidth:new N,halfHeight:new N};break}return e[t.id]=n,n}}}function mA(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie,shadowCameraNear:1,shadowCameraFar:1000};break}return e[t.id]=n,n}}}var gA=0;function _A(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function xA(e){let t=new pA,n=mA(),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 l=0;l<9;l++)i.probe.push(new N);let r=new N,s=new ze,o=new ze;function a(l){let u=0,h=0,f=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let d=0,m=0,x=0,p=0,g=0,A=0,E=0,y=0,w=0,T=0,R=0;l.sort(_A);for(let S=0,U=l.length;S<U;S++){let C=l[S],{color:z,intensity:j,distance:F}=C,H=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===br)H=C.shadow.map.texture;else H=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)u+=z.r*j,h+=z.g*j,f+=z.b*j;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],j);R++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let O=C.shadow,K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,i.directionalShadow[d]=K,i.directionalShadowMap[d]=H,i.directionalShadowMatrix[d]=C.shadow.matrix,A++}i.directional[d]=V,d++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(z).multiplyScalar(j),V.distance=F,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[x]=V;let O=C.shadow;if(C.map){if(i.spotLightMap[w]=C.map,w++,O.updateMatrices(C),C.castShadow)T++}if(i.spotLightMatrix[x]=O.matrix,C.castShadow){let K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,i.spotShadow[x]=K,i.spotShadowMap[x]=H,y++}x++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(z).multiplyScalar(j),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let O=C.shadow,K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,K.shadowCameraNear=O.camera.near,K.shadowCameraFar=O.camera.far,i.pointShadow[m]=K,i.pointShadowMap[m]=H,i.pointShadowMatrix[m]=C.shadow.matrix,E++}i.point[m]=V,m++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(j),V.groundColor.copy(C.groundColor).multiplyScalar(j),i.hemi[g]=V,g++}}if(p>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2;else i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2;i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=f;let _=i.hash;if(_.directionalLength!==d||_.pointLength!==m||_.spotLength!==x||_.rectAreaLength!==p||_.hemiLength!==g||_.numDirectionalShadows!==A||_.numPointShadows!==E||_.numSpotShadows!==y||_.numSpotMaps!==w||_.numLightProbes!==R)i.directional.length=d,i.spot.length=x,i.rectArea.length=p,i.point.length=m,i.hemi.length=g,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=E,i.pointShadowMap.length=E,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=E,i.spotLightMatrix.length=y+w-T,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=T,i.numLightProbes=R,_.directionalLength=d,_.pointLength=m,_.spotLength=x,_.rectAreaLength=p,_.hemiLength=g,_.numDirectionalShadows=A,_.numPointShadows=E,_.numSpotShadows=y,_.numSpotMaps=w,_.numLightProbes=R,i.version=gA++}function c(l,u){let h=0,f=0,d=0,m=0,x=0,p=u.matrixWorldInverse;for(let g=0,A=l.length;g<A;g++){let E=l[g];if(E.isDirectionalLight){let y=i.directional[h];y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(p),h++}else if(E.isSpotLight){let y=i.spot[d];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(p),d++}else if(E.isRectAreaLight){let y=i.rectArea[m];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),o.identity(),s.copy(E.matrixWorld),s.premultiply(p),o.extractRotation(s),y.halfWidth.set(E.width*0.5,0,0),y.halfHeight.set(0,E.height*0.5,0),y.halfWidth.applyMatrix4(o),y.halfHeight.applyMatrix4(o),m++}else if(E.isPointLight){let y=i.point[f];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),f++}else if(E.isHemisphereLight){let y=i.hemi[x];y.direction.setFromMatrixPosition(E.matrixWorld),y.direction.transformDirection(p),x++}}}return{setup:a,setupView:c,state:i}}function lx(e){let t=new xA(e),n=[],i=[],r=[];function s(f){h.camera=f,n.length=0,i.length=0,r.length=0}function o(f){n.push(f)}function a(f){i.push(f)}function c(f){r.push(f)}function l(){t.setup(n)}function u(f){t.setupView(n,f)}let h={lightsArray:n,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:h,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function vA(e){let t=new WeakMap;function n(r,s=0){let o=t.get(r),a;if(o===void 0)a=new lx(e),t.set(r,[a]);else if(s>=o.length)a=new lx(e),o.push(a);else a=o[s];return a}function i(){t=new WeakMap}return{get:n,dispose:i}}var yA=`void main() {
gl_Position = vec4( position, 1.0 );
-}`,wT=`uniform sampler2D shadow_pass;
+}`,bA=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
@@ -4149,12 +4142,12 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
-}`,TT=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],ET=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],W_=new ze,oo=new N,Yu=new N;function AT(e,t,n){let i=new Ks,r=new Ie,s=new Ie,o=new st,a=new Cu,c=new Iu,l={},u=n.maxTextureSize,f={[Ui]:Yt,[Yt]:Ui,[bn]:bn},h=new Mn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ie},radius:{value:4}},vertexShader:MT,fragmentShader:wT}),d=h.clone();d.defines.HORIZONTAL_PASS=1;let g=new tn;g.setAttribute("position",new Nt(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let y=new pt(g,h),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ks;let m=this.type;this.render=function(E,R,_){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(E.length===0)return;if(this.type===yg)Me("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ks;let S=e.getRenderTarget(),F=e.getActiveCubeFace(),C=e.getActiveMipmapLevel(),z=e.state;if(z.setBlending(Yn),z.buffers.depth.getReversed()===!0)z.buffers.color.setClear(0,0,0,0);else z.buffers.color.setClear(1,1,1,1);z.buffers.depth.setTest(!0),z.setScissorTest(!1);let J=m!==this.type;if(J)R.traverse(function(O){if(O.material)if(Array.isArray(O.material))O.material.forEach((H)=>H.needsUpdate=!0);else O.material.needsUpdate=!0});for(let O=0,H=E.length;O<H;O++){let V=E[O],U=V.shadow;if(U===void 0){Me("WebGLShadowMap:",V,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;r.copy(U.mapSize);let K=U.getFrameExtents();if(r.multiply(K),s.copy(U.mapSize),r.x>u||r.y>u){if(r.x>u)s.x=Math.floor(u/K.x),r.x=s.x*K.x,U.mapSize.x=s.x;if(r.y>u)s.y=Math.floor(u/K.y),r.y=s.y*K.y,U.mapSize.y=s.y}let Q=e.state.buffers.depth.getReversed();if(U.camera._reversedDepth=Q,U.map===null||J===!0){if(U.map!==null){if(U.map.depthTexture!==null)U.map.depthTexture.dispose(),U.map.depthTexture=null;U.map.dispose()}if(this.type===Zr){if(V.isPointLight){Me("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}U.map=new Sn(r.x,r.y,{format:pr,type:pi,minFilter:Gt,magFilter:Gt,generateMipmaps:!1}),U.map.texture.name=V.name+".shadowMap",U.map.depthTexture=new Bi(r.x,r.y,di),U.map.depthTexture.name=V.name+".shadowMapDepth",U.map.depthTexture.format=fr,U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=On,U.map.depthTexture.magFilter=On}else{if(V.isPointLight)U.map=new Ku(r.x),U.map.depthTexture=new Eu(r.x,Oi);else U.map=new Sn(r.x,r.y),U.map.depthTexture=new Bi(r.x,r.y,Oi);if(U.map.depthTexture.name=V.name+".shadowMap",U.map.depthTexture.format=fr,this.type===ks)U.map.depthTexture.compareFunction=Q?Ra:Aa,U.map.depthTexture.minFilter=Gt,U.map.depthTexture.magFilter=Gt;else U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=On,U.map.depthTexture.magFilter=On}U.camera.updateProjectionMatrix()}let se=U.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me<se;me++){if(U.map.isWebGLCubeRenderTarget)e.setRenderTarget(U.map,me),e.clear();else{if(me===0)e.setRenderTarget(U.map),e.clear();let _e=U.getViewport(me);o.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),z.viewport(o)}if(V.isPointLight){let{camera:_e,matrix:qe}=U,Ge=V.distance||_e.far;if(Ge!==_e.far)_e.far=Ge,_e.updateProjectionMatrix();oo.setFromMatrixPosition(V.matrixWorld),_e.position.copy(oo),Yu.copy(_e.position),Yu.add(TT[me]),_e.up.copy(ET[me]),_e.lookAt(Yu),_e.updateMatrixWorld(),qe.makeTranslation(-oo.x,-oo.y,-oo.z),W_.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),U._frustum.setFromProjectionMatrix(W_,_e.coordinateSystem,_e.reversedDepth)}else U.updateMatrices(V);i=U.getFrustum(),v(R,_,U.camera,V,this.type)}if(U.isPointLightShadow!==!0&&this.type===Zr)A(U,_);U.needsUpdate=!1}m=this.type,p.needsUpdate=!1,e.setRenderTarget(S,F,C)};function A(E,R){let _=t.update(y);if(h.defines.VSM_SAMPLES!==E.blurSamples)h.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,h.needsUpdate=!0,d.needsUpdate=!0;if(E.mapPass===null)E.mapPass=new Sn(r.x,r.y,{format:pr,type:pi});h.uniforms.shadow_pass.value=E.map.depthTexture,h.uniforms.resolution.value=E.mapSize,h.uniforms.radius.value=E.radius,e.setRenderTarget(E.mapPass),e.clear(),e.renderBufferDirect(R,null,_,h,y,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,e.setRenderTarget(E.map),e.clear(),e.renderBufferDirect(R,null,_,d,y,null)}function T(E,R,_,S){let F=null,C=_.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(C!==void 0)F=C;else if(F=_.isPointLight===!0?c:a,e.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){let z=F.uuid,J=R.uuid,O=l[z];if(O===void 0)O={},l[z]=O;let H=O[J];if(H===void 0)H=F.clone(),O[J]=H,R.addEventListener("dispose",w);F=H}if(F.visible=R.visible,F.wireframe=R.wireframe,S===Zr)F.side=R.shadowSide!==null?R.shadowSide:R.side;else F.side=R.shadowSide!==null?R.shadowSide:f[R.side];if(F.alphaMap=R.alphaMap,F.alphaTest=R.alphaToCoverage===!0?0.5:R.alphaTest,F.map=R.map,F.clipShadows=R.clipShadows,F.clippingPlanes=R.clippingPlanes,F.clipIntersection=R.clipIntersection,F.displacementMap=R.displacementMap,F.displacementScale=R.displacementScale,F.displacementBias=R.displacementBias,F.wireframeLinewidth=R.wireframeLinewidth,F.linewidth=R.linewidth,_.isPointLight===!0&&F.isMeshDistanceMaterial===!0){let z=e.properties.get(F);z.light=_}return F}function v(E,R,_,S,F){if(E.visible===!1)return;if(E.layers.test(R.layers)&&(E.isMesh||E.isLine||E.isPoints)){if((E.castShadow||E.receiveShadow&&F===Zr)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,E.matrixWorld);let J=t.update(E),O=E.material;if(Array.isArray(O)){let H=J.groups;for(let V=0,U=H.length;V<U;V++){let K=H[V],Q=O[K.materialIndex];if(Q&&Q.visible){let se=T(E,Q,S,F);E.onBeforeShadow(e,E,R,_,J,se,K),e.renderBufferDirect(_,null,J,se,E,K),E.onAfterShadow(e,E,R,_,J,se,K)}}}else if(O.visible){let H=T(E,O,S,F);E.onBeforeShadow(e,E,R,_,J,H,null),e.renderBufferDirect(_,null,J,H,E,null),E.onAfterShadow(e,E,R,_,J,H,null)}}}let z=E.children;for(let J=0,O=z.length;J<O;J++)v(z[J],R,_,S,F)}function w(E){E.target.removeEventListener("dispose",w);for(let _ in l){let S=l[_],F=E.target.uuid;if(F in S)S[F].dispose(),delete S[F]}}}function RT(e,t){function n(){let P=!1,oe=new st,Y=null,ae=new st(0,0,0,0);return{setMask:function(ve){if(Y!==ve&&!P)e.colorMask(ve,ve,ve,ve),Y=ve},setLocked:function(ve){P=ve},setClear:function(ve,ee,ce,Fe,St){if(St===!0)ve*=Fe,ee*=Fe,ce*=Fe;if(oe.set(ve,ee,ce,Fe),ae.equals(oe)===!1)e.clearColor(ve,ee,ce,Fe),ae.copy(oe)},reset:function(){P=!1,Y=null,ae.set(-1,0,0,0)}}}function i(){let P=!1,oe=!1,Y=null,ae=null,ve=null;return{setReversed:function(ee){if(oe!==ee){let ce=t.get("EXT_clip_control");if(ee)ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.ZERO_TO_ONE_EXT);else ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.NEGATIVE_ONE_TO_ONE_EXT);oe=ee;let Fe=ve;ve=null,this.setClear(Fe)}},getReversed:function(){return oe},setTest:function(ee){if(ee)de(e.DEPTH_TEST);else Re(e.DEPTH_TEST)},setMask:function(ee){if(Y!==ee&&!P)e.depthMask(ee),Y=ee},setFunc:function(ee){if(oe)ee=p_[ee];if(ae!==ee){switch(ee){case Gg:e.depthFunc(e.NEVER);break;case Hg:e.depthFunc(e.ALWAYS);break;case Vg:e.depthFunc(e.LESS);break;case Al:e.depthFunc(e.LEQUAL);break;case Wg:e.depthFunc(e.EQUAL);break;case $g:e.depthFunc(e.GEQUAL);break;case Zg:e.depthFunc(e.GREATER);break;case Xg:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}ae=ee}},setLocked:function(ee){P=ee},setClear:function(ee){if(ve!==ee){if(ve=ee,oe)ee=1-ee;e.clearDepth(ee)}},reset:function(){P=!1,Y=null,ae=null,ve=null,oe=!1}}}function r(){let P=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Fe=null,St=null;return{setTest:function(ft){if(!P)if(ft)de(e.STENCIL_TEST);else Re(e.STENCIL_TEST)},setMask:function(ft){if(oe!==ft&&!P)e.stencilMask(ft),oe=ft},setFunc:function(ft,kn,ni){if(Y!==ft||ae!==kn||ve!==ni)e.stencilFunc(ft,kn,ni),Y=ft,ae=kn,ve=ni},setOp:function(ft,kn,ni){if(ee!==ft||ce!==kn||Fe!==ni)e.stencilOp(ft,kn,ni),ee=ft,ce=kn,Fe=ni},setLocked:function(ft){P=ft},setClear:function(ft){if(St!==ft)e.clearStencil(ft),St=ft},reset:function(){P=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Fe=null,St=null}}}let s=new n,o=new i,a=new r,c=new WeakMap,l=new WeakMap,u={},f={},h={},d=new WeakMap,g=[],y=null,p=!1,m=null,A=null,T=null,v=null,w=null,E=null,R=null,_=new Le(0,0,0),S=0,F=!1,C=null,z=null,J=null,O=null,H=null,V=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),U=!1,K=0,Q=e.getParameter(e.VERSION);if(Q.indexOf("WebGL")!==-1)K=parseFloat(/^WebGL (\d)/.exec(Q)[1]),U=K>=1;else if(Q.indexOf("OpenGL ES")!==-1)K=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),U=K>=2;let se=null,me={},_e=e.getParameter(e.SCISSOR_BOX),qe=e.getParameter(e.VIEWPORT),Ge=new st().fromArray(_e),Z=new st().fromArray(qe);function ne(P,oe,Y,ae){let ve=new Uint8Array(4),ee=e.createTexture();e.bindTexture(P,ee),e.texParameteri(P,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(P,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let ce=0;ce<Y;ce++)if(P===e.TEXTURE_3D||P===e.TEXTURE_2D_ARRAY)e.texImage3D(oe,0,e.RGBA,1,1,ae,0,e.RGBA,e.UNSIGNED_BYTE,ve);else e.texImage2D(oe+ce,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,ve);return ee}let fe={};fe[e.TEXTURE_2D]=ne(e.TEXTURE_2D,e.TEXTURE_2D,1),fe[e.TEXTURE_CUBE_MAP]=ne(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[e.TEXTURE_2D_ARRAY]=ne(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),fe[e.TEXTURE_3D]=ne(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),de(e.DEPTH_TEST),o.setFunc(Al),gn(!1),mt(Ml),de(e.CULL_FACE),Je(Yn);function de(P){if(u[P]!==!0)e.enable(P),u[P]=!0}function Re(P){if(u[P]!==!1)e.disable(P),u[P]=!1}function Ze(P,oe){if(h[P]!==oe){if(e.bindFramebuffer(P,oe),h[P]=oe,P===e.DRAW_FRAMEBUFFER)h[e.FRAMEBUFFER]=oe;if(P===e.FRAMEBUFFER)h[e.DRAW_FRAMEBUFFER]=oe;return!0}return!1}function Oe(P,oe){let Y=g,ae=!1;if(P){if(Y=d.get(oe),Y===void 0)Y=[],d.set(oe,Y);let ve=P.textures;if(Y.length!==ve.length||Y[0]!==e.COLOR_ATTACHMENT0){for(let ee=0,ce=ve.length;ee<ce;ee++)Y[ee]=e.COLOR_ATTACHMENT0+ee;Y.length=ve.length,ae=!0}}else if(Y[0]!==e.BACK)Y[0]=e.BACK,ae=!0;if(ae)e.drawBuffers(Y)}function ke(P){if(y!==P)return e.useProgram(P),y=P,!0;return!1}let Ke={[Xr]:e.FUNC_ADD,[Sg]:e.FUNC_SUBTRACT,[Mg]:e.FUNC_REVERSE_SUBTRACT};Ke[wg]=e.MIN,Ke[Tg]=e.MAX;let Ye={[Eg]:e.ZERO,[Ag]:e.ONE,[Rg]:e.SRC_COLOR,[Ig]:e.SRC_ALPHA,[Og]:e.SRC_ALPHA_SATURATE,[Dg]:e.DST_COLOR,[Lg]:e.DST_ALPHA,[Cg]:e.ONE_MINUS_SRC_COLOR,[Pg]:e.ONE_MINUS_SRC_ALPHA,[Ug]:e.ONE_MINUS_DST_COLOR,[Ng]:e.ONE_MINUS_DST_ALPHA,[Fg]:e.CONSTANT_COLOR,[zg]:e.ONE_MINUS_CONSTANT_COLOR,[kg]:e.CONSTANT_ALPHA,[Bg]:e.ONE_MINUS_CONSTANT_ALPHA};function Je(P,oe,Y,ae,ve,ee,ce,Fe,St,ft){if(P===Yn){if(p===!0)Re(e.BLEND),p=!1;return}if(p===!1)de(e.BLEND),p=!0;if(P!==bg){if(P!==m||ft!==F){if(A!==Xr||w!==Xr)e.blendEquation(e.FUNC_ADD),A=Xr,w=Xr;if(ft)switch(P){case Bs:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case wl:e.blendFunc(e.ONE,e.ONE);break;case Tl:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case El:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Ne("WebGLState: Invalid blending: ",P);break}else switch(P){case Bs:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case wl:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Tl:Ne("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case El:Ne("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ne("WebGLState: Invalid blending: ",P);break}T=null,v=null,E=null,R=null,_.set(0,0,0),S=0,m=P,F=ft}return}if(ve=ve||oe,ee=ee||Y,ce=ce||ae,oe!==A||ve!==w)e.blendEquationSeparate(Ke[oe],Ke[ve]),A=oe,w=ve;if(Y!==T||ae!==v||ee!==E||ce!==R)e.blendFuncSeparate(Ye[Y],Ye[ae],Ye[ee],Ye[ce]),T=Y,v=ae,E=ee,R=ce;if(Fe.equals(_)===!1||St!==S)e.blendColor(Fe.r,Fe.g,Fe.b,St),_.copy(Fe),S=St;m=P,F=!1}function Ft(P,oe){P.side===bn?Re(e.CULL_FACE):de(e.CULL_FACE);let Y=P.side===Yt;if(oe)Y=!Y;gn(Y),P.blending===Bs&&P.transparent===!1?Je(Yn):Je(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),o.setFunc(P.depthFunc),o.setTest(P.depthTest),o.setMask(P.depthWrite),s.setMask(P.colorWrite);let ae=P.stencilWrite;if(a.setTest(ae),ae)a.setMask(P.stencilWriteMask),a.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),a.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass);zt(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?de(e.SAMPLE_ALPHA_TO_COVERAGE):Re(e.SAMPLE_ALPHA_TO_COVERAGE)}function gn(P){if(C!==P){if(P)e.frontFace(e.CW);else e.frontFace(e.CCW);C=P}}function mt(P){if(P!==xg){if(de(e.CULL_FACE),P!==z)if(P===Ml)e.cullFace(e.BACK);else if(P===vg)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else Re(e.CULL_FACE);z=P}function Ht(P){if(P!==J){if(U)e.lineWidth(P);J=P}}function zt(P,oe,Y){if(P){if(de(e.POLYGON_OFFSET_FILL),O!==oe||H!==Y){if(O=oe,H=Y,o.getReversed())oe=-oe;e.polygonOffset(oe,Y)}}else Re(e.POLYGON_OFFSET_FILL)}function Pt(P){if(P)de(e.SCISSOR_TEST);else Re(e.SCISSOR_TEST)}function L(P){if(P===void 0)P=e.TEXTURE0+V-1;if(se!==P)e.activeTexture(P),se=P}function _n(P,oe,Y){if(Y===void 0)if(se===null)Y=e.TEXTURE0+V-1;else Y=se;let ae=me[Y];if(ae===void 0)ae={type:void 0,texture:void 0},me[Y]=ae;if(ae.type!==P||ae.texture!==oe){if(se!==Y)e.activeTexture(Y),se=Y;e.bindTexture(P,oe||fe[P]),ae.type=P,ae.texture=oe}}function nt(){let P=me[se];if(P!==void 0&&P.type!==void 0)e.bindTexture(P.type,null),P.type=void 0,P.texture=void 0}function gt(){try{e.compressedTexImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function M(){try{e.compressedTexImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function x(){try{e.texSubImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function I(){try{e.texSubImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function W(){try{e.compressedTexSubImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function te(){try{e.compressedTexSubImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function ie(){try{e.texStorage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function le(){try{e.texStorage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function X(){try{e.texImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function j(){try{e.texImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function xe(P){if(f[P]!==void 0)return f[P];else return e.getParameter(P)}function we(P,oe){if(f[P]!==oe)e.pixelStorei(P,oe),f[P]=oe}function ue(P){if(Ge.equals(P)===!1)e.scissor(P.x,P.y,P.z,P.w),Ge.copy(P)}function re(P){if(Z.equals(P)===!1)e.viewport(P.x,P.y,P.z,P.w),Z.copy(P)}function Ce(P,oe){let Y=l.get(oe);if(Y===void 0)Y=new WeakMap,l.set(oe,Y);let ae=Y.get(P);if(ae===void 0)ae=e.getUniformBlockIndex(oe,P.name),Y.set(P,ae)}function Pe(P,oe){let ae=l.get(oe).get(P);if(c.get(oe)!==ae)e.uniformBlockBinding(oe,ae,P.__bindingPointIndex),c.set(oe,ae)}function et(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},f={},se=null,me={},h={},d=new WeakMap,g=[],y=null,p=!1,m=null,A=null,T=null,v=null,w=null,E=null,R=null,_=new Le(0,0,0),S=0,F=!1,C=null,z=null,J=null,O=null,H=null,Ge.set(0,0,e.canvas.width,e.canvas.height),Z.set(0,0,e.canvas.width,e.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:de,disable:Re,bindFramebuffer:Ze,drawBuffers:Oe,useProgram:ke,setBlending:Je,setMaterial:Ft,setFlipSided:gn,setCullFace:mt,setLineWidth:Ht,setPolygonOffset:zt,setScissorTest:Pt,activeTexture:L,bindTexture:_n,unbindTexture:nt,compressedTexImage2D:gt,compressedTexImage3D:M,texImage2D:X,texImage3D:j,pixelStorei:we,getParameter:xe,updateUBOMapping:Ce,uniformBlockBinding:Pe,texStorage2D:ie,texStorage3D:le,texSubImage2D:x,texSubImage3D:I,compressedTexSubImage2D:W,compressedTexSubImage3D:te,scissor:ue,viewport:re,reset:et}}function CT(e,t,n,i,r,s,o){let a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ie,u=new WeakMap,f=new Set,h,d=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(M){}function y(M,x){return g?new OffscreenCanvas(M,x):Vr("canvas")}function p(M,x,I){let W=1,te=gt(M);if(te.width>I||te.height>I)W=I/Math.max(te.width,te.height);if(W<1)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap||typeof VideoFrame<"u"&&M instanceof VideoFrame){let ie=Math.floor(W*te.width),le=Math.floor(W*te.height);if(h===void 0)h=y(ie,le);let X=x?y(ie,le):h;return X.width=ie,X.height=le,X.getContext("2d").drawImage(M,0,0,ie,le),Me("WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+le+")."),X}else{if("data"in M)Me("WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+").");return M}return M}function m(M){return M.generateMipmaps}function A(M){e.generateMipmap(M)}function T(M){if(M.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(M.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function v(M,x,I,W,te,ie=!1){if(M!==null){if(e[M]!==void 0)return e[M];Me("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let le;if(W){if(le=t.get("EXT_texture_norm16"),!le)Me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let X=x;if(x===e.RED){if(I===e.FLOAT)X=e.R32F;if(I===e.HALF_FLOAT)X=e.R16F;if(I===e.UNSIGNED_BYTE)X=e.R8;if(I===e.UNSIGNED_SHORT&&le)X=le.R16_EXT;if(I===e.SHORT&&le)X=le.R16_SNORM_EXT}if(x===e.RED_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.R8UI;if(I===e.UNSIGNED_SHORT)X=e.R16UI;if(I===e.UNSIGNED_INT)X=e.R32UI;if(I===e.BYTE)X=e.R8I;if(I===e.SHORT)X=e.R16I;if(I===e.INT)X=e.R32I}if(x===e.RG){if(I===e.FLOAT)X=e.RG32F;if(I===e.HALF_FLOAT)X=e.RG16F;if(I===e.UNSIGNED_BYTE)X=e.RG8;if(I===e.UNSIGNED_SHORT&&le)X=le.RG16_EXT;if(I===e.SHORT&&le)X=le.RG16_SNORM_EXT}if(x===e.RG_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RG8UI;if(I===e.UNSIGNED_SHORT)X=e.RG16UI;if(I===e.UNSIGNED_INT)X=e.RG32UI;if(I===e.BYTE)X=e.RG8I;if(I===e.SHORT)X=e.RG16I;if(I===e.INT)X=e.RG32I}if(x===e.RGB_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RGB8UI;if(I===e.UNSIGNED_SHORT)X=e.RGB16UI;if(I===e.UNSIGNED_INT)X=e.RGB32UI;if(I===e.BYTE)X=e.RGB8I;if(I===e.SHORT)X=e.RGB16I;if(I===e.INT)X=e.RGB32I}if(x===e.RGBA_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RGBA8UI;if(I===e.UNSIGNED_SHORT)X=e.RGBA16UI;if(I===e.UNSIGNED_INT)X=e.RGBA32UI;if(I===e.BYTE)X=e.RGBA8I;if(I===e.SHORT)X=e.RGBA16I;if(I===e.INT)X=e.RGBA32I}if(x===e.RGB){if(I===e.UNSIGNED_SHORT&&le)X=le.RGB16_EXT;if(I===e.SHORT&&le)X=le.RGB16_SNORM_EXT;if(I===e.UNSIGNED_INT_5_9_9_9_REV)X=e.RGB9_E5;if(I===e.UNSIGNED_INT_10F_11F_11F_REV)X=e.R11F_G11F_B10F}if(x===e.RGBA){let j=ie?vu:We.getTransfer(te);if(I===e.FLOAT)X=e.RGBA32F;if(I===e.HALF_FLOAT)X=e.RGBA16F;if(I===e.UNSIGNED_BYTE)X=j===ht?e.SRGB8_ALPHA8:e.RGBA8;if(I===e.UNSIGNED_SHORT&&le)X=le.RGBA16_EXT;if(I===e.SHORT&&le)X=le.RGBA16_SNORM_EXT;if(I===e.UNSIGNED_SHORT_4_4_4_4)X=e.RGBA4;if(I===e.UNSIGNED_SHORT_5_5_5_1)X=e.RGB5_A1}if(X===e.R16F||X===e.R32F||X===e.RG16F||X===e.RG32F||X===e.RGBA16F||X===e.RGBA32F)t.get("EXT_color_buffer_float");return X}function w(M,x){let I;if(M){if(x===null||x===Oi||x===Kr)I=e.DEPTH24_STENCIL8;else if(x===di)I=e.DEPTH32F_STENCIL8;else if(x===Vs)I=e.DEPTH24_STENCIL8,Me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(x===null||x===Oi||x===Kr)I=e.DEPTH_COMPONENT24;else if(x===di)I=e.DEPTH_COMPONENT32F;else if(x===Vs)I=e.DEPTH_COMPONENT16;return I}function E(M,x){if(m(M)===!0||M.isFramebufferTexture&&M.minFilter!==On&&M.minFilter!==Gt)return Math.log2(Math.max(x.width,x.height))+1;else if(M.mipmaps!==void 0&&M.mipmaps.length>0)return M.mipmaps.length;else if(M.isCompressedTexture&&Array.isArray(M.image))return x.mipmaps.length;else return 1}function R(M){let x=M.target;if(x.removeEventListener("dispose",R),S(x),x.isVideoTexture)u.delete(x);if(x.isHTMLTexture)f.delete(x)}function _(M){let x=M.target;x.removeEventListener("dispose",_),C(x)}function S(M){let x=i.get(M);if(x.__webglInit===void 0)return;let I=M.source,W=d.get(I);if(W){let te=W[x.__cacheKey];if(te.usedTimes--,te.usedTimes===0)F(M);if(Object.keys(W).length===0)d.delete(I)}i.remove(M)}function F(M){let x=i.get(M);e.deleteTexture(x.__webglTexture);let I=M.source,W=d.get(I);delete W[x.__cacheKey],o.memory.textures--}function C(M){let x=i.get(M);if(M.depthTexture)M.depthTexture.dispose(),i.remove(M.depthTexture);if(M.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(x.__webglFramebuffer[W]))for(let te=0;te<x.__webglFramebuffer[W].length;te++)e.deleteFramebuffer(x.__webglFramebuffer[W][te]);else e.deleteFramebuffer(x.__webglFramebuffer[W]);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer[W])}else{if(Array.isArray(x.__webglFramebuffer))for(let W=0;W<x.__webglFramebuffer.length;W++)e.deleteFramebuffer(x.__webglFramebuffer[W]);else e.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer);if(x.__webglMultisampledFramebuffer)e.deleteFramebuffer(x.__webglMultisampledFramebuffer);if(x.__webglColorRenderbuffer){for(let W=0;W<x.__webglColorRenderbuffer.length;W++)if(x.__webglColorRenderbuffer[W])e.deleteRenderbuffer(x.__webglColorRenderbuffer[W])}if(x.__webglDepthRenderbuffer)e.deleteRenderbuffer(x.__webglDepthRenderbuffer)}let I=M.textures;for(let W=0,te=I.length;W<te;W++){let ie=i.get(I[W]);if(ie.__webglTexture)e.deleteTexture(ie.__webglTexture),o.memory.textures--;i.remove(I[W])}i.remove(M)}let z=0;function J(){z=0}function O(){return z}function H(M){z=M}function V(){let M=z;if(M>=r.maxTextures)Me("WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+r.maxTextures);return z+=1,M}function U(M){let x=[];return x.push(M.wrapS),x.push(M.wrapT),x.push(M.wrapR||0),x.push(M.magFilter),x.push(M.minFilter),x.push(M.anisotropy),x.push(M.internalFormat),x.push(M.format),x.push(M.type),x.push(M.generateMipmaps),x.push(M.premultiplyAlpha),x.push(M.flipY),x.push(M.unpackAlignment),x.push(M.colorSpace),x.join()}function K(M,x){let I=i.get(M);if(M.isVideoTexture)_n(M);if(M.isRenderTargetTexture===!1&&M.isExternalTexture!==!0&&M.version>0&&I.__version!==M.version){let W=M.image;if(W===null)Me("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)Me("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(I,M,x);return}}else if(M.isExternalTexture)I.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,I.__webglTexture,e.TEXTURE0+x)}function Q(M,x){let I=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){Re(I,M,x);return}else if(M.isExternalTexture)I.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,I.__webglTexture,e.TEXTURE0+x)}function se(M,x){let I=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){Re(I,M,x);return}n.bindTexture(e.TEXTURE_3D,I.__webglTexture,e.TEXTURE0+x)}function me(M,x){let I=i.get(M);if(M.isCubeDepthTexture!==!0&&M.version>0&&I.__version!==M.version){Ze(I,M,x);return}n.bindTexture(e.TEXTURE_CUBE_MAP,I.__webglTexture,e.TEXTURE0+x)}let _e={[Yr]:e.REPEAT,[jr]:e.CLAMP_TO_EDGE,[xa]:e.MIRRORED_REPEAT},qe={[On]:e.NEAREST,[va]:e.NEAREST_MIPMAP_NEAREST,[hr]:e.NEAREST_MIPMAP_LINEAR,[Gt]:e.LINEAR,[Jr]:e.LINEAR_MIPMAP_NEAREST,[jn]:e.LINEAR_MIPMAP_LINEAR},Ge={[s_]:e.NEVER,[u_]:e.ALWAYS,[o_]:e.LESS,[Aa]:e.LEQUAL,[a_]:e.EQUAL,[Ra]:e.GEQUAL,[c_]:e.GREATER,[l_]:e.NOTEQUAL};function Z(M,x){if(x.type===di&&t.has("OES_texture_float_linear")===!1&&(x.magFilter===Gt||x.magFilter===Jr||x.magFilter===hr||x.magFilter===jn||x.minFilter===Gt||x.minFilter===Jr||x.minFilter===hr||x.minFilter===jn))Me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(M,e.TEXTURE_WRAP_S,_e[x.wrapS]),e.texParameteri(M,e.TEXTURE_WRAP_T,_e[x.wrapT]),M===e.TEXTURE_3D||M===e.TEXTURE_2D_ARRAY)e.texParameteri(M,e.TEXTURE_WRAP_R,_e[x.wrapR]);if(e.texParameteri(M,e.TEXTURE_MAG_FILTER,qe[x.magFilter]),e.texParameteri(M,e.TEXTURE_MIN_FILTER,qe[x.minFilter]),x.compareFunction)e.texParameteri(M,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(M,e.TEXTURE_COMPARE_FUNC,Ge[x.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===On)return;if(x.minFilter!==hr&&x.minFilter!==jn)return;if(x.type===di&&t.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||i.get(x).__currentAnisotropy){let I=t.get("EXT_texture_filter_anisotropic");e.texParameterf(M,I.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,r.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy}}}function ne(M,x){let I=!1;if(M.__webglInit===void 0)M.__webglInit=!0,x.addEventListener("dispose",R);let W=x.source,te=d.get(W);if(te===void 0)te={},d.set(W,te);let ie=U(x);if(ie!==M.__cacheKey){if(te[ie]===void 0)te[ie]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,I=!0;te[ie].usedTimes++;let le=te[M.__cacheKey];if(le!==void 0){if(te[M.__cacheKey].usedTimes--,le.usedTimes===0)F(x)}M.__cacheKey=ie,M.__webglTexture=te[ie].texture}return I}function fe(M,x,I){return Math.floor(Math.floor(M/I)/x)}function de(M,x,I,W){let ie=M.updateRanges;if(ie.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,x.width,x.height,I,W,x.data);else{ie.sort((we,ue)=>we.start-ue.start);let le=0;for(let we=1;we<ie.length;we++){let ue=ie[le],re=ie[we],Ce=ue.start+ue.count,Pe=fe(re.start,x.width,4),et=fe(ue.start,x.width,4);if(re.start<=Ce+1&&Pe===et&&fe(re.start+re.count-1,x.width,4)===Pe)ue.count=Math.max(ue.count,re.start+re.count-ue.start);else++le,ie[le]=re}ie.length=le+1;let X=n.getParameter(e.UNPACK_ROW_LENGTH),j=n.getParameter(e.UNPACK_SKIP_PIXELS),xe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,x.width);for(let we=0,ue=ie.length;we<ue;we++){let re=ie[we],Ce=Math.floor(re.start/4),Pe=Math.ceil(re.count/4),et=Ce%x.width,P=Math.floor(Ce/x.width),oe=Pe,Y=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,et),n.pixelStorei(e.UNPACK_SKIP_ROWS,P),n.texSubImage2D(e.TEXTURE_2D,0,et,P,oe,1,I,W,x.data)}M.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,X),n.pixelStorei(e.UNPACK_SKIP_PIXELS,j),n.pixelStorei(e.UNPACK_SKIP_ROWS,xe)}}function Re(M,x,I){let W=e.TEXTURE_2D;if(x.isDataArrayTexture||x.isCompressedArrayTexture)W=e.TEXTURE_2D_ARRAY;if(x.isData3DTexture)W=e.TEXTURE_3D;let te=ne(M,x),ie=x.source;n.bindTexture(W,M.__webglTexture,e.TEXTURE0+I);let le=i.get(ie);if(ie.version!==le.__version||te===!0){if(n.activeTexture(e.TEXTURE0+I),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){let Y=We.getPrimaries(We.workingColorSpace),ae=x.colorSpace===mr?null:We.getPrimaries(x.colorSpace),ve=x.colorSpace===mr||Y===ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve)}n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment);let j=p(x.image,!1,r.maxTextureSize);j=nt(x,j);let xe=s.convert(x.format,x.colorSpace),we=s.convert(x.type),ue=v(x.internalFormat,xe,we,x.normalized,x.colorSpace,x.isVideoTexture);Z(W,x);let re,Ce=x.mipmaps,Pe=x.isVideoTexture!==!0,et=le.__version===void 0||te===!0,P=ie.dataReady,oe=E(x,j);if(x.isDepthTexture){if(ue=w(x.format===dr,x.type),et)if(Pe)n.texStorage2D(e.TEXTURE_2D,1,ue,j.width,j.height);else n.texImage2D(e.TEXTURE_2D,0,ue,j.width,j.height,0,xe,we,null)}else if(x.isDataTexture)if(Ce.length>0){if(Pe&&et)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data);x.generateMipmaps=!1}else if(Pe){if(et)n.texStorage2D(e.TEXTURE_2D,oe,ue,j.width,j.height);if(P)de(x,j,xe,we)}else n.texImage2D(e.TEXTURE_2D,0,ue,j.width,j.height,0,xe,we,j.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){if(Pe&&et)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,Ce[0].width,Ce[0].height,j.depth);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],x.format!==Jn)if(xe!==null)if(Pe){if(P)if(x.layerUpdates.size>0){let ve=Vu(re.width,re.height,x.format,x.type);for(let ee of x.layerUpdates){let ce=re.data.subarray(ee*ve/re.data.BYTES_PER_ELEMENT,(ee+1)*ve/re.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,ee,re.width,re.height,1,xe,ce)}x.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,j.depth,xe,re.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,j.depth,0,re.data,0,0);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Pe){if(P)n.texSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,j.depth,xe,we,re.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,j.depth,0,xe,we,re.data)}else{if(Pe&&et)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],x.format!==Jn)if(xe!==null)if(Pe){if(P)n.compressedTexSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,re.data)}else n.compressedTexImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,re.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data)}else if(x.isDataArrayTexture)if(Pe){if(et)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,j.width,j.height,j.depth);if(P)if(x.layerUpdates.size>0){let Y=Vu(j.width,j.height,x.format,x.type);for(let ae of x.layerUpdates){let ve=j.data.subarray(ae*Y/j.data.BYTES_PER_ELEMENT,(ae+1)*Y/j.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,ae,j.width,j.height,1,xe,we,ve)}x.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,xe,we,j.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,ue,j.width,j.height,j.depth,0,xe,we,j.data);else if(x.isData3DTexture)if(Pe){if(et)n.texStorage3D(e.TEXTURE_3D,oe,ue,j.width,j.height,j.depth);if(P)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,xe,we,j.data)}else n.texImage3D(e.TEXTURE_3D,0,ue,j.width,j.height,j.depth,0,xe,we,j.data);else if(x.isFramebufferTexture){if(et)if(Pe)n.texStorage2D(e.TEXTURE_2D,oe,ue,j.width,j.height);else{let Y=j.width,ae=j.height;for(let ve=0;ve<oe;ve++)n.texImage2D(e.TEXTURE_2D,ve,ue,Y,ae,0,xe,we,null),Y>>=1,ae>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in e){let Y=e.canvas;if(!Y.hasAttribute("layoutsubtree"))Y.setAttribute("layoutsubtree","true");if(j.parentNode!==Y){Y.appendChild(j),f.add(x),Y.onpaint=(ae)=>{let ve=ae.changedElements;for(let ee of f)if(ve.includes(ee.image))ee.needsUpdate=!0},Y.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,j);else{let{RGBA:ve,RGBA:ee,UNSIGNED_BYTE:ce}=e;e.texElementImage2D(e.TEXTURE_2D,0,ve,ee,ce,j)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(Ce.length>0){if(Pe&&et){let Y=gt(Ce[0]);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,xe,we,re)}else n.texImage2D(e.TEXTURE_2D,Y,ue,xe,we,re);x.generateMipmaps=!1}else if(Pe){if(et){let Y=gt(j);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}if(P)n.texSubImage2D(e.TEXTURE_2D,0,0,0,xe,we,j)}else n.texImage2D(e.TEXTURE_2D,0,ue,xe,we,j);if(m(x))A(W);if(le.__version=ie.version,x.onUpdate)x.onUpdate(x)}M.__version=x.version}function Ze(M,x,I){if(x.image.length!==6)return;let W=ne(M,x),te=x.source;n.bindTexture(e.TEXTURE_CUBE_MAP,M.__webglTexture,e.TEXTURE0+I);let ie=i.get(te);if(te.version!==ie.__version||W===!0){n.activeTexture(e.TEXTURE0+I);let le=We.getPrimaries(We.workingColorSpace),X=x.colorSpace===mr?null:We.getPrimaries(x.colorSpace),j=x.colorSpace===mr||le===X?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,j);let xe=x.isCompressedTexture||x.image[0].isCompressedTexture,we=x.image[0]&&x.image[0].isDataTexture,ue=[];for(let ee=0;ee<6;ee++){if(!xe&&!we)ue[ee]=p(x.image[ee],!0,r.maxCubemapSize);else ue[ee]=we?x.image[ee].image:x.image[ee];ue[ee]=nt(x,ue[ee])}let re=ue[0],Ce=s.convert(x.format,x.colorSpace),Pe=s.convert(x.type),et=v(x.internalFormat,Ce,Pe,x.normalized,x.colorSpace),P=x.isVideoTexture!==!0,oe=ie.__version===void 0||W===!0,Y=te.dataReady,ae=E(x,re);Z(e.TEXTURE_CUBE_MAP,x);let ve;if(xe){if(P&&oe)n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,et,re.width,re.height);for(let ee=0;ee<6;ee++){ve=ue[ee].mipmaps;for(let ce=0;ce<ve.length;ce++){let Fe=ve[ce];if(x.format!==Jn)if(Ce!==null)if(P){if(Y)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Fe.width,Fe.height,Ce,Fe.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,et,Fe.width,Fe.height,0,Fe.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Fe.width,Fe.height,Ce,Pe,Fe.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,et,Fe.width,Fe.height,0,Ce,Pe,Fe.data)}}}else{if(ve=x.mipmaps,P&&oe){if(ve.length>0)ae++;let ee=gt(ue[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,et,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(we){if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ue[ee].width,ue[ee].height,Ce,Pe,ue[ee].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,et,ue[ee].width,ue[ee].height,0,Ce,Pe,ue[ee].data);for(let ce=0;ce<ve.length;ce++){let St=ve[ce].image[ee].image;if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,St.width,St.height,Ce,Pe,St.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,et,St.width,St.height,0,Ce,Pe,St.data)}}else{if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ce,Pe,ue[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,et,Ce,Pe,ue[ee]);for(let ce=0;ce<ve.length;ce++){let Fe=ve[ce];if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,Ce,Pe,Fe.image[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,et,Ce,Pe,Fe.image[ee])}}}if(m(x))A(e.TEXTURE_CUBE_MAP);if(ie.__version=te.version,x.onUpdate)x.onUpdate(x)}M.__version=x.version}function Oe(M,x,I,W,te,ie){let le=s.convert(I.format,I.colorSpace),X=s.convert(I.type),j=v(I.internalFormat,le,X,I.normalized,I.colorSpace),xe=i.get(x),we=i.get(I);if(we.__renderTarget=x,!xe.__hasExternalTextures){let ue=Math.max(1,x.width>>ie),re=Math.max(1,x.height>>ie);if(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)n.texImage3D(te,ie,j,ue,re,x.depth,0,le,X,null);else n.texImage2D(te,ie,j,ue,re,0,le,X,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,M),L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,W,te,we.__webglTexture,0,Pt(x));else if(te===e.TEXTURE_2D||te>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,W,te,we.__webglTexture,ie);n.bindFramebuffer(e.FRAMEBUFFER,null)}function ke(M,x,I){if(e.bindRenderbuffer(e.RENDERBUFFER,M),x.depthBuffer){let W=x.depthTexture,te=W&&W.isDepthTexture?W.type:null,ie=w(x.stencilBuffer,te),le=x.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(L(x))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Pt(x),ie,x.width,x.height);else if(I)e.renderbufferStorageMultisample(e.RENDERBUFFER,Pt(x),ie,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,ie,x.width,x.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,le,e.RENDERBUFFER,M)}else{let W=x.textures;for(let te=0;te<W.length;te++){let ie=W[te],le=s.convert(ie.format,ie.colorSpace),X=s.convert(ie.type),j=v(ie.internalFormat,le,X,ie.normalized,ie.colorSpace);if(L(x))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Pt(x),j,x.width,x.height);else if(I)e.renderbufferStorageMultisample(e.RENDERBUFFER,Pt(x),j,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,j,x.width,x.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Ke(M,x,I){let W=x.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,M),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let te=i.get(x.depthTexture);if(te.__renderTarget=x,!te.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0;if(W){if(te.__webglInit===void 0)te.__webglInit=!0,x.depthTexture.addEventListener("dispose",R);if(te.__webglTexture===void 0){te.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture),Z(e.TEXTURE_CUBE_MAP,x.depthTexture);let xe=s.convert(x.depthTexture.format),we=s.convert(x.depthTexture.type),ue;if(x.depthTexture.format===fr)ue=e.DEPTH_COMPONENT24;else if(x.depthTexture.format===dr)ue=e.DEPTH24_STENCIL8;for(let re=0;re<6;re++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+re,0,ue,x.width,x.height,0,xe,we,null)}}else K(x.depthTexture,0);let ie=te.__webglTexture,le=Pt(x),X=W?e.TEXTURE_CUBE_MAP_POSITIVE_X+I:e.TEXTURE_2D,j=x.depthTexture.format===dr?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(x.depthTexture.format===fr)if(L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,j,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,j,X,ie,0);else if(x.depthTexture.format===dr)if(L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,j,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,j,X,ie,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ye(M){let x=i.get(M),I=M.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==M.depthTexture){let W=M.depthTexture;if(x.__depthDisposeCallback)x.__depthDisposeCallback();if(W){let te=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,W.removeEventListener("dispose",te)};W.addEventListener("dispose",te),x.__depthDisposeCallback=te}x.__boundDepthTexture=W}if(M.depthTexture&&!x.__autoAllocateDepthBuffer)if(I)for(let W=0;W<6;W++)Ke(x.__webglFramebuffer[W],M,W);else{let W=M.texture.mipmaps;if(W&&W.length>0)Ke(x.__webglFramebuffer[0],M,0);else Ke(x.__webglFramebuffer,M,0)}else if(I){x.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[W]),x.__webglDepthbuffer[W]===void 0)x.__webglDepthbuffer[W]=e.createRenderbuffer(),ke(x.__webglDepthbuffer[W],M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=x.__webglDepthbuffer[W];e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}else{let W=M.texture.mipmaps;if(W&&W.length>0)n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer);if(x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=e.createRenderbuffer(),ke(x.__webglDepthbuffer,M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=x.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function Je(M,x,I){let W=i.get(M);if(x!==void 0)Oe(W.__webglFramebuffer,M,M.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(I!==void 0)Ye(M)}function Ft(M){let x=M.texture,I=i.get(M),W=i.get(x);M.addEventListener("dispose",_);let te=M.textures,ie=M.isWebGLCubeRenderTarget===!0,le=te.length>1;if(!le){if(W.__webglTexture===void 0)W.__webglTexture=e.createTexture();W.__version=x.version,o.memory.textures++}if(ie){I.__webglFramebuffer=[];for(let X=0;X<6;X++)if(x.mipmaps&&x.mipmaps.length>0){I.__webglFramebuffer[X]=[];for(let j=0;j<x.mipmaps.length;j++)I.__webglFramebuffer[X][j]=e.createFramebuffer()}else I.__webglFramebuffer[X]=e.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){I.__webglFramebuffer=[];for(let X=0;X<x.mipmaps.length;X++)I.__webglFramebuffer[X]=e.createFramebuffer()}else I.__webglFramebuffer=e.createFramebuffer();if(le)for(let X=0,j=te.length;X<j;X++){let xe=i.get(te[X]);if(xe.__webglTexture===void 0)xe.__webglTexture=e.createTexture(),o.memory.textures++}if(M.samples>0&&L(M)===!1){I.__webglMultisampledFramebuffer=e.createFramebuffer(),I.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let X=0;X<te.length;X++){let j=te[X];I.__webglColorRenderbuffer[X]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,I.__webglColorRenderbuffer[X]);let xe=s.convert(j.format,j.colorSpace),we=s.convert(j.type),ue=v(j.internalFormat,xe,we,j.normalized,j.colorSpace,M.isXRRenderTarget===!0),re=Pt(M);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,ue,M.width,M.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+X,e.RENDERBUFFER,I.__webglColorRenderbuffer[X])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),M.depthBuffer)I.__webglDepthRenderbuffer=e.createRenderbuffer(),ke(I.__webglDepthRenderbuffer,M,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(ie){n.bindTexture(e.TEXTURE_CUBE_MAP,W.__webglTexture),Z(e.TEXTURE_CUBE_MAP,x);for(let X=0;X<6;X++)if(x.mipmaps&&x.mipmaps.length>0)for(let j=0;j<x.mipmaps.length;j++)Oe(I.__webglFramebuffer[X][j],M,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,j);else Oe(I.__webglFramebuffer[X],M,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);if(m(x))A(e.TEXTURE_CUBE_MAP);n.unbindTexture()}else if(le){for(let X=0,j=te.length;X<j;X++){let xe=te[X],we=i.get(xe),ue=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)ue=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(ue,we.__webglTexture),Z(ue,xe),Oe(I.__webglFramebuffer,M,xe,e.COLOR_ATTACHMENT0+X,ue,0),m(xe))A(ue)}n.unbindTexture()}else{let X=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)X=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,W.__webglTexture),Z(X,x),x.mipmaps&&x.mipmaps.length>0)for(let j=0;j<x.mipmaps.length;j++)Oe(I.__webglFramebuffer[j],M,x,e.COLOR_ATTACHMENT0,X,j);else Oe(I.__webglFramebuffer,M,x,e.COLOR_ATTACHMENT0,X,0);if(m(x))A(X);n.unbindTexture()}if(M.depthBuffer)Ye(M)}function gn(M){let x=M.textures;for(let I=0,W=x.length;I<W;I++){let te=x[I];if(m(te)){let ie=T(M),le=i.get(te).__webglTexture;n.bindTexture(ie,le),A(ie),n.unbindTexture()}}}let mt=[],Ht=[];function zt(M){if(M.samples>0){if(L(M)===!1){let{textures:x,width:I,height:W}=M,te=e.COLOR_BUFFER_BIT,ie=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,le=i.get(M),X=x.length>1;if(X)for(let xe=0;xe<x.length;xe++)n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,le.__webglMultisampledFramebuffer);let j=M.texture.mipmaps;if(j&&j.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer);for(let xe=0;xe<x.length;xe++){if(M.resolveDepthBuffer){if(M.depthBuffer)te|=e.DEPTH_BUFFER_BIT;if(M.stencilBuffer&&M.resolveStencilBuffer)te|=e.STENCIL_BUFFER_BIT}if(X){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(x[xe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,we,0)}if(e.blitFramebuffer(0,0,I,W,0,0,I,W,te,e.NEAREST),c===!0){if(mt.length=0,Ht.length=0,mt.push(e.COLOR_ATTACHMENT0+xe),M.depthBuffer&&M.resolveDepthBuffer===!1)mt.push(ie),Ht.push(ie),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,Ht);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,mt)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),X)for(let xe=0;xe<x.length;xe++){n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(x[xe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,we,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&c){let x=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[x])}}}function Pt(M){return Math.min(r.maxSamples,M.samples)}function L(M){let x=i.get(M);return M.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function _n(M){let x=o.render.frame;if(u.get(M)!==x)u.set(M,x),M.update()}function nt(M,x){let{colorSpace:I,format:W,type:te}=M;if(M.isCompressedTexture===!0||M.isVideoTexture===!0)return x;if(I!==hn&&I!==mr)if(We.getTransfer(I)===ht){if(W!==Jn||te!==Fn)Me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Ne("WebGLTextures: Unsupported texture color space:",I);return x}function gt(M){if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement)l.width=M.naturalWidth||M.width,l.height=M.naturalHeight||M.height;else if(typeof VideoFrame<"u"&&M instanceof VideoFrame)l.width=M.displayWidth,l.height=M.displayHeight;else l.width=M.width,l.height=M.height;return l}this.allocateTextureUnit=V,this.resetTextureUnits=J,this.getTextureUnits=O,this.setTextureUnits=H,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=se,this.setTextureCube=me,this.rebindTextures=Je,this.setupRenderTarget=Ft,this.updateRenderTargetMipmap=gn,this.updateMultisampleRenderTarget=zt,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=Oe,this.useMultisampledRTT=L,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function IT(e,t){function n(i,r=mr){let s,o=We.getTransfer(r);if(i===Fn)return e.UNSIGNED_BYTE;if(i===Ul)return e.UNSIGNED_SHORT_4_4_4_4;if(i===Ol)return e.UNSIGNED_SHORT_5_5_5_1;if(i===Qg)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===e_)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===Jg)return e.BYTE;if(i===Kg)return e.SHORT;if(i===Vs)return e.UNSIGNED_SHORT;if(i===Dl)return e.INT;if(i===Oi)return e.UNSIGNED_INT;if(i===di)return e.FLOAT;if(i===pi)return e.HALF_FLOAT;if(i===t_)return e.ALPHA;if(i===n_)return e.RGB;if(i===Jn)return e.RGBA;if(i===fr)return e.DEPTH_COMPONENT;if(i===dr)return e.DEPTH_STENCIL;if(i===i_)return e.RED;if(i===Fl)return e.RED_INTEGER;if(i===pr)return e.RG;if(i===zl)return e.RG_INTEGER;if(i===kl)return e.RGBA_INTEGER;if(i===ya||i===ba||i===Sa||i===Ma)if(o===ht)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===ya)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ba)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Sa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Ma)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===ya)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ba)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Sa)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ma)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Bl||i===Gl||i===Hl||i===Vl)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Bl)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Gl)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Hl)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Vl)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Wl||i===$l||i===Zl||i===Xl||i===ql||i===wa||i===Yl)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Wl||i===$l)return o===ht?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Zl)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Xl)return s.COMPRESSED_R11_EAC;if(i===ql)return s.COMPRESSED_SIGNED_R11_EAC;if(i===wa)return s.COMPRESSED_RG11_EAC;if(i===Yl)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===jl||i===Jl||i===Kl||i===Ql||i===eu||i===tu||i===nu||i===iu||i===ru||i===su||i===ou||i===au||i===cu||i===lu)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(i===jl)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Jl)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Kl)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Ql)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===eu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===tu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===nu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===iu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ru)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===su)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===ou)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===au)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===cu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===lu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===uu||i===hu||i===fu)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(i===uu)return o===ht?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===hu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===fu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===du||i===pu||i===Ta||i===mu)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(i===du)return s.COMPRESSED_RED_RGTC1_EXT;if(i===pu)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ta)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===mu)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===Kr)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}var PT=`
+}`,SA=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],MA=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],ux=new ze,vo=new N,Oh=new N;function wA(e,t,n){let i=new uo,r=new Ie,s=new Ie,o=new st,a=new mh,c=new gh,l={},u=n.maxTextureSize,h={[Vi]:jt,[jt]:Vi,[Tn]:Tn},f=new An({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ie},radius:{value:4}},vertexShader:yA,fragmentShader:bA}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let m=new nn;m.setAttribute("position",new Nt(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let x=new pt(m,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Js;let g=this.type;this.render=function(T,R,_){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(T.length===0)return;if(this.type===B_)Me("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Js;let S=e.getRenderTarget(),U=e.getActiveCubeFace(),C=e.getActiveMipmapLevel(),z=e.state;if(z.setBlending(ni),z.buffers.depth.getReversed()===!0)z.buffers.color.setClear(0,0,0,0);else z.buffers.color.setClear(1,1,1,1);z.buffers.depth.setTest(!0),z.setScissorTest(!1);let j=g!==this.type;if(j)R.traverse(function(F){if(F.material)if(Array.isArray(F.material))F.material.forEach((H)=>H.needsUpdate=!0);else F.material.needsUpdate=!0});for(let F=0,H=T.length;F<H;F++){let V=T[F],O=V.shadow;if(O===void 0){Me("WebGLShadowMap:",V,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;r.copy(O.mapSize);let K=O.getFrameExtents();if(r.multiply(K),s.copy(O.mapSize),r.x>u||r.y>u){if(r.x>u)s.x=Math.floor(u/K.x),r.x=s.x*K.x,O.mapSize.x=s.x;if(r.y>u)s.y=Math.floor(u/K.y),r.y=s.y*K.y,O.mapSize.y=s.y}let Q=e.state.buffers.depth.getReversed();if(O.camera._reversedDepth=Q,O.map===null||j===!0){if(O.map!==null){if(O.map.depthTexture!==null)O.map.depthTexture.dispose(),O.map.depthTexture=null;O.map.dispose()}if(this.type===es){if(V.isPointLight){Me("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}O.map=new En(r.x,r.y,{format:br,type:wi,minFilter:Ht,magFilter:Ht,generateMipmaps:!1}),O.map.texture.name=V.name+".shadowMap",O.map.depthTexture=new qi(r.x,r.y,Mi),O.map.depthTexture.name=V.name+".shadowMapDepth",O.map.depthTexture.format=vr,O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=Bn,O.map.depthTexture.magFilter=Bn}else{if(V.isPointLight)O.map=new zh(r.x),O.map.depthTexture=new fh(r.x,$i);else O.map=new En(r.x,r.y),O.map.depthTexture=new qi(r.x,r.y,$i);if(O.map.depthTexture.name=V.name+".shadowMap",O.map.depthTexture.format=vr,this.type===Js)O.map.depthTexture.compareFunction=Q?ja:Ya,O.map.depthTexture.minFilter=Ht,O.map.depthTexture.magFilter=Ht;else O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=Bn,O.map.depthTexture.magFilter=Bn}O.camera.updateProjectionMatrix()}let se=O.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me<se;me++){if(O.map.isWebGLCubeRenderTarget)e.setRenderTarget(O.map,me),e.clear();else{if(me===0)e.setRenderTarget(O.map),e.clear();let _e=O.getViewport(me);o.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),z.viewport(o)}if(V.isPointLight){let{camera:_e,matrix:qe}=O,Ge=V.distance||_e.far;if(Ge!==_e.far)_e.far=Ge,_e.updateProjectionMatrix();vo.setFromMatrixPosition(V.matrixWorld),_e.position.copy(vo),Oh.copy(_e.position),Oh.add(SA[me]),_e.up.copy(MA[me]),_e.lookAt(Oh),_e.updateMatrixWorld(),qe.makeTranslation(-vo.x,-vo.y,-vo.z),ux.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),O._frustum.setFromProjectionMatrix(ux,_e.coordinateSystem,_e.reversedDepth)}else O.updateMatrices(V);i=O.getFrustum(),y(R,_,O.camera,V,this.type)}if(O.isPointLightShadow!==!0&&this.type===es)A(O,_);O.needsUpdate=!1}g=this.type,p.needsUpdate=!1,e.setRenderTarget(S,U,C)};function A(T,R){let _=t.update(x);if(f.defines.VSM_SAMPLES!==T.blurSamples)f.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0;if(T.mapPass===null)T.mapPass=new En(r.x,r.y,{format:br,type:wi});f.uniforms.shadow_pass.value=T.map.depthTexture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,e.setRenderTarget(T.mapPass),e.clear(),e.renderBufferDirect(R,null,_,f,x,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,e.setRenderTarget(T.map),e.clear(),e.renderBufferDirect(R,null,_,d,x,null)}function E(T,R,_,S){let U=null,C=_.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(C!==void 0)U=C;else if(U=_.isPointLight===!0?c:a,e.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){let z=U.uuid,j=R.uuid,F=l[z];if(F===void 0)F={},l[z]=F;let H=F[j];if(H===void 0)H=U.clone(),F[j]=H,R.addEventListener("dispose",w);U=H}if(U.visible=R.visible,U.wireframe=R.wireframe,S===es)U.side=R.shadowSide!==null?R.shadowSide:R.side;else U.side=R.shadowSide!==null?R.shadowSide:h[R.side];if(U.alphaMap=R.alphaMap,U.alphaTest=R.alphaToCoverage===!0?0.5:R.alphaTest,U.map=R.map,U.clipShadows=R.clipShadows,U.clippingPlanes=R.clippingPlanes,U.clipIntersection=R.clipIntersection,U.displacementMap=R.displacementMap,U.displacementScale=R.displacementScale,U.displacementBias=R.displacementBias,U.wireframeLinewidth=R.wireframeLinewidth,U.linewidth=R.linewidth,_.isPointLight===!0&&U.isMeshDistanceMaterial===!0){let z=e.properties.get(U);z.light=_}return U}function y(T,R,_,S,U){if(T.visible===!1)return;if(T.layers.test(R.layers)&&(T.isMesh||T.isLine||T.isPoints)){if((T.castShadow||T.receiveShadow&&U===es)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,T.matrixWorld);let j=t.update(T),F=T.material;if(Array.isArray(F)){let H=j.groups;for(let V=0,O=H.length;V<O;V++){let K=H[V],Q=F[K.materialIndex];if(Q&&Q.visible){let se=E(T,Q,S,U);T.onBeforeShadow(e,T,R,_,j,se,K),e.renderBufferDirect(_,null,j,se,T,K),T.onAfterShadow(e,T,R,_,j,se,K)}}}else if(F.visible){let H=E(T,F,S,U);T.onBeforeShadow(e,T,R,_,j,H,null),e.renderBufferDirect(_,null,j,H,T,null),T.onAfterShadow(e,T,R,_,j,H,null)}}}let z=T.children;for(let j=0,F=z.length;j<F;j++)y(z[j],R,_,S,U)}function w(T){T.target.removeEventListener("dispose",w);for(let _ in l){let S=l[_],U=T.target.uuid;if(U in S)S[U].dispose(),delete S[U]}}}function TA(e,t){function n(){let P=!1,oe=new st,Y=null,ae=new st(0,0,0,0);return{setMask:function(ve){if(Y!==ve&&!P)e.colorMask(ve,ve,ve,ve),Y=ve},setLocked:function(ve){P=ve},setClear:function(ve,ee,ce,Fe,St){if(St===!0)ve*=Fe,ee*=Fe,ce*=Fe;if(oe.set(ve,ee,ce,Fe),ae.equals(oe)===!1)e.clearColor(ve,ee,ce,Fe),ae.copy(oe)},reset:function(){P=!1,Y=null,ae.set(-1,0,0,0)}}}function i(){let P=!1,oe=!1,Y=null,ae=null,ve=null;return{setReversed:function(ee){if(oe!==ee){let ce=t.get("EXT_clip_control");if(ee)ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.ZERO_TO_ONE_EXT);else ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.NEGATIVE_ONE_TO_ONE_EXT);oe=ee;let Fe=ve;ve=null,this.setClear(Fe)}},getReversed:function(){return oe},setTest:function(ee){if(ee)de(e.DEPTH_TEST);else Re(e.DEPTH_TEST)},setMask:function(ee){if(Y!==ee&&!P)e.depthMask(ee),Y=ee},setFunc:function(ee){if(oe)ee=D0[ee];if(ae!==ee){switch(ee){case a0:e.depthFunc(e.NEVER);break;case c0:e.depthFunc(e.ALWAYS);break;case l0:e.depthFunc(e.LESS);break;case du:e.depthFunc(e.LEQUAL);break;case u0:e.depthFunc(e.EQUAL);break;case h0:e.depthFunc(e.GEQUAL);break;case f0:e.depthFunc(e.GREATER);break;case d0:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}ae=ee}},setLocked:function(ee){P=ee},setClear:function(ee){if(ve!==ee){if(ve=ee,oe)ee=1-ee;e.clearDepth(ee)}},reset:function(){P=!1,Y=null,ae=null,ve=null,oe=!1}}}function r(){let P=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Fe=null,St=null;return{setTest:function(ft){if(!P)if(ft)de(e.STENCIL_TEST);else Re(e.STENCIL_TEST)},setMask:function(ft){if(oe!==ft&&!P)e.stencilMask(ft),oe=ft},setFunc:function(ft,Vn,li){if(Y!==ft||ae!==Vn||ve!==li)e.stencilFunc(ft,Vn,li),Y=ft,ae=Vn,ve=li},setOp:function(ft,Vn,li){if(ee!==ft||ce!==Vn||Fe!==li)e.stencilOp(ft,Vn,li),ee=ft,ce=Vn,Fe=li},setLocked:function(ft){P=ft},setClear:function(ft){if(St!==ft)e.clearStencil(ft),St=ft},reset:function(){P=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Fe=null,St=null}}}let s=new n,o=new i,a=new r,c=new WeakMap,l=new WeakMap,u={},h={},f={},d=new WeakMap,m=[],x=null,p=!1,g=null,A=null,E=null,y=null,w=null,T=null,R=null,_=new Le(0,0,0),S=0,U=!1,C=null,z=null,j=null,F=null,H=null,V=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=!1,K=0,Q=e.getParameter(e.VERSION);if(Q.indexOf("WebGL")!==-1)K=parseFloat(/^WebGL (\d)/.exec(Q)[1]),O=K>=1;else if(Q.indexOf("OpenGL ES")!==-1)K=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),O=K>=2;let se=null,me={},_e=e.getParameter(e.SCISSOR_BOX),qe=e.getParameter(e.VIEWPORT),Ge=new st().fromArray(_e),Z=new st().fromArray(qe);function ne(P,oe,Y,ae){let ve=new Uint8Array(4),ee=e.createTexture();e.bindTexture(P,ee),e.texParameteri(P,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(P,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let ce=0;ce<Y;ce++)if(P===e.TEXTURE_3D||P===e.TEXTURE_2D_ARRAY)e.texImage3D(oe,0,e.RGBA,1,1,ae,0,e.RGBA,e.UNSIGNED_BYTE,ve);else e.texImage2D(oe+ce,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,ve);return ee}let fe={};fe[e.TEXTURE_2D]=ne(e.TEXTURE_2D,e.TEXTURE_2D,1),fe[e.TEXTURE_CUBE_MAP]=ne(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[e.TEXTURE_2D_ARRAY]=ne(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),fe[e.TEXTURE_3D]=ne(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),de(e.DEPTH_TEST),o.setFunc(du),vn(!1),mt(lu),de(e.CULL_FACE),Je(ni);function de(P){if(u[P]!==!0)e.enable(P),u[P]=!0}function Re(P){if(u[P]!==!1)e.disable(P),u[P]=!1}function Ze(P,oe){if(f[P]!==oe){if(e.bindFramebuffer(P,oe),f[P]=oe,P===e.DRAW_FRAMEBUFFER)f[e.FRAMEBUFFER]=oe;if(P===e.FRAMEBUFFER)f[e.DRAW_FRAMEBUFFER]=oe;return!0}return!1}function Ue(P,oe){let Y=m,ae=!1;if(P){if(Y=d.get(oe),Y===void 0)Y=[],d.set(oe,Y);let ve=P.textures;if(Y.length!==ve.length||Y[0]!==e.COLOR_ATTACHMENT0){for(let ee=0,ce=ve.length;ee<ce;ee++)Y[ee]=e.COLOR_ATTACHMENT0+ee;Y.length=ve.length,ae=!0}}else if(Y[0]!==e.BACK)Y[0]=e.BACK,ae=!0;if(ae)e.drawBuffers(Y)}function ke(P){if(x!==P)return e.useProgram(P),x=P,!0;return!1}let Ke={[ts]:e.FUNC_ADD,[H_]:e.FUNC_SUBTRACT,[V_]:e.FUNC_REVERSE_SUBTRACT};Ke[$_]=e.MIN,Ke[W_]=e.MAX;let Ye={[Z_]:e.ZERO,[X_]:e.ONE,[q_]:e.SRC_COLOR,[j_]:e.SRC_ALPHA,[n0]:e.SRC_ALPHA_SATURATE,[e0]:e.DST_COLOR,[K_]:e.DST_ALPHA,[Y_]:e.ONE_MINUS_SRC_COLOR,[J_]:e.ONE_MINUS_SRC_ALPHA,[t0]:e.ONE_MINUS_DST_COLOR,[Q_]:e.ONE_MINUS_DST_ALPHA,[i0]:e.CONSTANT_COLOR,[r0]:e.ONE_MINUS_CONSTANT_COLOR,[s0]:e.CONSTANT_ALPHA,[o0]:e.ONE_MINUS_CONSTANT_ALPHA};function Je(P,oe,Y,ae,ve,ee,ce,Fe,St,ft){if(P===ni){if(p===!0)Re(e.BLEND),p=!1;return}if(p===!1)de(e.BLEND),p=!0;if(P!==G_){if(P!==g||ft!==U){if(A!==ts||w!==ts)e.blendEquation(e.FUNC_ADD),A=ts,w=ts;if(ft)switch(P){case Ks:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case uu:e.blendFunc(e.ONE,e.ONE);break;case hu:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case fu:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Ne("WebGLState: Invalid blending: ",P);break}else switch(P){case Ks:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case uu:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case hu:Ne("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case fu:Ne("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ne("WebGLState: Invalid blending: ",P);break}E=null,y=null,T=null,R=null,_.set(0,0,0),S=0,g=P,U=ft}return}if(ve=ve||oe,ee=ee||Y,ce=ce||ae,oe!==A||ve!==w)e.blendEquationSeparate(Ke[oe],Ke[ve]),A=oe,w=ve;if(Y!==E||ae!==y||ee!==T||ce!==R)e.blendFuncSeparate(Ye[Y],Ye[ae],Ye[ee],Ye[ce]),E=Y,y=ae,T=ee,R=ce;if(Fe.equals(_)===!1||St!==S)e.blendColor(Fe.r,Fe.g,Fe.b,St),_.copy(Fe),S=St;g=P,U=!1}function Ft(P,oe){P.side===Tn?Re(e.CULL_FACE):de(e.CULL_FACE);let Y=P.side===jt;if(oe)Y=!Y;vn(Y),P.blending===Ks&&P.transparent===!1?Je(ni):Je(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),o.setFunc(P.depthFunc),o.setTest(P.depthTest),o.setMask(P.depthWrite),s.setMask(P.colorWrite);let ae=P.stencilWrite;if(a.setTest(ae),ae)a.setMask(P.stencilWriteMask),a.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),a.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass);zt(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?de(e.SAMPLE_ALPHA_TO_COVERAGE):Re(e.SAMPLE_ALPHA_TO_COVERAGE)}function vn(P){if(C!==P){if(P)e.frontFace(e.CW);else e.frontFace(e.CCW);C=P}}function mt(P){if(P!==z_){if(de(e.CULL_FACE),P!==z)if(P===lu)e.cullFace(e.BACK);else if(P===k_)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else Re(e.CULL_FACE);z=P}function Vt(P){if(P!==j){if(O)e.lineWidth(P);j=P}}function zt(P,oe,Y){if(P){if(de(e.POLYGON_OFFSET_FILL),F!==oe||H!==Y){if(F=oe,H=Y,o.getReversed())oe=-oe;e.polygonOffset(oe,Y)}}else Re(e.POLYGON_OFFSET_FILL)}function Pt(P){if(P)de(e.SCISSOR_TEST);else Re(e.SCISSOR_TEST)}function L(P){if(P===void 0)P=e.TEXTURE0+V-1;if(se!==P)e.activeTexture(P),se=P}function yn(P,oe,Y){if(Y===void 0)if(se===null)Y=e.TEXTURE0+V-1;else Y=se;let ae=me[Y];if(ae===void 0)ae={type:void 0,texture:void 0},me[Y]=ae;if(ae.type!==P||ae.texture!==oe){if(se!==Y)e.activeTexture(Y),se=Y;e.bindTexture(P,oe||fe[P]),ae.type=P,ae.texture=oe}}function it(){let P=me[se];if(P!==void 0&&P.type!==void 0)e.bindTexture(P.type,null),P.type=void 0,P.texture=void 0}function gt(){try{e.compressedTexImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function M(){try{e.compressedTexImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function v(){try{e.texSubImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function I(){try{e.texSubImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function W(){try{e.compressedTexSubImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function te(){try{e.compressedTexSubImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function ie(){try{e.texStorage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function le(){try{e.texStorage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function X(){try{e.texImage2D(...arguments)}catch(P){Ne("WebGLState:",P)}}function J(){try{e.texImage3D(...arguments)}catch(P){Ne("WebGLState:",P)}}function xe(P){if(h[P]!==void 0)return h[P];else return e.getParameter(P)}function we(P,oe){if(h[P]!==oe)e.pixelStorei(P,oe),h[P]=oe}function ue(P){if(Ge.equals(P)===!1)e.scissor(P.x,P.y,P.z,P.w),Ge.copy(P)}function re(P){if(Z.equals(P)===!1)e.viewport(P.x,P.y,P.z,P.w),Z.copy(P)}function Ce(P,oe){let Y=l.get(oe);if(Y===void 0)Y=new WeakMap,l.set(oe,Y);let ae=Y.get(P);if(ae===void 0)ae=e.getUniformBlockIndex(oe,P.name),Y.set(P,ae)}function Pe(P,oe){let ae=l.get(oe).get(P);if(c.get(oe)!==ae)e.uniformBlockBinding(oe,ae,P.__bindingPointIndex),c.set(oe,ae)}function et(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},h={},se=null,me={},f={},d=new WeakMap,m=[],x=null,p=!1,g=null,A=null,E=null,y=null,w=null,T=null,R=null,_=new Le(0,0,0),S=0,U=!1,C=null,z=null,j=null,F=null,H=null,Ge.set(0,0,e.canvas.width,e.canvas.height),Z.set(0,0,e.canvas.width,e.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:de,disable:Re,bindFramebuffer:Ze,drawBuffers:Ue,useProgram:ke,setBlending:Je,setMaterial:Ft,setFlipSided:vn,setCullFace:mt,setLineWidth:Vt,setPolygonOffset:zt,setScissorTest:Pt,activeTexture:L,bindTexture:yn,unbindTexture:it,compressedTexImage2D:gt,compressedTexImage3D:M,texImage2D:X,texImage3D:J,pixelStorei:we,getParameter:xe,updateUBOMapping:Ce,uniformBlockBinding:Pe,texStorage2D:ie,texStorage3D:le,texSubImage2D:v,texSubImage3D:I,compressedTexSubImage2D:W,compressedTexSubImage3D:te,scissor:ue,viewport:re,reset:et}}function EA(e,t,n,i,r,s,o){let a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ie,u=new WeakMap,h=new Set,f,d=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(M){}function x(M,v){return m?new OffscreenCanvas(M,v):Jr("canvas")}function p(M,v,I){let W=1,te=gt(M);if(te.width>I||te.height>I)W=I/Math.max(te.width,te.height);if(W<1)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap||typeof VideoFrame<"u"&&M instanceof VideoFrame){let ie=Math.floor(W*te.width),le=Math.floor(W*te.height);if(f===void 0)f=x(ie,le);let X=v?x(ie,le):f;return X.width=ie,X.height=le,X.getContext("2d").drawImage(M,0,0,ie,le),Me("WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+le+")."),X}else{if("data"in M)Me("WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+").");return M}return M}function g(M){return M.generateMipmaps}function A(M){e.generateMipmap(M)}function E(M){if(M.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(M.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function y(M,v,I,W,te,ie=!1){if(M!==null){if(e[M]!==void 0)return e[M];Me("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let le;if(W){if(le=t.get("EXT_texture_norm16"),!le)Me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let X=v;if(v===e.RED){if(I===e.FLOAT)X=e.R32F;if(I===e.HALF_FLOAT)X=e.R16F;if(I===e.UNSIGNED_BYTE)X=e.R8;if(I===e.UNSIGNED_SHORT&&le)X=le.R16_EXT;if(I===e.SHORT&&le)X=le.R16_SNORM_EXT}if(v===e.RED_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.R8UI;if(I===e.UNSIGNED_SHORT)X=e.R16UI;if(I===e.UNSIGNED_INT)X=e.R32UI;if(I===e.BYTE)X=e.R8I;if(I===e.SHORT)X=e.R16I;if(I===e.INT)X=e.R32I}if(v===e.RG){if(I===e.FLOAT)X=e.RG32F;if(I===e.HALF_FLOAT)X=e.RG16F;if(I===e.UNSIGNED_BYTE)X=e.RG8;if(I===e.UNSIGNED_SHORT&&le)X=le.RG16_EXT;if(I===e.SHORT&&le)X=le.RG16_SNORM_EXT}if(v===e.RG_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RG8UI;if(I===e.UNSIGNED_SHORT)X=e.RG16UI;if(I===e.UNSIGNED_INT)X=e.RG32UI;if(I===e.BYTE)X=e.RG8I;if(I===e.SHORT)X=e.RG16I;if(I===e.INT)X=e.RG32I}if(v===e.RGB_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RGB8UI;if(I===e.UNSIGNED_SHORT)X=e.RGB16UI;if(I===e.UNSIGNED_INT)X=e.RGB32UI;if(I===e.BYTE)X=e.RGB8I;if(I===e.SHORT)X=e.RGB16I;if(I===e.INT)X=e.RGB32I}if(v===e.RGBA_INTEGER){if(I===e.UNSIGNED_BYTE)X=e.RGBA8UI;if(I===e.UNSIGNED_SHORT)X=e.RGBA16UI;if(I===e.UNSIGNED_INT)X=e.RGBA32UI;if(I===e.BYTE)X=e.RGBA8I;if(I===e.SHORT)X=e.RGBA16I;if(I===e.INT)X=e.RGBA32I}if(v===e.RGB){if(I===e.UNSIGNED_SHORT&&le)X=le.RGB16_EXT;if(I===e.SHORT&&le)X=le.RGB16_SNORM_EXT;if(I===e.UNSIGNED_INT_5_9_9_9_REV)X=e.RGB9_E5;if(I===e.UNSIGNED_INT_10F_11F_11F_REV)X=e.R11F_G11F_B10F}if(v===e.RGBA){let J=ie?sh:$e.getTransfer(te);if(I===e.FLOAT)X=e.RGBA32F;if(I===e.HALF_FLOAT)X=e.RGBA16F;if(I===e.UNSIGNED_BYTE)X=J===ht?e.SRGB8_ALPHA8:e.RGBA8;if(I===e.UNSIGNED_SHORT&&le)X=le.RGBA16_EXT;if(I===e.SHORT&&le)X=le.RGBA16_SNORM_EXT;if(I===e.UNSIGNED_SHORT_4_4_4_4)X=e.RGBA4;if(I===e.UNSIGNED_SHORT_5_5_5_1)X=e.RGB5_A1}if(X===e.R16F||X===e.R32F||X===e.RG16F||X===e.RG32F||X===e.RGBA16F||X===e.RGBA32F)t.get("EXT_color_buffer_float");return X}function w(M,v){let I;if(M){if(v===null||v===$i||v===os)I=e.DEPTH24_STENCIL8;else if(v===Mi)I=e.DEPTH32F_STENCIL8;else if(v===to)I=e.DEPTH24_STENCIL8,Me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(v===null||v===$i||v===os)I=e.DEPTH_COMPONENT24;else if(v===Mi)I=e.DEPTH_COMPONENT32F;else if(v===to)I=e.DEPTH_COMPONENT16;return I}function T(M,v){if(g(M)===!0||M.isFramebufferTexture&&M.minFilter!==Bn&&M.minFilter!==Ht)return Math.log2(Math.max(v.width,v.height))+1;else if(M.mipmaps!==void 0&&M.mipmaps.length>0)return M.mipmaps.length;else if(M.isCompressedTexture&&Array.isArray(M.image))return v.mipmaps.length;else return 1}function R(M){let v=M.target;if(v.removeEventListener("dispose",R),S(v),v.isVideoTexture)u.delete(v);if(v.isHTMLTexture)h.delete(v)}function _(M){let v=M.target;v.removeEventListener("dispose",_),C(v)}function S(M){let v=i.get(M);if(v.__webglInit===void 0)return;let I=M.source,W=d.get(I);if(W){let te=W[v.__cacheKey];if(te.usedTimes--,te.usedTimes===0)U(M);if(Object.keys(W).length===0)d.delete(I)}i.remove(M)}function U(M){let v=i.get(M);e.deleteTexture(v.__webglTexture);let I=M.source,W=d.get(I);delete W[v.__cacheKey],o.memory.textures--}function C(M){let v=i.get(M);if(M.depthTexture)M.depthTexture.dispose(),i.remove(M.depthTexture);if(M.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(v.__webglFramebuffer[W]))for(let te=0;te<v.__webglFramebuffer[W].length;te++)e.deleteFramebuffer(v.__webglFramebuffer[W][te]);else e.deleteFramebuffer(v.__webglFramebuffer[W]);if(v.__webglDepthbuffer)e.deleteRenderbuffer(v.__webglDepthbuffer[W])}else{if(Array.isArray(v.__webglFramebuffer))for(let W=0;W<v.__webglFramebuffer.length;W++)e.deleteFramebuffer(v.__webglFramebuffer[W]);else e.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer)e.deleteRenderbuffer(v.__webglDepthbuffer);if(v.__webglMultisampledFramebuffer)e.deleteFramebuffer(v.__webglMultisampledFramebuffer);if(v.__webglColorRenderbuffer){for(let W=0;W<v.__webglColorRenderbuffer.length;W++)if(v.__webglColorRenderbuffer[W])e.deleteRenderbuffer(v.__webglColorRenderbuffer[W])}if(v.__webglDepthRenderbuffer)e.deleteRenderbuffer(v.__webglDepthRenderbuffer)}let I=M.textures;for(let W=0,te=I.length;W<te;W++){let ie=i.get(I[W]);if(ie.__webglTexture)e.deleteTexture(ie.__webglTexture),o.memory.textures--;i.remove(I[W])}i.remove(M)}let z=0;function j(){z=0}function F(){return z}function H(M){z=M}function V(){let M=z;if(M>=r.maxTextures)Me("WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+r.maxTextures);return z+=1,M}function O(M){let v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function K(M,v){let I=i.get(M);if(M.isVideoTexture)yn(M);if(M.isRenderTargetTexture===!1&&M.isExternalTexture!==!0&&M.version>0&&I.__version!==M.version){let W=M.image;if(W===null)Me("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)Me("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(I,M,v);return}}else if(M.isExternalTexture)I.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,I.__webglTexture,e.TEXTURE0+v)}function Q(M,v){let I=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){Re(I,M,v);return}else if(M.isExternalTexture)I.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,I.__webglTexture,e.TEXTURE0+v)}function se(M,v){let I=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){Re(I,M,v);return}n.bindTexture(e.TEXTURE_3D,I.__webglTexture,e.TEXTURE0+v)}function me(M,v){let I=i.get(M);if(M.isCubeDepthTexture!==!0&&M.version>0&&I.__version!==M.version){Ze(I,M,v);return}n.bindTexture(e.TEXTURE_CUBE_MAP,I.__webglTexture,e.TEXTURE0+v)}let _e={[is]:e.REPEAT,[rs]:e.CLAMP_TO_EDGE,[Ba]:e.MIRRORED_REPEAT},qe={[Bn]:e.NEAREST,[Ga]:e.NEAREST_MIPMAP_NEAREST,[xr]:e.NEAREST_MIPMAP_LINEAR,[Ht]:e.LINEAR,[ss]:e.LINEAR_MIPMAP_NEAREST,[ii]:e.LINEAR_MIPMAP_LINEAR},Ge={[T0]:e.NEVER,[I0]:e.ALWAYS,[E0]:e.LESS,[Ya]:e.LEQUAL,[A0]:e.EQUAL,[ja]:e.GEQUAL,[R0]:e.GREATER,[C0]:e.NOTEQUAL};function Z(M,v){if(v.type===Mi&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===Ht||v.magFilter===ss||v.magFilter===xr||v.magFilter===ii||v.minFilter===Ht||v.minFilter===ss||v.minFilter===xr||v.minFilter===ii))Me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(M,e.TEXTURE_WRAP_S,_e[v.wrapS]),e.texParameteri(M,e.TEXTURE_WRAP_T,_e[v.wrapT]),M===e.TEXTURE_3D||M===e.TEXTURE_2D_ARRAY)e.texParameteri(M,e.TEXTURE_WRAP_R,_e[v.wrapR]);if(e.texParameteri(M,e.TEXTURE_MAG_FILTER,qe[v.magFilter]),e.texParameteri(M,e.TEXTURE_MIN_FILTER,qe[v.minFilter]),v.compareFunction)e.texParameteri(M,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(M,e.TEXTURE_COMPARE_FUNC,Ge[v.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Bn)return;if(v.minFilter!==xr&&v.minFilter!==ii)return;if(v.type===Mi&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){let I=t.get("EXT_texture_filter_anisotropic");e.texParameterf(M,I.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function ne(M,v){let I=!1;if(M.__webglInit===void 0)M.__webglInit=!0,v.addEventListener("dispose",R);let W=v.source,te=d.get(W);if(te===void 0)te={},d.set(W,te);let ie=O(v);if(ie!==M.__cacheKey){if(te[ie]===void 0)te[ie]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,I=!0;te[ie].usedTimes++;let le=te[M.__cacheKey];if(le!==void 0){if(te[M.__cacheKey].usedTimes--,le.usedTimes===0)U(v)}M.__cacheKey=ie,M.__webglTexture=te[ie].texture}return I}function fe(M,v,I){return Math.floor(Math.floor(M/I)/v)}function de(M,v,I,W){let ie=M.updateRanges;if(ie.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,v.width,v.height,I,W,v.data);else{ie.sort((we,ue)=>we.start-ue.start);let le=0;for(let we=1;we<ie.length;we++){let ue=ie[le],re=ie[we],Ce=ue.start+ue.count,Pe=fe(re.start,v.width,4),et=fe(ue.start,v.width,4);if(re.start<=Ce+1&&Pe===et&&fe(re.start+re.count-1,v.width,4)===Pe)ue.count=Math.max(ue.count,re.start+re.count-ue.start);else++le,ie[le]=re}ie.length=le+1;let X=n.getParameter(e.UNPACK_ROW_LENGTH),J=n.getParameter(e.UNPACK_SKIP_PIXELS),xe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,v.width);for(let we=0,ue=ie.length;we<ue;we++){let re=ie[we],Ce=Math.floor(re.start/4),Pe=Math.ceil(re.count/4),et=Ce%v.width,P=Math.floor(Ce/v.width),oe=Pe,Y=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,et),n.pixelStorei(e.UNPACK_SKIP_ROWS,P),n.texSubImage2D(e.TEXTURE_2D,0,et,P,oe,1,I,W,v.data)}M.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,X),n.pixelStorei(e.UNPACK_SKIP_PIXELS,J),n.pixelStorei(e.UNPACK_SKIP_ROWS,xe)}}function Re(M,v,I){let W=e.TEXTURE_2D;if(v.isDataArrayTexture||v.isCompressedArrayTexture)W=e.TEXTURE_2D_ARRAY;if(v.isData3DTexture)W=e.TEXTURE_3D;let te=ne(M,v),ie=v.source;n.bindTexture(W,M.__webglTexture,e.TEXTURE0+I);let le=i.get(ie);if(ie.version!==le.__version||te===!0){if(n.activeTexture(e.TEXTURE0+I),(typeof ImageBitmap<"u"&&v.image instanceof ImageBitmap)===!1){let Y=$e.getPrimaries($e.workingColorSpace),ae=v.colorSpace===Sr?null:$e.getPrimaries(v.colorSpace),ve=v.colorSpace===Sr||Y===ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,v.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve)}n.pixelStorei(e.UNPACK_ALIGNMENT,v.unpackAlignment);let J=p(v.image,!1,r.maxTextureSize);J=it(v,J);let xe=s.convert(v.format,v.colorSpace),we=s.convert(v.type),ue=y(v.internalFormat,xe,we,v.normalized,v.colorSpace,v.isVideoTexture);Z(W,v);let re,Ce=v.mipmaps,Pe=v.isVideoTexture!==!0,et=le.__version===void 0||te===!0,P=ie.dataReady,oe=T(v,J);if(v.isDepthTexture){if(ue=w(v.format===yr,v.type),et)if(Pe)n.texStorage2D(e.TEXTURE_2D,1,ue,J.width,J.height);else n.texImage2D(e.TEXTURE_2D,0,ue,J.width,J.height,0,xe,we,null)}else if(v.isDataTexture)if(Ce.length>0){if(Pe&&et)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data);v.generateMipmaps=!1}else if(Pe){if(et)n.texStorage2D(e.TEXTURE_2D,oe,ue,J.width,J.height);if(P)de(v,J,xe,we)}else n.texImage2D(e.TEXTURE_2D,0,ue,J.width,J.height,0,xe,we,J.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){if(Pe&&et)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,Ce[0].width,Ce[0].height,J.depth);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],v.format!==ri)if(xe!==null)if(Pe){if(P)if(v.layerUpdates.size>0){let ve=Ch(re.width,re.height,v.format,v.type);for(let ee of v.layerUpdates){let ce=re.data.subarray(ee*ve/re.data.BYTES_PER_ELEMENT,(ee+1)*ve/re.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,ee,re.width,re.height,1,xe,ce)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,J.depth,xe,re.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,J.depth,0,re.data,0,0);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Pe){if(P)n.texSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,J.depth,xe,we,re.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,J.depth,0,xe,we,re.data)}else{if(Pe&&et)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],v.format!==ri)if(xe!==null)if(Pe){if(P)n.compressedTexSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,re.data)}else n.compressedTexImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,re.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data)}else if(v.isDataArrayTexture)if(Pe){if(et)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,J.width,J.height,J.depth);if(P)if(v.layerUpdates.size>0){let Y=Ch(J.width,J.height,v.format,v.type);for(let ae of v.layerUpdates){let ve=J.data.subarray(ae*Y/J.data.BYTES_PER_ELEMENT,(ae+1)*Y/J.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,ae,J.width,J.height,1,xe,we,ve)}v.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,xe,we,J.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,ue,J.width,J.height,J.depth,0,xe,we,J.data);else if(v.isData3DTexture)if(Pe){if(et)n.texStorage3D(e.TEXTURE_3D,oe,ue,J.width,J.height,J.depth);if(P)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,xe,we,J.data)}else n.texImage3D(e.TEXTURE_3D,0,ue,J.width,J.height,J.depth,0,xe,we,J.data);else if(v.isFramebufferTexture){if(et)if(Pe)n.texStorage2D(e.TEXTURE_2D,oe,ue,J.width,J.height);else{let Y=J.width,ae=J.height;for(let ve=0;ve<oe;ve++)n.texImage2D(e.TEXTURE_2D,ve,ue,Y,ae,0,xe,we,null),Y>>=1,ae>>=1}}else if(v.isHTMLTexture){if("texElementImage2D"in e){let Y=e.canvas;if(!Y.hasAttribute("layoutsubtree"))Y.setAttribute("layoutsubtree","true");if(J.parentNode!==Y){Y.appendChild(J),h.add(v),Y.onpaint=(ae)=>{let ve=ae.changedElements;for(let ee of h)if(ve.includes(ee.image))ee.needsUpdate=!0},Y.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,J);else{let{RGBA:ve,RGBA:ee,UNSIGNED_BYTE:ce}=e;e.texElementImage2D(e.TEXTURE_2D,0,ve,ee,ce,J)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(Ce.length>0){if(Pe&&et){let Y=gt(Ce[0]);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Pe){if(P)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,xe,we,re)}else n.texImage2D(e.TEXTURE_2D,Y,ue,xe,we,re);v.generateMipmaps=!1}else if(Pe){if(et){let Y=gt(J);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}if(P)n.texSubImage2D(e.TEXTURE_2D,0,0,0,xe,we,J)}else n.texImage2D(e.TEXTURE_2D,0,ue,xe,we,J);if(g(v))A(W);if(le.__version=ie.version,v.onUpdate)v.onUpdate(v)}M.__version=v.version}function Ze(M,v,I){if(v.image.length!==6)return;let W=ne(M,v),te=v.source;n.bindTexture(e.TEXTURE_CUBE_MAP,M.__webglTexture,e.TEXTURE0+I);let ie=i.get(te);if(te.version!==ie.__version||W===!0){n.activeTexture(e.TEXTURE0+I);let le=$e.getPrimaries($e.workingColorSpace),X=v.colorSpace===Sr?null:$e.getPrimaries(v.colorSpace),J=v.colorSpace===Sr||le===X?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,v.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,v.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,J);let xe=v.isCompressedTexture||v.image[0].isCompressedTexture,we=v.image[0]&&v.image[0].isDataTexture,ue=[];for(let ee=0;ee<6;ee++){if(!xe&&!we)ue[ee]=p(v.image[ee],!0,r.maxCubemapSize);else ue[ee]=we?v.image[ee].image:v.image[ee];ue[ee]=it(v,ue[ee])}let re=ue[0],Ce=s.convert(v.format,v.colorSpace),Pe=s.convert(v.type),et=y(v.internalFormat,Ce,Pe,v.normalized,v.colorSpace),P=v.isVideoTexture!==!0,oe=ie.__version===void 0||W===!0,Y=te.dataReady,ae=T(v,re);Z(e.TEXTURE_CUBE_MAP,v);let ve;if(xe){if(P&&oe)n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,et,re.width,re.height);for(let ee=0;ee<6;ee++){ve=ue[ee].mipmaps;for(let ce=0;ce<ve.length;ce++){let Fe=ve[ce];if(v.format!==ri)if(Ce!==null)if(P){if(Y)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Fe.width,Fe.height,Ce,Fe.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,et,Fe.width,Fe.height,0,Fe.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Fe.width,Fe.height,Ce,Pe,Fe.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,et,Fe.width,Fe.height,0,Ce,Pe,Fe.data)}}}else{if(ve=v.mipmaps,P&&oe){if(ve.length>0)ae++;let ee=gt(ue[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,et,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(we){if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ue[ee].width,ue[ee].height,Ce,Pe,ue[ee].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,et,ue[ee].width,ue[ee].height,0,Ce,Pe,ue[ee].data);for(let ce=0;ce<ve.length;ce++){let St=ve[ce].image[ee].image;if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,St.width,St.height,Ce,Pe,St.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,et,St.width,St.height,0,Ce,Pe,St.data)}}else{if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ce,Pe,ue[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,et,Ce,Pe,ue[ee]);for(let ce=0;ce<ve.length;ce++){let Fe=ve[ce];if(P){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,Ce,Pe,Fe.image[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,et,Ce,Pe,Fe.image[ee])}}}if(g(v))A(e.TEXTURE_CUBE_MAP);if(ie.__version=te.version,v.onUpdate)v.onUpdate(v)}M.__version=v.version}function Ue(M,v,I,W,te,ie){let le=s.convert(I.format,I.colorSpace),X=s.convert(I.type),J=y(I.internalFormat,le,X,I.normalized,I.colorSpace),xe=i.get(v),we=i.get(I);if(we.__renderTarget=v,!xe.__hasExternalTextures){let ue=Math.max(1,v.width>>ie),re=Math.max(1,v.height>>ie);if(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)n.texImage3D(te,ie,J,ue,re,v.depth,0,le,X,null);else n.texImage2D(te,ie,J,ue,re,0,le,X,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,M),L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,W,te,we.__webglTexture,0,Pt(v));else if(te===e.TEXTURE_2D||te>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,W,te,we.__webglTexture,ie);n.bindFramebuffer(e.FRAMEBUFFER,null)}function ke(M,v,I){if(e.bindRenderbuffer(e.RENDERBUFFER,M),v.depthBuffer){let W=v.depthTexture,te=W&&W.isDepthTexture?W.type:null,ie=w(v.stencilBuffer,te),le=v.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(L(v))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Pt(v),ie,v.width,v.height);else if(I)e.renderbufferStorageMultisample(e.RENDERBUFFER,Pt(v),ie,v.width,v.height);else e.renderbufferStorage(e.RENDERBUFFER,ie,v.width,v.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,le,e.RENDERBUFFER,M)}else{let W=v.textures;for(let te=0;te<W.length;te++){let ie=W[te],le=s.convert(ie.format,ie.colorSpace),X=s.convert(ie.type),J=y(ie.internalFormat,le,X,ie.normalized,ie.colorSpace);if(L(v))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Pt(v),J,v.width,v.height);else if(I)e.renderbufferStorageMultisample(e.RENDERBUFFER,Pt(v),J,v.width,v.height);else e.renderbufferStorage(e.RENDERBUFFER,J,v.width,v.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Ke(M,v,I){let W=v.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,M),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let te=i.get(v.depthTexture);if(te.__renderTarget=v,!te.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0;if(W){if(te.__webglInit===void 0)te.__webglInit=!0,v.depthTexture.addEventListener("dispose",R);if(te.__webglTexture===void 0){te.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture),Z(e.TEXTURE_CUBE_MAP,v.depthTexture);let xe=s.convert(v.depthTexture.format),we=s.convert(v.depthTexture.type),ue;if(v.depthTexture.format===vr)ue=e.DEPTH_COMPONENT24;else if(v.depthTexture.format===yr)ue=e.DEPTH24_STENCIL8;for(let re=0;re<6;re++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+re,0,ue,v.width,v.height,0,xe,we,null)}}else K(v.depthTexture,0);let ie=te.__webglTexture,le=Pt(v),X=W?e.TEXTURE_CUBE_MAP_POSITIVE_X+I:e.TEXTURE_2D,J=v.depthTexture.format===yr?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(v.depthTexture.format===vr)if(L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,J,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,J,X,ie,0);else if(v.depthTexture.format===yr)if(L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,J,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,J,X,ie,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ye(M){let v=i.get(M),I=M.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==M.depthTexture){let W=M.depthTexture;if(v.__depthDisposeCallback)v.__depthDisposeCallback();if(W){let te=()=>{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,W.removeEventListener("dispose",te)};W.addEventListener("dispose",te),v.__depthDisposeCallback=te}v.__boundDepthTexture=W}if(M.depthTexture&&!v.__autoAllocateDepthBuffer)if(I)for(let W=0;W<6;W++)Ke(v.__webglFramebuffer[W],M,W);else{let W=M.texture.mipmaps;if(W&&W.length>0)Ke(v.__webglFramebuffer[0],M,0);else Ke(v.__webglFramebuffer,M,0)}else if(I){v.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer[W]),v.__webglDepthbuffer[W]===void 0)v.__webglDepthbuffer[W]=e.createRenderbuffer(),ke(v.__webglDepthbuffer[W],M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=v.__webglDepthbuffer[W];e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}else{let W=M.texture.mipmaps;if(W&&W.length>0)n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer);if(v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=e.createRenderbuffer(),ke(v.__webglDepthbuffer,M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=v.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function Je(M,v,I){let W=i.get(M);if(v!==void 0)Ue(W.__webglFramebuffer,M,M.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(I!==void 0)Ye(M)}function Ft(M){let v=M.texture,I=i.get(M),W=i.get(v);M.addEventListener("dispose",_);let te=M.textures,ie=M.isWebGLCubeRenderTarget===!0,le=te.length>1;if(!le){if(W.__webglTexture===void 0)W.__webglTexture=e.createTexture();W.__version=v.version,o.memory.textures++}if(ie){I.__webglFramebuffer=[];for(let X=0;X<6;X++)if(v.mipmaps&&v.mipmaps.length>0){I.__webglFramebuffer[X]=[];for(let J=0;J<v.mipmaps.length;J++)I.__webglFramebuffer[X][J]=e.createFramebuffer()}else I.__webglFramebuffer[X]=e.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){I.__webglFramebuffer=[];for(let X=0;X<v.mipmaps.length;X++)I.__webglFramebuffer[X]=e.createFramebuffer()}else I.__webglFramebuffer=e.createFramebuffer();if(le)for(let X=0,J=te.length;X<J;X++){let xe=i.get(te[X]);if(xe.__webglTexture===void 0)xe.__webglTexture=e.createTexture(),o.memory.textures++}if(M.samples>0&&L(M)===!1){I.__webglMultisampledFramebuffer=e.createFramebuffer(),I.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let X=0;X<te.length;X++){let J=te[X];I.__webglColorRenderbuffer[X]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,I.__webglColorRenderbuffer[X]);let xe=s.convert(J.format,J.colorSpace),we=s.convert(J.type),ue=y(J.internalFormat,xe,we,J.normalized,J.colorSpace,M.isXRRenderTarget===!0),re=Pt(M);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,ue,M.width,M.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+X,e.RENDERBUFFER,I.__webglColorRenderbuffer[X])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),M.depthBuffer)I.__webglDepthRenderbuffer=e.createRenderbuffer(),ke(I.__webglDepthRenderbuffer,M,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(ie){n.bindTexture(e.TEXTURE_CUBE_MAP,W.__webglTexture),Z(e.TEXTURE_CUBE_MAP,v);for(let X=0;X<6;X++)if(v.mipmaps&&v.mipmaps.length>0)for(let J=0;J<v.mipmaps.length;J++)Ue(I.__webglFramebuffer[X][J],M,v,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,J);else Ue(I.__webglFramebuffer[X],M,v,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);if(g(v))A(e.TEXTURE_CUBE_MAP);n.unbindTexture()}else if(le){for(let X=0,J=te.length;X<J;X++){let xe=te[X],we=i.get(xe),ue=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)ue=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(ue,we.__webglTexture),Z(ue,xe),Ue(I.__webglFramebuffer,M,xe,e.COLOR_ATTACHMENT0+X,ue,0),g(xe))A(ue)}n.unbindTexture()}else{let X=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)X=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,W.__webglTexture),Z(X,v),v.mipmaps&&v.mipmaps.length>0)for(let J=0;J<v.mipmaps.length;J++)Ue(I.__webglFramebuffer[J],M,v,e.COLOR_ATTACHMENT0,X,J);else Ue(I.__webglFramebuffer,M,v,e.COLOR_ATTACHMENT0,X,0);if(g(v))A(X);n.unbindTexture()}if(M.depthBuffer)Ye(M)}function vn(M){let v=M.textures;for(let I=0,W=v.length;I<W;I++){let te=v[I];if(g(te)){let ie=E(M),le=i.get(te).__webglTexture;n.bindTexture(ie,le),A(ie),n.unbindTexture()}}}let mt=[],Vt=[];function zt(M){if(M.samples>0){if(L(M)===!1){let{textures:v,width:I,height:W}=M,te=e.COLOR_BUFFER_BIT,ie=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,le=i.get(M),X=v.length>1;if(X)for(let xe=0;xe<v.length;xe++)n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,le.__webglMultisampledFramebuffer);let J=M.texture.mipmaps;if(J&&J.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer);for(let xe=0;xe<v.length;xe++){if(M.resolveDepthBuffer){if(M.depthBuffer)te|=e.DEPTH_BUFFER_BIT;if(M.stencilBuffer&&M.resolveStencilBuffer)te|=e.STENCIL_BUFFER_BIT}if(X){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(v[xe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,we,0)}if(e.blitFramebuffer(0,0,I,W,0,0,I,W,te,e.NEAREST),c===!0){if(mt.length=0,Vt.length=0,mt.push(e.COLOR_ATTACHMENT0+xe),M.depthBuffer&&M.resolveDepthBuffer===!1)mt.push(ie),Vt.push(ie),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,Vt);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,mt)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),X)for(let xe=0;xe<v.length;xe++){n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(v[xe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,we,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&c){let v=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[v])}}}function Pt(M){return Math.min(r.maxSamples,M.samples)}function L(M){let v=i.get(M);return M.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function yn(M){let v=o.render.frame;if(u.get(M)!==v)u.set(M,v),M.update()}function it(M,v){let{colorSpace:I,format:W,type:te}=M;if(M.isCompressedTexture===!0||M.isVideoTexture===!0)return v;if(I!==pn&&I!==Sr)if($e.getTransfer(I)===ht){if(W!==ri||te!==Gn)Me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Ne("WebGLTextures: Unsupported texture color space:",I);return v}function gt(M){if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement)l.width=M.naturalWidth||M.width,l.height=M.naturalHeight||M.height;else if(typeof VideoFrame<"u"&&M instanceof VideoFrame)l.width=M.displayWidth,l.height=M.displayHeight;else l.width=M.width,l.height=M.height;return l}this.allocateTextureUnit=V,this.resetTextureUnits=j,this.getTextureUnits=F,this.setTextureUnits=H,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=se,this.setTextureCube=me,this.rebindTextures=Je,this.setupRenderTarget=Ft,this.updateRenderTargetMipmap=vn,this.updateMultisampleRenderTarget=zt,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=L,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function AA(e,t){function n(i,r=Sr){let s,o=$e.getTransfer(r);if(i===Gn)return e.UNSIGNED_BYTE;if(i===bu)return e.UNSIGNED_SHORT_4_4_4_4;if(i===Su)return e.UNSIGNED_SHORT_5_5_5_1;if(i===v0)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===y0)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===_0)return e.BYTE;if(i===x0)return e.SHORT;if(i===to)return e.UNSIGNED_SHORT;if(i===yu)return e.INT;if(i===$i)return e.UNSIGNED_INT;if(i===Mi)return e.FLOAT;if(i===wi)return e.HALF_FLOAT;if(i===b0)return e.ALPHA;if(i===S0)return e.RGB;if(i===ri)return e.RGBA;if(i===vr)return e.DEPTH_COMPONENT;if(i===yr)return e.DEPTH_STENCIL;if(i===M0)return e.RED;if(i===Mu)return e.RED_INTEGER;if(i===br)return e.RG;if(i===wu)return e.RG_INTEGER;if(i===Tu)return e.RGBA_INTEGER;if(i===Ha||i===Va||i===$a||i===Wa)if(o===ht)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ha)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Va)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===$a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Wa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ha)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Va)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===$a)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Wa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Eu||i===Au||i===Ru||i===Cu)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Eu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Au)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ru)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Cu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Iu||i===Pu||i===Lu||i===Nu||i===Du||i===Za||i===Ou)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Iu||i===Pu)return o===ht?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Lu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Nu)return s.COMPRESSED_R11_EAC;if(i===Du)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Za)return s.COMPRESSED_RG11_EAC;if(i===Ou)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Uu||i===Fu||i===zu||i===ku||i===Bu||i===Gu||i===Hu||i===Vu||i===$u||i===Wu||i===Zu||i===Xu||i===qu||i===Yu)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Uu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Fu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===zu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ku)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Bu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Gu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Hu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Vu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===$u)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Wu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Zu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Xu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===qu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Yu)return o===ht?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===ju||i===Ju||i===Ku)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(i===ju)return o===ht?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ju)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ku)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Qu||i===eh||i===Xa||i===th)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(i===Qu)return s.COMPRESSED_RED_RGTC1_EXT;if(i===eh)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Xa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===th)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===os)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}var RA=`
void main() {
gl_Position = vec4( position, 1.0 );
-}`,LT=`
+}`,CA=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -4173,4 +4166,4 @@ void main() {
}
-}`;class n0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Fa(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new Mn({vertexShader:PT,fragmentShader:LT,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new pt(new to(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class i0 extends zn{constructor(e,t){super();let n=this,i=null,r=1,s=null,o="local-floor",a=1,c=null,l=null,u=null,f=null,h=null,d=null,g=typeof XRWebGLBinding<"u",y=new n0,p={},m=t.getContextAttributes(),A=null,T=null,v=[],w=[],E=new Ie,R=null,_=new Lt;_.viewport=new st;let S=new Lt;S.viewport=new st;let F=[_,S],C=new Fu,z=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=v[Z];if(ne===void 0)ne=new Xs,v[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=v[Z];if(ne===void 0)ne=new Xs,v[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=v[Z];if(ne===void 0)ne=new Xs,v[Z]=ne;return ne.getHandSpace()};function O(Z){let ne=w.indexOf(Z.inputSource);if(ne===-1)return;let fe=v[ne];if(fe!==void 0)fe.update(Z.inputSource,Z.frame,c||s),fe.dispatchEvent({type:Z.type,data:Z.inputSource})}function H(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",V);for(let Z=0;Z<v.length;Z++){let ne=w[Z];if(ne===null)continue;w[Z]=null,v[Z].disconnect(ne)}z=null,J=null,y.reset();for(let Z in p)delete p[Z];e.setRenderTarget(A),h=null,f=null,u=null,i=null,T=null,Ge.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(E.width,E.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(r=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(o=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){if(u===null&&g)u=new XRWebGLBinding(i,t);return u},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",O),i.addEventListener("selectstart",O),i.addEventListener("selectend",O),i.addEventListener("squeeze",O),i.addEventListener("squeezestart",O),i.addEventListener("squeezeend",O),i.addEventListener("end",H),i.addEventListener("inputsourceschange",V),m.xrCompatible!==!0)await t.makeXRCompatible();if(R=e.getPixelRatio(),e.getSize(E),!(g&&("createProjectionLayer"in XRWebGLBinding.prototype))){let fe={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:h}),e.setPixelRatio(1),e.setSize(h.framebufferWidth,h.framebufferHeight,!1),T=new Sn(h.framebufferWidth,h.framebufferHeight,{format:Jn,type:Fn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{let fe=null,de=null,Re=null;if(m.depth)Re=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=m.stencil?dr:fr,de=m.stencil?Kr:Oi;let Ze={colorFormat:t.RGBA8,depthFormat:Re,scaleFactor:r};u=this.getBinding(),f=u.createProjectionLayer(Ze),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),T=new Sn(f.textureWidth,f.textureHeight,{format:Jn,type:Fn,depthTexture:new Bi(f.textureWidth,f.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(a),c=null,s=await i.requestReferenceSpace(o),Ge.setContext(i),Ge.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function V(Z){for(let ne=0;ne<Z.removed.length;ne++){let fe=Z.removed[ne],de=w.indexOf(fe);if(de>=0)w[de]=null,v[de].disconnect(fe)}for(let ne=0;ne<Z.added.length;ne++){let fe=Z.added[ne],de=w.indexOf(fe);if(de===-1){for(let Ze=0;Ze<v.length;Ze++)if(Ze>=w.length){w.push(fe),de=Ze;break}else if(w[Ze]===null){w[Ze]=fe,de=Ze;break}if(de===-1)break}let Re=v[de];if(Re)Re.connect(fe)}}let U=new N,K=new N;function Q(Z,ne,fe){U.setFromMatrixPosition(ne.matrixWorld),K.setFromMatrixPosition(fe.matrixWorld);let de=U.distanceTo(K),Re=ne.projectionMatrix.elements,Ze=fe.projectionMatrix.elements,Oe=Re[14]/(Re[10]-1),ke=Re[14]/(Re[10]+1),Ke=(Re[9]+1)/Re[5],Ye=(Re[9]-1)/Re[5],Je=(Re[8]-1)/Re[0],Ft=(Ze[8]+1)/Ze[0],gn=Oe*Je,mt=Oe*Ft,Ht=de/(-Je+Ft),zt=Ht*-Je;if(ne.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(zt),Z.translateZ(Ht),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Re[10]===-1)Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{let Pt=Oe+Ht,L=ke+Ht,_n=gn-zt,nt=mt+(de-zt),gt=Ke*ke/L*Pt,M=Ye*ke/L*Pt;Z.projectionMatrix.makePerspective(_n,nt,gt,M,Pt,L),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function se(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:fe}=Z;if(y.texture!==null){if(y.depthNear>0)ne=y.depthNear;if(y.depthFar>0)fe=y.depthFar}if(C.near=S.near=_.near=ne,C.far=S.far=_.far=fe,z!==C.near||J!==C.far)i.updateRenderState({depthNear:C.near,depthFar:C.far}),z=C.near,J=C.far;C.layers.mask=Z.layers.mask|6,_.layers.mask=C.layers.mask&-5,S.layers.mask=C.layers.mask&-3;let de=Z.parent,Re=C.cameras;se(C,de);for(let Ze=0;Ze<Re.length;Ze++)se(Re[Ze],de);if(Re.length===2)Q(C,_,S);else C.projectionMatrix.copy(_.projectionMatrix);me(Z,C,de)};function me(Z,ne,fe){if(fe===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(fe.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=cr*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return C},this.getFoveation=function(){if(f===null&&h===null)return;return a},this.setFoveation=function(Z){if(a=Z,f!==null)f.fixedFoveation=Z;if(h!==null&&h.fixedFoveation!==void 0)h.fixedFoveation=Z},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(C)},this.getCameraTexture=function(Z){return p[Z]};let _e=null;function qe(Z,ne){if(l=ne.getViewerPose(c||s),d=ne,l!==null){let fe=l.views;if(h!==null)e.setRenderTargetFramebuffer(T,h.framebuffer),e.setRenderTarget(T);let de=!1;if(fe.length!==C.cameras.length)C.cameras.length=0,de=!0;for(let ke=0;ke<fe.length;ke++){let Ke=fe[ke],Ye=null;if(h!==null)Ye=h.getViewport(Ke);else{let Ft=u.getViewSubImage(f,Ke);if(Ye=Ft.viewport,ke===0)e.setRenderTargetTextures(T,Ft.colorTexture,Ft.depthStencilTexture),e.setRenderTarget(T)}let Je=F[ke];if(Je===void 0)Je=new Lt,Je.layers.enable(ke),Je.viewport=new st,F[ke]=Je;if(Je.matrix.fromArray(Ke.transform.matrix),Je.matrix.decompose(Je.position,Je.quaternion,Je.scale),Je.projectionMatrix.fromArray(Ke.projectionMatrix),Je.projectionMatrixInverse.copy(Je.projectionMatrix).invert(),Je.viewport.set(Ye.x,Ye.y,Ye.width,Ye.height),ke===0)C.matrix.copy(Je.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale);if(de===!0)C.cameras.push(Je)}let Re=i.enabledFeatures;if(Re&&Re.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&g){u=n.getBinding();let ke=u.getDepthInformation(fe[0]);if(ke&&ke.isValid&&ke.texture)y.init(ke,i.renderState)}if(Re&&Re.includes("camera-access")&&g){e.state.unbindTexture(),u=n.getBinding();for(let ke=0;ke<fe.length;ke++){let Ke=fe[ke].camera;if(Ke){let Ye=p[Ke];if(!Ye)Ye=new Fa,p[Ke]=Ye;let Je=u.getCameraImage(Ke);Ye.sourceTexture=Je}}}}for(let fe=0;fe<v.length;fe++){let de=w[fe],Re=v[fe];if(de!==null&&Re!==void 0)Re.update(de,ne,c||s)}if(_e)_e(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});d=null}let Ge=new $_;Ge.setAnimationLoop(qe),this.setAnimationLoop=function(Z){_e=Z},this.dispose=function(){}}}var NT=new ze,r0=new Ue;r0.set(-1,0,0,0,1,0,0,0,1);function DT(e,t){function n(p,m){if(p.matrixAutoUpdate===!0)p.updateMatrix();m.value.copy(p.matrix)}function i(p,m){if(m.color.getRGB(p.fogColor.value,Au(e)),m.isFog)p.fogNear.value=m.near,p.fogFar.value=m.far;else if(m.isFogExp2)p.fogDensity.value=m.density}function r(p,m,A,T,v){if(m.isNodeMaterial)m.uniformsNeedUpdate=!1;else if(m.isMeshBasicMaterial)s(p,m);else if(m.isMeshLambertMaterial){if(s(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshToonMaterial)s(p,m),f(p,m);else if(m.isMeshPhongMaterial){if(s(p,m),u(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshStandardMaterial){if(s(p,m),h(p,m),m.isMeshPhysicalMaterial)d(p,m,v)}else if(m.isMeshMatcapMaterial)s(p,m),g(p,m);else if(m.isMeshDepthMaterial)s(p,m);else if(m.isMeshDistanceMaterial)s(p,m),y(p,m);else if(m.isMeshNormalMaterial)s(p,m);else if(m.isLineBasicMaterial){if(o(p,m),m.isLineDashedMaterial)a(p,m)}else if(m.isPointsMaterial)c(p,m,A,T);else if(m.isSpriteMaterial)l(p,m);else if(m.isShadowMaterial)p.color.value.copy(m.color),p.opacity.value=m.opacity;else if(m.isShaderMaterial)m.uniformsNeedUpdate=!1}function s(p,m){if(p.opacity.value=m.opacity,m.color)p.diffuse.value.copy(m.color);if(m.emissive)p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity);if(m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.bumpMap){if(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Yt)p.bumpScale.value*=-1}if(m.normalMap){if(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Yt)p.normalScale.value.negate()}if(m.displacementMap)p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias;if(m.emissiveMap)p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform);if(m.specularMap)p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest;let A=t.get(m),{envMap:T,envMapRotation:v}=A;if(T){if(p.envMap.value=T,p.envMapRotation.value.setFromMatrix4(NT.makeRotationFromEuler(v)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(r0);p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio}if(m.lightMap)p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform);if(m.aoMap)p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform)}function o(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map)p.map.value=m.map,n(m.map,p.mapTransform)}function a(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function c(p,m,A,T){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*A,p.scale.value=T*0.5,m.map)p.map.value=m.map,n(m.map,p.uvTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function l(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function u(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,0.0001)}function f(p,m){if(m.gradientMap)p.gradientMap.value=m.gradientMap}function h(p,m){if(p.metalness.value=m.metalness,m.metalnessMap)p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=m.roughness,m.roughnessMap)p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform);if(m.envMap)p.envMapIntensity.value=m.envMapIntensity}function d(p,m,A){if(p.ior.value=m.ior,m.sheen>0){if(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap)p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform);if(m.sheenRoughnessMap)p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(m.clearcoat>0){if(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap)p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform);if(m.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(m.clearcoatNormalMap){if(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Yt)p.clearcoatNormalScale.value.negate()}}if(m.dispersion>0)p.dispersion.value=m.dispersion;if(m.iridescence>0){if(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap)p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform);if(m.iridescenceThicknessMap)p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(m.transmission>0){if(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),m.transmissionMap)p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=m.thickness,m.thicknessMap)p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)}if(m.anisotropy>0){if(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap)p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap)p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform);if(m.specularIntensityMap)p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform)}function g(p,m){if(m.matcap)p.matcap.value=m.matcap}function y(p,m){let A=t.get(m).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function UT(e,t,n,i){let r={},s={},o=[],a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(v,w){let E=w.program;i.uniformBlockBinding(v,E)}function l(v,w){let E=r[v.id];if(E===void 0)p(v),E=u(v),r[v.id]=E,v.addEventListener("dispose",A);let R=w.program;i.updateUBOMapping(v,R);let _=t.render.frame;if(s[v.id]!==_)h(v),s[v.id]=_}function u(v){let w=f();v.__bindingPointIndex=w;let E=e.createBuffer(),{__size:R,usage:_}=v;return e.bindBuffer(e.UNIFORM_BUFFER,E),e.bufferData(e.UNIFORM_BUFFER,R,_),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,w,E),E}function f(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return Ne("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(v){let w=r[v.id],{uniforms:E,__cache:R}=v;e.bindBuffer(e.UNIFORM_BUFFER,w);for(let _=0,S=E.length;_<S;_++){let F=E[_];if(Array.isArray(F))for(let C=0,z=F.length;C<z;C++)d(F[C],_,C,R);else d(F,_,0,R)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function d(v,w,E,R){if(y(v,w,E,R)===!0){let{__offset:_,value:S}=v;if(Array.isArray(S)){let F=0;for(let C=0;C<S.length;C++){let z=S[C],J=m(z);if(g(z,v.__data,F),typeof z!=="number"&&typeof z!=="boolean"&&!z.isMatrix3&&!ArrayBuffer.isView(z))F+=J.storage/Float32Array.BYTES_PER_ELEMENT}}else g(S,v.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,_,v.__data)}}function g(v,w,E){if(typeof v==="number"||typeof v==="boolean")w[0]=v;else if(v.isMatrix3)w[0]=v.elements[0],w[1]=v.elements[1],w[2]=v.elements[2],w[3]=0,w[4]=v.elements[3],w[5]=v.elements[4],w[6]=v.elements[5],w[7]=0,w[8]=v.elements[6],w[9]=v.elements[7],w[10]=v.elements[8],w[11]=0;else if(ArrayBuffer.isView(v))w.set(new v.constructor(v.buffer,v.byteOffset,w.length));else v.toArray(w,E)}function y(v,w,E,R){let _=v.value,S=w+"_"+E;if(R[S]===void 0){if(typeof _==="number"||typeof _==="boolean")R[S]=_;else if(ArrayBuffer.isView(_))R[S]=_.slice();else R[S]=_.clone();return!0}else{let F=R[S];if(typeof _==="number"||typeof _==="boolean"){if(F!==_)return R[S]=_,!0}else if(ArrayBuffer.isView(_))return!0;else if(F.equals(_)===!1)return F.copy(_),!0}return!1}function p(v){let w=v.uniforms,E=0,R=16;for(let S=0,F=w.length;S<F;S++){let C=Array.isArray(w[S])?w[S]:[w[S]];for(let z=0,J=C.length;z<J;z++){let O=C[z],H=Array.isArray(O.value)?O.value:[O.value];for(let V=0,U=H.length;V<U;V++){let K=H[V],Q=m(K),se=E%R,me=se%Q.boundary,_e=se+me;if(E+=me,_e!==0&&R-_e<Q.storage)E+=R-_e;O.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=E,E+=Q.storage}}}let _=E%R;if(_>0)E+=R-_;return v.__size=E,v.__cache={},this}function m(v){let w={boundary:0,storage:0};if(typeof v==="number"||typeof v==="boolean")w.boundary=4,w.storage=4;else if(v.isVector2)w.boundary=8,w.storage=8;else if(v.isVector3||v.isColor)w.boundary=16,w.storage=12;else if(v.isVector4)w.boundary=16,w.storage=16;else if(v.isMatrix3)w.boundary=48,w.storage=48;else if(v.isMatrix4)w.boundary=64,w.storage=64;else if(v.isTexture)Me("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(v))w.boundary=16,w.storage=v.byteLength;else Me("WebGLRenderer: Unsupported uniform value type.",v);return w}function A(v){let w=v.target;w.removeEventListener("dispose",A);let E=o.indexOf(w.__bindingPointIndex);o.splice(E,1),e.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function T(){for(let v in r)e.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:c,update:l,dispose:T}}var OT=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Qn=null;function FT(){if(Qn===null)Qn=new js(OT,16,16,pr,pi),Qn.name="DFG_LUT",Qn.minFilter=Gt,Qn.magFilter=Gt,Qn.wrapS=jr,Qn.wrapT=jr,Qn.generateMipmaps=!1,Qn.needsUpdate=!0;return Qn}class Qu{constructor(e={}){let{canvas:t=h_(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:c=!1,powerPreference:l="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!1,outputBufferType:h=Fn}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=s;let g=h,y=new Set([kl,zl,Fl]),p=new Set([Fn,Oi,Vs,Kr,Ul,Ol]),m=new Uint32Array(4),A=new Int32Array(4),T=new N,v=null,w=null,E=[],R=[],_=null;this.domElement=t,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=Un,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let S=this,F=!1,C=null,z=null,J=null,O=null;this._outputColorSpace=Fi;let H=0,V=0,U=null,K=-1,Q=null,se=new st,me=new st,_e=null,qe=new Le(0),Ge=0,{width:Z,height:ne}=t,fe=1,de=null,Re=null,Ze=new st(0,0,Z,ne),Oe=new st(0,0,Z,ne),ke=!1,Ke=new Ks,Ye=!1,Je=!1,Ft=new ze,gn=new N,mt=new st,Ht={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},zt=!1;function Pt(){return U===null?fe:1}let L=n;function _n(b,D){return t.getContext(b,D)}try{let b={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${_g}`);if(t.addEventListener("webglcontextlost",Fe,!1),t.addEventListener("webglcontextrestored",St,!1),t.addEventListener("webglcontextcreationerror",ft,!1),L===null){if(L=_n("webgl2",b),L===null)if(_n("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(b){throw Ne("WebGLRenderer: "+b.message),b}let nt,gt,M,x,I,W,te,ie,le,X,j,xe,we,ue,re,Ce,Pe,et,P,oe,Y,ae,ve;function ee(){if(nt=new WM(L),nt.init(),Y=new IT(L,nt),gt=new OM(L,nt,e,Y),M=new RT(L,nt),gt.reversedDepthBuffer&&f)M.buffers.depth.setReversed(!0);z=L.createFramebuffer(),J=L.createFramebuffer(),O=L.createFramebuffer(),x=new XM(L),I=new pT,W=new CT(L,nt,M,I,gt,Y,x),te=new VM(S),ie=new Jy(L),ae=new DM(L,ie),le=new $M(L,ie,x,ae),X=new YM(L,le,ie,ae,x),et=new qM(L,gt,W),re=new FM(I),j=new dT(S,te,nt,gt,ae,re),xe=new DT(S,I),we=new gT,ue=new ST(nt),Pe=new NM(S,te,M,X,d,a),Ce=new AT(S,X,gt),ve=new UT(L,x,gt,M),P=new UM(L,nt,x),oe=new ZM(L,nt,x),x.programs=j.programs,S.capabilities=gt,S.extensions=nt,S.properties=I,S.renderLists=we,S.shadowMap=Ce,S.state=M,S.info=x}if(ee(),g!==Fn)_=new JM(g,t.width,t.height,o,i,r);let ce=new i0(S,L);this.xr=ce,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let b=nt.get("WEBGL_lose_context");if(b)b.loseContext()},this.forceContextRestore=function(){let b=nt.get("WEBGL_lose_context");if(b)b.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(b){if(b===void 0)return;fe=b,this.setSize(Z,ne,!1)},this.getSize=function(b){return b.set(Z,ne)},this.setSize=function(b,D,G=!0){if(ce.isPresenting){Me("WebGLRenderer: Can't change size while VR device is presenting.");return}if(Z=b,ne=D,t.width=Math.floor(b*fe),t.height=Math.floor(D*fe),G===!0)t.style.width=b+"px",t.style.height=D+"px";if(_!==null)_.setSize(t.width,t.height);this.setViewport(0,0,b,D)},this.getDrawingBufferSize=function(b){return b.set(Z*fe,ne*fe).floor()},this.setDrawingBufferSize=function(b,D,G){Z=b,ne=D,fe=G,t.width=Math.floor(b*G),t.height=Math.floor(D*G),this.setViewport(0,0,b,D)},this.setEffects=function(b){if(g===Fn){Ne("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(b){for(let D=0;D<b.length;D++)if(b[D].isOutputPass===!0){Me("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(b||[])},this.getCurrentViewport=function(b){return b.copy(se)},this.getViewport=function(b){return b.copy(Ze)},this.setViewport=function(b,D,G,k){if(b.isVector4)Ze.set(b.x,b.y,b.z,b.w);else Ze.set(b,D,G,k);M.viewport(se.copy(Ze).multiplyScalar(fe).round())},this.getScissor=function(b){return b.copy(Oe)},this.setScissor=function(b,D,G,k){if(b.isVector4)Oe.set(b.x,b.y,b.z,b.w);else Oe.set(b,D,G,k);M.scissor(me.copy(Oe).multiplyScalar(fe).round())},this.getScissorTest=function(){return ke},this.setScissorTest=function(b){M.setScissorTest(ke=b)},this.setOpaqueSort=function(b){de=b},this.setTransparentSort=function(b){Re=b},this.getClearColor=function(b){return b.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor(...arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha(...arguments)},this.clear=function(b=!0,D=!0,G=!0){let k=0;if(b){let B=!1;if(U!==null){let ge=U.texture.format;B=y.has(ge)}if(B){let ge=U.texture.type,be=p.has(ge),pe=Pe.getClearColor(),Se=Pe.getClearAlpha(),{r:Ee,g:Be,b:Ve}=pe;if(be)m[0]=Ee,m[1]=Be,m[2]=Ve,m[3]=Se,L.clearBufferuiv(L.COLOR,0,m);else A[0]=Ee,A[1]=Be,A[2]=Ve,A[3]=Se,L.clearBufferiv(L.COLOR,0,A)}else k|=L.COLOR_BUFFER_BIT}if(D)k|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(G)k|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(k!==0)L.clear(k)},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.setNodesHandler=function(b){b.setRenderer(this),C=b},this.dispose=function(){t.removeEventListener("webglcontextlost",Fe,!1),t.removeEventListener("webglcontextrestored",St,!1),t.removeEventListener("webglcontextcreationerror",ft,!1),Pe.dispose(),we.dispose(),ue.dispose(),I.dispose(),te.dispose(),X.dispose(),ae.dispose(),ve.dispose(),j.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",_h),ce.removeEventListener("sessionend",xh),ji.stop()};function Fe(b){b.preventDefault(),zs("WebGLRenderer: Context Lost."),F=!0}function St(){zs("WebGLRenderer: Context Restored."),F=!1;let b=x.autoReset,D=Ce.enabled,G=Ce.autoUpdate,k=Ce.needsUpdate,B=Ce.type;ee(),x.autoReset=b,Ce.enabled=D,Ce.autoUpdate=G,Ce.needsUpdate=k,Ce.type=B}function ft(b){Ne("WebGLRenderer: A WebGL context could not be created. Reason: ",b.statusMessage)}function kn(b){let D=b.target;D.removeEventListener("dispose",kn),ni(D)}function ni(b){X0(b),I.remove(b)}function X0(b){let D=I.get(b).programs;if(D!==void 0){if(D.forEach(function(G){j.releaseProgram(G)}),b.isShaderMaterial)j.releaseShaderCache(b)}}this.renderBufferDirect=function(b,D,G,k,B,ge){if(D===null)D=Ht;let be=B.isMesh&&B.matrixWorld.determinantAffine()<0,pe=j0(b,D,G,k,B);M.setMaterial(k,be);let Se=G.index,Ee=1;if(k.wireframe===!0){if(Se=le.getWireframeAttribute(G),Se===void 0)return;Ee=2}let Be=G.drawRange,Ve=G.attributes.position,Ae=Be.start*Ee,ot=(Be.start+Be.count)*Ee;if(ge!==null)Ae=Math.max(Ae,ge.start*Ee),ot=Math.min(ot,(ge.start+ge.count)*Ee);if(Se!==null)Ae=Math.max(Ae,0),ot=Math.min(ot,Se.count);else if(Ve!==void 0&&Ve!==null)Ae=Math.max(Ae,0),ot=Math.min(ot,Ve.count);let Tt=ot-Ae;if(Tt<0||Tt===1/0)return;ae.setup(B,k,pe,G,Se);let Mt,lt=P;if(Se!==null)Mt=ie.get(Se),lt=oe,lt.setIndex(Mt);if(B.isMesh)if(k.wireframe===!0)M.setLineWidth(k.wireframeLinewidth*Pt()),lt.setMode(L.LINES);else lt.setMode(L.TRIANGLES);else if(B.isLine){let $t=k.linewidth;if($t===void 0)$t=1;if(M.setLineWidth($t*Pt()),B.isLineSegments)lt.setMode(L.LINES);else if(B.isLineLoop)lt.setMode(L.LINE_LOOP);else lt.setMode(L.LINE_STRIP)}else if(B.isPoints)lt.setMode(L.POINTS);else if(B.isSprite)lt.setMode(L.TRIANGLES);if(B.isBatchedMesh)if(!nt.get("WEBGL_multi_draw")){let{_multiDrawStarts:$t,_multiDrawCounts:ye,_multiDrawCount:on}=B,Qe=Se?ie.get(Se).bytesPerElement:1,xn=I.get(k).currentProgram.getUniforms();for(let Bn=0;Bn<on;Bn++)xn.setValue(L,"_gl_DrawID",Bn),lt.render($t[Bn]/Qe,ye[Bn])}else lt.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else if(B.isInstancedMesh)lt.renderInstances(Ae,Tt,B.count);else if(G.isInstancedBufferGeometry){let $t=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,ye=Math.min(G.instanceCount,$t);lt.renderInstances(Ae,Tt,ye)}else lt.render(Ae,Tt)};function gh(b,D,G){if(b.transparent===!0&&b.side===bn&&b.forceSinglePass===!1)b.side=Yt,b.needsUpdate=!0,xo(b,D,G),b.side=Ui,b.needsUpdate=!0,xo(b,D,G),b.side=bn;else xo(b,D,G)}this.compile=function(b,D,G=null){if(G===null)G=b;if(w=ue.get(G),w.init(D),R.push(w),G.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}}),b!==G)b.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}});w.setupLights();let k=new Set;return b.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;let ge=B.material;if(ge)if(Array.isArray(ge))for(let be=0;be<ge.length;be++){let pe=ge[be];gh(pe,G,B),k.add(pe)}else gh(ge,G,B),k.add(ge)}),w=R.pop(),k},this.compileAsync=function(b,D,G=null){let k=this.compile(b,D,G);return new Promise((B)=>{function ge(){if(k.forEach(function(be){if(I.get(be).currentProgram.isReady())k.delete(be)}),k.size===0){B(b);return}setTimeout(ge,10)}if(nt.get("KHR_parallel_shader_compile")!==null)ge();else setTimeout(ge,10)})};let nc=null;function q0(b){if(nc)nc(b)}function _h(){ji.stop()}function xh(){ji.start()}let ji=new $_;if(ji.setAnimationLoop(q0),typeof self<"u")ji.setContext(self);this.setAnimationLoop=function(b){nc=b,ce.setAnimationLoop(b),b===null?ji.stop():ji.start()},ce.addEventListener("sessionstart",_h),ce.addEventListener("sessionend",xh),this.render=function(b,D){if(D!==void 0&&D.isCamera!==!0){Ne("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;if(C!==null)C.renderStart(b,D);let G=ce.enabled===!0&&ce.isPresenting===!0,k=_!==null&&(U===null||G)&&_.begin(S,U);if(b.matrixWorldAutoUpdate===!0)b.updateMatrixWorld();if(D.parent===null&&D.matrixWorldAutoUpdate===!0)D.updateMatrixWorld();if(ce.enabled===!0&&ce.isPresenting===!0&&(_===null||_.isCompositing()===!1)){if(ce.cameraAutoUpdate===!0)ce.updateCamera(D);D=ce.getCamera()}if(b.isScene===!0)b.onBeforeRender(S,b,D,U);if(w=ue.get(b,R.length),w.init(D),w.state.textureUnits=W.getTextureUnits(),R.push(w),Ft.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Ke.setFromProjectionMatrix(Ft,bu,D.reversedDepth),Je=this.localClippingEnabled,Ye=re.init(this.clippingPlanes,Je),v=we.get(b,E.length),v.init(),E.push(v),ce.enabled===!0&&ce.isPresenting===!0){let be=S.xr.getDepthSensingMesh();if(be!==null)ic(be,D,-1/0,S.sortObjects)}if(ic(b,D,0,S.sortObjects),v.finish(),S.sortObjects===!0)v.sort(de,Re,D.reversedDepth);if(zt=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,zt)Pe.addToRenderList(v,b);if(this.info.render.frame++,this.info.autoReset===!0)this.info.reset();if(Ye===!0)re.beginShadows();let B=w.state.shadowsArray;if(Ce.render(B,b,D),Ye===!0)re.endShadows();if((k&&_.hasRenderPass())===!1){let be=v.opaque,pe=v.transmissive;if(w.setupLights(),D.isArrayCamera){let Se=D.cameras;if(pe.length>0)for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee];yh(be,pe,b,Ve)}if(zt)Pe.render(b);for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee];vh(v,b,Ve,Ve.viewport)}}else{if(pe.length>0)yh(be,pe,b,D);if(zt)Pe.render(b);vh(v,b,D)}}if(U!==null&&V===0)W.updateMultisampleRenderTarget(U),W.updateRenderTargetMipmap(U);if(k)_.end(S);if(b.isScene===!0)b.onAfterRender(S,b,D);if(ae.resetDefaultState(),K=-1,Q=null,R.pop(),R.length>0){if(w=R[R.length-1],W.setTextureUnits(w.state.textureUnits),Ye===!0)re.setGlobalState(S.clippingPlanes,w.state.camera)}else w=null;if(E.pop(),E.length>0)v=E[E.length-1];else v=null;if(C!==null)C.renderEnd()};function ic(b,D,G,k){if(b.visible===!1)return;if(b.layers.test(D.layers)){if(b.isGroup)G=b.renderOrder;else if(b.isLOD){if(b.autoUpdate===!0)b.update(D)}else if(b.isLightProbeGrid)w.pushLightProbeGrid(b);else if(b.isLight){if(w.pushLight(b),b.castShadow)w.pushShadow(b)}else if(b.isSprite){if(!b.frustumCulled||Ke.intersectsSprite(b)){if(k)mt.setFromMatrixPosition(b.matrixWorld).applyMatrix4(Ft);let be=X.update(b),pe=b.material;if(pe.visible)v.push(b,be,pe,G,mt.z,null)}}else if(b.isMesh||b.isLine||b.isPoints){if(!b.frustumCulled||Ke.intersectsObject(b)){let be=X.update(b),pe=b.material;if(k){if(b.boundingSphere!==void 0){if(b.boundingSphere===null)b.computeBoundingSphere();mt.copy(b.boundingSphere.center)}else{if(be.boundingSphere===null)be.computeBoundingSphere();mt.copy(be.boundingSphere.center)}mt.applyMatrix4(b.matrixWorld).applyMatrix4(Ft)}if(Array.isArray(pe)){let Se=be.groups;for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee],Ae=pe[Ve.materialIndex];if(Ae&&Ae.visible)v.push(b,be,Ae,G,mt.z,Ve)}}else if(pe.visible)v.push(b,be,pe,G,mt.z,null)}}}let ge=b.children;for(let be=0,pe=ge.length;be<pe;be++)ic(ge[be],D,G,k)}function vh(b,D,G,k){let{opaque:B,transmissive:ge,transparent:be}=b;if(w.setupLightsView(G),Ye===!0)re.setGlobalState(S.clippingPlanes,G);if(k)M.viewport(se.copy(k));if(B.length>0)_o(B,D,G);if(ge.length>0)_o(ge,D,G);if(be.length>0)_o(be,D,G);M.buffers.depth.setTest(!0),M.buffers.depth.setMask(!0),M.buffers.color.setMask(!0),M.setPolygonOffset(!1)}function yh(b,D,G,k){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(w.state.transmissionRenderTarget[k.id]===void 0){let Ae=nt.has("EXT_color_buffer_half_float")||nt.has("EXT_color_buffer_float");w.state.transmissionRenderTarget[k.id]=new Sn(1,1,{generateMipmaps:!0,type:Ae?pi:Fn,minFilter:jn,samples:Math.max(4,gt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:We.workingColorSpace})}let ge=w.state.transmissionRenderTarget[k.id],be=k.viewport||se;ge.setSize(be.z*S.transmissionResolutionScale,be.w*S.transmissionResolutionScale);let pe=S.getRenderTarget(),Se=S.getActiveCubeFace(),Ee=S.getActiveMipmapLevel();if(S.setRenderTarget(ge),S.getClearColor(qe),Ge=S.getClearAlpha(),Ge<1)S.setClearColor(16777215,0.5);if(S.clear(),zt)Pe.render(G);let Be=S.toneMapping;S.toneMapping=Un;let Ve=k.viewport;if(k.viewport!==void 0)k.viewport=void 0;if(w.setupLightsView(k),Ye===!0)re.setGlobalState(S.clippingPlanes,k);if(_o(b,G,k),W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge),nt.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let ot=0,Tt=D.length;ot<Tt;ot++){let Mt=D[ot],{object:lt,geometry:$t,material:ye,group:on}=Mt;if(ye.side===bn&&lt.layers.test(k.layers)){let Qe=ye.side;ye.side=Yt,ye.needsUpdate=!0,bh(lt,G,k,$t,ye,on),ye.side=Qe,ye.needsUpdate=!0,Ae=!0}}if(Ae===!0)W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge)}if(S.setRenderTarget(pe,Se,Ee),S.setClearColor(qe,Ge),Ve!==void 0)k.viewport=Ve;S.toneMapping=Be}function _o(b,D,G){let k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,ge=b.length;B<ge;B++){let be=b[B],{object:pe,geometry:Se,group:Ee}=be,Be=be.material;if(Be.allowOverride===!0&&k!==null)Be=k;if(pe.layers.test(G.layers))bh(pe,D,G,Se,Be,Ee)}}function bh(b,D,G,k,B,ge){if(b.onBeforeRender(S,D,G,k,B,ge),b.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,b.matrixWorld),b.normalMatrix.getNormalMatrix(b.modelViewMatrix),B.onBeforeRender(S,D,G,k,b,ge),B.transparent===!0&&B.side===bn&&B.forceSinglePass===!1)B.side=Yt,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=Ui,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=bn;else S.renderBufferDirect(G,D,k,B,b,ge);b.onAfterRender(S,D,G,k,B,ge)}function xo(b,D,G){if(D.isScene!==!0)D=Ht;let k=I.get(b),B=w.state.lights,ge=w.state.shadowsArray,be=B.state.version,pe=j.getParameters(b,B.state,ge,D,G,w.state.lightProbeGridArray),Se=j.getProgramCacheKey(pe),Ee=k.programs;k.environment=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?D.environment:null,k.fog=D.fog;let Be=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap;if(k.envMap=te.get(b.envMap||k.environment,Be),k.envMapRotation=k.environment!==null&&b.envMap===null?D.environmentRotation:b.envMapRotation,Ee===void 0)b.addEventListener("dispose",kn),Ee=new Map,k.programs=Ee;let Ve=Ee.get(Se);if(Ve!==void 0){if(k.currentProgram===Ve&&k.lightsStateVersion===be)return Mh(b,pe),Ve}else{if(pe.uniforms=j.getUniforms(b),C!==null&&b.isNodeMaterial)C.build(b,G,pe);b.onBeforeCompile(pe,S),Ve=j.acquireProgram(pe,Se),Ee.set(Se,Ve),k.uniforms=pe.uniforms}let Ae=k.uniforms;if(!b.isShaderMaterial&&!b.isRawShaderMaterial||b.clipping===!0)Ae.clippingPlanes=re.uniform;if(Mh(b,pe),k.needsLights=K0(b),k.lightsStateVersion=be,k.needsLights)Ae.ambientLightColor.value=B.state.ambient,Ae.lightProbe.value=B.state.probe,Ae.directionalLights.value=B.state.directional,Ae.directionalLightShadows.value=B.state.directionalShadow,Ae.spotLights.value=B.state.spot,Ae.spotLightShadows.value=B.state.spotShadow,Ae.rectAreaLights.value=B.state.rectArea,Ae.ltc_1.value=B.state.rectAreaLTC1,Ae.ltc_2.value=B.state.rectAreaLTC2,Ae.pointLights.value=B.state.point,Ae.pointLightShadows.value=B.state.pointShadow,Ae.hemisphereLights.value=B.state.hemi,Ae.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Ae.spotLightMatrix.value=B.state.spotLightMatrix,Ae.spotLightMap.value=B.state.spotLightMap,Ae.pointShadowMatrix.value=B.state.pointShadowMatrix;return k.lightProbeGrid=w.state.lightProbeGridArray.length>0,k.currentProgram=Ve,k.uniformsList=null,Ve}function Sh(b){if(b.uniformsList===null){let D=b.currentProgram.getUniforms();b.uniformsList=co.seqWithValue(D.seq,b.uniforms)}return b.uniformsList}function Mh(b,D){let G=I.get(b);G.outputColorSpace=D.outputColorSpace,G.batching=D.batching,G.batchingColor=D.batchingColor,G.instancing=D.instancing,G.instancingColor=D.instancingColor,G.instancingMorph=D.instancingMorph,G.skinning=D.skinning,G.morphTargets=D.morphTargets,G.morphNormals=D.morphNormals,G.morphColors=D.morphColors,G.morphTargetsCount=D.morphTargetsCount,G.numClippingPlanes=D.numClippingPlanes,G.numIntersection=D.numClipIntersection,G.vertexAlphas=D.vertexAlphas,G.vertexTangents=D.vertexTangents,G.toneMapping=D.toneMapping}function Y0(b,D){if(b.length===0)return null;if(b.length===1)return b[0].texture!==null?b[0]:null;T.setFromMatrixPosition(D.matrixWorld);for(let G=0,k=b.length;G<k;G++){let B=b[G];if(B.texture!==null&&B.boundingBox.containsPoint(T))return B}return null}function j0(b,D,G,k,B){if(D.isScene!==!0)D=Ht;W.resetTextureUnits();let ge=D.fog,be=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?D.environment:null,pe=U===null?S.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:We.workingColorSpace,Se=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ee=te.get(k.envMap||be,Se),Be=k.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,Ve=!!G.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ae=!!G.morphAttributes.position,ot=!!G.morphAttributes.normal,Tt=!!G.morphAttributes.color,Mt=Un;if(k.toneMapped){if(U===null||U.isXRRenderTarget===!0)Mt=S.toneMapping}let lt=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,$t=lt!==void 0?lt.length:0,ye=I.get(k),on=w.state.lights;if(Ye===!0){if(Je===!0||b!==Q){let dt=b===Q&&k.id===K;re.setState(k,b,dt)}}let Qe=!1;if(k.version===ye.__version){if(ye.needsLights&&ye.lightsStateVersion!==on.state.version)Qe=!0;else if(ye.outputColorSpace!==pe)Qe=!0;else if(B.isBatchedMesh&&ye.batching===!1)Qe=!0;else if(!B.isBatchedMesh&&ye.batching===!0)Qe=!0;else if(B.isBatchedMesh&&ye.batchingColor===!0&&B.colorTexture===null)Qe=!0;else if(B.isBatchedMesh&&ye.batchingColor===!1&&B.colorTexture!==null)Qe=!0;else if(B.isInstancedMesh&&ye.instancing===!1)Qe=!0;else if(!B.isInstancedMesh&&ye.instancing===!0)Qe=!0;else if(B.isSkinnedMesh&&ye.skinning===!1)Qe=!0;else if(!B.isSkinnedMesh&&ye.skinning===!0)Qe=!0;else if(B.isInstancedMesh&&ye.instancingColor===!0&&B.instanceColor===null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingColor===!1&&B.instanceColor!==null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!0&&B.morphTexture===null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!1&&B.morphTexture!==null)Qe=!0;else if(ye.envMap!==Ee)Qe=!0;else if(k.fog===!0&&ye.fog!==ge)Qe=!0;else if(ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==re.numPlanes||ye.numIntersection!==re.numIntersection))Qe=!0;else if(ye.vertexAlphas!==Be)Qe=!0;else if(ye.vertexTangents!==Ve)Qe=!0;else if(ye.morphTargets!==Ae)Qe=!0;else if(ye.morphNormals!==ot)Qe=!0;else if(ye.morphColors!==Tt)Qe=!0;else if(ye.toneMapping!==Mt)Qe=!0;else if(ye.morphTargetsCount!==$t)Qe=!0;else if(!!ye.lightProbeGrid!==w.state.lightProbeGridArray.length>0)Qe=!0}else Qe=!0,ye.__version=k.version;let xn=ye.currentProgram;if(Qe===!0){if(xn=xo(k,D,B),C&&k.isNodeMaterial)C.onUpdateProgram(k,xn,ye)}let Bn=!1,xi=!1,wr=!1,ut=xn.getUniforms(),Et=ye.uniforms;if(M.useProgram(xn.program))Bn=!0,xi=!0,wr=!0;if(k.id!==K)K=k.id,xi=!0;if(ye.needsLights){let dt=Y0(w.state.lightProbeGridArray,B);if(ye.lightProbeGrid!==dt)ye.lightProbeGrid=dt,xi=!0}if(Bn||Q!==b){if(M.buffers.depth.getReversed()&&b.reversedDepth!==!0)b._reversedDepth=!0,b.updateProjectionMatrix();ut.setValue(L,"projectionMatrix",b.projectionMatrix),ut.setValue(L,"viewMatrix",b.matrixWorldInverse);let yi=ut.map.cameraPosition;if(yi!==void 0)yi.setValue(L,gn.setFromMatrixPosition(b.matrixWorld));if(gt.logarithmicDepthBuffer)ut.setValue(L,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2));if(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)ut.setValue(L,"isOrthographic",b.isOrthographicCamera===!0);if(Q!==b)Q=b,xi=!0,wr=!0}if(ye.needsLights){if(on.state.directionalShadowMap.length>0)ut.setValue(L,"directionalShadowMap",on.state.directionalShadowMap,W);if(on.state.spotShadowMap.length>0)ut.setValue(L,"spotShadowMap",on.state.spotShadowMap,W);if(on.state.pointShadowMap.length>0)ut.setValue(L,"pointShadowMap",on.state.pointShadowMap,W)}if(B.isSkinnedMesh){ut.setOptional(L,B,"bindMatrix"),ut.setOptional(L,B,"bindMatrixInverse");let dt=B.skeleton;if(dt){if(dt.boneTexture===null)dt.computeBoneTexture();ut.setValue(L,"boneTexture",dt.boneTexture,W)}}if(B.isBatchedMesh){if(ut.setOptional(L,B,"batchingTexture"),ut.setValue(L,"batchingTexture",B._matricesTexture,W),ut.setOptional(L,B,"batchingIdTexture"),ut.setValue(L,"batchingIdTexture",B._indirectTexture,W),ut.setOptional(L,B,"batchingColorTexture"),B._colorsTexture!==null)ut.setValue(L,"batchingColorTexture",B._colorsTexture,W)}let vi=G.morphAttributes;if(vi.position!==void 0||vi.normal!==void 0||vi.color!==void 0)et.update(B,G,xn);if(xi||ye.receiveShadow!==B.receiveShadow)ye.receiveShadow=B.receiveShadow,ut.setValue(L,"receiveShadow",B.receiveShadow);if((k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&D.environment!==null)Et.envMapIntensity.value=D.environmentIntensity;if(Et.dfgLUT!==void 0)Et.dfgLUT.value=FT();if(xi){if(ut.setValue(L,"toneMappingExposure",S.toneMappingExposure),ye.needsLights)J0(Et,wr);if(ge&&k.fog===!0)xe.refreshFogUniforms(Et,ge);if(xe.refreshMaterialUniforms(Et,k,fe,ne,w.state.transmissionRenderTarget[b.id]),ye.needsLights&&ye.lightProbeGrid){let dt=ye.lightProbeGrid;Et.probesSH.value=dt.texture,Et.probesMin.value.copy(dt.boundingBox.min),Et.probesMax.value.copy(dt.boundingBox.max),Et.probesResolution.value.copy(dt.resolution)}co.upload(L,Sh(ye),Et,W)}if(k.isShaderMaterial&&k.uniformsNeedUpdate===!0)co.upload(L,Sh(ye),Et,W),k.uniformsNeedUpdate=!1;if(k.isSpriteMaterial)ut.setValue(L,"center",B.center);if(ut.setValue(L,"modelViewMatrix",B.modelViewMatrix),ut.setValue(L,"normalMatrix",B.normalMatrix),ut.setValue(L,"modelMatrix",B.matrixWorld),k.uniformsGroups!==void 0){let dt=k.uniformsGroups;for(let yi=0,Tr=dt.length;yi<Tr;yi++){let wh=dt[yi];ve.update(wh,xn),ve.bind(wh,xn)}}return xn}function J0(b,D){b.ambientLightColor.needsUpdate=D,b.lightProbe.needsUpdate=D,b.directionalLights.needsUpdate=D,b.directionalLightShadows.needsUpdate=D,b.pointLights.needsUpdate=D,b.pointLightShadows.needsUpdate=D,b.spotLights.needsUpdate=D,b.spotLightShadows.needsUpdate=D,b.rectAreaLights.needsUpdate=D,b.hemisphereLights.needsUpdate=D}function K0(b){return b.isMeshLambertMaterial||b.isMeshToonMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isShadowMaterial||b.isShaderMaterial&&b.lights===!0}if(this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(b,D,G){let k=I.get(b);if(k.__autoAllocateDepthBuffer=b.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1)k.__useRenderToTexture=!1;I.get(b.texture).__webglTexture=D,I.get(b.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:G,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(b,D){let G=I.get(b);G.__webglFramebuffer=D,G.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(b,D=0,G=0){U=b,H=D,V=G;let k=null,B=!1,ge=!1;if(b){let pe=I.get(b);if(pe.__useDefaultFramebuffer!==void 0){M.bindFramebuffer(L.FRAMEBUFFER,pe.__webglFramebuffer),se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest,M.viewport(se),M.scissor(me),M.setScissorTest(_e),K=-1;return}else if(pe.__webglFramebuffer===void 0)W.setupRenderTarget(b);else if(pe.__hasExternalTextures)W.rebindTextures(b,I.get(b.texture).__webglTexture,I.get(b.depthTexture).__webglTexture);else if(b.depthBuffer){let Be=b.depthTexture;if(pe.__boundDepthTexture!==Be){if(Be!==null&&I.has(Be)&&(b.width!==Be.image.width||b.height!==Be.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");W.setupDepthRenderbuffer(b)}}let Se=b.texture;if(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)ge=!0;let Ee=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget){if(Array.isArray(Ee[D]))k=Ee[D][G];else k=Ee[D];B=!0}else if(b.samples>0&&W.useMultisampledRTT(b)===!1)k=I.get(b).__webglMultisampledFramebuffer;else if(Array.isArray(Ee))k=Ee[G];else k=Ee;se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest}else se.copy(Ze).multiplyScalar(fe).floor(),me.copy(Oe).multiplyScalar(fe).floor(),_e=ke;if(G!==0)k=z;if(M.bindFramebuffer(L.FRAMEBUFFER,k))M.drawBuffers(b,k);if(M.viewport(se),M.scissor(me),M.setScissorTest(_e),B){let pe=I.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+D,pe.__webglTexture,G)}else if(ge){let pe=D;for(let Se=0;Se<b.textures.length;Se++){let Ee=I.get(b.textures[Se]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Se,Ee.__webglTexture,G,pe)}}else if(b!==null&&G!==0){let pe=I.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,pe.__webglTexture,G)}K=-1},this.readRenderTargetPixels=function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se){M.bindFramebuffer(L.FRAMEBUFFER,Se);try{let Ee=b.textures[pe],{format:Be,type:Ve}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!gt.textureFormatReadable(Be)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!gt.textureTypeReadable(Ve)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B))L.readPixels(D,G,k,B,Y.convert(Be),Y.convert(Ve),ge)}finally{let Ee=U!==null?I.get(U).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se)if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B)){M.bindFramebuffer(L.FRAMEBUFFER,Se);let Ee=b.textures[pe],{format:Be,type:Ve}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!gt.textureFormatReadable(Be))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!gt.textureTypeReadable(Ve))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,ge.byteLength,L.STREAM_READ),L.readPixels(D,G,k,B,Y.convert(Be),Y.convert(Ve),0);let ot=U!==null?I.get(U).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,ot);let Tt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await d_(L,Tt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,ge),L.deleteBuffer(Ae),L.deleteSync(Tt),ge}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(b,D=null,G=0){let k=Math.pow(2,-G),B=Math.floor(b.image.width*k),ge=Math.floor(b.image.height*k),be=D!==null?D.x:0,pe=D!==null?D.y:0;W.setTexture2D(b,0),L.copyTexSubImage2D(L.TEXTURE_2D,G,0,0,be,pe,B,ge),M.unbindTexture()},this.copyTextureToTexture=function(b,D,G=null,k=null,B=0,ge=0){let be,pe,Se,Ee,Be,Ve,Ae,ot,Tt,Mt=b.isCompressedTexture?b.mipmaps[ge]:b.image;if(G!==null)be=G.max.x-G.min.x,pe=G.max.y-G.min.y,Se=G.isBox3?G.max.z-G.min.z:1,Ee=G.min.x,Be=G.min.y,Ve=G.isBox3?G.min.z:0;else{let Et=Math.pow(2,-B);if(be=Math.floor(Mt.width*Et),pe=Math.floor(Mt.height*Et),b.isDataArrayTexture)Se=Mt.depth;else if(b.isData3DTexture)Se=Math.floor(Mt.depth*Et);else Se=1;Ee=0,Be=0,Ve=0}if(k!==null)Ae=k.x,ot=k.y,Tt=k.z;else Ae=0,ot=0,Tt=0;let lt=Y.convert(D.format),$t=Y.convert(D.type),ye;if(D.isData3DTexture)W.setTexture3D(D,0),ye=L.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)W.setTexture2DArray(D,0),ye=L.TEXTURE_2D_ARRAY;else W.setTexture2D(D,0),ye=L.TEXTURE_2D;M.activeTexture(L.TEXTURE0),M.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,D.flipY),M.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),M.pixelStorei(L.UNPACK_ALIGNMENT,D.unpackAlignment);let on=M.getParameter(L.UNPACK_ROW_LENGTH),Qe=M.getParameter(L.UNPACK_IMAGE_HEIGHT),xn=M.getParameter(L.UNPACK_SKIP_PIXELS),Bn=M.getParameter(L.UNPACK_SKIP_ROWS),xi=M.getParameter(L.UNPACK_SKIP_IMAGES);M.pixelStorei(L.UNPACK_ROW_LENGTH,Mt.width),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Mt.height),M.pixelStorei(L.UNPACK_SKIP_PIXELS,Ee),M.pixelStorei(L.UNPACK_SKIP_ROWS,Be),M.pixelStorei(L.UNPACK_SKIP_IMAGES,Ve);let wr=b.isDataArrayTexture||b.isData3DTexture,ut=D.isDataArrayTexture||D.isData3DTexture;if(b.isDepthTexture){let Et=I.get(b),vi=I.get(D),dt=I.get(Et.__renderTarget),yi=I.get(vi.__renderTarget);M.bindFramebuffer(L.READ_FRAMEBUFFER,dt.__webglFramebuffer),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,yi.__webglFramebuffer);for(let Tr=0;Tr<Se;Tr++){if(wr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,I.get(b).__webglTexture,B,Ve+Tr),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,I.get(D).__webglTexture,ge,Tt+Tr);L.blitFramebuffer(Ee,Be,be,pe,Ae,ot,be,pe,L.DEPTH_BUFFER_BIT,L.NEAREST)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(B!==0||b.isRenderTargetTexture||I.has(b)){let Et=I.get(b),vi=I.get(D);M.bindFramebuffer(L.READ_FRAMEBUFFER,J),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,O);for(let dt=0;dt<Se;dt++){if(wr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Et.__webglTexture,B,Ve+dt);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Et.__webglTexture,B);if(ut)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,vi.__webglTexture,ge,Tt+dt);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,vi.__webglTexture,ge);if(B!==0)L.blitFramebuffer(Ee,Be,be,pe,Ae,ot,be,pe,L.COLOR_BUFFER_BIT,L.NEAREST);else if(ut)L.copyTexSubImage3D(ye,ge,Ae,ot,Tt+dt,Ee,Be,be,pe);else L.copyTexSubImage2D(ye,ge,Ae,ot,Ee,Be,be,pe)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(ut)if(b.isDataTexture||b.isData3DTexture)L.texSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,$t,Mt.data);else if(D.isCompressedArrayTexture)L.compressedTexSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,Mt.data);else L.texSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,$t,Mt);else if(b.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,ge,Ae,ot,be,pe,lt,$t,Mt.data);else if(b.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,ge,Ae,ot,Mt.width,Mt.height,lt,Mt.data);else L.texSubImage2D(L.TEXTURE_2D,ge,Ae,ot,be,pe,lt,$t,Mt);if(M.pixelStorei(L.UNPACK_ROW_LENGTH,on),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Qe),M.pixelStorei(L.UNPACK_SKIP_PIXELS,xn),M.pixelStorei(L.UNPACK_SKIP_ROWS,Bn),M.pixelStorei(L.UNPACK_SKIP_IMAGES,xi),ge===0&&D.generateMipmaps)L.generateMipmap(ye);M.unbindTexture()},this.initRenderTarget=function(b){if(I.get(b).__webglFramebuffer===void 0)W.setupRenderTarget(b)},this.initTexture=function(b){if(b.isCubeTexture)W.setTextureCube(b,0);else if(b.isData3DTexture)W.setTexture3D(b,0);else if(b.isDataArrayTexture||b.isCompressedArrayTexture)W.setTexture2DArray(b,0);else W.setTexture2D(b,0);M.unbindTexture()},this.resetState=function(){H=0,V=0,U=null,M.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return bu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=We._getDrawingBufferColorSpace(e),t.unpackColorSpace=We._getUnpackColorSpace()}}function eh(e,t){if(t===_u)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Qr||t===Ws){let n=e.getIndex();if(n===null){let o=[],a=e.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);e.setIndex(o),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,r=[];if(t===Qr)for(let o=1;o<=i;o++)r.push(n.getX(0)),r.push(n.getX(o)),r.push(n.getX(o+1));else for(let o=0;o<i;o++)if(o%2===0)r.push(n.getX(o)),r.push(n.getX(o+1)),r.push(n.getX(o+2));else r.push(n.getX(o+2)),r.push(n.getX(o+1)),r.push(n.getX(o));if(r.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=e.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function s0(e){let t=new Map,n=new Map,i=e.clone();return o0(e,i,function(r,s){t.set(s,r),n.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=t.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return n.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function o0(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)o0(e.children[i],t.children[i],n)}class ah extends _i{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new p0(t)}),this.register(function(t){return new m0(t)}),this.register(function(t){return new w0(t)}),this.register(function(t){return new T0(t)}),this.register(function(t){return new E0(t)}),this.register(function(t){return new _0(t)}),this.register(function(t){return new x0(t)}),this.register(function(t){return new v0(t)}),this.register(function(t){return new y0(t)}),this.register(function(t){return new d0(t)}),this.register(function(t){return new b0(t)}),this.register(function(t){return new g0(t)}),this.register(function(t){return new M0(t)}),this.register(function(t){return new S0(t)}),this.register(function(t){return new h0(t)}),this.register(function(t){return new rh(t,Xe.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new rh(t,Xe.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new A0(t)})}load(e,t,n,i){let r=this,s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){let c=Zi.extractUrlBase(e);s=Zi.resolveURL(c,this.path)}else s=Zi.extractUrlBase(e);this.manager.itemStart(e);let o=function(c){if(i)i(c);else console.error(c);r.manager.itemError(e),r.manager.itemEnd(e)},a=new io(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{r.parse(c,s,function(l){t(l),r.manager.itemEnd(e)},o)}catch(l){o(l)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let r,s={},o={},a=new TextDecoder;if(typeof e==="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===R0){try{s[Xe.KHR_BINARY_GLTF]=new C0(e)}catch(u){if(i)i(u);return}r=JSON.parse(s[Xe.KHR_BINARY_GLTF].content)}else r=JSON.parse(a.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new D0(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){let u=this.pluginCallbacks[l](c);if(!u.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");o[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let l=0;l<r.extensionsUsed.length;++l){let u=r.extensionsUsed[l],f=r.extensionsRequired||[];switch(u){case Xe.KHR_MATERIALS_UNLIT:s[u]=new f0;break;case Xe.KHR_DRACO_MESH_COMPRESSION:s[u]=new I0(r,this.dracoLoader);break;case Xe.KHR_TEXTURE_TRANSFORM:s[u]=new P0;break;case Xe.KHR_MESH_QUANTIZATION:s[u]=new L0;break;default:if(f.indexOf(u)>=0&&o[u]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function kT(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function Rt(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}var Xe={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class h0{constructor(e){this.parser=e,this.name=Xe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];if(r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],c,l=new Le(16777215);if(a.color!==void 0)l.setRGB(a.color[0],a.color[1],a.color[2],hn);let u=a.range!==void 0?a.range:0;switch(a.type){case"directional":c=new os(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ss(l),c.distance=u;break;case"spot":c=new $a(l),c.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,c.angle=a.spot.outerConeAngle,c.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}if(c.position.set(0,0,0),ti(c,a),a.intensity!==void 0)c.intensity=a.intensity;return c.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(c),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;if(o===void 0)return null;return this._loadLight(o).then(function(a){return n._getNodeRef(t.cache,o,a)})}}class f0{constructor(){this.name=Xe.KHR_MATERIALS_UNLIT}getMaterialType(){return Kn}extendParams(e,t,n){let i=[];e.color=new Le(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],hn),e.opacity=s[3]}if(r.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",r.baseColorTexture,Fi))}return Promise.all(i)}}class d0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class p0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ie(r,r)}}return Promise.all(i)}}class m0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class g0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(t.iridescenceThicknessRange===void 0)t.iridescenceThicknessRange=[100,400];if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class _0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_SHEEN}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Le(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],hn)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,Fi));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class x0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class v0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_VOLUME}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Le().setRGB(r[0],r[1],r[2],hn),Promise.all(i)}}class y0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_IOR}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class b0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];if(t.specularColor=new Le().setRGB(r[0],r[1],r[2],hn),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,Fi));return Promise.all(i)}}class S0{constructor(e){this.parser=e,this.name=Xe.EXT_MATERIALS_BUMP}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class M0{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?dn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class w0{constructor(e){this.parser=e,this.name=Xe.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,r.source,s)}}class T0{constructor(e){this.parser=e,this.name=Xe.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class E0{constructor(e){this.parser=e,this.name=Xe.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class rh{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return r.then(function(o){let a=i.byteOffset||0,c=i.byteLength||0,{count:l,byteStride:u}=i,f=new Uint8Array(o,a,c);if(s.decodeGltfBufferAsync)return s.decodeGltfBufferAsync(l,u,f,i.mode,i.filter).then(function(h){return h.buffer});else return s.ready.then(function(){let h=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(h),l,u,f,i.mode,i.filter),h})})}else return null}}class A0{constructor(e){this.name=Xe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let c of i.primitives)if(c.mode!==wn.TRIANGLES&&c.mode!==wn.TRIANGLE_STRIP&&c.mode!==wn.TRIANGLE_FAN&&c.mode!==void 0)return null;let s=n.extensions[this.name].attributes,o=[],a={};for(let c in s)o.push(this.parser.getDependency("accessor",s[c]).then((l)=>(a[c]=l,a[c])));if(o.length<1)return null;return o.push(this.parser.createNodeMesh(e)),Promise.all(o).then((c)=>{let l=c.pop(),u=l.isGroup?l.children:[l],f=c[0].count,h=[];for(let d of u){let g=new ze,y=new N,p=new Bt,m=new N(1,1,1),A=new ns(d.geometry,d.material,f);for(let T=0;T<f;T++){if(a.TRANSLATION)y.fromBufferAttribute(a.TRANSLATION,T);if(a.ROTATION)p.fromBufferAttribute(a.ROTATION,T);if(a.SCALE)m.fromBufferAttribute(a.SCALE,T);A.setMatrixAt(T,g.compose(y,p,m))}for(let T in a)if(T==="_COLOR_0"){let v=a[T];A.instanceColor=new lr(v.array,v.itemSize,v.normalized)}else if(T!=="TRANSLATION"&&T!=="ROTATION"&&T!=="SCALE")d.geometry.setAttribute(T,a[T]);at.prototype.copy.call(A,d),this.parser.assignFinalMaterial(A),h.push(A)}if(l.isGroup)return l.clear(),l.add(...h),l;return h[0]})}}var R0="glTF",uo=12,a0={JSON:1313821514,BIN:5130562};class C0{constructor(e){this.name=Xe.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,uo),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==R0)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-uo,r=new DataView(e,uo),s=0;while(s<i){let o=r.getUint32(s,!0);s+=4;let a=r.getUint32(s,!0);if(s+=4,a===a0.JSON){let c=new Uint8Array(e,uo+s,o);this.content=n.decode(c)}else if(a===a0.BIN){let c=uo+s;this.body=e.slice(c,c+o)}s+=o}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class I0{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Xe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},c={};for(let l in s){let u=sh[l]||l.toLowerCase();o[u]=s[l]}for(let l in e.attributes){let u=sh[l]||l.toLowerCase();if(s[l]!==void 0){let f=n.accessors[e.attributes[l]],h=ls[f.componentType];c[u]=h.name,a[u]=f.normalized===!0}}return t.getDependency("bufferView",r).then(function(l){return new Promise(function(u,f){i.decodeDracoFile(l,function(h){for(let d in h.attributes){let g=h.attributes[d],y=a[d];if(y!==void 0)g.normalized=y}u(h)},o,c,hn,f)})})}}class P0{constructor(){this.name=Xe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);return e.needsUpdate=!0,e}}class L0{constructor(){this.name=Xe.KHR_MESH_QUANTIZATION}}class ch extends gi{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=o*2,c=o*3,l=i-t,u=(n-t)/l,f=u*u,h=f*u,d=e*c,g=d-c,y=-2*h+3*f,p=h-f,m=1-y,A=p-f+u;for(let T=0;T!==o;T++){let v=s[g+T+o],w=s[g+T+a]*l,E=s[d+T+o],R=s[d+T]*l;r[T]=m*v+A*w+y*E+p*R}return r}}var BT=new Bt;class N0 extends ch{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return BT.fromArray(r).normalize().toArray(r),r}}var wn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ls={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},c0={9728:On,9729:Gt,9984:va,9985:Jr,9986:hr,9987:jn},l0={33071:jr,33648:xa,10497:Yr},th={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sh={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},qi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},GT={CUBICSPLINE:void 0,LINEAR:Ea,STEP:gu},nh={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function HT(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new mi({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ui});return e.DefaultMaterial}function yr(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function ti(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function VT(e,t,n){let i=!1,r=!1,s=!1;for(let l=0,u=t.length;l<u;l++){let f=t[l];if(f.POSITION!==void 0)i=!0;if(f.NORMAL!==void 0)r=!0;if(f.COLOR_0!==void 0)s=!0;if(i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);let o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){let f=t[l];if(i){let h=f.POSITION!==void 0?n.getDependency("accessor",f.POSITION):e.attributes.position;o.push(h)}if(r){let h=f.NORMAL!==void 0?n.getDependency("accessor",f.NORMAL):e.attributes.normal;a.push(h)}if(s){let h=f.COLOR_0!==void 0?n.getDependency("accessor",f.COLOR_0):e.attributes.color;c.push(h)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let u=l[0],f=l[1],h=l[2];if(i)e.morphAttributes.position=u;if(r)e.morphAttributes.normal=f;if(s)e.morphAttributes.color=h;return e.morphTargetsRelative=!0,e})}function WT(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $T(e){let t,n=e.extensions&&e.extensions[Xe.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+ih(n.attributes);else t=e.indices+":"+ih(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+ih(e.targets[i]);return t}function ih(e){let t="",n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function oh(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ZT(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var XT=new ze;class D0{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new kT,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let a=o.match(/Version\/(\d+)/);i=n&&a?parseInt(a[1],10):-1,r=o.indexOf("Firefox")>-1,s=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||r&&s<98)this.textureLoader=new Ga(this.options.manager);else this.textureLoader=new Za(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new io(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){let o={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};return yr(r,o,i),ti(o,i),Promise.all(n._invokeAll(function(a){return a.afterRoot&&a.afterRoot(o)})).then(function(){for(let a of o.scenes)a.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let s=t[i].joints;for(let o=0,a=s.length;o<a;o++)e[s[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let s=e[i];if(s.mesh!==void 0){if(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0)n[s.mesh].isSkinnedMesh=!0}if(s.camera!==void 0)this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(s,o)=>{let a=this.associations.get(s);if(a!=null)this.associations.set(o,a);for(let[c,l]of s.children.entries())r(l,o.children[c])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,s){return n.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Xe.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,s){n.load(Zi.resolveURL(t.uri,i.path),r,void 0,function(){s(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let s=th[i.type],o=ls[i.componentType],a=i.normalized===!0,c=new o(i.count*s);return Promise.resolve(new Nt(c,s,a))}let r=[];if(i.bufferView!==void 0)r.push(this.getDependency("bufferView",i.bufferView));else r.push(null);if(i.sparse!==void 0)r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(r).then(function(s){let o=s[0],a=th[i.type],c=ls[i.componentType],l=c.BYTES_PER_ELEMENT,u=l*a,f=i.byteOffset||0,h=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,d=i.normalized===!0,g,y;if(h&&h!==u){let p=Math.floor(f/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,A=t.cache.get(m);if(!A)g=new c(o,p*h,i.count*h/l),A=new qs(g,h/l),t.cache.add(m,A);y=new ts(A,a,f%h/l,d)}else{if(o===null)g=new c(i.count*a);else g=new c(o,f,i.count*a);y=new Nt(g,a,d)}if(i.sparse!==void 0){let p=th.SCALAR,m=ls[i.sparse.indices.componentType],A=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,v=new m(s[1],A,i.sparse.count*p),w=new c(s[2],T,i.sparse.count*a);if(o!==null)y=new Nt(y.array.slice(),y.itemSize,y.normalized);y.normalized=!1;for(let E=0,R=v.length;E<R;E++){let _=v[E];if(y.setX(_,w[E*a]),a>=2)y.setY(_,w[E*a+1]);if(a>=3)y.setZ(_,w[E*a+2]);if(a>=4)y.setW(_,w[E*a+3]);if(a>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}y.normalized=d}return y})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,s=t.images[r],o=this.textureLoader;if(s.uri){let a=n.manager.getHandler(s.uri);if(a!==null)o=a}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];let c=this.loadImageSource(t,n).then(function(l){if(l.flipY=!1,l.name=s.name||o.name||"",l.name===""&&typeof o.uri==="string"&&o.uri.startsWith("data:image/")===!1)l.name=o.uri;let f=(r.samplers||{})[s.sampler]||{};return l.magFilter=c0[f.magFilter]||Gt,l.minFilter=c0[f.minFilter]||jn,l.wrapS=l0[f.wrapS]||Yr,l.wrapT=l0[f.wrapT]||Yr,l.generateMipmaps=!l.isCompressedTexture&&l.minFilter!==On&&l.minFilter!==Gt,i.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[a]=c,c}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let s=i.images[e],o=self.URL||self.webkitURL,a=s.uri||"",c=!1;if(s.bufferView!==void 0)a=n.getDependency("bufferView",s.bufferView).then(function(u){c=!0;let f=new Blob([u],{type:s.mimeType});return a=o.createObjectURL(f),a});else if(s.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(a).then(function(u){return new Promise(function(f,h){let d=f;if(t.isImageBitmapLoader===!0)d=function(g){let y=new wt(g);y.needsUpdate=!0,f(y)};t.load(Zi.resolveURL(u,r.path),d,void 0,h)})}).then(function(u){if(c===!0)o.revokeObjectURL(a);return ti(u,s),u.userData.mimeType=s.mimeType||ZT(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),u});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0)s=s.clone(),s.channel=n.texCoord;if(r.extensions[Xe.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Xe.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let a=r.associations.get(s);s=r.extensions[Xe.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),r.associations.set(s,a)}}if(i!==void 0)s.colorSpace=i;return e[t]=s,s})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new eo,rn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,a.sizeAttenuation=!1,this.cache.add(o,a);n=a}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new Qs,rn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,this.cache.add(o,a);n=a}if(i||r||s){let o="ClonedMaterial:"+n.uuid+":";if(i)o+="derivative-tangents:";if(r)o+="vertex-colors:";if(s)o+="flat-shading:";let a=this.cache.get(o);if(!a){if(a=n.clone(),r)a.vertexColors=!0;if(s)a.flatShading=!0;if(i){if(a.normalScale)a.normalScale.y*=-1;if(a.clearcoatNormalScale)a.clearcoatNormalScale.y*=-1}this.cache.add(o,a),this.associations.set(a,this.associations.get(n))}n=a}e.material=n}getMaterialType(){return mi}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],s,o={},a=r.extensions||{},c=[];if(a[Xe.KHR_MATERIALS_UNLIT]){let u=i[Xe.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Le(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let f=u.baseColorFactor;o.color.setRGB(f[0],f[1],f[2],hn),o.opacity=f[3]}if(u.baseColorTexture!==void 0)c.push(t.assignTexture(o,"map",u.baseColorTexture,Fi));if(o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0)c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture));s=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}if(r.doubleSided===!0)o.side=bn;let l=r.alphaMode||nh.OPAQUE;if(l===nh.BLEND)o.transparent=!0,o.depthWrite=!1;else if(o.transparent=!1,l===nh.MASK)o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:0.5;if(r.normalTexture!==void 0&&s!==Kn){if(c.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Ie(1,1),r.normalTexture.scale!==void 0){let u=r.normalTexture.scale;o.normalScale.set(u,u)}}if(r.occlusionTexture!==void 0&&s!==Kn){if(c.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0)o.aoMapIntensity=r.occlusionTexture.strength}if(r.emissiveFactor!==void 0&&s!==Kn){let u=r.emissiveFactor;o.emissive=new Le().setRGB(u[0],u[1],u[2],hn)}if(r.emissiveTexture!==void 0&&s!==Kn)c.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Fi));return Promise.all(c).then(function(){let u=new s(o);if(r.name)u.name=r.name;if(ti(u,r),t.associations.set(u,{materials:e}),r.extensions)yr(i,u,r);return u})}createUniqueName(e){let t=tt.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Xe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(a){return u0(a,o,t)})}let s=[];for(let o=0,a=e.length;o<a;o++){let c=e[o],l=$T(c),u=i[l];if(u)s.push(u.promise);else{let f;if(c.extensions&&c.extensions[Xe.KHR_DRACO_MESH_COMPRESSION])f=r(c);else f=u0(new tn,c,t);i[l]={primitive:c,promise:f},s.push(f)}}return Promise.all(s)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let a=0,c=s.length;a<c;a++){let l=s[a].material===void 0?HT(this.cache):this.getDependency("material",s[a].material);o.push(l)}return o.push(t.loadGeometries(s)),Promise.all(o).then(function(a){let c=a.slice(0,a.length-1),l=a[a.length-1],u=[];for(let h=0,d=l.length;h<d;h++){let g=l[h],y=s[h],p,m=c[h];if(y.mode===wn.TRIANGLES||y.mode===wn.TRIANGLE_STRIP||y.mode===wn.TRIANGLE_FAN||y.mode===void 0){if(p=r.isSkinnedMesh===!0?new Na(g,m):new pt(g,m),p.isSkinnedMesh===!0)p.normalizeSkinWeights();if(y.mode===wn.TRIANGLE_STRIP)p.geometry=eh(p.geometry,Ws);else if(y.mode===wn.TRIANGLE_FAN)p.geometry=eh(p.geometry,Qr)}else if(y.mode===wn.LINES)p=new Da(g,m);else if(y.mode===wn.LINE_STRIP)p=new ki(g,m);else if(y.mode===wn.LINE_LOOP)p=new Ua(g,m);else if(y.mode===wn.POINTS)p=new is(g,m);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+y.mode);if(Object.keys(p.geometry.morphAttributes).length>0)WT(p,r);if(p.name=t.createUniqueName(r.name||"mesh_"+e),ti(p,r),y.extensions)yr(i,p,y);t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h<d;h++)t.associations.set(u[h],{meshes:e,primitives:h});if(u.length===1){if(r.extensions)yr(i,u[0],r);return u[0]}let f=new Zn;if(r.extensions)yr(i,f,r);t.associations.set(f,{meshes:e});for(let h=0,d=u.length;h<d;h++)f.add(u[h]);return f})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Lt($s.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new xr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return ti(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let r=i.pop(),s=i,o=[],a=[];for(let c=0,l=s.length;c<l;c++){let u=s[c];if(u){o.push(u);let f=new ze;if(r!==null)f.fromArray(r.array,c*16);a.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Js(o,a)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],c=[],l=[];for(let u=0,f=i.channels.length;u<f;u++){let h=i.channels[u],d=i.samplers[h.sampler],g=h.target,y=g.node,p=i.parameters!==void 0?i.parameters[d.input]:d.input,m=i.parameters!==void 0?i.parameters[d.output]:d.output;if(g.node===void 0)continue;s.push(this.getDependency("node",y)),o.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",m)),c.push(d),l.push(g)}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l)]).then(function(u){let f=u[0],h=u[1],d=u[2],g=u[3],y=u[4],p=[];for(let A=0,T=f.length;A<T;A++){let v=f[A],w=h[A],E=d[A],R=g[A],_=y[A];if(v===void 0)continue;if(v.updateMatrix)v.updateMatrix();let S=n._createAnimationTracks(v,w,E,R,_);if(S)for(let F=0;F<S.length;F++)p.push(S[F])}let m=new $r(r,void 0,p);return ti(m,i),m})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(r){let s=n._getNodeRef(n.meshCache,i.mesh,r);if(i.weights!==void 0)s.traverse(function(o){if(!o.isMesh)return;for(let a=0,c=i.weights.length;a<c;a++)o.morphTargetInfluences[a]=i.weights[a]});return s})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),s=[],o=i.children||[];for(let c=0,l=o.length;c<l;c++)s.push(n.getDependency("node",o[c]));let a=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),a]).then(function(c){let l=c[0],u=c[1],f=c[2];if(f!==null)l.traverse(function(h){if(!h.isSkinnedMesh)return;h.bind(f,XT)});for(let h=0,d=u.length;h<d;h++)l.add(u[h]);if(l.userData.pivot!==void 0&&u.length>0){let h=l.userData.pivot,d=u[0];l.pivot=new N().fromArray(h),l.position.x-=h[0],l.position.y-=h[1],l.position.z-=h[2],d.position.set(0,0,0),delete l.userData.pivot}return l})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});if(a)o.push(a);if(r.camera!==void 0)o.push(i.getDependency("camera",r.camera).then(function(c){return i._getNodeRef(i.cameraCache,r.camera,c)}));return i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let l;if(r.isBone===!0)l=new Ys;else if(c.length>1)l=new Zn;else if(c.length===1)l=c[0];else l=new at;if(l!==c[0])for(let u=0,f=c.length;u<f;u++)l.add(c[u]);if(r.name)l.userData.name=r.name,l.name=s;if(ti(l,r),r.extensions)yr(n,l,r);if(r.matrix!==void 0){let u=new ze;u.fromArray(r.matrix),l.applyMatrix4(u)}else{if(r.translation!==void 0)l.position.fromArray(r.translation);if(r.rotation!==void 0)l.quaternion.fromArray(r.rotation);if(r.scale!==void 0)l.scale.fromArray(r.scale)}if(!i.associations.has(l))i.associations.set(l,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(l);i.associations.set(l,{...u})}return i.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new Zn;if(n.name)r.name=i.createUniqueName(n.name);if(ti(r,n),n.extensions)yr(t,r,n);let s=n.nodes||[],o=[];for(let a=0,c=s.length;a<c;a++)o.push(i.getDependency("node",s[a]));return Promise.all(o).then(function(a){for(let l=0,u=a.length;l<u;l++){let f=a[l];if(f.parent!==null)r.add(s0(f));else r.add(f)}let c=(l)=>{let u=new Map;for(let[f,h]of i.associations)if(f instanceof rn||f instanceof wt)u.set(f,h);return l.traverse((f)=>{let h=i.associations.get(f);if(h!=null)u.set(f,h)}),u};return i.associations=c(r),r})}_createAnimationTracks(e,t,n,i,r){let s=[],o=e.name?e.name:e.uuid,a=[];function c(h){if(h.morphTargetInfluences)a.push(h.name?h.name:h.uuid)}if(qi[r.path]===qi.weights){if(c(e),e.isGroup)e.children.forEach(c)}else a.push(o);let l;switch(qi[r.path]){case qi.weights:l=Vi;break;case qi.rotation:l=Wi;break;case qi.translation:case qi.scale:l=_r;break;default:switch(n.itemSize){case 1:l=Vi;break;case 2:case 3:default:l=_r;break}break}let u=i.interpolation!==void 0?GT[i.interpolation]:Ea,f=this._getArrayFromAccessor(n);for(let h=0,d=a.length;h<d;h++){let g=new l(a[h]+"."+qi[r.path],t.array,f,u);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(g);s.push(g)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=oh(t.constructor),i=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof Wi?N0:ch)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function qT(e,t,n){let i=t.attributes,r=new en;if(i.POSITION!==void 0){let a=n.json.accessors[i.POSITION],{min:c,max:l}=a;if(c!==void 0&&l!==void 0){if(r.set(new N(c[0],c[1],c[2]),new N(l[0],l[1],l[2])),a.normalized){let u=oh(ls[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=t.targets;if(s!==void 0){let a=new N,c=new N;for(let l=0,u=s.length;l<u;l++){let f=s[l];if(f.POSITION!==void 0){let h=n.json.accessors[f.POSITION],{min:d,max:g}=h;if(d!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),h.normalized){let y=oh(ls[h.componentType]);c.multiplyScalar(y)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}e.boundingBox=r;let o=new fn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}function u0(e,t,n){let i=t.attributes,r=[];function s(o,a){return n.getDependency("accessor",o).then(function(c){e.setAttribute(a,c)})}for(let o in i){let a=sh[o]||o.toLowerCase();if(a in e.attributes)continue;r.push(s(i[o],a))}if(t.indices!==void 0&&!e.index){let o=n.getDependency("accessor",t.indices).then(function(a){e.setIndex(a)});r.push(o)}if(We.workingColorSpace!==hn&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${We.workingColorSpace}" not supported.`);return ti(e,t),qT(e,t,n),Promise.all(r).then(function(){return t.targets!==void 0?VT(e,t.targets,n):e})}var U0={type:"change"},uh={type:"start"},F0={type:"end"},Qa=new zi,O0=new Ln,YT=Math.cos(70*$s.DEG2RAD),Ot=new N,sn=2*Math.PI,ct={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},lh=0.000001;class hh extends qa{constructor(e,t=null){super(e,t);if(this.state=ct.NONE,this.target=new N,this.cursor=new N,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=0.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:Ni.ROTATE,MIDDLE:Ni.DOLLY,RIGHT:Ni.PAN},this.touches={ONE:Di.ROTATE,TWO:Di.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Bt,this._lastTargetPosition=new N,this._quat=new Bt().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new ro,this._sphericalDelta=new ro,this._scale=1,this._panOffset=new N,this._rotateStart=new Ie,this._rotateEnd=new Ie,this._rotateDelta=new Ie,this._panStart=new Ie,this._panEnd=new Ie,this._panDelta=new Ie,this._dollyStart=new Ie,this._dollyEnd=new Ie,this._dollyDelta=new Ie,this._dollyDirection=new N,this._mouse=new Ie,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=JT.bind(this),this._onPointerDown=jT.bind(this),this._onPointerUp=KT.bind(this),this._onContextMenu=sE.bind(this),this._onMouseWheel=tE.bind(this),this._onKeyDown=nE.bind(this),this._onTouchStart=iE.bind(this),this._onTouchMove=rE.bind(this),this._onMouseDown=QT.bind(this),this._onMouseMove=eE.bind(this),this._interceptControlDown=oE.bind(this),this._interceptControlUp=aE.bind(this),this.domElement!==null)this.connect(this.domElement);this.update()}set cursorStyle(e){if(this._cursorStyle=e,e==="grab")this.domElement.style.cursor="grab";else this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),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.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.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=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){if(this._domElementKeyEvents!==null)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(U0),this.update(),this.state=ct.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;if(Ot.copy(t).sub(this.target),Ot.applyQuaternion(this._quat),this._spherical.setFromVector3(Ot),this.autoRotate&&this.state===ct.NONE)this._rotateLeft(this._getAutoRotationAngle(e));if(this.enableDamping)this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor;else this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi;let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;if(isFinite(n)&&isFinite(i)){if(n<-Math.PI)n+=sn;else if(n>Math.PI)n-=sn;if(i<-Math.PI)i+=sn;else if(i>Math.PI)i-=sn;if(n<=i)this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta));else this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)}if(this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0)this.target.addScaledVector(this._panOffset,this.dampingFactor);else 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{let s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=s!=this._spherical.radius}if(Ot.setFromSpherical(this._spherical),Ot.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ot),this.object.lookAt(this.target),this.enableDamping===!0)this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor);else this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0);if(this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){let o=Ot.length();s=this._clampDistance(o*this._scale);let a=o-s;this.object.position.addScaledVector(this._dollyDirection,a),this.object.updateMatrixWorld(),r=!!a}else if(this.object.isOrthographicCamera){let o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=a!==this.object.zoom;let c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=Ot.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;if(s!==null)if(this.screenSpacePanning)this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position);else if(Qa.origin.copy(this.object.position),Qa.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Qa.direction))<YT)this.object.lookAt(this.target);else O0.setFromNormalAndCoplanarPoint(this.object.up,this.target),Qa.intersectPlane(O0,this.target)}else if(this.object.isOrthographicCamera){let s=this.object.zoom;if(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom)this.object.updateProjectionMatrix(),r=!0}if(this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>lh||8*(1-this._lastQuaternion.dot(this.object.quaternion))>lh||this._lastTargetPosition.distanceToSquared(this.target)>lh)return this.dispatchEvent(U0),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0;return!1}_getAutoRotationAngle(e){if(e!==null)return sn/60*this.autoRotateSpeed*e;else return sn/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*0.01);return Math.pow(0.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ot.setFromMatrixColumn(t,0),Ot.multiplyScalar(-e),this._panOffset.add(Ot)}_panUp(e,t){if(this.screenSpacePanning===!0)Ot.setFromMatrixColumn(t,1);else Ot.setFromMatrixColumn(t,0),Ot.crossVectors(this.object.up,Ot);Ot.multiplyScalar(e),this._panOffset.add(Ot)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Ot.copy(i).sub(this.target);let r=Ot.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else if(this.object.isOrthographicCamera)this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix);else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1}_dollyOut(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale/=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_dollyIn(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale*=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,{width:s,height:o}=n;this._mouse.x=i/s*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sn*this._rotateDelta.x/t.clientHeight),this._rotateUp(sn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){if(this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0)this._dollyOut(this._getZoomScale(this._dollyDelta.y));else if(this._dollyDelta.y<0)this._dollyIn(this._getZoomScale(this._dollyDelta.y));this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.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(e){if(this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0)this._dollyIn(this._getZoomScale(e.deltaY));else if(e.deltaY>0)this._dollyOut(this._getZoomScale(e.deltaY));this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,this.keyPanSpeed);t=!0;break;case this.keys.BOTTOM:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(-sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,-this.keyPanSpeed);t=!0;break;case this.keys.LEFT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(this.keyPanSpeed,0);t=!0;break;case this.keys.RIGHT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(-sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(-this.keyPanSpeed,0);t=!0;break}if(t)e.preventDefault(),this.update()}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enablePan)this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enableRotate)this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=0.5*(e.pageX+n.x),r=0.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sn*this._rotateDelta.x/t.clientHeight),this._rotateUp(sn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.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(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.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);let s=(e.pageX+t.x)*0.5,o=(e.pageY+t.y)*0.5;this._updateZoomParameters(s,o)}_handleTouchMoveDollyPan(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enablePan)this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enableRotate)this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];if(t===void 0)t=new Ie,this._pointerPositions[e.pointerId]=t;t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}if(e.ctrlKey&&!this._controlActive)n.deltaY*=10;return n}}function jT(e){if(this.enabled===!1)return;if(this._pointers.length===0)this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp);if(this._isTrackingPointer(e))return;if(this._addPointer(e),e.pointerType==="touch")this._onTouchStart(e);else this._onMouseDown(e);if(this._cursorStyle==="grab")this.domElement.style.cursor="grabbing"}function JT(e){if(this.enabled===!1)return;if(e.pointerType==="touch")this._onTouchMove(e);else this._onMouseMove(e)}function KT(e){switch(this._removePointer(e),this._pointers.length){case 0:if(this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(F0),this.state=ct.NONE,this._cursorStyle==="grab")this.domElement.style.cursor="grab";break;case 1:let t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y});break}}function QT(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Ni.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(e),this.state=ct.DOLLY;break;case Ni.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=ct.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=ct.ROTATE}break;case Ni.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=ct.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=ct.PAN}break;default:this.state=ct.NONE}if(this.state!==ct.NONE)this.dispatchEvent(uh)}function eE(e){switch(this.state){case ct.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(e);break;case ct.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(e);break;case ct.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(e);break}}function tE(e){if(this.enabled===!1||this.enableZoom===!1||this.state!==ct.NONE)return;e.preventDefault(),this.dispatchEvent(uh),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(F0)}function nE(e){if(this.enabled===!1)return;this._handleKeyDown(e)}function iE(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case Di.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(e),this.state=ct.TOUCH_ROTATE;break;case Di.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(e),this.state=ct.TOUCH_PAN;break;default:this.state=ct.NONE}break;case 2:switch(this.touches.TWO){case Di.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(e),this.state=ct.TOUCH_DOLLY_PAN;break;case Di.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(e),this.state=ct.TOUCH_DOLLY_ROTATE;break;default:this.state=ct.NONE}break;default:this.state=ct.NONE}if(this.state!==ct.NONE)this.dispatchEvent(uh)}function rE(e){switch(this._trackPointer(e),this.state){case ct.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(e),this.update();break;case ct.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(e),this.update();break;case ct.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(e),this.update();break;case ct.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=ct.NONE}}function sE(e){if(this.enabled===!1)return;e.preventDefault()}function oE(e){if(e.key==="Control")this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}function aE(e){if(e.key==="Control")this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}class fh extends es{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let e=new Gi;e.deleteAttribute("uv");let t=new mi({side:Yt}),n=new mi,i=new ss(16777215,900,28,2);i.position.set(0.418,16.199,0.3),this.add(i);let r=new pt(e,t);r.position.set(-0.757,13.219,0.717),r.scale.set(31.713,28.305,28.591),this.add(r);let s=new ns(e,n,6),o=new at;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-0.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),s.setMatrixAt(0,o.matrix),o.position.set(-5.607,-0.754,-0.758),o.rotation.set(0,0.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),s.setMatrixAt(1,o.matrix),o.position.set(6.167,0.857,7.803),o.rotation.set(0,0.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),s.setMatrixAt(2,o.matrix),o.position.set(-2.017,0.018,6.124),o.rotation.set(0,0.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),s.setMatrixAt(3,o.matrix),o.position.set(2.291,-0.756,-2.621),o.rotation.set(0,-0.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),s.setMatrixAt(4,o.matrix),o.position.set(-2.193,-0.369,-5.547),o.rotation.set(0,0.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),s.setMatrixAt(5,o.matrix),this.add(s);let a=new pt(e,us(50));a.position.set(-16.116,14.37,8.208),a.scale.set(0.1,2.428,2.739),this.add(a);let c=new pt(e,us(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(0.1,2.425,2.751),this.add(c);let l=new pt(e,us(17));l.position.set(14.904,12.198,-1.832),l.scale.set(0.15,4.265,6.331),this.add(l);let u=new pt(e,us(43));u.position.set(-0.462,8.89,14.52),u.scale.set(4.38,5.441,0.088),this.add(u);let f=new pt(e,us(20));f.position.set(3.235,11.486,-12.541),f.scale.set(2.5,2,0.1),this.add(f);let h=new pt(e,us(100));h.position.set(0,20,0),h.scale.set(1,0.1,1),this.add(h)}dispose(){let e=new Set;this.traverse((t)=>{if(t.isMesh)e.add(t.geometry),e.add(t.material)});for(let t of e)t.dispose()}}function us(e){return new za({color:0,emissive:16777215,emissiveIntensity:e})}function z0(e,t,n=40,i=[e]){let r=e.getCenter(new N),s=Math.max(e.getSize(new N).length()/2,0.01),o=new N(1,0.65,1.25).normalize(),a=new N().crossVectors(new N(0,1,0),o).normalize(),c=new N().crossVectors(o,a),l=[];for(let A of i.length?i:[e])for(let T of[A.min.x,A.max.x])for(let v of[A.min.y,A.max.y])for(let w of[A.min.z,A.max.z])l.push(new N(T,v,w));let u=1/0,f=-1/0,h=1/0,d=-1/0;for(let A of l){let T=A.clone().sub(r),v=T.dot(a),w=T.dot(c);u=Math.min(u,v),f=Math.max(f,v),h=Math.min(h,w),d=Math.max(d,w)}r.addScaledVector(a,(u+f)/2),r.addScaledVector(c,(h+d)/2);let g=Math.tan(n*Math.PI/360),y=g*t,p=s;for(let A of l){let T=A.clone().sub(r),v=T.dot(o);p=Math.max(p,v+Math.abs(T.dot(a))*1.12/y,v+Math.abs(T.dot(c))*1.12/g)}let m=r.clone().addScaledVector(o,p);return{center:r,radius:s,distance:p,position:m}}function k0(e){let t=new Qu({antialias:!0,alpha:!1});t.setPixelRatio(Math.min(devicePixelRatio,2)),t.setClearColor(1382930),t.toneMapping=Gs,t.toneMappingExposure=1.15,e.replaceChildren(t.domElement);let n=new es,i=new Lt(40,1,0.01,1000),r=new hh(i,t.domElement);r.enableDamping=!0;let s=new lo(t),o=new fh,a=s.fromScene(o,0.04);n.environment=a.texture,o.dispose(),s.dispose();let c=new os(16773591,2.4);c.position.set(4,8,5),n.add(c),n.add(new Ha(14806490,5065021,1.7));let l,u,f=[],h=!0,d=performance.now(),g=0,y=0,p=!1,m=(w)=>{let E=new Set,R=new Set,_=new Set;w.traverse((S)=>{let F=S;if(!F.isMesh)return;E.add(F.geometry);for(let C of Array.isArray(F.material)?F.material:[F.material]){R.add(C);for(let z of Object.values(C))if(z instanceof wt)_.add(z)}});for(let S of[...E,...R,..._])S.dispose()},A=()=>{if(!l)return;let w=new en().setFromObject(l,!0),E=[];l.traverse((C)=>{if(C instanceof pt||C instanceof ki||C instanceof is){let z=new en().setFromObject(C,!0);if(!z.isEmpty())E.push(z)}});let{center:R,radius:_,distance:S,position:F}=z0(w,i.aspect,i.fov,E);r.target.copy(R),i.position.copy(F),i.near=Math.max(_/1000,0.0001),i.far=S+_*100,r.minDistance=_*0.1,r.maxDistance=_*80,i.updateProjectionMatrix(),r.update()},T=new ResizeObserver(()=>{let{clientWidth:w,clientHeight:E}=e;if(!w||!E)return;t.setSize(w,E),i.aspect=w/E,i.updateProjectionMatrix()});T.observe(e);let v=(w)=>{if(p)return;let E=Math.min((w-d)/1000,0.1);if(d=w,h)u?.update(E);r.update(),t.render(n,i),g=requestAnimationFrame(v)};return g=requestAnimationFrame(v),{async load(w){let E=++y;qc(w);let R=new no;R.setURLModifier((O)=>{if(!O.startsWith("blob:")&&!O.startsWith("data:"))throw Error("External model resources are not loaded");return O});let _=await new ah(R).parseAsync(Uint8Array.from(w).buffer,"");if(p||E!==y){m(_.scene);return}if(l)u?.stopAllAction(),u?.uncacheRoot(l),n.remove(l),m(l);l=_.scene,n.add(l),f=_.animations,u=new Xa(l),h=!0;let{clientWidth:S,clientHeight:F}=e;t.setSize(S,F),i.aspect=S/F,A();let C=0,z=0,J=new Set;return l.traverse((O)=>{let H=O;if(!H.isMesh)return;z++,C+=(H.geometry.index?.count??H.geometry.attributes.position?.count??0)/3*(H.isInstancedMesh?H.count:1);for(let V of Array.isArray(H.material)?H.material:[H.material])J.add(V)}),{triangles:C,meshes:z,materials:J.size,clips:f.map((O)=>O.name)}},reset:A,wire(w){l?.traverse((E)=>{let R=E;if(R.isMesh){for(let _ of Array.isArray(R.material)?R.material:[R.material])if("wireframe"in _)_.wireframe=w}})},lighting(w){t.toneMappingExposure=w==="bright"?1.65:w==="soft"?0.85:1.15,c.intensity=w==="soft"?0.8:2.4},clip(w){if(u?.stopAllAction(),f[w])u?.clipAction(f[w]).play()},pause(w){h=!w},dispose(){if(p=!0,y++,cancelAnimationFrame(g),T.disconnect(),r.dispose(),l)m(l);a.dispose(),t.dispose(),e.replaceChildren()}}}var De=(e)=>document.getElementById(e),Ct=(e,t,n)=>{let i=document.createElement(e);if(t!==void 0)i.textContent=t;if(n)i.className=n;return i},mo=[],fs=[],Sr=[],ec="",hs,mn,ho=0,B0=0,fo=!1,po=!1,Yi=new Set,dh=[],G0=[],br=(e)=>`${e.collection}/${e.manifest.assetId}/${e.manifest.revisionId}`,H0=(e)=>{De("status").textContent=e},Mr=(e)=>H0(e instanceof Error?e.message:String(e)),go=(e,t,n=dh)=>{let i=URL.createObjectURL(new Blob([Uint8Array.from(e)],{type:t}));return n.push(i),i};async function V0(e){let t=await fetch(e),n=await t.json();if(!t.ok)throw Error(n.error??"Request failed");return n}async function cE(e,t){if(e.local){let i=e.local.files[t];if(!i)throw Error("File unavailable");return i}if(e.loose&&t==="asset.glb")return e.loose;let n=await fetch(`/files/${br(e)}/${t}`);if(!n.ok)throw Error((await n.json()).error??"File unavailable");return new Uint8Array(await n.arrayBuffer())}function lE(e,t){if(e.local){if(t==="editable.zip")return go(Yc([e.local]),"application/zip");return go(e.local.files[t],t.endsWith(".js")?"text/javascript":"model/gltf-binary")}if(e.loose)return go(e.loose,"model/gltf-binary");return`/files/${br(e)}/${t}?download`}function W0(e,t){try{localStorage.setItem(e,t)}catch{}}function $0(e){try{return localStorage.getItem(e)}catch{return null}}function uE(){let e=De("collections");e.replaceChildren();for(let t of[...mo,...Sr.length?[{id:"opened-files",label:"Opened files"}]:[]]){let n=Ct("button",t.label,ec===t.id?"active":"");n.onclick=()=>void tc(t.id).catch(Mr),e.append(n)}}async function tc(e){let t=++B0;ec=e,Yi.clear(),uE(),H0("");let n=e==="opened-files"?Sr:(await V0(`/api/assets?collection=${encodeURIComponent(e)}`)).assets.map((i)=>({collection:e,manifest:i}));if(t!==B0)return;fs=n,W0("kiln.collection",e),De("collection-title").textContent=e==="opened-files"?"Opened files":mo.find((i)=>i.id===e)?.label??e,De("collection-caption").textContent=e==="opened-files"?"Previewed in your browser. Your original files stay untouched.":"Saved revisions, editable source, and everything ready to use.",ph()}function hE(){let e=new Map;for(let t of fs){let n=t.manifest.assetId;e.set(n,[...e.get(n)??[],t])}return[...e.values()].map((t)=>(t.sort((n,i)=>i.manifest.createdAt.localeCompare(n.manifest.createdAt)||i.manifest.revisionId.localeCompare(n.manifest.revisionId)),t.find((n)=>n.manifest.revisionId===$0(`kiln.revision.${n.collection}.${n.manifest.assetId}`))??t[0]))}function ph(){for(let i of G0.splice(0))URL.revokeObjectURL(i);let e=De("cards");e.replaceChildren();let t=De("search").value.toLowerCase(),n=hE().filter((i)=>`${i.manifest.name} ${i.manifest.tags.join(" ")}`.toLowerCase().includes(t));if(De("count").textContent=`${n.length} asset${n.length===1?"":"s"}`,De("export-selection").disabled=!Yi.size,!n.length){let i=Ct("div",void 0,"empty");if(i.append(Ct("b",t?"No matching assets":"Your next idea belongs here."),Ct("p",t?"Try another name or tag.":"Save an asset with your agent, or open a GLB or editable bundle.")),!t)i.append(Ct("code",'kiln save asset.kiln.js --name "My asset"'));e.append(i);return}for(let i of n){let r=i.manifest,s=Ct("article",void 0,"card"),o=Ct("button",void 0,"card-open");o.setAttribute("aria-label",`View ${r.name}`),o.onclick=()=>void mh(i).catch(Mr);let a=Ct("div",void 0,"thumb");if(r.files["preview.png"]){let d=Ct("img");d.loading="lazy",d.alt=r.name,d.src=i.local?go(i.local.files["preview.png"],"image/png",G0):`/files/${br(i)}/preview.png`,d.onerror=()=>{d.remove(),a.textContent="◇"},a.append(d)}else a.textContent="◇";let c=Ct("div",void 0,"card-content");c.append(Ct("span",r.name,"card-title"));let l=fs.filter((d)=>d.manifest.assetId===r.assetId),u=new Set(l.map((d)=>d.manifest.parentRevision)),f=l.filter((d)=>!u.has(d.manifest.revisionId));c.append(Ct("span",`${r.editable?"Editable source":"Source unavailable"} · ${l.length} revision${l.length===1?"":"s"}${f.length>1?` · ${f.length} branches`:""}`,"card-meta"));let h=Ct("div",void 0,"tags");for(let d of r.tags)h.append(Ct("span",d,"tag"));if(c.append(h),o.append(a,c),s.append(o),!i.loose){let d=Ct("input");d.type="checkbox",d.className="selection",d.checked=Yi.has(br(i)),d.setAttribute("aria-label",`Select ${r.name}`),d.onchange=()=>{if(d.checked)Yi.add(br(i));else Yi.delete(br(i));De("export-selection").disabled=!Yi.size},s.append(d)}e.append(s)}}async function mh(e){let t=++ho;hs=e,W0(`kiln.revision.${e.collection}.${e.manifest.assetId}`,e.manifest.revisionId);for(let o of dh.splice(0))URL.revokeObjectURL(o);let n=De("detail");if(!n.open)n.showModal();De("asset-name").textContent=e.manifest.name;let i=De("revisions");i.replaceChildren();for(let o of fs.filter((a)=>a.manifest.assetId===e.manifest.assetId)){let a=Ct("option",`${new Date(o.manifest.createdAt).toLocaleString()} · ${o.manifest.description||o.manifest.revisionId.slice(0,10)}`);a.value=o.manifest.revisionId,a.selected=o.manifest.revisionId===e.manifest.revisionId,i.append(a)}i.onchange=()=>{let o=fs.find((a)=>a.manifest.assetId===e.manifest.assetId&&a.manifest.revisionId===i.value);if(o)mh(o).catch(Mr)},De("asset-description").textContent=e.manifest.description??e.manifest.brief??(e.manifest.editable?"Source travels with this revision. Download the editable bundle to continue elsewhere.":"This GLB has no saved Kiln source. You can view and use the model."),De("provenance").textContent=e.loose?"Standalone GLB. No source or build provenance supplied.":JSON.stringify(e.manifest,null,2);let r=De("downloads");r.replaceChildren();for(let[o,a]of[["asset.glb","Download GLB"],...e.manifest.editable?[["source.kiln.js","Download source"]]:[],...!e.loose?[["editable.zip",e.manifest.editable?"Download editable bundle":"Download asset bundle"]]:[]]){let c=Ct("a",a);c.href=lE(e,o),c.download=`${e.manifest.name.replace(/[^a-z0-9_-]/gi,"-")}${o==="asset.glb"?".glb":o==="source.kiln.js"?".kiln.js":".zip"}`,r.append(c)}De("refine").disabled=!e.manifest.editable,De("asset-stats").replaceChildren(),De("stage-status").textContent="Loading saved GLB…",fo=!1,po=!1,De("wire").setAttribute("aria-pressed","false"),De("play").textContent="Pause";let s=De("animation");s.replaceChildren(new Option("Rest pose","")),De("play").disabled=!0;try{mn??=k0(De("stage"));let o=await cE(e,"asset.glb");if(t!==ho)return;let a=await mn.load(o);if(!a||t!==ho)return;mn.wire(!1),mn.lighting(De("lighting").value);for(let[c,l]of[[a.triangles.toLocaleString(),"triangles"],[a.meshes,"meshes"],[a.materials,"materials"],[`${(o.length/1024).toFixed(0)} KB`,"GLB"]]){let u=Ct("div");u.append(Ct("strong",String(c)),Ct("span",String(l))),De("asset-stats").append(u)}for(let c=0;c<a.clips.length;c++)s.append(new Option(a.clips[c],String(c)));De("stage-status").textContent=""}catch(o){if(t===ho)mn?.dispose(),mn=void 0,De("stage-status").textContent=`3D preview unavailable: ${o instanceof Error?o.message:o}. Downloads remain available.`}}async function Z0(e){for(let t of e){if(t.bytes.length>si)throw Error("File exceeds 64 MiB");if(t.name.toLowerCase().endsWith(".zip"))for(let n of Dm(t.bytes)){for(let[i,r]of Object.entries(n.files))if(`sha256:${Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(r)))).map((o)=>o.toString(16).padStart(2,"0")).join("")}`!==n.manifest.files[i]?.sha256)throw Error(`Bundle integrity failure: ${i}`);if(!Sr.some((i)=>i.manifest.revisionId===n.manifest.revisionId&&i.manifest.assetId===n.manifest.assetId))Sr.push({collection:"opened-files",manifest:n.manifest,local:n})}else{let n=`a_${crypto.randomUUID().replaceAll("-","")}`;Sr.push({collection:"opened-files",loose:t.bytes,manifest:{version:"kiln.asset.v1",assetId:n,revisionId:`r_${n}`,name:t.name.replace(/\.glb$/i,""),tags:[],createdAt:new Date().toISOString(),editable:!1,files:{}}})}}await tc("opened-files")}De("open").onchange=async(e)=>{try{let t=Array.from(e.target.files??[]);if(t.some((n)=>n.size>si))throw Error("File exceeds 64 MiB");await Z0(await Promise.all(t.map(async(n)=>({name:n.name,bytes:new Uint8Array(await n.arrayBuffer())}))))}catch(t){Mr(t)}};De("refresh").onclick=()=>void tc(ec).catch(Mr);De("search").oninput=ph;De("close-detail").onclick=()=>De("detail").close();De("detail").addEventListener("close",()=>{ho++,mn?.dispose(),mn=void 0;for(let e of dh.splice(0))URL.revokeObjectURL(e);ph()});De("frame").onclick=()=>mn?.reset();De("wire").onclick=()=>{fo=!fo,mn?.wire(fo),De("wire").setAttribute("aria-pressed",String(fo))};De("lighting").onchange=(e)=>mn?.lighting(e.target.value);De("animation").onchange=(e)=>{let t=e.target.value;mn?.clip(t===""?-1:Number(t)),De("play").disabled=t===""};De("play").onclick=()=>{po=!po,mn?.pause(po),De("play").textContent=po?"Play":"Pause"};De("refine").onclick=async()=>{if(!hs)return;let e=hs.manifest,t=hs.local?`Import the downloaded editable bundle using kiln import <bundle.zip>. Restore asset ${e.assetId}, revision ${e.revisionId}, using kiln_assets action=restore. Read its source with kiln_source, refine it with kiln_edit, review the result, and save a child revision with kiln_save. Requested change: `:`Use kiln_assets with action=restore, collection=${hs.collection}, assetId=${e.assetId}, revisionId=${e.revisionId}. Read the returned programRef with kiln_source, refine it with kiln_edit, review the result, and save with kiln_save using assetId=${e.assetId}, parentRevision=${e.revisionId}, collection=${hs.collection}. Requested change: `;try{await navigator.clipboard.writeText(t),De("refine").textContent="Instructions copied"}catch{De("provenance").textContent=t,De("provenance").parentElement?.setAttribute("open","")}};De("export-selection").onclick=()=>{try{let e=Ct("a");if(ec==="opened-files")e.href=go(Yc(fs.filter((t)=>Yi.has(br(t))).map((t)=>t.local)),"application/zip");else{let t=new URLSearchParams;for(let n of Yi)t.append("revision",n);e.href=`/api/bundle?${t}`}e.download="kiln-assets.zip",e.click()}catch(e){Mr(e)}};async function fE(){mo=(await V0("/api/collections")).collections;let e=$0("kiln.collection");if(await tc(mo.find((t)=>t.id===e)?.id??mo[0]?.id??"project"),new URLSearchParams(location.search).has("open")){let t=await fetch("/api/standalone");if(!t.ok)throw Error("File unavailable");if(await Z0([{name:t.headers.get("Content-Type")?.includes("zip")?"asset.zip":"asset.glb",bytes:new Uint8Array(await t.arrayBuffer())}]),Sr.length===1)await mh(Sr[0])}}fE().catch(Mr);
+}`;class Sx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new sc(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new An({vertexShader:RA,fragmentShader:CA,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new pt(new po(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Mx extends Hn{constructor(e,t){super();let n=this,i=null,r=1,s=null,o="local-floor",a=1,c=null,l=null,u=null,h=null,f=null,d=null,m=typeof XRWebGLBinding<"u",x=new Sx,p={},g=t.getContextAttributes(),A=null,E=null,y=[],w=[],T=new Ie,R=null,_=new Lt;_.viewport=new st;let S=new Lt;S.viewport=new st;let U=[_,S],C=new Mh,z=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=y[Z];if(ne===void 0)ne=new so,y[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=y[Z];if(ne===void 0)ne=new so,y[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=y[Z];if(ne===void 0)ne=new so,y[Z]=ne;return ne.getHandSpace()};function F(Z){let ne=w.indexOf(Z.inputSource);if(ne===-1)return;let fe=y[ne];if(fe!==void 0)fe.update(Z.inputSource,Z.frame,c||s),fe.dispatchEvent({type:Z.type,data:Z.inputSource})}function H(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",V);for(let Z=0;Z<y.length;Z++){let ne=w[Z];if(ne===null)continue;w[Z]=null,y[Z].disconnect(ne)}z=null,j=null,x.reset();for(let Z in p)delete p[Z];e.setRenderTarget(A),f=null,h=null,u=null,i=null,E=null,Ge.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(r=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(o=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){if(u===null&&m)u=new XRWebGLBinding(i,t);return u},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",H),i.addEventListener("inputsourceschange",V),g.xrCompatible!==!0)await t.makeXRCompatible();if(R=e.getPixelRatio(),e.getSize(T),!(m&&("createProjectionLayer"in XRWebGLBinding.prototype))){let fe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new En(f.framebufferWidth,f.framebufferHeight,{format:ri,type:Gn,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{let fe=null,de=null,Re=null;if(g.depth)Re=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=g.stencil?yr:vr,de=g.stencil?os:$i;let Ze={colorFormat:t.RGBA8,depthFormat:Re,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer(Ze),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new En(h.textureWidth,h.textureHeight,{format:ri,type:Gn,depthTexture:new qi(h.textureWidth,h.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(a),c=null,s=await i.requestReferenceSpace(o),Ge.setContext(i),Ge.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function V(Z){for(let ne=0;ne<Z.removed.length;ne++){let fe=Z.removed[ne],de=w.indexOf(fe);if(de>=0)w[de]=null,y[de].disconnect(fe)}for(let ne=0;ne<Z.added.length;ne++){let fe=Z.added[ne],de=w.indexOf(fe);if(de===-1){for(let Ze=0;Ze<y.length;Ze++)if(Ze>=w.length){w.push(fe),de=Ze;break}else if(w[Ze]===null){w[Ze]=fe,de=Ze;break}if(de===-1)break}let Re=y[de];if(Re)Re.connect(fe)}}let O=new N,K=new N;function Q(Z,ne,fe){O.setFromMatrixPosition(ne.matrixWorld),K.setFromMatrixPosition(fe.matrixWorld);let de=O.distanceTo(K),Re=ne.projectionMatrix.elements,Ze=fe.projectionMatrix.elements,Ue=Re[14]/(Re[10]-1),ke=Re[14]/(Re[10]+1),Ke=(Re[9]+1)/Re[5],Ye=(Re[9]-1)/Re[5],Je=(Re[8]-1)/Re[0],Ft=(Ze[8]+1)/Ze[0],vn=Ue*Je,mt=Ue*Ft,Vt=de/(-Je+Ft),zt=Vt*-Je;if(ne.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(zt),Z.translateZ(Vt),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Re[10]===-1)Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{let Pt=Ue+Vt,L=ke+Vt,yn=vn-zt,it=mt+(de-zt),gt=Ke*ke/L*Pt,M=Ye*ke/L*Pt;Z.projectionMatrix.makePerspective(yn,it,gt,M,Pt,L),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function se(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:fe}=Z;if(x.texture!==null){if(x.depthNear>0)ne=x.depthNear;if(x.depthFar>0)fe=x.depthFar}if(C.near=S.near=_.near=ne,C.far=S.far=_.far=fe,z!==C.near||j!==C.far)i.updateRenderState({depthNear:C.near,depthFar:C.far}),z=C.near,j=C.far;C.layers.mask=Z.layers.mask|6,_.layers.mask=C.layers.mask&-5,S.layers.mask=C.layers.mask&-3;let de=Z.parent,Re=C.cameras;se(C,de);for(let Ze=0;Ze<Re.length;Ze++)se(Re[Ze],de);if(Re.length===2)Q(C,_,S);else C.projectionMatrix.copy(_.projectionMatrix);me(Z,C,de)};function me(Z,ne,fe){if(fe===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(fe.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=mr*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return C},this.getFoveation=function(){if(h===null&&f===null)return;return a},this.setFoveation=function(Z){if(a=Z,h!==null)h.fixedFoveation=Z;if(f!==null&&f.fixedFoveation!==void 0)f.fixedFoveation=Z},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(C)},this.getCameraTexture=function(Z){return p[Z]};let _e=null;function qe(Z,ne){if(l=ne.getViewerPose(c||s),d=ne,l!==null){let fe=l.views;if(f!==null)e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E);let de=!1;if(fe.length!==C.cameras.length)C.cameras.length=0,de=!0;for(let ke=0;ke<fe.length;ke++){let Ke=fe[ke],Ye=null;if(f!==null)Ye=f.getViewport(Ke);else{let Ft=u.getViewSubImage(h,Ke);if(Ye=Ft.viewport,ke===0)e.setRenderTargetTextures(E,Ft.colorTexture,Ft.depthStencilTexture),e.setRenderTarget(E)}let Je=U[ke];if(Je===void 0)Je=new Lt,Je.layers.enable(ke),Je.viewport=new st,U[ke]=Je;if(Je.matrix.fromArray(Ke.transform.matrix),Je.matrix.decompose(Je.position,Je.quaternion,Je.scale),Je.projectionMatrix.fromArray(Ke.projectionMatrix),Je.projectionMatrixInverse.copy(Je.projectionMatrix).invert(),Je.viewport.set(Ye.x,Ye.y,Ye.width,Ye.height),ke===0)C.matrix.copy(Je.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale);if(de===!0)C.cameras.push(Je)}let Re=i.enabledFeatures;if(Re&&Re.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&m){u=n.getBinding();let ke=u.getDepthInformation(fe[0]);if(ke&&ke.isValid&&ke.texture)x.init(ke,i.renderState)}if(Re&&Re.includes("camera-access")&&m){e.state.unbindTexture(),u=n.getBinding();for(let ke=0;ke<fe.length;ke++){let Ke=fe[ke].camera;if(Ke){let Ye=p[Ke];if(!Ye)Ye=new sc,p[Ke]=Ye;let Je=u.getCameraImage(Ke);Ye.sourceTexture=Je}}}}for(let fe=0;fe<y.length;fe++){let de=w[fe],Re=y[fe];if(de!==null&&Re!==void 0)Re.update(de,ne,c||s)}if(_e)_e(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});d=null}let Ge=new hx;Ge.setAnimationLoop(qe),this.setAnimationLoop=function(Z){_e=Z},this.dispose=function(){}}}var IA=new ze,wx=new Oe;wx.set(-1,0,0,0,1,0,0,0,1);function PA(e,t){function n(p,g){if(p.matrixAutoUpdate===!0)p.updateMatrix();g.value.copy(p.matrix)}function i(p,g){if(g.color.getRGB(p.fogColor.value,dh(e)),g.isFog)p.fogNear.value=g.near,p.fogFar.value=g.far;else if(g.isFogExp2)p.fogDensity.value=g.density}function r(p,g,A,E,y){if(g.isNodeMaterial)g.uniformsNeedUpdate=!1;else if(g.isMeshBasicMaterial)s(p,g);else if(g.isMeshLambertMaterial){if(s(p,g),g.envMap)p.envMapIntensity.value=g.envMapIntensity}else if(g.isMeshToonMaterial)s(p,g),h(p,g);else if(g.isMeshPhongMaterial){if(s(p,g),u(p,g),g.envMap)p.envMapIntensity.value=g.envMapIntensity}else if(g.isMeshStandardMaterial){if(s(p,g),f(p,g),g.isMeshPhysicalMaterial)d(p,g,y)}else if(g.isMeshMatcapMaterial)s(p,g),m(p,g);else if(g.isMeshDepthMaterial)s(p,g);else if(g.isMeshDistanceMaterial)s(p,g),x(p,g);else if(g.isMeshNormalMaterial)s(p,g);else if(g.isLineBasicMaterial){if(o(p,g),g.isLineDashedMaterial)a(p,g)}else if(g.isPointsMaterial)c(p,g,A,E);else if(g.isSpriteMaterial)l(p,g);else if(g.isShadowMaterial)p.color.value.copy(g.color),p.opacity.value=g.opacity;else if(g.isShaderMaterial)g.uniformsNeedUpdate=!1}function s(p,g){if(p.opacity.value=g.opacity,g.color)p.diffuse.value.copy(g.color);if(g.emissive)p.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity);if(g.map)p.map.value=g.map,n(g.map,p.mapTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.bumpMap){if(p.bumpMap.value=g.bumpMap,n(g.bumpMap,p.bumpMapTransform),p.bumpScale.value=g.bumpScale,g.side===jt)p.bumpScale.value*=-1}if(g.normalMap){if(p.normalMap.value=g.normalMap,n(g.normalMap,p.normalMapTransform),p.normalScale.value.copy(g.normalScale),g.side===jt)p.normalScale.value.negate()}if(g.displacementMap)p.displacementMap.value=g.displacementMap,n(g.displacementMap,p.displacementMapTransform),p.displacementScale.value=g.displacementScale,p.displacementBias.value=g.displacementBias;if(g.emissiveMap)p.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,p.emissiveMapTransform);if(g.specularMap)p.specularMap.value=g.specularMap,n(g.specularMap,p.specularMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest;let A=t.get(g),{envMap:E,envMapRotation:y}=A;if(E){if(p.envMap.value=E,p.envMapRotation.value.setFromMatrix4(IA.makeRotationFromEuler(y)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(wx);p.reflectivity.value=g.reflectivity,p.ior.value=g.ior,p.refractionRatio.value=g.refractionRatio}if(g.lightMap)p.lightMap.value=g.lightMap,p.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,p.lightMapTransform);if(g.aoMap)p.aoMap.value=g.aoMap,p.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,p.aoMapTransform)}function o(p,g){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,g.map)p.map.value=g.map,n(g.map,p.mapTransform)}function a(p,g){p.dashSize.value=g.dashSize,p.totalSize.value=g.dashSize+g.gapSize,p.scale.value=g.scale}function c(p,g,A,E){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.size.value=g.size*A,p.scale.value=E*0.5,g.map)p.map.value=g.map,n(g.map,p.uvTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest}function l(p,g){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.rotation.value=g.rotation,g.map)p.map.value=g.map,n(g.map,p.mapTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest}function u(p,g){p.specular.value.copy(g.specular),p.shininess.value=Math.max(g.shininess,0.0001)}function h(p,g){if(g.gradientMap)p.gradientMap.value=g.gradientMap}function f(p,g){if(p.metalness.value=g.metalness,g.metalnessMap)p.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=g.roughness,g.roughnessMap)p.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,p.roughnessMapTransform);if(g.envMap)p.envMapIntensity.value=g.envMapIntensity}function d(p,g,A){if(p.ior.value=g.ior,g.sheen>0){if(p.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),p.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap)p.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,p.sheenColorMapTransform);if(g.sheenRoughnessMap)p.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(g.clearcoat>0){if(p.clearcoat.value=g.clearcoat,p.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap)p.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,p.clearcoatMapTransform);if(g.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(g.clearcoatNormalMap){if(p.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===jt)p.clearcoatNormalScale.value.negate()}}if(g.dispersion>0)p.dispersion.value=g.dispersion;if(g.iridescence>0){if(p.iridescence.value=g.iridescence,p.iridescenceIOR.value=g.iridescenceIOR,p.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap)p.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,p.iridescenceMapTransform);if(g.iridescenceThicknessMap)p.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(g.transmission>0){if(p.transmission.value=g.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),g.transmissionMap)p.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=g.thickness,g.thicknessMap)p.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=g.attenuationDistance,p.attenuationColor.value.copy(g.attenuationColor)}if(g.anisotropy>0){if(p.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap)p.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=g.specularIntensity,p.specularColor.value.copy(g.specularColor),g.specularColorMap)p.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,p.specularColorMapTransform);if(g.specularIntensityMap)p.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,p.specularIntensityMapTransform)}function m(p,g){if(g.matcap)p.matcap.value=g.matcap}function x(p,g){let A=t.get(g).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function LA(e,t,n,i){let r={},s={},o=[],a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,w){let T=w.program;i.uniformBlockBinding(y,T)}function l(y,w){let T=r[y.id];if(T===void 0)p(y),T=u(y),r[y.id]=T,y.addEventListener("dispose",A);let R=w.program;i.updateUBOMapping(y,R);let _=t.render.frame;if(s[y.id]!==_)f(y),s[y.id]=_}function u(y){let w=h();y.__bindingPointIndex=w;let T=e.createBuffer(),{__size:R,usage:_}=y;return e.bindBuffer(e.UNIFORM_BUFFER,T),e.bufferData(e.UNIFORM_BUFFER,R,_),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,w,T),T}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return Ne("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(y){let w=r[y.id],{uniforms:T,__cache:R}=y;e.bindBuffer(e.UNIFORM_BUFFER,w);for(let _=0,S=T.length;_<S;_++){let U=T[_];if(Array.isArray(U))for(let C=0,z=U.length;C<z;C++)d(U[C],_,C,R);else d(U,_,0,R)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function d(y,w,T,R){if(x(y,w,T,R)===!0){let{__offset:_,value:S}=y;if(Array.isArray(S)){let U=0;for(let C=0;C<S.length;C++){let z=S[C],j=g(z);if(m(z,y.__data,U),typeof z!=="number"&&typeof z!=="boolean"&&!z.isMatrix3&&!ArrayBuffer.isView(z))U+=j.storage/Float32Array.BYTES_PER_ELEMENT}}else m(S,y.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,_,y.__data)}}function m(y,w,T){if(typeof y==="number"||typeof y==="boolean")w[0]=y;else if(y.isMatrix3)w[0]=y.elements[0],w[1]=y.elements[1],w[2]=y.elements[2],w[3]=0,w[4]=y.elements[3],w[5]=y.elements[4],w[6]=y.elements[5],w[7]=0,w[8]=y.elements[6],w[9]=y.elements[7],w[10]=y.elements[8],w[11]=0;else if(ArrayBuffer.isView(y))w.set(new y.constructor(y.buffer,y.byteOffset,w.length));else y.toArray(w,T)}function x(y,w,T,R){let _=y.value,S=w+"_"+T;if(R[S]===void 0){if(typeof _==="number"||typeof _==="boolean")R[S]=_;else if(ArrayBuffer.isView(_))R[S]=_.slice();else R[S]=_.clone();return!0}else{let U=R[S];if(typeof _==="number"||typeof _==="boolean"){if(U!==_)return R[S]=_,!0}else if(ArrayBuffer.isView(_))return!0;else if(U.equals(_)===!1)return U.copy(_),!0}return!1}function p(y){let w=y.uniforms,T=0,R=16;for(let S=0,U=w.length;S<U;S++){let C=Array.isArray(w[S])?w[S]:[w[S]];for(let z=0,j=C.length;z<j;z++){let F=C[z],H=Array.isArray(F.value)?F.value:[F.value];for(let V=0,O=H.length;V<O;V++){let K=H[V],Q=g(K),se=T%R,me=se%Q.boundary,_e=se+me;if(T+=me,_e!==0&&R-_e<Q.storage)T+=R-_e;F.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=T,T+=Q.storage}}}let _=T%R;if(_>0)T+=R-_;return y.__size=T,y.__cache={},this}function g(y){let w={boundary:0,storage:0};if(typeof y==="number"||typeof y==="boolean")w.boundary=4,w.storage=4;else if(y.isVector2)w.boundary=8,w.storage=8;else if(y.isVector3||y.isColor)w.boundary=16,w.storage=12;else if(y.isVector4)w.boundary=16,w.storage=16;else if(y.isMatrix3)w.boundary=48,w.storage=48;else if(y.isMatrix4)w.boundary=64,w.storage=64;else if(y.isTexture)Me("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(y))w.boundary=16,w.storage=y.byteLength;else Me("WebGLRenderer: Unsupported uniform value type.",y);return w}function A(y){let w=y.target;w.removeEventListener("dispose",A);let T=o.indexOf(w.__bindingPointIndex);o.splice(T,1),e.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function E(){for(let y in r)e.deleteBuffer(r[y]);o=[],r={},s={}}return{bind:c,update:l,dispose:E}}var NA=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),oi=null;function DA(){if(oi===null)oi=new co(NA,16,16,br,wi),oi.name="DFG_LUT",oi.minFilter=Ht,oi.magFilter=Ht,oi.wrapS=rs,oi.wrapT=rs,oi.generateMipmaps=!1,oi.needsUpdate=!0;return oi}class kh{constructor(e={}){let{canvas:t=P0(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:c=!1,powerPreference:l="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:h=!1,outputBufferType:f=Gn}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=s;let m=f,x=new Set([Tu,wu,Mu]),p=new Set([Gn,$i,to,os,bu,Su]),g=new Uint32Array(4),A=new Int32Array(4),E=new N,y=null,w=null,T=[],R=[],_=null;this.domElement=t,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=kn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let S=this,U=!1,C=null,z=null,j=null,F=null;this._outputColorSpace=Wi;let H=0,V=0,O=null,K=-1,Q=null,se=new st,me=new st,_e=null,qe=new Le(0),Ge=0,{width:Z,height:ne}=t,fe=1,de=null,Re=null,Ze=new st(0,0,Z,ne),Ue=new st(0,0,Z,ne),ke=!1,Ke=new uo,Ye=!1,Je=!1,Ft=new ze,vn=new N,mt=new st,Vt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},zt=!1;function Pt(){return O===null?fe:1}let L=n;function yn(b,D){return t.getContext(b,D)}try{let b={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${F_}`);if(t.addEventListener("webglcontextlost",Fe,!1),t.addEventListener("webglcontextrestored",St,!1),t.addEventListener("webglcontextcreationerror",ft,!1),L===null){if(L=yn("webgl2",b),L===null)if(yn("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(b){throw Ne("WebGLRenderer: "+b.message),b}let it,gt,M,v,I,W,te,ie,le,X,J,xe,we,ue,re,Ce,Pe,et,P,oe,Y,ae,ve;function ee(){if(it=new GT(L),it.init(),Y=new AA(L,it),gt=new NT(L,it,e,Y),M=new TA(L,it),gt.reversedDepthBuffer&&h)M.buffers.depth.setReversed(!0);z=L.createFramebuffer(),j=L.createFramebuffer(),F=L.createFramebuffer(),v=new $T(L),I=new hA,W=new EA(L,it,M,I,gt,Y,v),te=new BT(S),ie=new qS(L),ae=new PT(L,ie),le=new HT(L,ie,v,ae),X=new ZT(L,le,ie,ae,v),et=new WT(L,gt,W),re=new DT(I),J=new uA(S,te,it,gt,ae,re),xe=new PA(S,I),we=new dA,ue=new vA(it),Pe=new IT(S,te,M,X,d,a),Ce=new wA(S,X,gt),ve=new LA(L,v,gt,M),P=new LT(L,it,v),oe=new VT(L,it,v),v.programs=J.programs,S.capabilities=gt,S.extensions=it,S.properties=I,S.renderLists=we,S.shadowMap=Ce,S.state=M,S.info=v}if(ee(),m!==Gn)_=new qT(m,t.width,t.height,o,i,r);let ce=new Mx(S,L);this.xr=ce,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let b=it.get("WEBGL_lose_context");if(b)b.loseContext()},this.forceContextRestore=function(){let b=it.get("WEBGL_lose_context");if(b)b.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(b){if(b===void 0)return;fe=b,this.setSize(Z,ne,!1)},this.getSize=function(b){return b.set(Z,ne)},this.setSize=function(b,D,G=!0){if(ce.isPresenting){Me("WebGLRenderer: Can't change size while VR device is presenting.");return}if(Z=b,ne=D,t.width=Math.floor(b*fe),t.height=Math.floor(D*fe),G===!0)t.style.width=b+"px",t.style.height=D+"px";if(_!==null)_.setSize(t.width,t.height);this.setViewport(0,0,b,D)},this.getDrawingBufferSize=function(b){return b.set(Z*fe,ne*fe).floor()},this.setDrawingBufferSize=function(b,D,G){Z=b,ne=D,fe=G,t.width=Math.floor(b*G),t.height=Math.floor(D*G),this.setViewport(0,0,b,D)},this.setEffects=function(b){if(m===Gn){Ne("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(b){for(let D=0;D<b.length;D++)if(b[D].isOutputPass===!0){Me("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(b||[])},this.getCurrentViewport=function(b){return b.copy(se)},this.getViewport=function(b){return b.copy(Ze)},this.setViewport=function(b,D,G,k){if(b.isVector4)Ze.set(b.x,b.y,b.z,b.w);else Ze.set(b,D,G,k);M.viewport(se.copy(Ze).multiplyScalar(fe).round())},this.getScissor=function(b){return b.copy(Ue)},this.setScissor=function(b,D,G,k){if(b.isVector4)Ue.set(b.x,b.y,b.z,b.w);else Ue.set(b,D,G,k);M.scissor(me.copy(Ue).multiplyScalar(fe).round())},this.getScissorTest=function(){return ke},this.setScissorTest=function(b){M.setScissorTest(ke=b)},this.setOpaqueSort=function(b){de=b},this.setTransparentSort=function(b){Re=b},this.getClearColor=function(b){return b.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor(...arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha(...arguments)},this.clear=function(b=!0,D=!0,G=!0){let k=0;if(b){let B=!1;if(O!==null){let ge=O.texture.format;B=x.has(ge)}if(B){let ge=O.texture.type,be=p.has(ge),pe=Pe.getClearColor(),Se=Pe.getClearAlpha(),{r:Ee,g:Be,b:Ve}=pe;if(be)g[0]=Ee,g[1]=Be,g[2]=Ve,g[3]=Se,L.clearBufferuiv(L.COLOR,0,g);else A[0]=Ee,A[1]=Be,A[2]=Ve,A[3]=Se,L.clearBufferiv(L.COLOR,0,A)}else k|=L.COLOR_BUFFER_BIT}if(D)k|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(G)k|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(k!==0)L.clear(k)},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.setNodesHandler=function(b){b.setRenderer(this),C=b},this.dispose=function(){t.removeEventListener("webglcontextlost",Fe,!1),t.removeEventListener("webglcontextrestored",St,!1),t.removeEventListener("webglcontextcreationerror",ft,!1),Pe.dispose(),we.dispose(),ue.dispose(),I.dispose(),te.dispose(),X.dispose(),ae.dispose(),ve.dispose(),J.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",rf),ce.removeEventListener("sessionend",sf),rr.stop()};function Fe(b){b.preventDefault(),js("WebGLRenderer: Context Lost."),U=!0}function St(){js("WebGLRenderer: Context Restored."),U=!1;let b=v.autoReset,D=Ce.enabled,G=Ce.autoUpdate,k=Ce.needsUpdate,B=Ce.type;ee(),v.autoReset=b,Ce.enabled=D,Ce.autoUpdate=G,Ce.needsUpdate=k,Ce.type=B}function ft(b){Ne("WebGLRenderer: A WebGL context could not be created. Reason: ",b.statusMessage)}function Vn(b){let D=b.target;D.removeEventListener("dispose",Vn),li(D)}function li(b){dv(b),I.remove(b)}function dv(b){let D=I.get(b).programs;if(D!==void 0){if(D.forEach(function(G){J.releaseProgram(G)}),b.isShaderMaterial)J.releaseShaderCache(b)}}this.renderBufferDirect=function(b,D,G,k,B,ge){if(D===null)D=Vt;let be=B.isMesh&&B.matrixWorld.determinantAffine()<0,pe=gv(b,D,G,k,B);M.setMaterial(k,be);let Se=G.index,Ee=1;if(k.wireframe===!0){if(Se=le.getWireframeAttribute(G),Se===void 0)return;Ee=2}let Be=G.drawRange,Ve=G.attributes.position,Ae=Be.start*Ee,ot=(Be.start+Be.count)*Ee;if(ge!==null)Ae=Math.max(Ae,ge.start*Ee),ot=Math.min(ot,(ge.start+ge.count)*Ee);if(Se!==null)Ae=Math.max(Ae,0),ot=Math.min(ot,Se.count);else if(Ve!==void 0&&Ve!==null)Ae=Math.max(Ae,0),ot=Math.min(ot,Ve.count);let Tt=ot-Ae;if(Tt<0||Tt===1/0)return;ae.setup(B,k,pe,G,Se);let Mt,lt=P;if(Se!==null)Mt=ie.get(Se),lt=oe,lt.setIndex(Mt);if(B.isMesh)if(k.wireframe===!0)M.setLineWidth(k.wireframeLinewidth*Pt()),lt.setMode(L.LINES);else lt.setMode(L.TRIANGLES);else if(B.isLine){let Wt=k.linewidth;if(Wt===void 0)Wt=1;if(M.setLineWidth(Wt*Pt()),B.isLineSegments)lt.setMode(L.LINES);else if(B.isLineLoop)lt.setMode(L.LINE_LOOP);else lt.setMode(L.LINE_STRIP)}else if(B.isPoints)lt.setMode(L.POINTS);else if(B.isSprite)lt.setMode(L.TRIANGLES);if(B.isBatchedMesh)if(!it.get("WEBGL_multi_draw")){let{_multiDrawStarts:Wt,_multiDrawCounts:ye,_multiDrawCount:an}=B,Qe=Se?ie.get(Se).bytesPerElement:1,bn=I.get(k).currentProgram.getUniforms();for(let $n=0;$n<an;$n++)bn.setValue(L,"_gl_DrawID",$n),lt.render(Wt[$n]/Qe,ye[$n])}else lt.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else if(B.isInstancedMesh)lt.renderInstances(Ae,Tt,B.count);else if(G.isInstancedBufferGeometry){let Wt=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,ye=Math.min(G.instanceCount,Wt);lt.renderInstances(Ae,Tt,ye)}else lt.render(Ae,Tt)};function nf(b,D,G){if(b.transparent===!0&&b.side===Tn&&b.forceSinglePass===!1)b.side=jt,b.needsUpdate=!0,Io(b,D,G),b.side=Vi,b.needsUpdate=!0,Io(b,D,G),b.side=Tn;else Io(b,D,G)}this.compile=function(b,D,G=null){if(G===null)G=b;if(w=ue.get(G),w.init(D),R.push(w),G.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}}),b!==G)b.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}});w.setupLights();let k=new Set;return b.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;let ge=B.material;if(ge)if(Array.isArray(ge))for(let be=0;be<ge.length;be++){let pe=ge[be];nf(pe,G,B),k.add(pe)}else nf(ge,G,B),k.add(ge)}),w=R.pop(),k},this.compileAsync=function(b,D,G=null){let k=this.compile(b,D,G);return new Promise((B)=>{function ge(){if(k.forEach(function(be){if(I.get(be).currentProgram.isReady())k.delete(be)}),k.size===0){B(b);return}setTimeout(ge,10)}if(it.get("KHR_parallel_shader_compile")!==null)ge();else setTimeout(ge,10)})};let wc=null;function pv(b){if(wc)wc(b)}function rf(){rr.stop()}function sf(){rr.start()}let rr=new hx;if(rr.setAnimationLoop(pv),typeof self<"u")rr.setContext(self);this.setAnimationLoop=function(b){wc=b,ce.setAnimationLoop(b),b===null?rr.stop():rr.start()},ce.addEventListener("sessionstart",rf),ce.addEventListener("sessionend",sf),this.render=function(b,D){if(D!==void 0&&D.isCamera!==!0){Ne("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;if(C!==null)C.renderStart(b,D);let G=ce.enabled===!0&&ce.isPresenting===!0,k=_!==null&&(O===null||G)&&_.begin(S,O);if(b.matrixWorldAutoUpdate===!0)b.updateMatrixWorld();if(D.parent===null&&D.matrixWorldAutoUpdate===!0)D.updateMatrixWorld();if(ce.enabled===!0&&ce.isPresenting===!0&&(_===null||_.isCompositing()===!1)){if(ce.cameraAutoUpdate===!0)ce.updateCamera(D);D=ce.getCamera()}if(b.isScene===!0)b.onBeforeRender(S,b,D,O);if(w=ue.get(b,R.length),w.init(D),w.state.textureUnits=W.getTextureUnits(),R.push(w),Ft.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Ke.setFromProjectionMatrix(Ft,ah,D.reversedDepth),Je=this.localClippingEnabled,Ye=re.init(this.clippingPlanes,Je),y=we.get(b,T.length),y.init(),T.push(y),ce.enabled===!0&&ce.isPresenting===!0){let be=S.xr.getDepthSensingMesh();if(be!==null)Tc(be,D,-1/0,S.sortObjects)}if(Tc(b,D,0,S.sortObjects),y.finish(),S.sortObjects===!0)y.sort(de,Re,D.reversedDepth);if(zt=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,zt)Pe.addToRenderList(y,b);if(this.info.render.frame++,this.info.autoReset===!0)this.info.reset();if(Ye===!0)re.beginShadows();let B=w.state.shadowsArray;if(Ce.render(B,b,D),Ye===!0)re.endShadows();if((k&&_.hasRenderPass())===!1){let be=y.opaque,pe=y.transmissive;if(w.setupLights(),D.isArrayCamera){let Se=D.cameras;if(pe.length>0)for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee];af(be,pe,b,Ve)}if(zt)Pe.render(b);for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee];of(y,b,Ve,Ve.viewport)}}else{if(pe.length>0)af(be,pe,b,D);if(zt)Pe.render(b);of(y,b,D)}}if(O!==null&&V===0)W.updateMultisampleRenderTarget(O),W.updateRenderTargetMipmap(O);if(k)_.end(S);if(b.isScene===!0)b.onAfterRender(S,b,D);if(ae.resetDefaultState(),K=-1,Q=null,R.pop(),R.length>0){if(w=R[R.length-1],W.setTextureUnits(w.state.textureUnits),Ye===!0)re.setGlobalState(S.clippingPlanes,w.state.camera)}else w=null;if(T.pop(),T.length>0)y=T[T.length-1];else y=null;if(C!==null)C.renderEnd()};function Tc(b,D,G,k){if(b.visible===!1)return;if(b.layers.test(D.layers)){if(b.isGroup)G=b.renderOrder;else if(b.isLOD){if(b.autoUpdate===!0)b.update(D)}else if(b.isLightProbeGrid)w.pushLightProbeGrid(b);else if(b.isLight){if(w.pushLight(b),b.castShadow)w.pushShadow(b)}else if(b.isSprite){if(!b.frustumCulled||Ke.intersectsSprite(b)){if(k)mt.setFromMatrixPosition(b.matrixWorld).applyMatrix4(Ft);let be=X.update(b),pe=b.material;if(pe.visible)y.push(b,be,pe,G,mt.z,null)}}else if(b.isMesh||b.isLine||b.isPoints){if(!b.frustumCulled||Ke.intersectsObject(b)){let be=X.update(b),pe=b.material;if(k){if(b.boundingSphere!==void 0){if(b.boundingSphere===null)b.computeBoundingSphere();mt.copy(b.boundingSphere.center)}else{if(be.boundingSphere===null)be.computeBoundingSphere();mt.copy(be.boundingSphere.center)}mt.applyMatrix4(b.matrixWorld).applyMatrix4(Ft)}if(Array.isArray(pe)){let Se=be.groups;for(let Ee=0,Be=Se.length;Ee<Be;Ee++){let Ve=Se[Ee],Ae=pe[Ve.materialIndex];if(Ae&&Ae.visible)y.push(b,be,Ae,G,mt.z,Ve)}}else if(pe.visible)y.push(b,be,pe,G,mt.z,null)}}}let ge=b.children;for(let be=0,pe=ge.length;be<pe;be++)Tc(ge[be],D,G,k)}function of(b,D,G,k){let{opaque:B,transmissive:ge,transparent:be}=b;if(w.setupLightsView(G),Ye===!0)re.setGlobalState(S.clippingPlanes,G);if(k)M.viewport(se.copy(k));if(B.length>0)Co(B,D,G);if(ge.length>0)Co(ge,D,G);if(be.length>0)Co(be,D,G);M.buffers.depth.setTest(!0),M.buffers.depth.setMask(!0),M.buffers.color.setMask(!0),M.setPolygonOffset(!1)}function af(b,D,G,k){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(w.state.transmissionRenderTarget[k.id]===void 0){let Ae=it.has("EXT_color_buffer_half_float")||it.has("EXT_color_buffer_float");w.state.transmissionRenderTarget[k.id]=new En(1,1,{generateMipmaps:!0,type:Ae?wi:Gn,minFilter:ii,samples:Math.max(4,gt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$e.workingColorSpace})}let ge=w.state.transmissionRenderTarget[k.id],be=k.viewport||se;ge.setSize(be.z*S.transmissionResolutionScale,be.w*S.transmissionResolutionScale);let pe=S.getRenderTarget(),Se=S.getActiveCubeFace(),Ee=S.getActiveMipmapLevel();if(S.setRenderTarget(ge),S.getClearColor(qe),Ge=S.getClearAlpha(),Ge<1)S.setClearColor(16777215,0.5);if(S.clear(),zt)Pe.render(G);let Be=S.toneMapping;S.toneMapping=kn;let Ve=k.viewport;if(k.viewport!==void 0)k.viewport=void 0;if(w.setupLightsView(k),Ye===!0)re.setGlobalState(S.clippingPlanes,k);if(Co(b,G,k),W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge),it.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let ot=0,Tt=D.length;ot<Tt;ot++){let Mt=D[ot],{object:lt,geometry:Wt,material:ye,group:an}=Mt;if(ye.side===Tn&&lt.layers.test(k.layers)){let Qe=ye.side;ye.side=jt,ye.needsUpdate=!0,cf(lt,G,k,Wt,ye,an),ye.side=Qe,ye.needsUpdate=!0,Ae=!0}}if(Ae===!0)W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge)}if(S.setRenderTarget(pe,Se,Ee),S.setClearColor(qe,Ge),Ve!==void 0)k.viewport=Ve;S.toneMapping=Be}function Co(b,D,G){let k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,ge=b.length;B<ge;B++){let be=b[B],{object:pe,geometry:Se,group:Ee}=be,Be=be.material;if(Be.allowOverride===!0&&k!==null)Be=k;if(pe.layers.test(G.layers))cf(pe,D,G,Se,Be,Ee)}}function cf(b,D,G,k,B,ge){if(b.onBeforeRender(S,D,G,k,B,ge),b.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,b.matrixWorld),b.normalMatrix.getNormalMatrix(b.modelViewMatrix),B.onBeforeRender(S,D,G,k,b,ge),B.transparent===!0&&B.side===Tn&&B.forceSinglePass===!1)B.side=jt,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=Vi,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=Tn;else S.renderBufferDirect(G,D,k,B,b,ge);b.onAfterRender(S,D,G,k,B,ge)}function Io(b,D,G){if(D.isScene!==!0)D=Vt;let k=I.get(b),B=w.state.lights,ge=w.state.shadowsArray,be=B.state.version,pe=J.getParameters(b,B.state,ge,D,G,w.state.lightProbeGridArray),Se=J.getProgramCacheKey(pe),Ee=k.programs;k.environment=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?D.environment:null,k.fog=D.fog;let Be=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap;if(k.envMap=te.get(b.envMap||k.environment,Be),k.envMapRotation=k.environment!==null&&b.envMap===null?D.environmentRotation:b.envMapRotation,Ee===void 0)b.addEventListener("dispose",Vn),Ee=new Map,k.programs=Ee;let Ve=Ee.get(Se);if(Ve!==void 0){if(k.currentProgram===Ve&&k.lightsStateVersion===be)return uf(b,pe),Ve}else{if(pe.uniforms=J.getUniforms(b),C!==null&&b.isNodeMaterial)C.build(b,G,pe);b.onBeforeCompile(pe,S),Ve=J.acquireProgram(pe,Se),Ee.set(Se,Ve),k.uniforms=pe.uniforms}let Ae=k.uniforms;if(!b.isShaderMaterial&&!b.isRawShaderMaterial||b.clipping===!0)Ae.clippingPlanes=re.uniform;if(uf(b,pe),k.needsLights=xv(b),k.lightsStateVersion=be,k.needsLights)Ae.ambientLightColor.value=B.state.ambient,Ae.lightProbe.value=B.state.probe,Ae.directionalLights.value=B.state.directional,Ae.directionalLightShadows.value=B.state.directionalShadow,Ae.spotLights.value=B.state.spot,Ae.spotLightShadows.value=B.state.spotShadow,Ae.rectAreaLights.value=B.state.rectArea,Ae.ltc_1.value=B.state.rectAreaLTC1,Ae.ltc_2.value=B.state.rectAreaLTC2,Ae.pointLights.value=B.state.point,Ae.pointLightShadows.value=B.state.pointShadow,Ae.hemisphereLights.value=B.state.hemi,Ae.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Ae.spotLightMatrix.value=B.state.spotLightMatrix,Ae.spotLightMap.value=B.state.spotLightMap,Ae.pointShadowMatrix.value=B.state.pointShadowMatrix;return k.lightProbeGrid=w.state.lightProbeGridArray.length>0,k.currentProgram=Ve,k.uniformsList=null,Ve}function lf(b){if(b.uniformsList===null){let D=b.currentProgram.getUniforms();b.uniformsList=bo.seqWithValue(D.seq,b.uniforms)}return b.uniformsList}function uf(b,D){let G=I.get(b);G.outputColorSpace=D.outputColorSpace,G.batching=D.batching,G.batchingColor=D.batchingColor,G.instancing=D.instancing,G.instancingColor=D.instancingColor,G.instancingMorph=D.instancingMorph,G.skinning=D.skinning,G.morphTargets=D.morphTargets,G.morphNormals=D.morphNormals,G.morphColors=D.morphColors,G.morphTargetsCount=D.morphTargetsCount,G.numClippingPlanes=D.numClippingPlanes,G.numIntersection=D.numClipIntersection,G.vertexAlphas=D.vertexAlphas,G.vertexTangents=D.vertexTangents,G.toneMapping=D.toneMapping}function mv(b,D){if(b.length===0)return null;if(b.length===1)return b[0].texture!==null?b[0]:null;E.setFromMatrixPosition(D.matrixWorld);for(let G=0,k=b.length;G<k;G++){let B=b[G];if(B.texture!==null&&B.boundingBox.containsPoint(E))return B}return null}function gv(b,D,G,k,B){if(D.isScene!==!0)D=Vt;W.resetTextureUnits();let ge=D.fog,be=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?D.environment:null,pe=O===null?S.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:$e.workingColorSpace,Se=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ee=te.get(k.envMap||be,Se),Be=k.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,Ve=!!G.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ae=!!G.morphAttributes.position,ot=!!G.morphAttributes.normal,Tt=!!G.morphAttributes.color,Mt=kn;if(k.toneMapped){if(O===null||O.isXRRenderTarget===!0)Mt=S.toneMapping}let lt=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Wt=lt!==void 0?lt.length:0,ye=I.get(k),an=w.state.lights;if(Ye===!0){if(Je===!0||b!==Q){let dt=b===Q&&k.id===K;re.setState(k,b,dt)}}let Qe=!1;if(k.version===ye.__version){if(ye.needsLights&&ye.lightsStateVersion!==an.state.version)Qe=!0;else if(ye.outputColorSpace!==pe)Qe=!0;else if(B.isBatchedMesh&&ye.batching===!1)Qe=!0;else if(!B.isBatchedMesh&&ye.batching===!0)Qe=!0;else if(B.isBatchedMesh&&ye.batchingColor===!0&&B.colorTexture===null)Qe=!0;else if(B.isBatchedMesh&&ye.batchingColor===!1&&B.colorTexture!==null)Qe=!0;else if(B.isInstancedMesh&&ye.instancing===!1)Qe=!0;else if(!B.isInstancedMesh&&ye.instancing===!0)Qe=!0;else if(B.isSkinnedMesh&&ye.skinning===!1)Qe=!0;else if(!B.isSkinnedMesh&&ye.skinning===!0)Qe=!0;else if(B.isInstancedMesh&&ye.instancingColor===!0&&B.instanceColor===null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingColor===!1&&B.instanceColor!==null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!0&&B.morphTexture===null)Qe=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!1&&B.morphTexture!==null)Qe=!0;else if(ye.envMap!==Ee)Qe=!0;else if(k.fog===!0&&ye.fog!==ge)Qe=!0;else if(ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==re.numPlanes||ye.numIntersection!==re.numIntersection))Qe=!0;else if(ye.vertexAlphas!==Be)Qe=!0;else if(ye.vertexTangents!==Ve)Qe=!0;else if(ye.morphTargets!==Ae)Qe=!0;else if(ye.morphNormals!==ot)Qe=!0;else if(ye.morphColors!==Tt)Qe=!0;else if(ye.toneMapping!==Mt)Qe=!0;else if(ye.morphTargetsCount!==Wt)Qe=!0;else if(!!ye.lightProbeGrid!==w.state.lightProbeGridArray.length>0)Qe=!0}else Qe=!0,ye.__version=k.version;let bn=ye.currentProgram;if(Qe===!0){if(bn=Io(k,D,B),C&&k.isNodeMaterial)C.onUpdateProgram(k,bn,ye)}let $n=!1,Ri=!1,Pr=!1,ut=bn.getUniforms(),Et=ye.uniforms;if(M.useProgram(bn.program))$n=!0,Ri=!0,Pr=!0;if(k.id!==K)K=k.id,Ri=!0;if(ye.needsLights){let dt=mv(w.state.lightProbeGridArray,B);if(ye.lightProbeGrid!==dt)ye.lightProbeGrid=dt,Ri=!0}if($n||Q!==b){if(M.buffers.depth.getReversed()&&b.reversedDepth!==!0)b._reversedDepth=!0,b.updateProjectionMatrix();ut.setValue(L,"projectionMatrix",b.projectionMatrix),ut.setValue(L,"viewMatrix",b.matrixWorldInverse);let Ii=ut.map.cameraPosition;if(Ii!==void 0)Ii.setValue(L,vn.setFromMatrixPosition(b.matrixWorld));if(gt.logarithmicDepthBuffer)ut.setValue(L,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2));if(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)ut.setValue(L,"isOrthographic",b.isOrthographicCamera===!0);if(Q!==b)Q=b,Ri=!0,Pr=!0}if(ye.needsLights){if(an.state.directionalShadowMap.length>0)ut.setValue(L,"directionalShadowMap",an.state.directionalShadowMap,W);if(an.state.spotShadowMap.length>0)ut.setValue(L,"spotShadowMap",an.state.spotShadowMap,W);if(an.state.pointShadowMap.length>0)ut.setValue(L,"pointShadowMap",an.state.pointShadowMap,W)}if(B.isSkinnedMesh){ut.setOptional(L,B,"bindMatrix"),ut.setOptional(L,B,"bindMatrixInverse");let dt=B.skeleton;if(dt){if(dt.boneTexture===null)dt.computeBoneTexture();ut.setValue(L,"boneTexture",dt.boneTexture,W)}}if(B.isBatchedMesh){if(ut.setOptional(L,B,"batchingTexture"),ut.setValue(L,"batchingTexture",B._matricesTexture,W),ut.setOptional(L,B,"batchingIdTexture"),ut.setValue(L,"batchingIdTexture",B._indirectTexture,W),ut.setOptional(L,B,"batchingColorTexture"),B._colorsTexture!==null)ut.setValue(L,"batchingColorTexture",B._colorsTexture,W)}let Ci=G.morphAttributes;if(Ci.position!==void 0||Ci.normal!==void 0||Ci.color!==void 0)et.update(B,G,bn);if(Ri||ye.receiveShadow!==B.receiveShadow)ye.receiveShadow=B.receiveShadow,ut.setValue(L,"receiveShadow",B.receiveShadow);if((k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&D.environment!==null)Et.envMapIntensity.value=D.environmentIntensity;if(Et.dfgLUT!==void 0)Et.dfgLUT.value=DA();if(Ri){if(ut.setValue(L,"toneMappingExposure",S.toneMappingExposure),ye.needsLights)_v(Et,Pr);if(ge&&k.fog===!0)xe.refreshFogUniforms(Et,ge);if(xe.refreshMaterialUniforms(Et,k,fe,ne,w.state.transmissionRenderTarget[b.id]),ye.needsLights&&ye.lightProbeGrid){let dt=ye.lightProbeGrid;Et.probesSH.value=dt.texture,Et.probesMin.value.copy(dt.boundingBox.min),Et.probesMax.value.copy(dt.boundingBox.max),Et.probesResolution.value.copy(dt.resolution)}bo.upload(L,lf(ye),Et,W)}if(k.isShaderMaterial&&k.uniformsNeedUpdate===!0)bo.upload(L,lf(ye),Et,W),k.uniformsNeedUpdate=!1;if(k.isSpriteMaterial)ut.setValue(L,"center",B.center);if(ut.setValue(L,"modelViewMatrix",B.modelViewMatrix),ut.setValue(L,"normalMatrix",B.normalMatrix),ut.setValue(L,"modelMatrix",B.matrixWorld),k.uniformsGroups!==void 0){let dt=k.uniformsGroups;for(let Ii=0,Lr=dt.length;Ii<Lr;Ii++){let hf=dt[Ii];ve.update(hf,bn),ve.bind(hf,bn)}}return bn}function _v(b,D){b.ambientLightColor.needsUpdate=D,b.lightProbe.needsUpdate=D,b.directionalLights.needsUpdate=D,b.directionalLightShadows.needsUpdate=D,b.pointLights.needsUpdate=D,b.pointLightShadows.needsUpdate=D,b.spotLights.needsUpdate=D,b.spotLightShadows.needsUpdate=D,b.rectAreaLights.needsUpdate=D,b.hemisphereLights.needsUpdate=D}function xv(b){return b.isMeshLambertMaterial||b.isMeshToonMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isShadowMaterial||b.isShaderMaterial&&b.lights===!0}if(this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(b,D,G){let k=I.get(b);if(k.__autoAllocateDepthBuffer=b.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1)k.__useRenderToTexture=!1;I.get(b.texture).__webglTexture=D,I.get(b.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:G,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(b,D){let G=I.get(b);G.__webglFramebuffer=D,G.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(b,D=0,G=0){O=b,H=D,V=G;let k=null,B=!1,ge=!1;if(b){let pe=I.get(b);if(pe.__useDefaultFramebuffer!==void 0){M.bindFramebuffer(L.FRAMEBUFFER,pe.__webglFramebuffer),se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest,M.viewport(se),M.scissor(me),M.setScissorTest(_e),K=-1;return}else if(pe.__webglFramebuffer===void 0)W.setupRenderTarget(b);else if(pe.__hasExternalTextures)W.rebindTextures(b,I.get(b.texture).__webglTexture,I.get(b.depthTexture).__webglTexture);else if(b.depthBuffer){let Be=b.depthTexture;if(pe.__boundDepthTexture!==Be){if(Be!==null&&I.has(Be)&&(b.width!==Be.image.width||b.height!==Be.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");W.setupDepthRenderbuffer(b)}}let Se=b.texture;if(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)ge=!0;let Ee=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget){if(Array.isArray(Ee[D]))k=Ee[D][G];else k=Ee[D];B=!0}else if(b.samples>0&&W.useMultisampledRTT(b)===!1)k=I.get(b).__webglMultisampledFramebuffer;else if(Array.isArray(Ee))k=Ee[G];else k=Ee;se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest}else se.copy(Ze).multiplyScalar(fe).floor(),me.copy(Ue).multiplyScalar(fe).floor(),_e=ke;if(G!==0)k=z;if(M.bindFramebuffer(L.FRAMEBUFFER,k))M.drawBuffers(b,k);if(M.viewport(se),M.scissor(me),M.setScissorTest(_e),B){let pe=I.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+D,pe.__webglTexture,G)}else if(ge){let pe=D;for(let Se=0;Se<b.textures.length;Se++){let Ee=I.get(b.textures[Se]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Se,Ee.__webglTexture,G,pe)}}else if(b!==null&&G!==0){let pe=I.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,pe.__webglTexture,G)}K=-1},this.readRenderTargetPixels=function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se){M.bindFramebuffer(L.FRAMEBUFFER,Se);try{let Ee=b.textures[pe],{format:Be,type:Ve}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!gt.textureFormatReadable(Be)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!gt.textureTypeReadable(Ve)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B))L.readPixels(D,G,k,B,Y.convert(Be),Y.convert(Ve),ge)}finally{let Ee=O!==null?I.get(O).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=I.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se)if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B)){M.bindFramebuffer(L.FRAMEBUFFER,Se);let Ee=b.textures[pe],{format:Be,type:Ve}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!gt.textureFormatReadable(Be))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!gt.textureTypeReadable(Ve))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,ge.byteLength,L.STREAM_READ),L.readPixels(D,G,k,B,Y.convert(Be),Y.convert(Ve),0);let ot=O!==null?I.get(O).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,ot);let Tt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await N0(L,Tt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,ge),L.deleteBuffer(Ae),L.deleteSync(Tt),ge}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(b,D=null,G=0){let k=Math.pow(2,-G),B=Math.floor(b.image.width*k),ge=Math.floor(b.image.height*k),be=D!==null?D.x:0,pe=D!==null?D.y:0;W.setTexture2D(b,0),L.copyTexSubImage2D(L.TEXTURE_2D,G,0,0,be,pe,B,ge),M.unbindTexture()},this.copyTextureToTexture=function(b,D,G=null,k=null,B=0,ge=0){let be,pe,Se,Ee,Be,Ve,Ae,ot,Tt,Mt=b.isCompressedTexture?b.mipmaps[ge]:b.image;if(G!==null)be=G.max.x-G.min.x,pe=G.max.y-G.min.y,Se=G.isBox3?G.max.z-G.min.z:1,Ee=G.min.x,Be=G.min.y,Ve=G.isBox3?G.min.z:0;else{let Et=Math.pow(2,-B);if(be=Math.floor(Mt.width*Et),pe=Math.floor(Mt.height*Et),b.isDataArrayTexture)Se=Mt.depth;else if(b.isData3DTexture)Se=Math.floor(Mt.depth*Et);else Se=1;Ee=0,Be=0,Ve=0}if(k!==null)Ae=k.x,ot=k.y,Tt=k.z;else Ae=0,ot=0,Tt=0;let lt=Y.convert(D.format),Wt=Y.convert(D.type),ye;if(D.isData3DTexture)W.setTexture3D(D,0),ye=L.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)W.setTexture2DArray(D,0),ye=L.TEXTURE_2D_ARRAY;else W.setTexture2D(D,0),ye=L.TEXTURE_2D;M.activeTexture(L.TEXTURE0),M.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,D.flipY),M.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),M.pixelStorei(L.UNPACK_ALIGNMENT,D.unpackAlignment);let an=M.getParameter(L.UNPACK_ROW_LENGTH),Qe=M.getParameter(L.UNPACK_IMAGE_HEIGHT),bn=M.getParameter(L.UNPACK_SKIP_PIXELS),$n=M.getParameter(L.UNPACK_SKIP_ROWS),Ri=M.getParameter(L.UNPACK_SKIP_IMAGES);M.pixelStorei(L.UNPACK_ROW_LENGTH,Mt.width),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Mt.height),M.pixelStorei(L.UNPACK_SKIP_PIXELS,Ee),M.pixelStorei(L.UNPACK_SKIP_ROWS,Be),M.pixelStorei(L.UNPACK_SKIP_IMAGES,Ve);let Pr=b.isDataArrayTexture||b.isData3DTexture,ut=D.isDataArrayTexture||D.isData3DTexture;if(b.isDepthTexture){let Et=I.get(b),Ci=I.get(D),dt=I.get(Et.__renderTarget),Ii=I.get(Ci.__renderTarget);M.bindFramebuffer(L.READ_FRAMEBUFFER,dt.__webglFramebuffer),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,Ii.__webglFramebuffer);for(let Lr=0;Lr<Se;Lr++){if(Pr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,I.get(b).__webglTexture,B,Ve+Lr),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,I.get(D).__webglTexture,ge,Tt+Lr);L.blitFramebuffer(Ee,Be,be,pe,Ae,ot,be,pe,L.DEPTH_BUFFER_BIT,L.NEAREST)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(B!==0||b.isRenderTargetTexture||I.has(b)){let Et=I.get(b),Ci=I.get(D);M.bindFramebuffer(L.READ_FRAMEBUFFER,j),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,F);for(let dt=0;dt<Se;dt++){if(Pr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Et.__webglTexture,B,Ve+dt);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Et.__webglTexture,B);if(ut)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Ci.__webglTexture,ge,Tt+dt);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Ci.__webglTexture,ge);if(B!==0)L.blitFramebuffer(Ee,Be,be,pe,Ae,ot,be,pe,L.COLOR_BUFFER_BIT,L.NEAREST);else if(ut)L.copyTexSubImage3D(ye,ge,Ae,ot,Tt+dt,Ee,Be,be,pe);else L.copyTexSubImage2D(ye,ge,Ae,ot,Ee,Be,be,pe)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(ut)if(b.isDataTexture||b.isData3DTexture)L.texSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,Wt,Mt.data);else if(D.isCompressedArrayTexture)L.compressedTexSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,Mt.data);else L.texSubImage3D(ye,ge,Ae,ot,Tt,be,pe,Se,lt,Wt,Mt);else if(b.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,ge,Ae,ot,be,pe,lt,Wt,Mt.data);else if(b.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,ge,Ae,ot,Mt.width,Mt.height,lt,Mt.data);else L.texSubImage2D(L.TEXTURE_2D,ge,Ae,ot,be,pe,lt,Wt,Mt);if(M.pixelStorei(L.UNPACK_ROW_LENGTH,an),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Qe),M.pixelStorei(L.UNPACK_SKIP_PIXELS,bn),M.pixelStorei(L.UNPACK_SKIP_ROWS,$n),M.pixelStorei(L.UNPACK_SKIP_IMAGES,Ri),ge===0&&D.generateMipmaps)L.generateMipmap(ye);M.unbindTexture()},this.initRenderTarget=function(b){if(I.get(b).__webglFramebuffer===void 0)W.setupRenderTarget(b)},this.initTexture=function(b){if(b.isCubeTexture)W.setTextureCube(b,0);else if(b.isData3DTexture)W.setTexture3D(b,0);else if(b.isDataArrayTexture||b.isCompressedArrayTexture)W.setTexture2DArray(b,0);else W.setTexture2D(b,0);M.unbindTexture()},this.resetState=function(){H=0,V=0,O=null,M.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ah}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=$e._getDrawingBufferColorSpace(e),t.unpackColorSpace=$e._getUnpackColorSpace()}}function Bh(e,t){if(t===ih)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===as||t===no){let n=e.getIndex();if(n===null){let o=[],a=e.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);e.setIndex(o),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,r=[];if(t===as)for(let o=1;o<=i;o++)r.push(n.getX(0)),r.push(n.getX(o)),r.push(n.getX(o+1));else for(let o=0;o<i;o++)if(o%2===0)r.push(n.getX(o)),r.push(n.getX(o+1)),r.push(n.getX(o+2));else r.push(n.getX(o+2)),r.push(n.getX(o+1)),r.push(n.getX(o));if(r.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=e.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function Tx(e){let t=new Map,n=new Map,i=e.clone();return Ex(e,i,function(r,s){t.set(s,r),n.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=t.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return n.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function Ex(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)Ex(e.children[i],t.children[i],n)}class Xh extends Ai{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Dx(t)}),this.register(function(t){return new Ox(t)}),this.register(function(t){return new $x(t)}),this.register(function(t){return new Wx(t)}),this.register(function(t){return new Zx(t)}),this.register(function(t){return new Fx(t)}),this.register(function(t){return new zx(t)}),this.register(function(t){return new kx(t)}),this.register(function(t){return new Bx(t)}),this.register(function(t){return new Nx(t)}),this.register(function(t){return new Gx(t)}),this.register(function(t){return new Ux(t)}),this.register(function(t){return new Vx(t)}),this.register(function(t){return new Hx(t)}),this.register(function(t){return new Px(t)}),this.register(function(t){return new $h(t,Xe.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new $h(t,Xe.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Xx(t)})}load(e,t,n,i){let r=this,s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){let c=er.extractUrlBase(e);s=er.resolveURL(c,this.path)}else s=er.extractUrlBase(e);this.manager.itemStart(e);let o=function(c){if(i)i(c);else console.error(c);r.manager.itemError(e),r.manager.itemEnd(e)},a=new go(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{r.parse(c,s,function(l){t(l),r.manager.itemEnd(e)},o)}catch(l){o(l)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let r,s={},o={},a=new TextDecoder;if(typeof e==="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===qx){try{s[Xe.KHR_BINARY_GLTF]=new Yx(e)}catch(u){if(i)i(u);return}r=JSON.parse(s[Xe.KHR_BINARY_GLTF].content)}else r=JSON.parse(a.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new ev(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){let u=this.pluginCallbacks[l](c);if(!u.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");o[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let l=0;l<r.extensionsUsed.length;++l){let u=r.extensionsUsed[l],h=r.extensionsRequired||[];switch(u){case Xe.KHR_MATERIALS_UNLIT:s[u]=new Lx;break;case Xe.KHR_DRACO_MESH_COMPRESSION:s[u]=new jx(r,this.dracoLoader);break;case Xe.KHR_TEXTURE_TRANSFORM:s[u]=new Jx;break;case Xe.KHR_MESH_QUANTIZATION:s[u]=new Kx;break;default:if(h.indexOf(u)>=0&&o[u]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function UA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function Rt(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}var Xe={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Px{constructor(e){this.parser=e,this.name=Xe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];if(r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],c,l=new Le(16777215);if(a.color!==void 0)l.setRGB(a.color[0],a.color[1],a.color[2],pn);let u=a.range!==void 0?a.range:0;switch(a.type){case"directional":c=new ps(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ds(l),c.distance=u;break;case"spot":c=new dc(l),c.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,c.angle=a.spot.outerConeAngle,c.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}if(c.position.set(0,0,0),ci(c,a),a.intensity!==void 0)c.intensity=a.intensity;return c.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(c),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;if(o===void 0)return null;return this._loadLight(o).then(function(a){return n._getNodeRef(t.cache,o,a)})}}class Lx{constructor(){this.name=Xe.KHR_MATERIALS_UNLIT}getMaterialType(){return si}extendParams(e,t,n){let i=[];e.color=new Le(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],pn),e.opacity=s[3]}if(r.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",r.baseColorTexture,Wi))}return Promise.all(i)}}class Nx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class Dx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ie(r,r)}}return Promise.all(i)}}class Ox{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class Ux{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(t.iridescenceThicknessRange===void 0)t.iridescenceThicknessRange=[100,400];if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class Fx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_SHEEN}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Le(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],pn)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,Wi));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class zx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class kx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_VOLUME}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Le().setRGB(r[0],r[1],r[2],pn),Promise.all(i)}}class Bx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_IOR}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class Gx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];if(t.specularColor=new Le().setRGB(r[0],r[1],r[2],pn),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,Wi));return Promise.all(i)}}class Hx{constructor(e){this.parser=e,this.name=Xe.EXT_MATERIALS_BUMP}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class Vx{constructor(e){this.parser=e,this.name=Xe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Rt(this.parser,e,this.name)!==null?gn:null}extendMaterialParams(e,t){let n=Rt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class $x{constructor(e){this.parser=e,this.name=Xe.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,r.source,s)}}class Wx{constructor(e){this.parser=e,this.name=Xe.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class Zx{constructor(e){this.parser=e,this.name=Xe.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class $h{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return r.then(function(o){let a=i.byteOffset||0,c=i.byteLength||0,{count:l,byteStride:u}=i,h=new Uint8Array(o,a,c);if(s.decodeGltfBufferAsync)return s.decodeGltfBufferAsync(l,u,h,i.mode,i.filter).then(function(f){return f.buffer});else return s.ready.then(function(){let f=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(f),l,u,h,i.mode,i.filter),f})})}else return null}}class Xx{constructor(e){this.name=Xe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let c of i.primitives)if(c.mode!==Rn.TRIANGLES&&c.mode!==Rn.TRIANGLE_STRIP&&c.mode!==Rn.TRIANGLE_FAN&&c.mode!==void 0)return null;let s=n.extensions[this.name].attributes,o=[],a={};for(let c in s)o.push(this.parser.getDependency("accessor",s[c]).then((l)=>(a[c]=l,a[c])));if(o.length<1)return null;return o.push(this.parser.createNodeMesh(e)),Promise.all(o).then((c)=>{let l=c.pop(),u=l.isGroup?l.children:[l],h=c[0].count,f=[];for(let d of u){let m=new ze,x=new N,p=new Gt,g=new N(1,1,1),A=new us(d.geometry,d.material,h);for(let E=0;E<h;E++){if(a.TRANSLATION)x.fromBufferAttribute(a.TRANSLATION,E);if(a.ROTATION)p.fromBufferAttribute(a.ROTATION,E);if(a.SCALE)g.fromBufferAttribute(a.SCALE,E);A.setMatrixAt(E,m.compose(x,p,g))}for(let E in a)if(E==="_COLOR_0"){let y=a[E];A.instanceColor=new gr(y.array,y.itemSize,y.normalized)}else if(E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE")d.geometry.setAttribute(E,a[E]);at.prototype.copy.call(A,d),this.parser.assignFinalMaterial(A),f.push(A)}if(l.isGroup)return l.clear(),l.add(...f),l;return f[0]})}}var qx="glTF",Mo=12,Ax={JSON:1313821514,BIN:5130562};class Yx{constructor(e){this.name=Xe.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Mo),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==qx)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-Mo,r=new DataView(e,Mo),s=0;while(s<i){let o=r.getUint32(s,!0);s+=4;let a=r.getUint32(s,!0);if(s+=4,a===Ax.JSON){let c=new Uint8Array(e,Mo+s,o);this.content=n.decode(c)}else if(a===Ax.BIN){let c=Mo+s;this.body=e.slice(c,c+o)}s+=o}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class jx{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Xe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},c={};for(let l in s){let u=Wh[l]||l.toLowerCase();o[u]=s[l]}for(let l in e.attributes){let u=Wh[l]||l.toLowerCase();if(s[l]!==void 0){let h=n.accessors[e.attributes[l]],f=_s[h.componentType];c[u]=f.name,a[u]=h.normalized===!0}}return t.getDependency("bufferView",r).then(function(l){return new Promise(function(u,h){i.decodeDracoFile(l,function(f){for(let d in f.attributes){let m=f.attributes[d],x=a[d];if(x!==void 0)m.normalized=x}u(f)},o,c,pn,h)})})}}class Jx{constructor(){this.name=Xe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);return e.needsUpdate=!0,e}}class Kx{constructor(){this.name=Xe.KHR_MESH_QUANTIZATION}}class qh extends Ei{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=o*2,c=o*3,l=i-t,u=(n-t)/l,h=u*u,f=h*u,d=e*c,m=d-c,x=-2*f+3*h,p=f-h,g=1-x,A=p-h+u;for(let E=0;E!==o;E++){let y=s[m+E+o],w=s[m+E+a]*l,T=s[d+E+o],R=s[d+E]*l;r[E]=g*y+A*w+x*T+p*R}return r}}var FA=new Gt;class Qx extends qh{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return FA.fromArray(r).normalize().toArray(r),r}}var Rn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},_s={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Rx={9728:Bn,9729:Ht,9984:Ga,9985:ss,9986:xr,9987:ii},Cx={33071:rs,33648:Ba,10497:is},Gh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Wh={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},nr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},zA={CUBICSPLINE:void 0,LINEAR:qa,STEP:nh},Hh={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function kA(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new Ti({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Vi});return e.DefaultMaterial}function Ar(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function ci(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function BA(e,t,n){let i=!1,r=!1,s=!1;for(let l=0,u=t.length;l<u;l++){let h=t[l];if(h.POSITION!==void 0)i=!0;if(h.NORMAL!==void 0)r=!0;if(h.COLOR_0!==void 0)s=!0;if(i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);let o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){let h=t[l];if(i){let f=h.POSITION!==void 0?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(f)}if(r){let f=h.NORMAL!==void 0?n.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(f)}if(s){let f=h.COLOR_0!==void 0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;c.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let u=l[0],h=l[1],f=l[2];if(i)e.morphAttributes.position=u;if(r)e.morphAttributes.normal=h;if(s)e.morphAttributes.color=f;return e.morphTargetsRelative=!0,e})}function GA(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function HA(e){let t,n=e.extensions&&e.extensions[Xe.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+Vh(n.attributes);else t=e.indices+":"+Vh(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+Vh(e.targets[i]);return t}function Vh(e){let t="",n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Zh(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function VA(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var $A=new ze;class ev{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new UA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let a=o.match(/Version\/(\d+)/);i=n&&a?parseInt(a[1],10):-1,r=o.indexOf("Firefox")>-1,s=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||r&&s<98)this.textureLoader=new lc(this.options.manager);else this.textureLoader=new pc(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new go(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){let o={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};return Ar(r,o,i),ci(o,i),Promise.all(n._invokeAll(function(a){return a.afterRoot&&a.afterRoot(o)})).then(function(){for(let a of o.scenes)a.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let s=t[i].joints;for(let o=0,a=s.length;o<a;o++)e[s[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let s=e[i];if(s.mesh!==void 0){if(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0)n[s.mesh].isSkinnedMesh=!0}if(s.camera!==void 0)this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(s,o)=>{let a=this.associations.get(s);if(a!=null)this.associations.set(o,a);for(let[c,l]of s.children.entries())r(l,o.children[c])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,s){return n.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Xe.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,s){n.load(er.resolveURL(t.uri,i.path),r,void 0,function(){s(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let s=Gh[i.type],o=_s[i.componentType],a=i.normalized===!0,c=new o(i.count*s);return Promise.resolve(new Nt(c,s,a))}let r=[];if(i.bufferView!==void 0)r.push(this.getDependency("bufferView",i.bufferView));else r.push(null);if(i.sparse!==void 0)r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(r).then(function(s){let o=s[0],a=Gh[i.type],c=_s[i.componentType],l=c.BYTES_PER_ELEMENT,u=l*a,h=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,d=i.normalized===!0,m,x;if(f&&f!==u){let p=Math.floor(h/f),g="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,A=t.cache.get(g);if(!A)m=new c(o,p*f,i.count*f/l),A=new oo(m,f/l),t.cache.add(g,A);x=new ls(A,a,h%f/l,d)}else{if(o===null)m=new c(i.count*a);else m=new c(o,h,i.count*a);x=new Nt(m,a,d)}if(i.sparse!==void 0){let p=Gh.SCALAR,g=_s[i.sparse.indices.componentType],A=i.sparse.indices.byteOffset||0,E=i.sparse.values.byteOffset||0,y=new g(s[1],A,i.sparse.count*p),w=new c(s[2],E,i.sparse.count*a);if(o!==null)x=new Nt(x.array.slice(),x.itemSize,x.normalized);x.normalized=!1;for(let T=0,R=y.length;T<R;T++){let _=y[T];if(x.setX(_,w[T*a]),a>=2)x.setY(_,w[T*a+1]);if(a>=3)x.setZ(_,w[T*a+2]);if(a>=4)x.setW(_,w[T*a+3]);if(a>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}x.normalized=d}return x})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,s=t.images[r],o=this.textureLoader;if(s.uri){let a=n.manager.getHandler(s.uri);if(a!==null)o=a}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];let c=this.loadImageSource(t,n).then(function(l){if(l.flipY=!1,l.name=s.name||o.name||"",l.name===""&&typeof o.uri==="string"&&o.uri.startsWith("data:image/")===!1)l.name=o.uri;let h=(r.samplers||{})[s.sampler]||{};return l.magFilter=Rx[h.magFilter]||Ht,l.minFilter=Rx[h.minFilter]||ii,l.wrapS=Cx[h.wrapS]||is,l.wrapT=Cx[h.wrapT]||is,l.generateMipmaps=!l.isCompressedTexture&&l.minFilter!==Bn&&l.minFilter!==Ht,i.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[a]=c,c}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let s=i.images[e],o=self.URL||self.webkitURL,a=s.uri||"",c=!1;if(s.bufferView!==void 0)a=n.getDependency("bufferView",s.bufferView).then(function(u){c=!0;let h=new Blob([u],{type:s.mimeType});return a=o.createObjectURL(h),a});else if(s.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(a).then(function(u){return new Promise(function(h,f){let d=h;if(t.isImageBitmapLoader===!0)d=function(m){let x=new wt(m);x.needsUpdate=!0,h(x)};t.load(er.resolveURL(u,r.path),d,void 0,f)})}).then(function(u){if(c===!0)o.revokeObjectURL(a);return ci(u,s),u.userData.mimeType=s.mimeType||VA(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),u});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0)s=s.clone(),s.channel=n.texCoord;if(r.extensions[Xe.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Xe.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let a=r.associations.get(s);s=r.extensions[Xe.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),r.associations.set(s,a)}}if(i!==void 0)s.colorSpace=i;return e[t]=s,s})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new fo,sn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,a.sizeAttenuation=!1,this.cache.add(o,a);n=a}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new ho,sn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,this.cache.add(o,a);n=a}if(i||r||s){let o="ClonedMaterial:"+n.uuid+":";if(i)o+="derivative-tangents:";if(r)o+="vertex-colors:";if(s)o+="flat-shading:";let a=this.cache.get(o);if(!a){if(a=n.clone(),r)a.vertexColors=!0;if(s)a.flatShading=!0;if(i){if(a.normalScale)a.normalScale.y*=-1;if(a.clearcoatNormalScale)a.clearcoatNormalScale.y*=-1}this.cache.add(o,a),this.associations.set(a,this.associations.get(n))}n=a}e.material=n}getMaterialType(){return Ti}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],s,o={},a=r.extensions||{},c=[];if(a[Xe.KHR_MATERIALS_UNLIT]){let u=i[Xe.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Le(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let h=u.baseColorFactor;o.color.setRGB(h[0],h[1],h[2],pn),o.opacity=h[3]}if(u.baseColorTexture!==void 0)c.push(t.assignTexture(o,"map",u.baseColorTexture,Wi));if(o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0)c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture));s=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,o)})))}if(r.doubleSided===!0)o.side=Tn;let l=r.alphaMode||Hh.OPAQUE;if(l===Hh.BLEND)o.transparent=!0,o.depthWrite=!1;else if(o.transparent=!1,l===Hh.MASK)o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:0.5;if(r.normalTexture!==void 0&&s!==si){if(c.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Ie(1,1),r.normalTexture.scale!==void 0){let u=r.normalTexture.scale;o.normalScale.set(u,u)}}if(r.occlusionTexture!==void 0&&s!==si){if(c.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0)o.aoMapIntensity=r.occlusionTexture.strength}if(r.emissiveFactor!==void 0&&s!==si){let u=r.emissiveFactor;o.emissive=new Le().setRGB(u[0],u[1],u[2],pn)}if(r.emissiveTexture!==void 0&&s!==si)c.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Wi));return Promise.all(c).then(function(){let u=new s(o);if(r.name)u.name=r.name;if(ci(u,r),t.associations.set(u,{materials:e}),r.extensions)Ar(i,u,r);return u})}createUniqueName(e){let t=tt.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Xe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(a){return Ix(a,o,t)})}let s=[];for(let o=0,a=e.length;o<a;o++){let c=e[o],l=HA(c),u=i[l];if(u)s.push(u.promise);else{let h;if(c.extensions&&c.extensions[Xe.KHR_DRACO_MESH_COMPRESSION])h=r(c);else h=Ix(new nn,c,t);i[l]={primitive:c,promise:h},s.push(h)}}return Promise.all(s)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let a=0,c=s.length;a<c;a++){let l=s[a].material===void 0?kA(this.cache):this.getDependency("material",s[a].material);o.push(l)}return o.push(t.loadGeometries(s)),Promise.all(o).then(function(a){let c=a.slice(0,a.length-1),l=a[a.length-1],u=[];for(let f=0,d=l.length;f<d;f++){let m=l[f],x=s[f],p,g=c[f];if(x.mode===Rn.TRIANGLES||x.mode===Rn.TRIANGLE_STRIP||x.mode===Rn.TRIANGLE_FAN||x.mode===void 0){if(p=r.isSkinnedMesh===!0?new tc(m,g):new pt(m,g),p.isSkinnedMesh===!0)p.normalizeSkinWeights();if(x.mode===Rn.TRIANGLE_STRIP)p.geometry=Bh(p.geometry,no);else if(x.mode===Rn.TRIANGLE_FAN)p.geometry=Bh(p.geometry,as)}else if(x.mode===Rn.LINES)p=new nc(m,g);else if(x.mode===Rn.LINE_STRIP)p=new Xi(m,g);else if(x.mode===Rn.LINE_LOOP)p=new ic(m,g);else if(x.mode===Rn.POINTS)p=new hs(m,g);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);if(Object.keys(p.geometry.morphAttributes).length>0)GA(p,r);if(p.name=t.createUniqueName(r.name||"mesh_"+e),ci(p,r),x.extensions)Ar(i,p,x);t.assignFinalMaterial(p),u.push(p)}for(let f=0,d=u.length;f<d;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1){if(r.extensions)Ar(i,u[0],r);return u[0]}let h=new Qn;if(r.extensions)Ar(i,h,r);t.associations.set(h,{meshes:e});for(let f=0,d=u.length;f<d;f++)h.add(u[f]);return h})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Lt(io.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new Tr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return ci(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let r=i.pop(),s=i,o=[],a=[];for(let c=0,l=s.length;c<l;c++){let u=s[c];if(u){o.push(u);let h=new ze;if(r!==null)h.fromArray(r.array,c*16);a.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new lo(o,a)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],c=[],l=[];for(let u=0,h=i.channels.length;u<h;u++){let f=i.channels[u],d=i.samplers[f.sampler],m=f.target,x=m.node,p=i.parameters!==void 0?i.parameters[d.input]:d.input,g=i.parameters!==void 0?i.parameters[d.output]:d.output;if(m.node===void 0)continue;s.push(this.getDependency("node",x)),o.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",g)),c.push(d),l.push(m)}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l)]).then(function(u){let h=u[0],f=u[1],d=u[2],m=u[3],x=u[4],p=[];for(let A=0,E=h.length;A<E;A++){let y=h[A],w=f[A],T=d[A],R=m[A],_=x[A];if(y===void 0)continue;if(y.updateMatrix)y.updateMatrix();let S=n._createAnimationTracks(y,w,T,R,_);if(S)for(let U=0;U<S.length;U++)p.push(S[U])}let g=new Qr(r,void 0,p);return ci(g,i),g})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(r){let s=n._getNodeRef(n.meshCache,i.mesh,r);if(i.weights!==void 0)s.traverse(function(o){if(!o.isMesh)return;for(let a=0,c=i.weights.length;a<c;a++)o.morphTargetInfluences[a]=i.weights[a]});return s})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),s=[],o=i.children||[];for(let c=0,l=o.length;c<l;c++)s.push(n.getDependency("node",o[c]));let a=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),a]).then(function(c){let l=c[0],u=c[1],h=c[2];if(h!==null)l.traverse(function(f){if(!f.isSkinnedMesh)return;f.bind(h,$A)});for(let f=0,d=u.length;f<d;f++)l.add(u[f]);if(l.userData.pivot!==void 0&&u.length>0){let f=l.userData.pivot,d=u[0];l.pivot=new N().fromArray(f),l.position.x-=f[0],l.position.y-=f[1],l.position.z-=f[2],d.position.set(0,0,0),delete l.userData.pivot}return l})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});if(a)o.push(a);if(r.camera!==void 0)o.push(i.getDependency("camera",r.camera).then(function(c){return i._getNodeRef(i.cameraCache,r.camera,c)}));return i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let l;if(r.isBone===!0)l=new ao;else if(c.length>1)l=new Qn;else if(c.length===1)l=c[0];else l=new at;if(l!==c[0])for(let u=0,h=c.length;u<h;u++)l.add(c[u]);if(r.name)l.userData.name=r.name,l.name=s;if(ci(l,r),r.extensions)Ar(n,l,r);if(r.matrix!==void 0){let u=new ze;u.fromArray(r.matrix),l.applyMatrix4(u)}else{if(r.translation!==void 0)l.position.fromArray(r.translation);if(r.rotation!==void 0)l.quaternion.fromArray(r.rotation);if(r.scale!==void 0)l.scale.fromArray(r.scale)}if(!i.associations.has(l))i.associations.set(l,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(l);i.associations.set(l,{...u})}return i.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new Qn;if(n.name)r.name=i.createUniqueName(n.name);if(ci(r,n),n.extensions)Ar(t,r,n);let s=n.nodes||[],o=[];for(let a=0,c=s.length;a<c;a++)o.push(i.getDependency("node",s[a]));return Promise.all(o).then(function(a){for(let l=0,u=a.length;l<u;l++){let h=a[l];if(h.parent!==null)r.add(Tx(h));else r.add(h)}let c=(l)=>{let u=new Map;for(let[h,f]of i.associations)if(h instanceof sn||h instanceof wt)u.set(h,f);return l.traverse((h)=>{let f=i.associations.get(h);if(f!=null)u.set(h,f)}),u};return i.associations=c(r),r})}_createAnimationTracks(e,t,n,i,r){let s=[],o=e.name?e.name:e.uuid,a=[];function c(f){if(f.morphTargetInfluences)a.push(f.name?f.name:f.uuid)}if(nr[r.path]===nr.weights){if(c(e),e.isGroup)e.children.forEach(c)}else a.push(o);let l;switch(nr[r.path]){case nr.weights:l=Ji;break;case nr.rotation:l=Ki;break;case nr.translation:case nr.scale:l=wr;break;default:switch(n.itemSize){case 1:l=Ji;break;case 2:case 3:default:l=wr;break}break}let u=i.interpolation!==void 0?zA[i.interpolation]:qa,h=this._getArrayFromAccessor(n);for(let f=0,d=a.length;f<d;f++){let m=new l(a[f]+"."+nr[r.path],t.array,h,u);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(m);s.push(m)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Zh(t.constructor),i=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof Ki?Qx:qh)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function WA(e,t,n){let i=t.attributes,r=new tn;if(i.POSITION!==void 0){let a=n.json.accessors[i.POSITION],{min:c,max:l}=a;if(c!==void 0&&l!==void 0){if(r.set(new N(c[0],c[1],c[2]),new N(l[0],l[1],l[2])),a.normalized){let u=Zh(_s[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=t.targets;if(s!==void 0){let a=new N,c=new N;for(let l=0,u=s.length;l<u;l++){let h=s[l];if(h.POSITION!==void 0){let f=n.json.accessors[h.POSITION],{min:d,max:m}=f;if(d!==void 0&&m!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(m[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(m[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(m[2]))),f.normalized){let x=Zh(_s[f.componentType]);c.multiplyScalar(x)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}e.boundingBox=r;let o=new mn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}function Ix(e,t,n){let i=t.attributes,r=[];function s(o,a){return n.getDependency("accessor",o).then(function(c){e.setAttribute(a,c)})}for(let o in i){let a=Wh[o]||o.toLowerCase();if(a in e.attributes)continue;r.push(s(i[o],a))}if(t.indices!==void 0&&!e.index){let o=n.getDependency("accessor",t.indices).then(function(a){e.setIndex(a)});r.push(o)}if($e.workingColorSpace!==pn&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${$e.workingColorSpace}" not supported.`);return ci(e,t),WA(e,t,n),Promise.all(r).then(function(){return t.targets!==void 0?BA(e,t.targets,n):e})}var tv={type:"change"},jh={type:"start"},iv={type:"end"},bc=new Zi,nv=new Un,ZA=Math.cos(70*io.DEG2RAD),Ut=new N,on=2*Math.PI,ct={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Yh=0.000001;class Jh extends gc{constructor(e,t=null){super(e,t);if(this.state=ct.NONE,this.target=new N,this.cursor=new N,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=0.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:Gi.ROTATE,MIDDLE:Gi.DOLLY,RIGHT:Gi.PAN},this.touches={ONE:Hi.ROTATE,TWO:Hi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Gt,this._lastTargetPosition=new N,this._quat=new Gt().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new _o,this._sphericalDelta=new _o,this._scale=1,this._panOffset=new N,this._rotateStart=new Ie,this._rotateEnd=new Ie,this._rotateDelta=new Ie,this._panStart=new Ie,this._panEnd=new Ie,this._panDelta=new Ie,this._dollyStart=new Ie,this._dollyEnd=new Ie,this._dollyDelta=new Ie,this._dollyDirection=new N,this._mouse=new Ie,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=qA.bind(this),this._onPointerDown=XA.bind(this),this._onPointerUp=YA.bind(this),this._onContextMenu=n1.bind(this),this._onMouseWheel=KA.bind(this),this._onKeyDown=QA.bind(this),this._onTouchStart=e1.bind(this),this._onTouchMove=t1.bind(this),this._onMouseDown=jA.bind(this),this._onMouseMove=JA.bind(this),this._interceptControlDown=i1.bind(this),this._interceptControlUp=r1.bind(this),this.domElement!==null)this.connect(this.domElement);this.update()}set cursorStyle(e){if(this._cursorStyle=e,e==="grab")this.domElement.style.cursor="grab";else this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),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.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.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=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){if(this._domElementKeyEvents!==null)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(tv),this.update(),this.state=ct.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;if(Ut.copy(t).sub(this.target),Ut.applyQuaternion(this._quat),this._spherical.setFromVector3(Ut),this.autoRotate&&this.state===ct.NONE)this._rotateLeft(this._getAutoRotationAngle(e));if(this.enableDamping)this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor;else this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi;let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;if(isFinite(n)&&isFinite(i)){if(n<-Math.PI)n+=on;else if(n>Math.PI)n-=on;if(i<-Math.PI)i+=on;else if(i>Math.PI)i-=on;if(n<=i)this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta));else this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)}if(this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0)this.target.addScaledVector(this._panOffset,this.dampingFactor);else 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{let s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=s!=this._spherical.radius}if(Ut.setFromSpherical(this._spherical),Ut.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ut),this.object.lookAt(this.target),this.enableDamping===!0)this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor);else this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0);if(this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){let o=Ut.length();s=this._clampDistance(o*this._scale);let a=o-s;this.object.position.addScaledVector(this._dollyDirection,a),this.object.updateMatrixWorld(),r=!!a}else if(this.object.isOrthographicCamera){let o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=a!==this.object.zoom;let c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=Ut.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;if(s!==null)if(this.screenSpacePanning)this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position);else if(bc.origin.copy(this.object.position),bc.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(bc.direction))<ZA)this.object.lookAt(this.target);else nv.setFromNormalAndCoplanarPoint(this.object.up,this.target),bc.intersectPlane(nv,this.target)}else if(this.object.isOrthographicCamera){let s=this.object.zoom;if(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom)this.object.updateProjectionMatrix(),r=!0}if(this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Yh||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Yh||this._lastTargetPosition.distanceToSquared(this.target)>Yh)return this.dispatchEvent(tv),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0;return!1}_getAutoRotationAngle(e){if(e!==null)return on/60*this.autoRotateSpeed*e;else return on/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*0.01);return Math.pow(0.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ut.setFromMatrixColumn(t,0),Ut.multiplyScalar(-e),this._panOffset.add(Ut)}_panUp(e,t){if(this.screenSpacePanning===!0)Ut.setFromMatrixColumn(t,1);else Ut.setFromMatrixColumn(t,0),Ut.crossVectors(this.object.up,Ut);Ut.multiplyScalar(e),this._panOffset.add(Ut)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Ut.copy(i).sub(this.target);let r=Ut.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else if(this.object.isOrthographicCamera)this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix);else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1}_dollyOut(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale/=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_dollyIn(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale*=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,{width:s,height:o}=n;this._mouse.x=i/s*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(on*this._rotateDelta.x/t.clientHeight),this._rotateUp(on*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){if(this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0)this._dollyOut(this._getZoomScale(this._dollyDelta.y));else if(this._dollyDelta.y<0)this._dollyIn(this._getZoomScale(this._dollyDelta.y));this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.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(e){if(this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0)this._dollyIn(this._getZoomScale(e.deltaY));else if(e.deltaY>0)this._dollyOut(this._getZoomScale(e.deltaY));this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(on*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,this.keyPanSpeed);t=!0;break;case this.keys.BOTTOM:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(-on*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,-this.keyPanSpeed);t=!0;break;case this.keys.LEFT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(on*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(this.keyPanSpeed,0);t=!0;break;case this.keys.RIGHT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(-on*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(-this.keyPanSpeed,0);t=!0;break}if(t)e.preventDefault(),this.update()}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enablePan)this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enableRotate)this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=0.5*(e.pageX+n.x),r=0.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(on*this._rotateDelta.x/t.clientHeight),this._rotateUp(on*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.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(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.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);let s=(e.pageX+t.x)*0.5,o=(e.pageY+t.y)*0.5;this._updateZoomParameters(s,o)}_handleTouchMoveDollyPan(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enablePan)this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enableRotate)this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];if(t===void 0)t=new Ie,this._pointerPositions[e.pointerId]=t;t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}if(e.ctrlKey&&!this._controlActive)n.deltaY*=10;return n}}function XA(e){if(this.enabled===!1)return;if(this._pointers.length===0)this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp);if(this._isTrackingPointer(e))return;if(this._addPointer(e),e.pointerType==="touch")this._onTouchStart(e);else this._onMouseDown(e);if(this._cursorStyle==="grab")this.domElement.style.cursor="grabbing"}function qA(e){if(this.enabled===!1)return;if(e.pointerType==="touch")this._onTouchMove(e);else this._onMouseMove(e)}function YA(e){switch(this._removePointer(e),this._pointers.length){case 0:if(this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(iv),this.state=ct.NONE,this._cursorStyle==="grab")this.domElement.style.cursor="grab";break;case 1:let t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y});break}}function jA(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Gi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(e),this.state=ct.DOLLY;break;case Gi.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=ct.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=ct.ROTATE}break;case Gi.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=ct.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=ct.PAN}break;default:this.state=ct.NONE}if(this.state!==ct.NONE)this.dispatchEvent(jh)}function JA(e){switch(this.state){case ct.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(e);break;case ct.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(e);break;case ct.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(e);break}}function KA(e){if(this.enabled===!1||this.enableZoom===!1||this.state!==ct.NONE)return;e.preventDefault(),this.dispatchEvent(jh),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(iv)}function QA(e){if(this.enabled===!1)return;this._handleKeyDown(e)}function e1(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case Hi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(e),this.state=ct.TOUCH_ROTATE;break;case Hi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(e),this.state=ct.TOUCH_PAN;break;default:this.state=ct.NONE}break;case 2:switch(this.touches.TWO){case Hi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(e),this.state=ct.TOUCH_DOLLY_PAN;break;case Hi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(e),this.state=ct.TOUCH_DOLLY_ROTATE;break;default:this.state=ct.NONE}break;default:this.state=ct.NONE}if(this.state!==ct.NONE)this.dispatchEvent(jh)}function t1(e){switch(this._trackPointer(e),this.state){case ct.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(e),this.update();break;case ct.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(e),this.update();break;case ct.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(e),this.update();break;case ct.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=ct.NONE}}function n1(e){if(this.enabled===!1)return;e.preventDefault()}function i1(e){if(e.key==="Control")this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}function r1(e){if(e.key==="Control")this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}class Kh extends cs{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let e=new Yi;e.deleteAttribute("uv");let t=new Ti({side:jt}),n=new Ti,i=new ds(16777215,900,28,2);i.position.set(0.418,16.199,0.3),this.add(i);let r=new pt(e,t);r.position.set(-0.757,13.219,0.717),r.scale.set(31.713,28.305,28.591),this.add(r);let s=new us(e,n,6),o=new at;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-0.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),s.setMatrixAt(0,o.matrix),o.position.set(-5.607,-0.754,-0.758),o.rotation.set(0,0.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),s.setMatrixAt(1,o.matrix),o.position.set(6.167,0.857,7.803),o.rotation.set(0,0.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),s.setMatrixAt(2,o.matrix),o.position.set(-2.017,0.018,6.124),o.rotation.set(0,0.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),s.setMatrixAt(3,o.matrix),o.position.set(2.291,-0.756,-2.621),o.rotation.set(0,-0.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),s.setMatrixAt(4,o.matrix),o.position.set(-2.193,-0.369,-5.547),o.rotation.set(0,0.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),s.setMatrixAt(5,o.matrix),this.add(s);let a=new pt(e,xs(50));a.position.set(-16.116,14.37,8.208),a.scale.set(0.1,2.428,2.739),this.add(a);let c=new pt(e,xs(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(0.1,2.425,2.751),this.add(c);let l=new pt(e,xs(17));l.position.set(14.904,12.198,-1.832),l.scale.set(0.15,4.265,6.331),this.add(l);let u=new pt(e,xs(43));u.position.set(-0.462,8.89,14.52),u.scale.set(4.38,5.441,0.088),this.add(u);let h=new pt(e,xs(20));h.position.set(3.235,11.486,-12.541),h.scale.set(2.5,2,0.1),this.add(h);let f=new pt(e,xs(100));f.position.set(0,20,0),f.scale.set(1,0.1,1),this.add(f)}dispose(){let e=new Set;this.traverse((t)=>{if(t.isMesh)e.add(t.geometry),e.add(t.material)});for(let t of e)t.dispose()}}function xs(e){return new oc({color:0,emissive:16777215,emissiveIntensity:e})}function rv(e,t,n=40,i=[e]){let r=e.getCenter(new N),s=Math.max(e.getSize(new N).length()/2,0.01),o=new N(1,0.65,1.25).normalize(),a=new N().crossVectors(new N(0,1,0),o).normalize(),c=new N().crossVectors(o,a),l=[];for(let A of i.length?i:[e])for(let E of[A.min.x,A.max.x])for(let y of[A.min.y,A.max.y])for(let w of[A.min.z,A.max.z])l.push(new N(E,y,w));let u=1/0,h=-1/0,f=1/0,d=-1/0;for(let A of l){let E=A.clone().sub(r),y=E.dot(a),w=E.dot(c);u=Math.min(u,y),h=Math.max(h,y),f=Math.min(f,w),d=Math.max(d,w)}r.addScaledVector(a,(u+h)/2),r.addScaledVector(c,(f+d)/2);let m=Math.tan(n*Math.PI/360),x=m*t,p=s;for(let A of l){let E=A.clone().sub(r),y=E.dot(o);p=Math.max(p,y+Math.abs(E.dot(a))*1.12/x,y+Math.abs(E.dot(c))*1.12/m)}let g=r.clone().addScaledVector(o,p);return{center:r,radius:s,distance:p,position:g}}function sv(e){let t=new kh({antialias:!0,alpha:!1});t.setPixelRatio(Math.min(devicePixelRatio,2)),t.setClearColor(1382930),t.toneMapping=Qs,t.toneMappingExposure=1.15,e.replaceChildren(t.domElement);let n=new cs,i=new Lt(40,1,0.01,1000),r=new Jh(i,t.domElement);r.enableDamping=!0;let s=new So(t),o=new Kh,a=s.fromScene(o,0.04);n.environment=a.texture,o.dispose(),s.dispose();let c=new ps(16773591,2.4);c.position.set(4,8,5),n.add(c),n.add(new uc(14806490,5065021,1.7));let l,u,h=[],f=!0,d=performance.now(),m=0,x=0,p=!1,g=(w)=>{let T=new Set,R=new Set,_=new Set;w.traverse((S)=>{let U=S;if(!U.isMesh)return;T.add(U.geometry);for(let C of Array.isArray(U.material)?U.material:[U.material]){R.add(C);for(let z of Object.values(C))if(z instanceof wt)_.add(z)}});for(let S of[...T,...R,..._])S.dispose()},A=()=>{if(!l)return;let w=new tn().setFromObject(l,!0),T=[];l.traverse((C)=>{if(C instanceof pt||C instanceof Xi||C instanceof hs){let z=new tn().setFromObject(C,!0);if(!z.isEmpty())T.push(z)}});let{center:R,radius:_,distance:S,position:U}=rv(w,i.aspect,i.fov,T);r.target.copy(R),i.position.copy(U),i.near=Math.max(_/1000,0.0001),i.far=S+_*100,r.minDistance=_*0.1,r.maxDistance=_*80,i.updateProjectionMatrix(),r.update()},E=new ResizeObserver(()=>{let{clientWidth:w,clientHeight:T}=e;if(!w||!T)return;t.setSize(w,T),i.aspect=w/T,i.updateProjectionMatrix()});E.observe(e);let y=(w)=>{if(p)return;let T=Math.min((w-d)/1000,0.1);if(d=w,f)u?.update(T);r.update(),t.render(n,i),m=requestAnimationFrame(y)};return m=requestAnimationFrame(y),{async load(w){let T=++x;Dl(w);let R=new mo;R.setURLModifier((F)=>{if(!F.startsWith("blob:")&&!F.startsWith("data:"))throw Error("External model resources are not loaded");return F});let _=await new Xh(R).parseAsync(Uint8Array.from(w).buffer,"");if(p||T!==x){g(_.scene);return}if(l)u?.stopAllAction(),u?.uncacheRoot(l),n.remove(l),g(l);l=_.scene,n.add(l),h=_.animations,u=new mc(l),f=!0;let{clientWidth:S,clientHeight:U}=e;t.setSize(S,U),i.aspect=S/U,A();let C=0,z=0,j=new Set;return l.traverse((F)=>{let H=F;if(!H.isMesh)return;z++,C+=(H.geometry.index?.count??H.geometry.attributes.position?.count??0)/3*(H.isInstancedMesh?H.count:1);for(let V of Array.isArray(H.material)?H.material:[H.material])j.add(V)}),{triangles:C,meshes:z,materials:j.size,clips:h.map((F)=>F.name)}},reset:A,wire(w){l?.traverse((T)=>{let R=T;if(R.isMesh){for(let _ of Array.isArray(R.material)?R.material:[R.material])if("wireframe"in _)_.wireframe=w}})},lighting(w){t.toneMappingExposure=w==="bright"?1.65:w==="soft"?0.85:1.15,c.intensity=w==="soft"?0.8:2.4},clip(w){if(u?.stopAllAction(),h[w])u?.clipAction(h[w]).play()},pause(w){f=!w},dispose(){if(p=!0,x++,cancelAnimationFrame(m),E.disconnect(),r.dispose(),l)g(l);a.dispose(),t.dispose(),e.replaceChildren()}}}var De=(e)=>document.getElementById(e),Ct=(e,t,n)=>{let i=document.createElement(e);if(t!==void 0)i.textContent=t;if(n)i.className=n;return i},Ao=[],ys=[],Cr=[],Sc="",vs,xn,wo=0,ov=0,To=!1,Eo=!1,ir=new Set,Qh=[],av=[],Rr=(e)=>`${e.collection}/${e.manifest.assetId}/${e.manifest.revisionId}`,cv=(e)=>{De("status").textContent=e},Ir=(e)=>cv(e instanceof Error?e.message:String(e)),Ro=(e,t,n=Qh)=>{let i=URL.createObjectURL(new Blob([Uint8Array.from(e)],{type:t}));return n.push(i),i};async function lv(e){let t=await fetch(e),n=await t.json();if(!t.ok)throw Error(n.error??"Request failed");return n}async function s1(e,t){if(e.local){let i=e.local.files[t];if(!i)throw Error("File unavailable");return i}if(e.loose&&t==="asset.glb")return e.loose;let n=await fetch(`/files/${Rr(e)}/${t}`);if(!n.ok)throw Error((await n.json()).error??"File unavailable");return new Uint8Array(await n.arrayBuffer())}function o1(e,t){if(e.local){if(t==="editable.zip")return Ro(Ol([e.local]),"application/zip");return Ro(e.local.files[t],t.endsWith(".js")?"text/javascript":"model/gltf-binary")}if(e.loose)return Ro(e.loose,"model/gltf-binary");return`/files/${Rr(e)}/${t}?download`}function uv(e,t){try{localStorage.setItem(e,t)}catch{}}function hv(e){try{return localStorage.getItem(e)}catch{return null}}function a1(){let e=De("collections");e.replaceChildren();for(let t of[...Ao,...Cr.length?[{id:"opened-files",label:"Opened files"}]:[]]){let n=Ct("button",t.label,Sc===t.id?"active":"");n.onclick=()=>void Mc(t.id).catch(Ir),e.append(n)}}async function Mc(e){let t=++ov;Sc=e,ir.clear(),a1(),cv("");let n=e==="opened-files"?Cr:(await lv(`/api/assets?collection=${encodeURIComponent(e)}`)).assets.map((i)=>({collection:e,manifest:i}));if(t!==ov)return;ys=n,uv("kiln.collection",e),De("collection-title").textContent=e==="opened-files"?"Opened files":Ao.find((i)=>i.id===e)?.label??e,De("collection-caption").textContent=e==="opened-files"?"Previewed in your browser. Your original files stay untouched.":"Saved revisions, editable source, and everything ready to use.",ef()}function c1(){let e=new Map;for(let t of ys){let n=t.manifest.assetId;e.set(n,[...e.get(n)??[],t])}return[...e.values()].map((t)=>(t.sort((n,i)=>i.manifest.createdAt.localeCompare(n.manifest.createdAt)||i.manifest.revisionId.localeCompare(n.manifest.revisionId)),t.find((n)=>n.manifest.revisionId===hv(`kiln.revision.${n.collection}.${n.manifest.assetId}`))??t[0]))}function ef(){for(let i of av.splice(0))URL.revokeObjectURL(i);let e=De("cards");e.replaceChildren();let t=De("search").value.toLowerCase(),n=c1().filter((i)=>`${i.manifest.name} ${i.manifest.tags.join(" ")}`.toLowerCase().includes(t));if(De("count").textContent=`${n.length} asset${n.length===1?"":"s"}`,De("export-selection").disabled=!ir.size,!n.length){let i=Ct("div",void 0,"empty");if(i.append(Ct("b",t?"No matching assets":"Your next idea belongs here."),Ct("p",t?"Try another name or tag.":"Save an asset with your agent, or open a GLB or editable bundle.")),!t)i.append(Ct("code",'kiln save asset.kiln.js --name "My asset"'));e.append(i);return}for(let i of n){let r=i.manifest,s=Ct("article",void 0,"card"),o=Ct("button",void 0,"card-open");o.setAttribute("aria-label",`View ${r.name}`),o.onclick=()=>void tf(i).catch(Ir);let a=Ct("div",void 0,"thumb");if(r.files["preview.png"]){let d=Ct("img");d.loading="lazy",d.alt=r.name,d.src=i.local?Ro(i.local.files["preview.png"],"image/png",av):`/files/${Rr(i)}/preview.png`,d.onerror=()=>{d.remove(),a.textContent="◇"},a.append(d)}else a.textContent="◇";let c=Ct("div",void 0,"card-content");c.append(Ct("span",r.name,"card-title"));let l=ys.filter((d)=>d.manifest.assetId===r.assetId),u=new Set(l.map((d)=>d.manifest.parentRevision)),h=l.filter((d)=>!u.has(d.manifest.revisionId));c.append(Ct("span",`${r.editable?"Editable source":"Source unavailable"} · ${l.length} revision${l.length===1?"":"s"}${h.length>1?` · ${h.length} branches`:""}`,"card-meta"));let f=Ct("div",void 0,"tags");for(let d of r.tags)f.append(Ct("span",d,"tag"));if(c.append(f),o.append(a,c),s.append(o),!i.loose){let d=Ct("input");d.type="checkbox",d.className="selection",d.checked=ir.has(Rr(i)),d.setAttribute("aria-label",`Select ${r.name}`),d.onchange=()=>{if(d.checked)ir.add(Rr(i));else ir.delete(Rr(i));De("export-selection").disabled=!ir.size},s.append(d)}e.append(s)}}async function tf(e){let t=++wo;vs=e,uv(`kiln.revision.${e.collection}.${e.manifest.assetId}`,e.manifest.revisionId);for(let o of Qh.splice(0))URL.revokeObjectURL(o);let n=De("detail");if(!n.open)n.showModal();De("asset-name").textContent=e.manifest.name;let i=De("revisions");i.replaceChildren();for(let o of ys.filter((a)=>a.manifest.assetId===e.manifest.assetId)){let a=Ct("option",`${new Date(o.manifest.createdAt).toLocaleString()} · ${o.manifest.description||o.manifest.revisionId.slice(0,10)}`);a.value=o.manifest.revisionId,a.selected=o.manifest.revisionId===e.manifest.revisionId,i.append(a)}i.onchange=()=>{let o=ys.find((a)=>a.manifest.assetId===e.manifest.assetId&&a.manifest.revisionId===i.value);if(o)tf(o).catch(Ir)},De("asset-description").textContent=e.manifest.description??e.manifest.brief??(e.manifest.editable?"Source travels with this revision. Download the editable bundle to continue elsewhere.":"This GLB has no saved Kiln source. You can view and use the model."),De("provenance").textContent=e.loose?"Standalone GLB. No source or build provenance supplied.":JSON.stringify(e.manifest,null,2);let r=De("downloads");r.replaceChildren();for(let[o,a]of[["asset.glb","Download GLB"],...e.manifest.editable?[["source.kiln.js","Download source"]]:[],...!e.loose?[["editable.zip",e.manifest.editable?"Download editable bundle":"Download asset bundle"]]:[]]){let c=Ct("a",a);c.href=o1(e,o),c.download=`${e.manifest.name.replace(/[^a-z0-9_-]/gi,"-")}${o==="asset.glb"?".glb":o==="source.kiln.js"?".kiln.js":".zip"}`,r.append(c)}De("refine").disabled=!e.manifest.editable,De("asset-stats").replaceChildren(),De("stage-status").textContent="Loading saved GLB…",To=!1,Eo=!1,De("wire").setAttribute("aria-pressed","false"),De("play").textContent="Pause";let s=De("animation");s.replaceChildren(new Option("Rest pose","")),De("play").disabled=!0;try{xn??=sv(De("stage"));let o=await s1(e,"asset.glb");if(t!==wo)return;let a=await xn.load(o);if(!a||t!==wo)return;xn.wire(!1),xn.lighting(De("lighting").value);for(let[c,l]of[[a.triangles.toLocaleString(),"triangles"],[a.meshes,"meshes"],[a.materials,"materials"],[`${(o.length/1024).toFixed(0)} KB`,"GLB"]]){let u=Ct("div");u.append(Ct("strong",String(c)),Ct("span",String(l))),De("asset-stats").append(u)}for(let c=0;c<a.clips.length;c++)s.append(new Option(a.clips[c],String(c)));De("stage-status").textContent=""}catch(o){if(t===wo)xn?.dispose(),xn=void 0,De("stage-status").textContent=`3D preview unavailable: ${o instanceof Error?o.message:o}. Downloads remain available.`}}async function fv(e){for(let t of e){if(t.bytes.length>mi)throw Error("File exceeds 64 MiB");if(t.name.toLowerCase().endsWith(".zip"))for(let n of e_(t.bytes)){for(let[i,r]of Object.entries(n.files))if(`sha256:${Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(r)))).map((o)=>o.toString(16).padStart(2,"0")).join("")}`!==n.manifest.files[i]?.sha256)throw Error(`Bundle integrity failure: ${i}`);if(!Cr.some((i)=>i.manifest.revisionId===n.manifest.revisionId&&i.manifest.assetId===n.manifest.assetId))Cr.push({collection:"opened-files",manifest:n.manifest,local:n})}else{let n=`a_${crypto.randomUUID().replaceAll("-","")}`;Cr.push({collection:"opened-files",loose:t.bytes,manifest:{version:"kiln.asset.v1",assetId:n,revisionId:`r_${n}`,name:t.name.replace(/\.glb$/i,""),tags:[],createdAt:new Date().toISOString(),editable:!1,files:{}}})}}await Mc("opened-files")}De("open").onchange=async(e)=>{try{let t=Array.from(e.target.files??[]);if(t.some((n)=>n.size>mi))throw Error("File exceeds 64 MiB");await fv(await Promise.all(t.map(async(n)=>({name:n.name,bytes:new Uint8Array(await n.arrayBuffer())}))))}catch(t){Ir(t)}};De("refresh").onclick=()=>void Mc(Sc).catch(Ir);De("search").oninput=ef;De("close-detail").onclick=()=>De("detail").close();De("detail").addEventListener("close",()=>{wo++,xn?.dispose(),xn=void 0;for(let e of Qh.splice(0))URL.revokeObjectURL(e);ef()});De("frame").onclick=()=>xn?.reset();De("wire").onclick=()=>{To=!To,xn?.wire(To),De("wire").setAttribute("aria-pressed",String(To))};De("lighting").onchange=(e)=>xn?.lighting(e.target.value);De("animation").onchange=(e)=>{let t=e.target.value;xn?.clip(t===""?-1:Number(t)),De("play").disabled=t===""};De("play").onclick=()=>{Eo=!Eo,xn?.pause(Eo),De("play").textContent=Eo?"Play":"Pause"};De("refine").onclick=async()=>{if(!vs)return;let e=vs.manifest,t=vs.local?`Import the downloaded editable bundle using kiln import <bundle.zip>. Restore asset ${e.assetId}, revision ${e.revisionId}, using kiln_assets action=restore. Read its source with kiln_source, refine it with kiln_edit, review the result, and save a child revision with kiln_save. Requested change: `:`Use kiln_assets with action=restore, collection=${vs.collection}, assetId=${e.assetId}, revisionId=${e.revisionId}. Read the returned programRef with kiln_source, refine it with kiln_edit, review the result, and save with kiln_save using assetId=${e.assetId}, parentRevision=${e.revisionId}, collection=${vs.collection}. Requested change: `;try{await navigator.clipboard.writeText(t),De("refine").textContent="Instructions copied"}catch{De("provenance").textContent=t,De("provenance").parentElement?.setAttribute("open","")}};De("export-selection").onclick=()=>{try{let e=Ct("a");if(Sc==="opened-files")e.href=Ro(Ol(ys.filter((t)=>ir.has(Rr(t))).map((t)=>t.local)),"application/zip");else{let t=new URLSearchParams;for(let n of ir)t.append("revision",n);e.href=`/api/bundle?${t}`}e.download="kiln-assets.zip",e.click()}catch(e){Ir(e)}};async function l1(){Ao=(await lv("/api/collections")).collections;let e=hv("kiln.collection");if(await Mc(Ao.find((t)=>t.id===e)?.id??Ao[0]?.id??"project"),new URLSearchParams(location.search).has("open")){let t=await fetch("/api/standalone");if(!t.ok)throw Error("File unavailable");if(await fv([{name:t.headers.get("Content-Type")?.includes("zip")?"asset.zip":"asset.glb",bytes:new Uint8Array(await t.arrayBuffer())}]),Cr.length===1)await tf(Cr[0])}}l1().catch(Ir);
diff --git a/dist/viewer/chat.html b/dist/viewer/chat.html
index 6a5ee702..81e06589 100644
--- a/dist/viewer/chat.html
+++ b/dist/viewer/chat.html
@@ -116,13 +116,13 @@
</div>
<p id="status" role="status">Loading asset from Kiln…</p>
<script type="module">
- var Zh="185",Ei={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Ai={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xh=0,yc=1,qh=2;var _s=1,Yh=2,kr=3,Ri=0,Xt=1,vn=2,Vn=0,xs=1,bc=2,Sc=3,Mc=4,jh=5;var Br=100,Jh=101,Kh=102,Qh=103,ef=104,tf=200,nf=201,rf=202,sf=203,of=204,af=205,cf=206,lf=207,uf=208,hf=209,ff=210,df=211,pf=212,mf=213,gf=214,_f=0,xf=1,vf=2,wc=3,yf=4,bf=5,Sf=6,Mf=7,wf=0,Tf=1,Ef=2,Pn=0,Tc=1,Ec=2,Ac=3,vs=4,Rc=5,Cc=6,Pc=7;var Gr=301,nr=302,Oo=303,Fo=304,ys=306,Hr=1000,Vr=1001,zo=1002,In=1003,ko=1004;var ir=1005;var kt=1006,Wr=1007;var Wn=1008;var Ln=1009,Af=1010,Rf=1011,bs=1012,Ic=1013,Ci=1014,ui=1015,hi=1016,Lc=1017,Nc=1018,$r=1020,Cf=35902,Pf=35899,If=1021,Lf=1022,$n=1023,rr=1026,sr=1027,Nf=1028,Dc=1029,or=1030,Uc=1031;var Oc=1033,Bo=33776,Go=33777,Ho=33778,Vo=33779,Fc=35840,zc=35841,kc=35842,Bc=35843,Gc=36196,Hc=37492,Vc=37496,Wc=37488,$c=37489,Wo=37490,Zc=37491,Xc=37808,qc=37809,Yc=37810,jc=37811,Jc=37812,Kc=37813,Qc=37814,el=37815,tl=37816,nl=37817,il=37818,rl=37819,sl=37820,ol=37821,al=36492,cl=36494,ll=36495,ul=36283,hl=36284,$o=36285,fl=36286;var dl=2300,Zo=2301;var pl=0,Ss=1,Zr=2;var ml=0,Df=1,ar="",Pi="srgb",cn="srgb-linear",gl="linear",ut="srgb";var Uf=512,Of=513,Ff=514,Xo=515,zf=516,kf=517,qo=518,Bf=519;var _l="300 es",xl=2000;function z0(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function k0(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Or(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Gf(){let e=Or("canvas");return e.style.display="block",e}var uh={},Fr=null;function gs(...e){let t="THREE."+e.shift();if(Fr)Fr("log",t,...e);else console.log(t,...e)}function Hf(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Me(...e){e=Hf(e);let t="THREE."+e.shift();if(Fr)Fr("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Ne(...e){e=Hf(e);let t="THREE."+e.shift();if(Fr)Fr("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function Qi(...e){let t=e.join(" ");if(t in uh)return;uh[t]=!0,Me(...e)}function Vf(e,t,n){return new Promise(function(i,r){function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}var Wf={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class Nn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);if(r!==-1)i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e);e.target=null}}}var $t=["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"],hh=1234567,ps=Math.PI/180,er=180/Math.PI;function Cn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return($t[e&255]+$t[e>>8&255]+$t[e>>16&255]+$t[e>>24&255]+"-"+$t[t&255]+$t[t>>8&255]+"-"+$t[t>>16&15|64]+$t[t>>24&255]+"-"+$t[n&63|128]+$t[n>>8&255]+"-"+$t[n>>16&255]+$t[n>>24&255]+$t[i&255]+$t[i>>8&255]+$t[i>>16&255]+$t[i>>24&255]).toLowerCase()}function We(e,t,n){return Math.max(t,Math.min(n,e))}function vl(e,t){return(e%t+t)%t}function B0(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function G0(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function ms(e,t,n){return(1-n)*e+n*t}function H0(e,t,n,i){return ms(e,t,1-Math.exp(-n*i))}function V0(e,t=1){return t-Math.abs(vl(e,t*2)-t)}function W0(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function $0(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function Z0(e,t){return e+Math.floor(Math.random()*(t-e+1))}function X0(e,t){return e+Math.random()*(t-e)}function q0(e){return e*(0.5-Math.random())}function Y0(e){if(e!==void 0)hh=e;let t=hh+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function j0(e){return e*ps}function J0(e){return e*er}function K0(e){return(e&e-1)===0&&e!==0}function Q0(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function ex(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function tx(e,t,n,i,r){let{cos:s,sin:o}=Math,a=s(n/2),c=o(n/2),l=s((t+i)/2),u=o((t+i)/2),f=s((t-i)/2),h=o((t-i)/2),d=s((i-t)/2),g=o((i-t)/2);switch(r){case"XYX":e.set(a*u,c*f,c*h,a*l);break;case"YZY":e.set(c*h,a*u,c*f,a*l);break;case"ZXZ":e.set(c*f,c*h,a*u,a*l);break;case"XZX":e.set(a*u,c*g,c*d,a*l);break;case"YXY":e.set(c*d,a*u,c*g,a*l);break;case"ZYZ":e.set(c*g,c*d,a*u,a*l);break;default:Me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Rn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function nt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("THREE.MathUtils: Invalid component type.")}}var Ms={DEG2RAD:ps,RAD2DEG:er,generateUUID:Cn,clamp:We,euclideanModulo:vl,mapLinear:B0,inverseLerp:G0,lerp:ms,damp:H0,pingpong:V0,smoothstep:W0,smootherstep:$0,randInt:Z0,randFloat:X0,randFloatSpread:q0,seededRandom:Y0,degToRad:j0,radToDeg:J0,isPowerOfTwo:K0,ceilPowerOfTwo:Q0,floorPowerOfTwo:ex,setQuaternionFromProperEuler:tx,normalize:nt,denormalize:Rn};class Pe{static{Pe.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],f=r[s+0],h=r[s+1],d=r[s+2],g=r[s+3];if(u!==g||a!==f||c!==h||l!==d){let b=a*f+c*h+l*d+u*g;if(b<0)f=-f,h=-h,d=-d,g=-g,b=-b;let p=1-o;if(b<0.9995){let m=Math.acos(b),A=Math.sin(m);p=Math.sin(p*m)/A,o=Math.sin(o*m)/A,a=a*p+f*o,c=c*p+h*o,l=l*p+d*o,u=u*p+g*o}else{a=a*p+f*o,c=c*p+h*o,l=l*p+d*o,u=u*p+g*o;let m=1/Math.sqrt(a*a+c*c+l*l+u*u);a*=m,c*=m,l*=m,u*=m}}e[t]=a,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){let o=n[i],a=n[i+1],c=n[i+2],l=n[i+3],u=r[s],f=r[s+1],h=r[s+2],d=r[s+3];return e[t]=o*d+l*u+a*h-c*f,e[t+1]=a*d+l*f+c*u-o*h,e[t+2]=c*d+l*h+o*f-a*u,e[t+3]=l*d-o*u-a*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:r,_order:s}=e,{cos:o,sin:a}=Math,c=o(n/2),l=o(i/2),u=o(r/2),f=a(n/2),h=a(i/2),d=a(r/2);switch(s){case"XYZ":this._x=f*l*u+c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u-f*h*d;break;case"YXZ":this._x=f*l*u+c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u+f*h*d;break;case"ZXY":this._x=f*l*u-c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u-f*h*d;break;case"ZYX":this._x=f*l*u-c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u+f*h*d;break;case"YZX":this._x=f*l*u+c*h*d,this._y=c*h*u+f*l*d,this._z=c*l*d-f*h*u,this._w=c*l*u-f*h*d;break;case"XZY":this._x=f*l*u-c*h*d,this._y=c*h*u-f*l*d,this._z=c*l*d+f*h*u,this._w=c*l*u+f*h*d;break;default:Me("Quaternion: .setFromEuler() encountered an unknown order: "+s)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],c=t[2],l=t[6],u=t[10],f=n+o+u;if(f>0){let h=0.5/Math.sqrt(f+1);this._w=0.25/h,this._x=(l-a)*h,this._y=(r-c)*h,this._z=(s-i)*h}else if(n>o&&n>u){let h=2*Math.sqrt(1+n-o-u);this._w=(l-a)/h,this._x=0.25*h,this._y=(i+s)/h,this._z=(r+c)/h}else if(o>u){let h=2*Math.sqrt(1+o-n-u);this._w=(r-c)/h,this._x=(i+s)/h,this._y=0.25*h,this._z=(a+l)/h}else{let h=2*Math.sqrt(1+u-n-o);this._w=(s-i)/h,this._x=(r+c)/h,this._y=(a+l)/h,this._z=0.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,{_x:o,_y:a,_z:c,_w:l}=t;return this._x=n*l+s*o+i*c-r*a,this._y=i*l+s*a+r*o-n*c,this._z=r*l+s*c+n*a-i*o,this._w=s*l-n*o-i*a-r*c,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,o=this.dot(e);if(o<0)n=-n,i=-i,r=-r,s=-s,o=-o;let a=1-t;if(o<0.9995){let c=Math.acos(o),l=Math.sin(c);a=Math.sin(a*c)/l,t=Math.sin(t*c)/l,this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this._onChangeCallback()}else this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{static{N.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(fh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(fh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:r,y:s,z:o,w:a}=e,c=2*(s*i-o*n),l=2*(o*t-r*i),u=2*(r*n-s*t);return this.x=t+a*c+s*u-o*l,this.y=n+a*l+o*c-r*u,this.z=i+a*u+r*l-s*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:r}=e,{x:s,y:o,z:a}=t;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Xa.copy(this).projectOnVector(e),this.sub(Xa)}reflect(e){return this.sub(Xa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var Xa=new N,fh=new zt;class De{static{De.prototype.isMatrix3=!0}constructor(e,t,n,i,r,s,o,a,c){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c)}set(e,t,n,i,r,s,o,a,c){let l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=a,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],c=n[1],l=n[4],u=n[7],f=n[2],h=n[5],d=n[8],g=i[0],b=i[3],p=i[6],m=i[1],A=i[4],T=i[7],v=i[2],w=i[5],E=i[8];return r[0]=s*g+o*m+a*v,r[3]=s*b+o*A+a*w,r[6]=s*p+o*T+a*E,r[1]=c*g+l*m+u*v,r[4]=c*b+l*A+u*w,r[7]=c*p+l*T+u*E,r[2]=f*g+h*m+d*v,r[5]=f*b+h*A+d*w,r[8]=f*p+h*T+d*E,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*s*l-t*o*c-n*r*l+n*o*a+i*r*c-i*s*a}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=l*s-o*c,f=o*a-l*r,h=c*r-s*a,d=t*u+n*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=u*g,e[1]=(i*c-l*n)*g,e[2]=(o*n-i*s)*g,e[3]=f*g,e[4]=(l*t-i*a)*g,e[5]=(i*r-o*t)*g,e[6]=h*g,e[7]=(n*a-c*t)*g,e[8]=(s*t-n*r)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){let a=Math.cos(r),c=Math.sin(r);return this.set(n*a,n*c,-n*(a*s+c*o)+s+e,-i*c,i*a,-i*(-c*s+a*o)+o+t,0,0,1),this}scale(e,t){return Qi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(qa.makeScale(e,t)),this}rotate(e){return Qi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(qa.makeRotation(-e)),this}translate(e,t){return Qi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(qa.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}var qa=new De,dh=new De().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),ph=new De().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function nx(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(r,s,o){if(this.enabled===!1||s===o||!s||!o)return r;if(this.spaces[s].transfer==="srgb")r.r=li(r.r),r.g=li(r.g),r.b=li(r.b);if(this.spaces[s].primaries!==this.spaces[o].primaries)r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ);if(this.spaces[o].transfer==="srgb")r.r=Ur(r.r),r.g=Ur(r.g),r.b=Ur(r.b);return r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){if(r==="")return"linear";return this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Qi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Qi("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(r,s)}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:dh,fromXYZ:ph,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:dh,fromXYZ:ph,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}var Ve=nx();function li(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function Ur(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}var br;class yl{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(br===void 0)br=Or("canvas");br.width=e.width,br.height=e.height;let i=br.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=br}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Or("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let s=0;s<r.length;s++)r[s]=li(r[s]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(li(t[n]/255)*255);else t[n]=li(t[n]);return{data:t,width:e.width,height:e.height}}else return Me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}var ix=0;class ws{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ix++}),this.uuid=Cn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width,t.height,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let s=0,o=i.length;s<o;s++)if(i[s].isDataTexture)r.push(Ya(i[s].image));else r.push(Ya(i[s]))}else r=Ya(i);n.url=r}if(!t)e.images[this.uuid]=n;return n}}function Ya(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return yl.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Me("Texture: Unable to serialize Texture."),{}}var rx=0,ja=new N;class St extends Nn{constructor(e=St.DEFAULT_IMAGE,t=St.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,a=1009,c=St.DEFAULT_ANISOTROPY,l=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:rx++}),this.uuid=Cn(),this.name="",this.source=new ws(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,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 De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ja).x}get height(){return this.source.getSize(ja).y}get depth(){return this.source.getSize(ja).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Me(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=300;St.DEFAULT_ANISOTROPY=1;class it{static{it.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,s=0.01,o=0.1,a=e.elements,c=a[0],l=a[4],u=a[8],f=a[1],h=a[5],d=a[9],g=a[2],b=a[6],p=a[10];if(Math.abs(l-f)<0.01&&Math.abs(u-g)<0.01&&Math.abs(d-b)<0.01){if(Math.abs(l+f)<0.1&&Math.abs(u+g)<0.1&&Math.abs(d+b)<0.1&&Math.abs(c+h+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let A=(c+1)/2,T=(h+1)/2,v=(p+1)/2,w=(l+f)/4,E=(u+g)/4,R=(d+b)/4;if(A>T&&A>v)if(A<0.01)n=0,i=0.707106781,r=0.707106781;else n=Math.sqrt(A),i=w/n,r=E/n;else if(T>v)if(T<0.01)n=0.707106781,i=0,r=0.707106781;else i=Math.sqrt(T),n=w/i,r=R/i;else if(v<0.01)n=0.707106781,i=0.707106781,r=0;else r=Math.sqrt(v),n=E/r,i=R/r;return this.set(n,i,r,t),this}let m=Math.sqrt((b-d)*(b-d)+(u-g)*(u-g)+(f-l)*(f-l));if(Math.abs(m)<0.001)m=1;return this.x=(b-d)/m,this.y=(u-g)/m,this.z=(f-l)/m,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class bl extends Nn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new it(0,0,e,t),this.scissorTest=!1,this.viewport=new it(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new St(i),s=n.count;for(let o=0;o<s;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(e!==null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ws(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null)this.depthTexture=e.depthTexture.clone();return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class yn extends bl{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}}class Yo extends St{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Sl extends St{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fe{static{Fe.prototype.isMatrix4=!0}constructor(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,b){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,b)}set(e,t,n,i,r,s,o,a,c,l,u,f,h,d,g,b){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=s,p[9]=o,p[13]=a,p[2]=c,p[6]=l,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=g,p[15]=b,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 Fe().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Sr.setFromMatrixColumn(e,0).length(),r=1/Sr.setFromMatrixColumn(e,1).length(),s=1/Sr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:r}=e,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let f=s*l,h=s*u,d=o*l,g=o*u;t[0]=a*l,t[4]=-a*u,t[8]=c,t[1]=h+d*c,t[5]=f-g*c,t[9]=-o*a,t[2]=g-f*c,t[6]=d+h*c,t[10]=s*a}else if(e.order==="YXZ"){let f=a*l,h=a*u,d=c*l,g=c*u;t[0]=f+g*o,t[4]=d*o-h,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-o,t[2]=h*o-d,t[6]=g+f*o,t[10]=s*a}else if(e.order==="ZXY"){let f=a*l,h=a*u,d=c*l,g=c*u;t[0]=f-g*o,t[4]=-s*u,t[8]=d+h*o,t[1]=h+d*o,t[5]=s*l,t[9]=g-f*o,t[2]=-s*c,t[6]=o,t[10]=s*a}else if(e.order==="ZYX"){let f=s*l,h=s*u,d=o*l,g=o*u;t[0]=a*l,t[4]=d*c-h,t[8]=f*c+g,t[1]=a*u,t[5]=g*c+f,t[9]=h*c-d,t[2]=-c,t[6]=o*a,t[10]=s*a}else if(e.order==="YZX"){let f=s*a,h=s*c,d=o*a,g=o*c;t[0]=a*l,t[4]=g-f*u,t[8]=d*u+h,t[1]=u,t[5]=s*l,t[9]=-o*l,t[2]=-c*l,t[6]=h*u+d,t[10]=f-g*u}else if(e.order==="XZY"){let f=s*a,h=s*c,d=o*a,g=o*c;t[0]=a*l,t[4]=-u,t[8]=c*l,t[1]=f*u+g,t[5]=s*l,t[9]=h*u-d,t[2]=d*u-h,t[6]=o*l,t[10]=g*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sx,e,ox)}lookAt(e,t,n){let i=this.elements;if(on.subVectors(e,t),on.lengthSq()===0)on.z=1;if(on.normalize(),yi.crossVectors(n,on),yi.lengthSq()===0){if(Math.abs(n.z)===1)on.x+=0.0001;else on.z+=0.0001;on.normalize(),yi.crossVectors(n,on)}return yi.normalize(),ao.crossVectors(on,yi),i[0]=yi.x,i[4]=ao.x,i[8]=on.x,i[1]=yi.y,i[5]=ao.y,i[9]=on.y,i[2]=yi.z,i[6]=ao.z,i[10]=on.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],c=n[12],l=n[1],u=n[5],f=n[9],h=n[13],d=n[2],g=n[6],b=n[10],p=n[14],m=n[3],A=n[7],T=n[11],v=n[15],w=i[0],E=i[4],R=i[8],_=i[12],S=i[1],F=i[5],C=i[9],z=i[13],J=i[2],O=i[6],H=i[10],V=i[14],U=i[3],K=i[7],Q=i[11],se=i[15];return r[0]=s*w+o*S+a*J+c*U,r[4]=s*E+o*F+a*O+c*K,r[8]=s*R+o*C+a*H+c*Q,r[12]=s*_+o*z+a*V+c*se,r[1]=l*w+u*S+f*J+h*U,r[5]=l*E+u*F+f*O+h*K,r[9]=l*R+u*C+f*H+h*Q,r[13]=l*_+u*z+f*V+h*se,r[2]=d*w+g*S+b*J+p*U,r[6]=d*E+g*F+b*O+p*K,r[10]=d*R+g*C+b*H+p*Q,r[14]=d*_+g*z+b*V+p*se,r[3]=m*w+A*S+T*J+v*U,r[7]=m*E+A*F+T*O+v*K,r[11]=m*R+A*C+T*H+v*Q,r[15]=m*_+A*z+T*V+v*se,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],c=e[13],l=e[2],u=e[6],f=e[10],h=e[14],d=e[3],g=e[7],b=e[11],p=e[15],m=a*h-c*f,A=o*h-c*u,T=o*f-a*u,v=s*h-c*l,w=s*f-a*l,E=s*u-o*l;return t*(g*m-b*A+p*T)-n*(d*m-b*v+p*w)+i*(d*A-g*v+p*E)-r*(d*T-g*w+b*E)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],s=e[5],o=e[9],a=e[2],c=e[6],l=e[10];return t*(s*l-o*c)-n*(r*l-o*a)+i*(r*c-s*a)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],f=e[10],h=e[11],d=e[12],g=e[13],b=e[14],p=e[15],m=t*o-n*s,A=t*a-i*s,T=t*c-r*s,v=n*a-i*o,w=n*c-r*o,E=i*c-r*a,R=l*g-u*d,_=l*b-f*d,S=l*p-h*d,F=u*b-f*g,C=u*p-h*g,z=f*p-h*b,J=m*z-A*C+T*F+v*S-w*_+E*R;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let O=1/J;return e[0]=(o*z-a*C+c*F)*O,e[1]=(i*C-n*z-r*F)*O,e[2]=(g*E-b*w+p*v)*O,e[3]=(f*w-u*E-h*v)*O,e[4]=(a*S-s*z-c*_)*O,e[5]=(t*z-i*S+r*_)*O,e[6]=(b*T-d*E-p*A)*O,e[7]=(l*E-f*T+h*A)*O,e[8]=(s*C-o*S+c*R)*O,e[9]=(n*S-t*C-r*R)*O,e[10]=(d*w-g*T+p*m)*O,e[11]=(u*T-l*w-h*m)*O,e[12]=(o*_-s*F-a*R)*O,e[13]=(t*F-n*_+i*R)*O,e[14]=(g*A-d*v-b*m)*O,e[15]=(l*v-u*A+f*m)*O,this}scale(e){let t=this.elements,{x:n,y:i,z:r}=e;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,{x:s,y:o,z:a}=e,c=r*s,l=r*o;return this.set(c*s+n,c*o-i*a,c*a+i*o,0,c*o+i*a,l*o+n,l*a-i*s,0,c*a-i*o,l*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:r,_y:s,_z:o,_w:a}=t,c=r+r,l=s+s,u=o+o,f=r*c,h=r*l,d=r*u,g=s*l,b=s*u,p=o*u,m=a*c,A=a*l,T=a*u,{x:v,y:w,z:E}=n;return i[0]=(1-(g+p))*v,i[1]=(h+T)*v,i[2]=(d-A)*v,i[3]=0,i[4]=(h-T)*w,i[5]=(1-(f+p))*w,i[6]=(b+m)*w,i[7]=0,i[8]=(d+A)*E,i[9]=(b-m)*E,i[10]=(1-(f+g))*E,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let s=Sr.set(i[0],i[1],i[2]).length(),o=Sr.set(i[4],i[5],i[6]).length(),a=Sr.set(i[8],i[9],i[10]).length();if(r<0)s=-s;wn.copy(this);let c=1/s,l=1/o,u=1/a;return wn.elements[0]*=c,wn.elements[1]*=c,wn.elements[2]*=c,wn.elements[4]*=l,wn.elements[5]*=l,wn.elements[6]*=l,wn.elements[8]*=u,wn.elements[9]*=u,wn.elements[10]*=u,t.setFromRotationMatrix(wn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2*r/(t-e),u=2*r/(n-i),f=(t+e)/(t-e),h=(n+i)/(n-i),d,g;if(a)d=r/(s-r),g=s*r/(s-r);else if(o===2000)d=-(s+r)/(s-r),g=-2*s*r/(s-r);else if(o===2001)d=-s/(s-r),g=-s*r/(s-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=u,c[9]=h,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),h=-(n+i)/(n-i),d,g;if(a)d=1/(s-r),g=s/(s-r);else if(o===2000)d=-2/(s-r),g=-(s+r)/(s-r);else if(o===2001)d=-1/(s-r),g=-r/(s-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=u,c[9]=0,c[13]=h,c[2]=0,c[6]=0,c[10]=d,c[14]=g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}var Sr=new N,wn=new Fe,sx=new N(0,0,0),ox=new N(1,1,1),yi=new N,ao=new N,on=new N,mh=new Fe,gh=new zt;class Hn{constructor(e=0,t=0,n=0,i=Hn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],c=i[5],l=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":if(this._y=Math.asin(We(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-l,h),this._z=Math.atan2(-s,r);else this._x=Math.atan2(f,c),this._z=0;break;case"YXZ":if(this._x=Math.asin(-We(l,-1,1)),Math.abs(l)<0.9999999)this._y=Math.atan2(o,h),this._z=Math.atan2(a,c);else this._y=Math.atan2(-u,r),this._z=0;break;case"ZXY":if(this._x=Math.asin(We(f,-1,1)),Math.abs(f)<0.9999999)this._y=Math.atan2(-u,h),this._z=Math.atan2(-s,c);else this._y=0,this._z=Math.atan2(a,r);break;case"ZYX":if(this._y=Math.asin(-We(u,-1,1)),Math.abs(u)<0.9999999)this._x=Math.atan2(f,h),this._z=Math.atan2(a,r);else this._x=0,this._z=Math.atan2(-s,c);break;case"YZX":if(this._z=Math.asin(We(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r);else this._x=0,this._y=Math.atan2(o,h);break;case"XZY":if(this._z=Math.asin(-We(s,-1,1)),Math.abs(s)<0.9999999)this._x=Math.atan2(f,c),this._y=Math.atan2(o,r);else this._x=Math.atan2(-l,h),this._y=0;break;default:Me("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return mh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gh.setFromEuler(this),this.setFromQuaternion(gh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Hn.DEFAULT_ORDER="XYZ";class jo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}var ax=0,_h=new N,Mr=new zt,ii=new Fe,co=new N,os=new N,cx=new N,lx=new zt,xh=new N(1,0,0),vh=new N(0,1,0),yh=new N(0,0,1),bh={type:"added"},ux={type:"removed"},wr={type:"childadded",child:null},Ja={type:"childremoved",child:null};class ot extends Nn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:ax++}),this.uuid=Cn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DEFAULT_UP.clone();let e=new N,t=new Hn,n=new zt,i=new N(1,1,1);function r(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new De}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new jo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Mr.setFromAxisAngle(e,t),this.quaternion.multiply(Mr),this}rotateOnWorldAxis(e,t){return Mr.setFromAxisAngle(e,t),this.quaternion.premultiply(Mr),this}rotateX(e){return this.rotateOnAxis(xh,e)}rotateY(e){return this.rotateOnAxis(vh,e)}rotateZ(e){return this.rotateOnAxis(yh,e)}translateOnAxis(e,t){return _h.copy(e).applyQuaternion(this.quaternion),this.position.add(_h.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xh,e)}translateY(e){return this.translateOnAxis(vh,e)}translateZ(e){return this.translateOnAxis(yh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ii.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)co.copy(e);else co.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),os.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)ii.lookAt(os,co,this.up);else ii.lookAt(co,os,this.up);if(this.quaternion.setFromRotationMatrix(ii),i)ii.extractRotation(i.matrixWorld),Mr.setFromRotationMatrix(ii),this.quaternion.premultiply(Mr.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Ne("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(bh),wr.child=e,this.dispatchEvent(wr),wr.child=null;else Ne("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(ux),Ja.child=e,this.dispatchEvent(Ja),Ja.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),ii.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),ii.multiply(e.parent.matrixWorld);return e.applyMatrix4(ii),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(bh),wr.child=e,this.dispatchEvent(wr),wr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(os,e,cx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(os,lx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,this.name!=="")i.name=this.name;if(this.castShadow===!0)i.castShadow=!0;if(this.receiveShadow===!0)i.receiveShadow=!0;if(this.visible===!1)i.visible=!1;if(this.frustumCulled===!1)i.frustumCulled=!1;if(this.renderOrder!==0)i.renderOrder=this.renderOrder;if(this.static!==!1)i.static=this.static;if(Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)i.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((o)=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((o)=>({...o})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function r(o,a){if(o[a.uuid]===void 0)o[a.uuid]=a.toJSON(e);return a.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let c=0,l=a.length;c<l;c++){let u=a[c];r(e.shapes,u)}else r(e.shapes,a)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,c=this.material.length;a<c;a++)o.push(r(e.materials,this.material[a]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(r(e.animations,a))}}if(t){let o=s(e.geometries),a=s(e.materials),c=s(e.textures),l=s(e.images),u=s(e.shapes),f=s(e.skeletons),h=s(e.animations),d=s(e.nodes);if(o.length>0)n.geometries=o;if(a.length>0)n.materials=a;if(c.length>0)n.textures=c;if(l.length>0)n.images=l;if(u.length>0)n.shapes=u;if(f.length>0)n.skeletons=f;if(h.length>0)n.animations=h;if(d.length>0)n.nodes=d}return n.object=i,n;function s(o){let a=[];for(let c in o){let l=o[c];delete l.metadata,a.push(l)}return a}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}}ot.DEFAULT_UP=new N(0,1,0);ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Bn extends ot{constructor(){super();this.isGroup=!0,this.type="Group"}}var hx={type:"move"};class Ts{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Bn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new Bn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Bn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,r=null,s=null,o=this._targetRay,a=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(let g of e.hand.values()){let b=t.getJointPose(g,n),p=this._getHandJoint(c,g);if(b!==null)p.matrix.fromArray(b.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=b.radius;p.visible=b!==null}let l=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=l.position.distanceTo(u.position),h=0.02,d=0.005;if(c.inputState.pinching&&f>h+d)c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!c.inputState.pinching&&f<=h-d)c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(a!==null&&e.gripSpace){if(r=t.getPose(e.gripSpace,n),r!==null){if(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity);else a.hasLinearVelocity=!1;if(r.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity);else a.hasAngularVelocity=!1;if(a.eventsEnabled)a.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(o!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null)i=r;if(i!==null){if(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity);else o.hasLinearVelocity=!1;if(i.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity);else o.hasAngularVelocity=!1;this.dispatchEvent(hx)}}}if(o!==null)o.visible=i!==null;if(a!==null)a.visible=r!==null;if(c!==null)c.visible=s!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Bn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}var $f={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},bi={h:0,s:0,l:0},lo={h:0,s:0,l:0};function Ka(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Le{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Ve.workingColorSpace){if(e=vl(e,1),t=We(t,0,1),n=We(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=0.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=Ka(s,r,e+0.3333333333333333),this.g=Ka(s,r,e),this.b=Ka(s,r,e-0.3333333333333333)}return Ve.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(r){if(r===void 0)return;if(parseFloat(r)<1)Me("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Me("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);else if(s===6)return this.setHex(parseInt(r,16),t);else Me("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=$f[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Me("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=li(e.r),this.g=li(e.g),this.b=li(e.b),this}copyLinearToSRGB(e){return this.r=Ur(e.r),this.g=Ur(e.g),this.b=Ur(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return Ve.workingToColorSpace(Zt.copy(this),e),Math.round(We(Zt.r*255,0,255))*65536+Math.round(We(Zt.g*255,0,255))*256+Math.round(We(Zt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.workingToColorSpace(Zt.copy(this),t);let{r:n,g:i,b:r}=Zt,s=Math.max(n,i,r),o=Math.min(n,i,r),a,c,l=(o+s)/2;if(o===s)a=0,c=0;else{let u=s-o;switch(c=l<=0.5?u/(s+o):u/(2-s-o),s){case n:a=(i-r)/u+(i<r?6:0);break;case i:a=(r-n)/u+2;break;case r:a=(n-i)/u+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getRGB(e,t=Ve.workingColorSpace){return Ve.workingToColorSpace(Zt.copy(this),t),e.r=Zt.r,e.g=Zt.g,e.b=Zt.b,e}getStyle(e="srgb"){Ve.workingToColorSpace(Zt.copy(this),e);let{r:t,g:n,b:i}=Zt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(bi),this.setHSL(bi.h+e,bi.s+t,bi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(bi),e.getHSL(lo);let n=ms(bi.h,lo.h,t),i=ms(bi.s,lo.s,t),r=ms(bi.l,lo.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var Zt=new Le;Le.NAMES=$f;class Xr extends ot{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Hn,this.environmentIntensity=1,this.environmentRotation=new Hn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){if(super.copy(e,t),e.background!==null)this.background=e.background.clone();if(e.environment!==null)this.environment=e.environment.clone();if(e.fog!==null)this.fog=e.fog.clone();if(this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null)this.overrideMaterial=e.overrideMaterial.clone();return this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)t.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)t.object.backgroundIntensity=this.backgroundIntensity;if(t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)t.object.environmentIntensity=this.environmentIntensity;return t.object.environmentRotation=this.environmentRotation.toArray(),t}}var Tn=new N,ri=new N,Qa=new N,si=new N,Tr=new N,Er=new N,Sh=new N,ec=new N,tc=new N,nc=new N,ic=new it,rc=new it,sc=new it;class xn{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Tn.subVectors(e,t),i.cross(Tn);let r=i.lengthSq();if(r>0)return i.multiplyScalar(1/Math.sqrt(r));return i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Tn.subVectors(i,t),ri.subVectors(n,t),Qa.subVectors(e,t);let s=Tn.dot(Tn),o=Tn.dot(ri),a=Tn.dot(Qa),c=ri.dot(ri),l=ri.dot(Qa),u=s*c-o*o;if(u===0)return r.set(0,0,0),null;let f=1/u,h=(c*a-o*l)*f,d=(s*l-o*a)*f;return r.set(1-h-d,d,h)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,si)===null)return!1;return si.x>=0&&si.y>=0&&si.x+si.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){if(this.getBarycoord(e,t,n,i,si)===null){if(a.x=0,a.y=0,"z"in a)a.z=0;if("w"in a)a.w=0;return null}return a.setScalar(0),a.addScaledVector(r,si.x),a.addScaledVector(s,si.y),a.addScaledVector(o,si.z),a}static getInterpolatedAttribute(e,t,n,i,r,s){return ic.setScalar(0),rc.setScalar(0),sc.setScalar(0),ic.fromBufferAttribute(e,t),rc.fromBufferAttribute(e,n),sc.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(ic,r.x),s.addScaledVector(rc,r.y),s.addScaledVector(sc,r.z),s}static isFrontFacing(e,t,n,i){return Tn.subVectors(n,t),ri.subVectors(e,t),Tn.cross(ri).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Tn.subVectors(this.c,this.b),ri.subVectors(this.a,this.b),Tn.cross(ri).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return xn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return xn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return xn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,s,o;Tr.subVectors(i,n),Er.subVectors(r,n),ec.subVectors(e,n);let a=Tr.dot(ec),c=Er.dot(ec);if(a<=0&&c<=0)return t.copy(n);tc.subVectors(e,i);let l=Tr.dot(tc),u=Er.dot(tc);if(l>=0&&u<=l)return t.copy(i);let f=a*u-l*c;if(f<=0&&a>=0&&l<=0)return s=a/(a-l),t.copy(n).addScaledVector(Tr,s);nc.subVectors(e,r);let h=Tr.dot(nc),d=Er.dot(nc);if(d>=0&&h<=d)return t.copy(r);let g=h*c-a*d;if(g<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Er,o);let b=l*d-h*u;if(b<=0&&u-l>=0&&h-d>=0)return Sh.subVectors(r,i),o=(u-l)/(u-l+(h-d)),t.copy(i).addScaledVector(Sh,o);let p=1/(b+g+f);return s=g*p,o=f*p,t.copy(n).addScaledVector(Tr,s).addScaledVector(Er,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Jt{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(En.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(En.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=En.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=r.count;s<o;s++){if(e.isMesh===!0)e.getVertexPosition(s,En);else En.fromBufferAttribute(r,s);En.applyMatrix4(e.matrixWorld),this.expandByPoint(En)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();uo.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();uo.copy(n.boundingBox)}uo.applyMatrix4(e.matrixWorld),this.union(uo)}}let i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,En),En.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(as),ho.subVectors(this.max,as),Ar.subVectors(e.a,as),Rr.subVectors(e.b,as),Cr.subVectors(e.c,as),Si.subVectors(Rr,Ar),Mi.subVectors(Cr,Rr),Yi.subVectors(Ar,Cr);let t=[0,-Si.z,Si.y,0,-Mi.z,Mi.y,0,-Yi.z,Yi.y,Si.z,0,-Si.x,Mi.z,0,-Mi.x,Yi.z,0,-Yi.x,-Si.y,Si.x,0,-Mi.y,Mi.x,0,-Yi.y,Yi.x,0];if(!oc(t,Ar,Rr,Cr,ho))return!1;if(t=[1,0,0,0,1,0,0,0,1],!oc(t,Ar,Rr,Cr,ho))return!1;return fo.crossVectors(Si,Mi),t=[fo.x,fo.y,fo.z],oc(t,Ar,Rr,Cr,ho)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,En).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(En).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oi),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}var oi=[new N,new N,new N,new N,new N,new N,new N,new N],En=new N,uo=new Jt,Ar=new N,Rr=new N,Cr=new N,Si=new N,Mi=new N,Yi=new N,as=new N,ho=new N,fo=new N,ji=new N;function oc(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){ji.fromArray(e,s);let a=r.x*Math.abs(ji.x)+r.y*Math.abs(ji.y)+r.z*Math.abs(ji.z),c=t.dot(ji),l=n.dot(ji),u=i.dot(ji);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var Rt=new N,po=new Pe,fx=0;class It extends Nn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:fx++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)po.fromBufferAttribute(this,t),po.applyMatrix3(e),this.setXY(t,po.x,po.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix3(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix4(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyNormalMatrix(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.transformDirection(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=Rn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=nt(n,this.array);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=Rn(t,this.array);return t}setX(e,t){if(this.normalized)t=nt(t,this.array);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=Rn(t,this.array);return t}setY(e,t){if(this.normalized)t=nt(t,this.array);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=Rn(t,this.array);return t}setZ(e,t){if(this.normalized)t=nt(t,this.array);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=Rn(t,this.array);return t}setW(e,t){if(this.normalized)t=nt(t,this.array);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=nt(t,this.array),n=nt(n,this.array);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=nt(t,this.array),n=nt(n,this.array),i=nt(i,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e*=this.itemSize,this.normalized)t=nt(t,this.array),n=nt(n,this.array),i=nt(i,this.array),r=nt(r,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")e.name=this.name;if(this.usage!==35044)e.usage=this.usage;return e}dispose(){this.dispatchEvent({type:"dispose"})}}class Jo extends It{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ko extends It{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class tn extends It{constructor(e,t,n){super(new Float32Array(e),t,n)}}var dx=new Jt,cs=new N,ac=new N;class ln{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else dx.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;cs.subVectors(e,this.center);let t=cs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(cs,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else ac.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(cs.copy(e.center).add(ac)),this.expandByPoint(cs.copy(e.center).sub(ac));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}var px=0,_n=new Fe,cc=new ot,Pr=new N,an=new Jt,ls=new Jt,Ft=new N;class Kt extends Nn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:px++}),this.uuid=Cn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((z0(e))?Ko:Jo)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let r=new De().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return _n.makeRotationFromQuaternion(e),this.applyMatrix4(_n),this}rotateX(e){return _n.makeRotationX(e),this.applyMatrix4(_n),this}rotateY(e){return _n.makeRotationY(e),this.applyMatrix4(_n),this}rotateZ(e){return _n.makeRotationZ(e),this.applyMatrix4(_n),this}translate(e,t,n){return _n.makeTranslation(e,t,n),this.applyMatrix4(_n),this}scale(e,t,n){return _n.makeScale(e,t,n),this.applyMatrix4(_n),this}lookAt(e){return cc.lookAt(e),cc.updateMatrix(),this.applyMatrix4(cc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pr).negate(),this.translate(Pr.x,Pr.y,Pr.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];n.push(s.x,s.y,s.z||0)}this.setAttribute("position",new tn(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}if(e.length>t.count)Me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new Jt;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];if(an.setFromBufferAttribute(r),this.morphTargetsRelative)Ft.addVectors(this.boundingBox.min,an.min),this.boundingBox.expandByPoint(Ft),Ft.addVectors(this.boundingBox.max,an.max),this.boundingBox.expandByPoint(Ft);else this.boundingBox.expandByPoint(an.min),this.boundingBox.expandByPoint(an.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Ne('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new ln;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){let n=this.boundingSphere.center;if(an.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];if(ls.setFromBufferAttribute(o),this.morphTargetsRelative)Ft.addVectors(an.min,ls.min),an.expandByPoint(Ft),Ft.addVectors(an.max,ls.max),an.expandByPoint(Ft);else an.expandByPoint(ls.min),an.expandByPoint(ls.max)}an.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)Ft.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Ft));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],a=this.morphTargetsRelative;for(let c=0,l=o.count;c<l;c++){if(Ft.fromBufferAttribute(o,c),a)Pr.fromBufferAttribute(e,c),Ft.add(Pr);i=Math.max(i,n.distanceToSquared(Ft))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Ne('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ne("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:r}=t,s=this.getAttribute("tangent");if(s===void 0||s.count!==n.count)s=new It(new Float32Array(4*n.count),4),this.setAttribute("tangent",s);let o=[],a=[];for(let R=0;R<n.count;R++)o[R]=new N,a[R]=new N;let c=new N,l=new N,u=new N,f=new Pe,h=new Pe,d=new Pe,g=new N,b=new N;function p(R,_,S){c.fromBufferAttribute(n,R),l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,S),f.fromBufferAttribute(r,R),h.fromBufferAttribute(r,_),d.fromBufferAttribute(r,S),l.sub(c),u.sub(c),h.sub(f),d.sub(f);let F=1/(h.x*d.y-d.x*h.y);if(!isFinite(F))return;g.copy(l).multiplyScalar(d.y).addScaledVector(u,-h.y).multiplyScalar(F),b.copy(u).multiplyScalar(h.x).addScaledVector(l,-d.x).multiplyScalar(F),o[R].add(g),o[_].add(g),o[S].add(g),a[R].add(b),a[_].add(b),a[S].add(b)}let m=this.groups;if(m.length===0)m=[{start:0,count:e.count}];for(let R=0,_=m.length;R<_;++R){let S=m[R],{start:F,count:C}=S;for(let z=F,J=F+C;z<J;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}let A=new N,T=new N,v=new N,w=new N;function E(R){v.fromBufferAttribute(i,R),w.copy(v);let _=o[R];A.copy(_),A.sub(v.multiplyScalar(v.dot(_))).normalize(),T.crossVectors(w,_);let F=T.dot(a[R])<0?-1:1;s.setXYZW(R,A.x,A.y,A.z,F)}for(let R=0,_=m.length;R<_;++R){let S=m[R],{start:F,count:C}=S;for(let z=F,J=F+C;z<J;z+=3)E(e.getX(z+0)),E(e.getX(z+1)),E(e.getX(z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new It(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,h=n.count;f<h;f++)n.setXYZ(f,0,0,0);let i=new N,r=new N,s=new N,o=new N,a=new N,c=new N,l=new N,u=new N;if(e)for(let f=0,h=e.count;f<h;f+=3){let d=e.getX(f+0),g=e.getX(f+1),b=e.getX(f+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,b),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,b),o.add(l),a.add(l),c.add(l),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(b,c.x,c.y,c.z)}else for(let f=0,h=t.count;f<h;f+=3)i.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),s.fromBufferAttribute(t,f+2),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),n.setXYZ(f+0,l.x,l.y,l.z),n.setXYZ(f+1,l.x,l.y,l.z),n.setXYZ(f+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ft.fromBufferAttribute(e,t),Ft.normalize(),e.setXYZ(t,Ft.x,Ft.y,Ft.z)}toNonIndexed(){function e(o,a){let{array:c,itemSize:l,normalized:u}=o,f=new c.constructor(a.length*l),h=0,d=0;for(let g=0,b=a.length;g<b;g++){if(o.isInterleavedBufferAttribute)h=a[g]*o.data.stride+o.offset;else h=a[g]*l;for(let p=0;p<l;p++)f[d++]=c[h++]}return new It(f,l,u)}if(this.index===null)return Me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Kt,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],c=e(a,n);t.setAttribute(o,c)}let r=this.morphAttributes;for(let o in r){let a=[],c=r[o];for(let l=0,u=c.length;l<u;l++){let f=c[l],h=e(f,n);a.push(h)}t.morphAttributes[o]=a}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,a=s.length;o<a;o++){let c=s[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!=="")e.name=this.name;if(Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let a=this.parameters;for(let c in a)if(a[c]!==void 0)e[c]=a[c];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let a in n){let c=n[a];e.data.attributes[a]=c.toJSON(e.data)}let i={},r=!1;for(let a in this.morphAttributes){let c=this.morphAttributes[a],l=[];for(let u=0,f=c.length;u<f;u++){let h=c[u];l.push(h.toJSON(e.data))}if(l.length>0)i[a]=l,r=!0}if(r)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;if(s.length>0)e.data.groups=JSON.parse(JSON.stringify(s));let o=this.boundingSphere;if(o!==null)e.data.boundingSphere=o.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let c in i){let l=i[c];this.setAttribute(c,l.clone(t))}let r=e.morphAttributes;for(let c in r){let l=[],u=r[c];for(let f=0,h=u.length;f<h;f++)l.push(u[f].clone(t));this.morphAttributes[c]=l}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let c=0,l=s.length;c<l;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;if(o!==null)this.boundingBox=o.clone();let a=e.boundingSphere;if(a!==null)this.boundingSphere=a.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Es{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=Cn()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Cn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Cn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var jt=new N;class qr{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyMatrix4(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyNormalMatrix(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.transformDirection(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=Rn(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=nt(n,this.array);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=nt(t,this.array);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=nt(t,this.array);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=nt(t,this.array);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=nt(t,this.array);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=Rn(t,this.array);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=Rn(t,this.array);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=Rn(t,this.array);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=Rn(t,this.array);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=nt(t,this.array),n=nt(n,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=nt(t,this.array),n=nt(n,this.array),i=nt(i,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e=e*this.data.stride+this.offset,this.normalized)t=nt(t,this.array),n=nt(n,this.array),i=nt(i,this.array),r=nt(r,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){gs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new It(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new qr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){gs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var mx=0;class nn extends Nn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:mx++}),this.uuid=Cn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Le(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Me(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!=="")n.name=this.name;if(this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)n.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.shadowSide!==null)n.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)n.blending=this.blending;if(this.side!==0)n.side=this.side;if(this.vertexColors===!0)n.vertexColors=!0;if(this.opacity<1)n.opacity=this.opacity;if(this.transparent===!0)n.transparent=!0;if(this.blendSrc!==204)n.blendSrc=this.blendSrc;if(this.blendDst!==205)n.blendDst=this.blendDst;if(this.blendEquation!==100)n.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)n.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)n.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)n.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)n.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)n.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)n.depthFunc=this.depthFunc;if(this.depthTest===!1)n.depthTest=this.depthTest;if(this.depthWrite===!1)n.depthWrite=this.depthWrite;if(this.colorWrite===!1)n.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)n.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)n.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)n.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)n.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)n.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)n.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)n.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)n.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)n.rotation=this.rotation;if(this.polygonOffset===!0)n.polygonOffset=!0;if(this.polygonOffsetFactor!==0)n.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)n.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)n.linewidth=this.linewidth;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.dithering===!0)n.dithering=!0;if(this.alphaTest>0)n.alphaTest=this.alphaTest;if(this.alphaHash===!0)n.alphaHash=!0;if(this.alphaToCoverage===!0)n.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)n.premultipliedAlpha=!0;if(this.forceSinglePass===!0)n.forceSinglePass=!0;if(this.allowOverride===!1)n.allowOverride=!1;if(this.wireframe===!0)n.wireframe=!0;if(this.wireframeLinewidth>1)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)n.flatShading=!0;if(this.visible===!1)n.visible=!1;if(this.toneMapped===!1)n.toneMapped=!1;if(this.fog===!1)n.fog=!1;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(r){let s=[];for(let o in r){let a=r[o];delete a.metadata,s.push(a)}return s}if(t){let r=i(e.textures),s=i(e.images);if(r.length>0)n.textures=r;if(s.length>0)n.images=s}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Le().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessRange=e.iridescenceThicknessRange;if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new Pe().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new Pe().fromArray(e.clearcoatNormalScale);if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}}var ai=new N,lc=new N,mo=new N,wi=new N,uc=new N,go=new N,hc=new N;class Ii{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ai)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ai.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return ai.copy(this.origin).addScaledVector(this.direction,t),ai.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){lc.copy(e).add(t).multiplyScalar(0.5),mo.copy(t).sub(e).normalize(),wi.copy(this.origin).sub(lc);let r=e.distanceTo(t)*0.5,s=-this.direction.dot(mo),o=wi.dot(this.direction),a=-wi.dot(mo),c=wi.lengthSq(),l=Math.abs(1-s*s),u,f,h,d;if(l>0)if(u=s*a-o,f=s*o-a,d=r*l,u>=0)if(f>=-d)if(f<=d){let g=1/l;u*=g,f*=g,h=u*(u+s*f+2*o)+f*(s*u+f+2*a)+c}else f=r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;else f=-r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;else if(f<=-d)u=Math.max(0,-(-s*r+o)),f=u>0?-r:Math.min(Math.max(-r,-a),r),h=-u*u+f*(f+2*a)+c;else if(f<=d)u=0,f=Math.min(Math.max(-r,-a),r),h=f*(f+2*a)+c;else u=Math.max(0,-(s*r+o)),f=u>0?r:Math.min(Math.max(-r,-a),r),h=-u*u+f*(f+2*a)+c;else f=s>0?-r:r,u=Math.max(0,-(s*f+o)),h=-u*u+f*(f+2*a)+c;if(n)n.copy(this.origin).addScaledVector(this.direction,u);if(i)i.copy(lc).addScaledVector(mo,f);return h}intersectSphere(e,t){ai.subVectors(e.center,this.origin);let n=ai.dot(this.direction),i=ai.dot(ai)-n*n,r=e.radius*e.radius;if(i>r)return null;let s=Math.sqrt(r-i),o=n-s,a=n+s;if(a<0)return null;if(o<0)return this.at(a,t);return this.at(o,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,r,s,o,a,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,f=this.origin;if(c>=0)n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c;else n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c;if(l>=0)r=(e.min.y-f.y)*l,s=(e.max.y-f.y)*l;else r=(e.max.y-f.y)*l,s=(e.min.y-f.y)*l;if(n>s||r>i)return null;if(r>n||isNaN(n))n=r;if(s<i||isNaN(i))i=s;if(u>=0)o=(e.min.z-f.z)*u,a=(e.max.z-f.z)*u;else o=(e.max.z-f.z)*u,a=(e.min.z-f.z)*u;if(n>a||o>i)return null;if(o>n||n!==n)n=o;if(a<i||i!==i)i=a;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ai)!==null}intersectTriangle(e,t,n,i,r){uc.subVectors(t,e),go.subVectors(n,e),hc.crossVectors(uc,go);let s=this.direction.dot(hc),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;wi.subVectors(this.origin,e);let a=o*this.direction.dot(go.crossVectors(wi,go));if(a<0)return null;let c=o*this.direction.dot(uc.cross(wi));if(c<0)return null;if(a+c>s)return null;let l=-o*wi.dot(hc);if(l<0)return null;return this.at(l/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Zn extends nn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hn,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}var Mh=new Fe,Ji=new Ii,_o=new ln,wh=new N,xo=new N,vo=new N,yo=new N,fc=new N,bo=new N,Th=new N,So=new N;class dt extends ot{constructor(e=new Kt,t=new Zn){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){bo.set(0,0,0);for(let a=0,c=r.length;a<c;a++){let l=o[a],u=r[a];if(l===0)continue;if(fc.fromBufferAttribute(u,e),s)bo.addScaledVector(fc,l);else bo.addScaledVector(fc.sub(t),l)}t.add(bo)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(_o.copy(n.boundingSphere),_o.applyMatrix4(r),Ji.copy(e.ray).recast(e.near),_o.containsPoint(Ji.origin)===!1){if(Ji.intersectSphere(_o,wh)===null)return;if(Ji.origin.distanceToSquared(wh)>(e.far-e.near)**2)return}if(Mh.copy(r).invert(),Ji.copy(e.ray).applyMatrix4(Mh),n.boundingBox!==null){if(Ji.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,Ji)}_computeIntersections(e,t,n){let i,r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,c=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,{groups:f,drawRange:h}=r;if(o!==null)if(Array.isArray(s))for(let d=0,g=f.length;d<g;d++){let b=f[d],p=s[b.materialIndex],m=Math.max(b.start,h.start),A=Math.min(o.count,Math.min(b.start+b.count,h.start+h.count));for(let T=m,v=A;T<v;T+=3){let w=o.getX(T),E=o.getX(T+1),R=o.getX(T+2);if(i=Mo(this,p,e,n,c,l,u,w,E,R),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,t.push(i)}}else{let d=Math.max(0,h.start),g=Math.min(o.count,h.start+h.count);for(let b=d,p=g;b<p;b+=3){let m=o.getX(b),A=o.getX(b+1),T=o.getX(b+2);if(i=Mo(this,s,e,n,c,l,u,m,A,T),i)i.faceIndex=Math.floor(b/3),t.push(i)}}else if(a!==void 0)if(Array.isArray(s))for(let d=0,g=f.length;d<g;d++){let b=f[d],p=s[b.materialIndex],m=Math.max(b.start,h.start),A=Math.min(a.count,Math.min(b.start+b.count,h.start+h.count));for(let T=m,v=A;T<v;T+=3){let w=T,E=T+1,R=T+2;if(i=Mo(this,p,e,n,c,l,u,w,E,R),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,t.push(i)}}else{let d=Math.max(0,h.start),g=Math.min(a.count,h.start+h.count);for(let b=d,p=g;b<p;b+=3){let m=b,A=b+1,T=b+2;if(i=Mo(this,s,e,n,c,l,u,m,A,T),i)i.faceIndex=Math.floor(b/3),t.push(i)}}}}function gx(e,t,n,i,r,s,o,a){let c;if(t.side===1)c=i.intersectTriangle(o,s,r,!0,a);else c=i.intersectTriangle(r,s,o,t.side===0,a);if(c===null)return null;So.copy(a),So.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(So);if(l<n.near||l>n.far)return null;return{distance:l,point:So.clone(),object:e}}function Mo(e,t,n,i,r,s,o,a,c,l){e.getVertexPosition(a,xo),e.getVertexPosition(c,vo),e.getVertexPosition(l,yo);let u=gx(e,t,n,i,xo,vo,yo,Th);if(u){let f=new N;if(xn.getBarycoord(Th,xo,vo,yo,f),r)u.uv=xn.getInterpolatedAttribute(r,a,c,l,f,new Pe);if(s)u.uv1=xn.getInterpolatedAttribute(s,a,c,l,f,new Pe);if(o){if(u.normal=xn.getInterpolatedAttribute(o,a,c,l,f,new N),u.normal.dot(i.direction)>0)u.normal.multiplyScalar(-1)}let h={a,b:c,c:l,normal:new N,materialIndex:0};xn.getNormal(xo,vo,yo,h.normal),u.face=h,u.barycoord=f}return u}var us=new it,Eh=new it,Ah=new it,_x=new it,Rh=new Fe,wo=new N,dc=new ln,Ch=new Fe,pc=new Ii;class Qo extends dt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new Jt;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,wo),this.boundingBox.expandByPoint(wo)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new ln;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,wo),this.boundingSphere.expandByPoint(wo)}copy(e,t){if(super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(dc.copy(this.boundingSphere),dc.applyMatrix4(i),e.ray.intersectsSphere(dc)===!1)return;if(Ch.copy(i).invert(),pc.copy(e.ray).applyMatrix4(Ch),this.boundingBox!==null){if(pc.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,pc)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new it,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();if(r!==1/0)e.multiplyScalar(r);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Me("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(Eh.fromBufferAttribute(i.attributes.skinIndex,e),Ah.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)us.copy(t),t.set(0,0,0,0);else us.set(...t,1),t.set(0,0,0);us.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let s=Ah.getComponent(r);if(s!==0){let o=Eh.getComponent(r);Rh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(_x.copy(us).applyMatrix4(Rh),s)}}if(t.isVector4)t.w=us.w;return t.applyMatrix4(this.bindMatrixInverse)}}class As extends ot{constructor(){super();this.isBone=!0,this.type="Bone"}}class Rs extends St{constructor(e=null,t=1,n=1,i,r,s,o,a,c=1003,l=1003,u,f){super(null,s,o,a,c,l,i,r,u,f);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var Ph=new Fe,xx=new Fe;class Cs{constructor(e=[],t=[]){this.uuid=Cn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Me("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Fe;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=e.length;r<s;r++){let o=e[r]?e[r].matrixWorld:xx;Ph.multiplyMatrices(o,t[r]),Ph.toArray(n,r*16)}if(i!==null)i.needsUpdate=!0}clone(){return new Cs(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new Rs(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],s=t[r];if(s===void 0)Me("Skeleton: No bone found with UUID:",r),s=new As;this.bones.push(s),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let s=t[i];e.bones.push(s.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}}class tr extends It{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}var Ir=new Fe,Ih=new Fe,To=[],Lh=new Jt,vx=new Fe,hs=new dt,fs=new ln;class Yr extends dt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new tr(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,vx)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new Jt;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ir),Lh.copy(e.boundingBox).applyMatrix4(Ir),this.boundingBox.union(Lh)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new ln;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ir),fs.copy(e.boundingSphere).applyMatrix4(Ir),this.boundingSphere.union(fs)}copy(e,t){if(super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null)this.morphTexture=e.morphTexture.clone();if(e.instanceColor!==null)this.instanceColor=e.instanceColor.clone();if(this.count=e.count,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,s=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[s+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(hs.geometry=this.geometry,hs.material=this.material,hs.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(fs.copy(this.boundingSphere),fs.applyMatrix4(n),e.ray.intersectsSphere(fs)===!1)return;for(let r=0;r<i;r++){this.getMatrixAt(r,Ir),Ih.multiplyMatrices(n,Ir),hs.matrixWorld=Ih,hs.raycast(e,To);for(let s=0,o=To.length;s<o;s++){let a=To[s];a.instanceId=r,a.object=this,t.push(a)}To.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new tr(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new Rs(new Float32Array(i*this.count),i,this.count,1028,1015);let r=this.morphTexture.source.data.data,s=0;for(let c=0;c<n.length;c++)s+=n[c];let o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;return r[a]=o,r.set(n,a+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var mc=new N,yx=new N,bx=new De;class An{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=mc.subVectors(n,t).cross(yx.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(mc),r=this.normal.dot(i);if(r===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let s=-(e.start.dot(this.normal)+this.constant)/r;if(n===!0&&(s<0||s>1))return null;return t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||bx.getNormalMatrix(e),i=this.coplanarPoint(mc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}var Ki=new ln,Sx=new Pe(0.5,0.5),Eo=new N;class Ps{constructor(e=new An,t=new An,n=new An,i=new An,r=new An,s=new An){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],c=r[3],l=r[4],u=r[5],f=r[6],h=r[7],d=r[8],g=r[9],b=r[10],p=r[11],m=r[12],A=r[13],T=r[14],v=r[15];if(i[0].setComponents(c-s,h-l,p-d,v-m).normalize(),i[1].setComponents(c+s,h+l,p+d,v+m).normalize(),i[2].setComponents(c+o,h+u,p+g,v+A).normalize(),i[3].setComponents(c-o,h-u,p-g,v-A).normalize(),n)i[4].setComponents(a,f,b,T).normalize(),i[5].setComponents(c-a,h-f,p-b,v-T).normalize();else if(i[4].setComponents(c-a,h-f,p-b,v-T).normalize(),t===2000)i[5].setComponents(c+a,h+f,p+b,v+T).normalize();else if(t===2001)i[5].setComponents(a,f,b,T).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();Ki.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();Ki.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ki)}intersectsSprite(e){Ki.center.set(0,0,0);let t=Sx.distanceTo(e.center);return Ki.radius=0.7071067811865476+t,Ki.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ki)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Eo.x=i.normal.x>0?e.max.x:e.min.x,Eo.y=i.normal.y>0?e.max.y:e.min.y,Eo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Eo)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Is extends nn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}var Do=new N,Uo=new N,Nh=new Fe,ds=new Ii,Ao=new ln,gc=new N,Dh=new N;class Li extends ot{constructor(e=new Kt,t=new Is){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Do.fromBufferAttribute(t,i-1),Uo.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Do.distanceTo(Uo);e.setAttribute("lineDistance",new tn(n,1))}else Me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Ao.copy(n.boundingSphere),Ao.applyMatrix4(i),Ao.radius+=r,e.ray.intersectsSphere(Ao)===!1)return;Nh.copy(i).invert(),ds.copy(e.ray).applyMatrix4(Nh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=this.isLineSegments?2:1,l=n.index,f=n.attributes.position;if(l!==null){let h=Math.max(0,s.start),d=Math.min(l.count,s.start+s.count);for(let g=h,b=d-1;g<b;g+=c){let p=l.getX(g),m=l.getX(g+1),A=Ro(this,e,ds,a,p,m,g);if(A)t.push(A)}if(this.isLineLoop){let g=l.getX(d-1),b=l.getX(h),p=Ro(this,e,ds,a,g,b,d-1);if(p)t.push(p)}}else{let h=Math.max(0,s.start),d=Math.min(f.count,s.start+s.count);for(let g=h,b=d-1;g<b;g+=c){let p=Ro(this,e,ds,a,g,g+1,g);if(p)t.push(p)}if(this.isLineLoop){let g=Ro(this,e,ds,a,d-1,h,d-1);if(g)t.push(g)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Ro(e,t,n,i,r,s,o){let a=e.geometry.attributes.position;if(Do.fromBufferAttribute(a,r),Uo.fromBufferAttribute(a,s),n.distanceSqToSegment(Do,Uo,gc,Dh)>i)return;gc.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(gc);if(l<t.near||l>t.far)return;return{distance:l,point:Dh.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Uh=new N,Oh=new N;class ea extends Li{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Uh.fromBufferAttribute(t,i),Oh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Uh.distanceTo(Oh);e.setAttribute("lineDistance",new tn(n,1))}else Me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ta extends Li{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}}class Ls extends nn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}var Fh=new Fe,vc=new Ii,Co=new ln,Po=new N;class jr extends ot{constructor(e=new Kt,t=new Ls){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Co.copy(n.boundingSphere),Co.applyMatrix4(i),Co.radius+=r,e.ray.intersectsSphere(Co)===!1)return;Fh.copy(i).invert(),vc.copy(e.ray).applyMatrix4(Fh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=n.index,u=n.attributes.position;if(c!==null){let f=Math.max(0,s.start),h=Math.min(c.count,s.start+s.count);for(let d=f,g=h;d<g;d++){let b=c.getX(d);Po.fromBufferAttribute(u,b),zh(Po,b,a,i,e,t,this)}}else{let f=Math.max(0,s.start),h=Math.min(u.count,s.start+s.count);for(let d=f,g=h;d<g;d++)Po.fromBufferAttribute(u,d),zh(Po,d,a,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function zh(e,t,n,i,r,s,o){let a=vc.distanceSqToPoint(e);if(a<n){let c=new N;vc.closestPointToPoint(e,c),c.applyMatrix4(i);let l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class na extends St{constructor(e=[],t=301,n,i,r,s,o,a,c,l){super(e,t,n,i,r,s,o,a,c,l);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ni extends St{constructor(e,t,n=1014,i,r,s,o=1003,a=1003,c,l=1026,u=1){if(l!==1026&&l!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let f={width:e,height:t,depth:u};super(f,i,r,s,o,a,l,n,c);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ws(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);if(this.compareFunction!==null)t.compareFunction=this.compareFunction;return t}}class Ml extends Ni{constructor(e,t=1014,n=301,i,r,s=1003,o=1003,a,c=1026){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,i,r,s,o,a,c);this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ia extends St{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Di extends Kt{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};let o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);let a=[],c=[],l=[],u=[],f=0,h=0;d("z","y","x",-1,-1,n,t,e,s,r,0),d("z","y","x",1,-1,n,t,-e,s,r,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new tn(c,3)),this.setAttribute("normal",new tn(l,3)),this.setAttribute("uv",new tn(u,2));function d(g,b,p,m,A,T,v,w,E,R,_){let S=T/E,F=v/R,C=T/2,z=v/2,J=w/2,O=E+1,H=R+1,V=0,U=0,K=new N;for(let Q=0;Q<H;Q++){let se=Q*F-z;for(let me=0;me<O;me++){let _e=me*S-C;K[g]=_e*m,K[b]=se*A,K[p]=J,c.push(K.x,K.y,K.z),K[g]=0,K[b]=0,K[p]=w>0?1:-1,l.push(K.x,K.y,K.z),u.push(me/E),u.push(1-Q/R),V+=1}}for(let Q=0;Q<R;Q++)for(let se=0;se<E;se++){let me=f+se+O*Q,_e=f+se+O*(Q+1),Xe=f+(se+1)+O*(Q+1),Be=f+(se+1)+O*Q;a.push(me,_e,Be),a.push(_e,Xe,Be),U+=6}o.addGroup(h,U,_),h+=U,f+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Di(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Ns extends Kt{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),c=o+1,l=a+1,u=e/o,f=t/a,h=[],d=[],g=[],b=[];for(let p=0;p<l;p++){let m=p*f-s;for(let A=0;A<c;A++){let T=A*u-r;d.push(T,-m,0),g.push(0,0,1),b.push(A/o),b.push(1-p/a)}}for(let p=0;p<a;p++)for(let m=0;m<o;m++){let A=m+c*p,T=m+c*(p+1),v=m+1+c*(p+1),w=m+1+c*p;h.push(A,T,w),h.push(T,v,w)}this.setIndex(h),this.setAttribute("position",new tn(d,3)),this.setAttribute("normal",new tn(g,3)),this.setAttribute("uv",new tn(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ns(e.width,e.height,e.widthSegments,e.heightSegments)}}function cr(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let r=e[n][i];if(kh(r))if(r.isRenderTargetTexture)Me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=r.clone();else if(Array.isArray(r))if(kh(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();t[n][i]=s}else t[n][i]=r.slice();else t[n][i]=r}}return t}function qt(e){let t={};for(let n=0;n<e.length;n++){let i=cr(e[n]);for(let r in i)t[r]=i[r]}return t}function kh(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Mx(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function wl(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return Ve.workingColorSpace}var Zf={clone:cr,merge:qt},wx=`void main() {
+ var Nf="185",Ui={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Fi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Df=0,Hc=1,Of=2;var Ts=1,Uf=2,Zr=3,zi=0,Xt=1,Sn=2,Xn=0,Es=1,Vc=2,Wc=3,$c=4,Ff=5;var Xr=100,zf=101,kf=102,Bf=103,Gf=104,Hf=200,Vf=201,Wf=202,$f=203,Zf=204,Xf=205,qf=206,Yf=207,jf=208,Jf=209,Kf=210,Qf=211,ed=212,td=213,nd=214,id=0,rd=1,sd=2,Zc=3,od=4,ad=5,cd=6,ld=7,ud=0,hd=1,fd=2,Dn=0,Xc=1,qc=2,Yc=3,As=4,jc=5,Jc=6,Kc=7;var qr=301,ur=302,qo=303,Yo=304,Rs=306,Yr=1000,jr=1001,jo=1002,On=1003,Jo=1004;var hr=1005;var kt=1006,Jr=1007;var qn=1008;var Un=1009,dd=1010,pd=1011,Cs=1012,Qc=1013,ki=1014,_i=1015,xi=1016,el=1017,tl=1018,Kr=1020,md=35902,gd=35899,_d=1021,xd=1022,Yn=1023,fr=1026,dr=1027,vd=1028,nl=1029,pr=1030,il=1031;var rl=1033,Ko=33776,Qo=33777,ea=33778,ta=33779,sl=35840,ol=35841,al=35842,cl=35843,ll=36196,ul=37492,hl=37496,fl=37488,dl=37489,na=37490,pl=37491,ml=37808,gl=37809,_l=37810,xl=37811,vl=37812,yl=37813,bl=37814,Sl=37815,Ml=37816,wl=37817,Tl=37818,El=37819,Al=37820,Rl=37821,Cl=36492,Pl=36494,Il=36495,Ll=36283,Nl=36284,ia=36285,Dl=36286;var Ol=2300,ra=2301;var Ul=0,Ps=1,Qr=2;var Fl=0,yd=1,mr="",Bi="srgb",ln="srgb-linear",zl="linear",ut="srgb";var bd=512,Sd=513,Md=514,sa=515,wd=516,Td=517,oa=518,Ed=519;var kl="300 es",Bl=2000;function rv(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function sv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Vr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ad(){let e=Vr("canvas");return e.style.display="block",e}var jh={},Wr=null;function ws(...e){let t="THREE."+e.shift();if(Wr)Wr("log",t,...e);else console.log(t,...e)}function Rd(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Me(...e){e=Rd(e);let t="THREE."+e.shift();if(Wr)Wr("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Ne(...e){e=Rd(e);let t="THREE."+e.shift();if(Wr)Wr("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function ar(...e){let t=e.join(" ");if(t in jh)return;jh[t]=!0,Me(...e)}function Cd(e,t,n){return new Promise(function(i,r){function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}var Pd={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class Fn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);if(r!==-1)i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e);e.target=null}}}var $t=["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"],Jh=1234567,Ss=Math.PI/180,cr=180/Math.PI;function Nn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return($t[e&255]+$t[e>>8&255]+$t[e>>16&255]+$t[e>>24&255]+"-"+$t[t&255]+$t[t>>8&255]+"-"+$t[t>>16&15|64]+$t[t>>24&255]+"-"+$t[n&63|128]+$t[n>>8&255]+"-"+$t[n>>16&255]+$t[n>>24&255]+$t[i&255]+$t[i>>8&255]+$t[i>>16&255]+$t[i>>24&255]).toLowerCase()}function We(e,t,n){return Math.max(t,Math.min(n,e))}function Gl(e,t){return(e%t+t)%t}function ov(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function av(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function Ms(e,t,n){return(1-n)*e+n*t}function cv(e,t,n,i){return Ms(e,t,1-Math.exp(-n*i))}function lv(e,t=1){return t-Math.abs(Gl(e,t*2)-t)}function uv(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function hv(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function fv(e,t){return e+Math.floor(Math.random()*(t-e+1))}function dv(e,t){return e+Math.random()*(t-e)}function pv(e){return e*(0.5-Math.random())}function mv(e){if(e!==void 0)Jh=e;let t=Jh+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function gv(e){return e*Ss}function _v(e){return e*cr}function xv(e){return(e&e-1)===0&&e!==0}function vv(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function yv(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function bv(e,t,n,i,r){let{cos:s,sin:o}=Math,a=s(n/2),c=o(n/2),l=s((t+i)/2),u=o((t+i)/2),h=s((t-i)/2),f=o((t-i)/2),d=s((i-t)/2),m=o((i-t)/2);switch(r){case"XYX":e.set(a*u,c*h,c*f,a*l);break;case"YZY":e.set(c*f,a*u,c*h,a*l);break;case"ZXZ":e.set(c*h,c*f,a*u,a*l);break;case"XZX":e.set(a*u,c*m,c*d,a*l);break;case"YXY":e.set(c*d,a*u,c*m,a*l);break;case"ZYZ":e.set(c*m,c*d,a*u,a*l);break;default:Me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ln(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function it(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("THREE.MathUtils: Invalid component type.")}}var Is={DEG2RAD:Ss,RAD2DEG:cr,generateUUID:Nn,clamp:We,euclideanModulo:Gl,mapLinear:ov,inverseLerp:av,lerp:Ms,damp:cv,pingpong:lv,smoothstep:uv,smootherstep:hv,randInt:fv,randFloat:dv,randFloatSpread:pv,seededRandom:mv,degToRad:gv,radToDeg:_v,isPowerOfTwo:xv,ceilPowerOfTwo:vv,floorPowerOfTwo:yv,setQuaternionFromProperEuler:bv,normalize:it,denormalize:Ln};class Pe{static{Pe.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],h=r[s+0],f=r[s+1],d=r[s+2],m=r[s+3];if(u!==m||a!==h||c!==f||l!==d){let x=a*h+c*f+l*d+u*m;if(x<0)h=-h,f=-f,d=-d,m=-m,x=-x;let p=1-o;if(x<0.9995){let g=Math.acos(x),A=Math.sin(g);p=Math.sin(p*g)/A,o=Math.sin(o*g)/A,a=a*p+h*o,c=c*p+f*o,l=l*p+d*o,u=u*p+m*o}else{a=a*p+h*o,c=c*p+f*o,l=l*p+d*o,u=u*p+m*o;let g=1/Math.sqrt(a*a+c*c+l*l+u*u);a*=g,c*=g,l*=g,u*=g}}e[t]=a,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){let o=n[i],a=n[i+1],c=n[i+2],l=n[i+3],u=r[s],h=r[s+1],f=r[s+2],d=r[s+3];return e[t]=o*d+l*u+a*f-c*h,e[t+1]=a*d+l*h+c*u-o*f,e[t+2]=c*d+l*f+o*h-a*u,e[t+3]=l*d-o*u-a*h-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:r,_order:s}=e,{cos:o,sin:a}=Math,c=o(n/2),l=o(i/2),u=o(r/2),h=a(n/2),f=a(i/2),d=a(r/2);switch(s){case"XYZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"YXZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"ZXY":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"ZYX":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"YZX":this._x=h*l*u+c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u-h*f*d;break;case"XZY":this._x=h*l*u-c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u+h*f*d;break;default:Me("Quaternion: .setFromEuler() encountered an unknown order: "+s)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],c=t[2],l=t[6],u=t[10],h=n+o+u;if(h>0){let f=0.5/Math.sqrt(h+1);this._w=0.25/f,this._x=(l-a)*f,this._y=(r-c)*f,this._z=(s-i)*f}else if(n>o&&n>u){let f=2*Math.sqrt(1+n-o-u);this._w=(l-a)/f,this._x=0.25*f,this._y=(i+s)/f,this._z=(r+c)/f}else if(o>u){let f=2*Math.sqrt(1+o-n-u);this._w=(r-c)/f,this._x=(i+s)/f,this._y=0.25*f,this._z=(a+l)/f}else{let f=2*Math.sqrt(1+u-n-o);this._w=(s-i)/f,this._x=(r+c)/f,this._y=(a+l)/f,this._z=0.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,{_x:o,_y:a,_z:c,_w:l}=t;return this._x=n*l+s*o+i*c-r*a,this._y=i*l+s*a+r*o-n*c,this._z=r*l+s*c+n*a-i*o,this._w=s*l-n*o-i*a-r*c,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:r,_w:s}=e,o=this.dot(e);if(o<0)n=-n,i=-i,r=-r,s=-s,o=-o;let a=1-t;if(o<0.9995){let c=Math.acos(o),l=Math.sin(c);a=Math.sin(a*c)/l,t=Math.sin(t*c)/l,this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this._onChangeCallback()}else this._x=this._x*a+n*t,this._y=this._y*a+i*t,this._z=this._z*a+r*t,this._w=this._w*a+s*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{static{N.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Kh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Kh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:r,y:s,z:o,w:a}=e,c=2*(s*i-o*n),l=2*(o*t-r*i),u=2*(r*n-s*t);return this.x=t+a*c+s*u-o*l,this.y=n+a*l+o*c-r*u,this.z=i+a*u+r*l-s*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:r}=e,{x:s,y:o,z:a}=t;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return mc.copy(this).projectOnVector(e),this.sub(mc)}reflect(e){return this.sub(mc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var mc=new N,Kh=new zt;class De{static{De.prototype.isMatrix3=!0}constructor(e,t,n,i,r,s,o,a,c){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c)}set(e,t,n,i,r,s,o,a,c){let l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=a,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],c=n[1],l=n[4],u=n[7],h=n[2],f=n[5],d=n[8],m=i[0],x=i[3],p=i[6],g=i[1],A=i[4],E=i[7],y=i[2],w=i[5],T=i[8];return r[0]=s*m+o*g+a*y,r[3]=s*x+o*A+a*w,r[6]=s*p+o*E+a*T,r[1]=c*m+l*g+u*y,r[4]=c*x+l*A+u*w,r[7]=c*p+l*E+u*T,r[2]=h*m+f*g+d*y,r[5]=h*x+f*A+d*w,r[8]=h*p+f*E+d*T,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*s*l-t*o*c-n*r*l+n*o*a+i*r*c-i*s*a}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=l*s-o*c,h=o*a-l*r,f=c*r-s*a,d=t*u+n*h+i*f;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return e[0]=u*m,e[1]=(i*c-l*n)*m,e[2]=(o*n-i*s)*m,e[3]=h*m,e[4]=(l*t-i*a)*m,e[5]=(i*r-o*t)*m,e[6]=f*m,e[7]=(n*a-c*t)*m,e[8]=(s*t-n*r)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){let a=Math.cos(r),c=Math.sin(r);return this.set(n*a,n*c,-n*(a*s+c*o)+s+e,-i*c,i*a,-i*(-c*s+a*o)+o+t,0,0,1),this}scale(e,t){return ar("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(gc.makeScale(e,t)),this}rotate(e){return ar("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(gc.makeRotation(-e)),this}translate(e,t){return ar("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(gc.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}var gc=new De,Qh=new De().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),ef=new De().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function Sv(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(r,s,o){if(this.enabled===!1||s===o||!s||!o)return r;if(this.spaces[s].transfer==="srgb")r.r=gi(r.r),r.g=gi(r.g),r.b=gi(r.b);if(this.spaces[s].primaries!==this.spaces[o].primaries)r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ);if(this.spaces[o].transfer==="srgb")r.r=Hr(r.r),r.g=Hr(r.g),r.b=Hr(r.b);return r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){if(r==="")return"linear";return this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ar("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ar("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(r,s)}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:Qh,fromXYZ:ef,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:Qh,fromXYZ:ef,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}var Ve=Sv();function gi(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function Hr(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}var Rr;class Hl{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(Rr===void 0)Rr=Vr("canvas");Rr.width=e.width,Rr.height=e.height;let i=Rr.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=Rr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Vr("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let s=0;s<r.length;s++)r[s]=gi(r[s]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(gi(t[n]/255)*255);else t[n]=gi(t[n]);return{data:t,width:e.width,height:e.height}}else return Me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}var Mv=0;class Ls{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Mv++}),this.uuid=Nn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width,t.height,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let s=0,o=i.length;s<o;s++)if(i[s].isDataTexture)r.push(_c(i[s].image));else r.push(_c(i[s]))}else r=_c(i);n.url=r}if(!t)e.images[this.uuid]=n;return n}}function _c(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return Hl.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Me("Texture: Unable to serialize Texture."),{}}var wv=0,xc=new N;class St extends Fn{constructor(e=St.DEFAULT_IMAGE,t=St.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,a=1009,c=St.DEFAULT_ANISOTROPY,l=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:wv++}),this.uuid=Nn(),this.name="",this.source=new Ls(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,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 De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(xc).x}get height(){return this.source.getSize(xc).y}get depth(){return this.source.getSize(xc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Me(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=300;St.DEFAULT_ANISOTROPY=1;class rt{static{rt.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,s=0.01,o=0.1,a=e.elements,c=a[0],l=a[4],u=a[8],h=a[1],f=a[5],d=a[9],m=a[2],x=a[6],p=a[10];if(Math.abs(l-h)<0.01&&Math.abs(u-m)<0.01&&Math.abs(d-x)<0.01){if(Math.abs(l+h)<0.1&&Math.abs(u+m)<0.1&&Math.abs(d+x)<0.1&&Math.abs(c+f+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let A=(c+1)/2,E=(f+1)/2,y=(p+1)/2,w=(l+h)/4,T=(u+m)/4,R=(d+x)/4;if(A>E&&A>y)if(A<0.01)n=0,i=0.707106781,r=0.707106781;else n=Math.sqrt(A),i=w/n,r=T/n;else if(E>y)if(E<0.01)n=0.707106781,i=0,r=0.707106781;else i=Math.sqrt(E),n=w/i,r=R/i;else if(y<0.01)n=0.707106781,i=0.707106781,r=0;else r=Math.sqrt(y),n=T/r,i=R/r;return this.set(n,i,r,t),this}let g=Math.sqrt((x-d)*(x-d)+(u-m)*(u-m)+(h-l)*(h-l));if(Math.abs(g)<0.001)g=1;return this.x=(x-d)/g,this.y=(u-m)/g,this.z=(h-l)/g,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Vl extends Fn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new rt(0,0,e,t),this.scissorTest=!1,this.viewport=new rt(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new St(i),s=n.count;for(let o=0;o<s;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(e!==null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new Ls(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null)this.depthTexture=e.depthTexture.clone();return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Mn extends Vl{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}}class aa extends St{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Wl extends St{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fe{static{Fe.prototype.isMatrix4=!0}constructor(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x)}set(e,t,n,i,r,s,o,a,c,l,u,h,f,d,m,x){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=s,p[9]=o,p[13]=a,p[2]=c,p[6]=l,p[10]=u,p[14]=h,p[3]=f,p[7]=d,p[11]=m,p[15]=x,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 Fe().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Cr.setFromMatrixColumn(e,0).length(),r=1/Cr.setFromMatrixColumn(e,1).length(),s=1/Cr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:r}=e,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let h=s*l,f=s*u,d=o*l,m=o*u;t[0]=a*l,t[4]=-a*u,t[8]=c,t[1]=f+d*c,t[5]=h-m*c,t[9]=-o*a,t[2]=m-h*c,t[6]=d+f*c,t[10]=s*a}else if(e.order==="YXZ"){let h=a*l,f=a*u,d=c*l,m=c*u;t[0]=h+m*o,t[4]=d*o-f,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-o,t[2]=f*o-d,t[6]=m+h*o,t[10]=s*a}else if(e.order==="ZXY"){let h=a*l,f=a*u,d=c*l,m=c*u;t[0]=h-m*o,t[4]=-s*u,t[8]=d+f*o,t[1]=f+d*o,t[5]=s*l,t[9]=m-h*o,t[2]=-s*c,t[6]=o,t[10]=s*a}else if(e.order==="ZYX"){let h=s*l,f=s*u,d=o*l,m=o*u;t[0]=a*l,t[4]=d*c-f,t[8]=h*c+m,t[1]=a*u,t[5]=m*c+h,t[9]=f*c-d,t[2]=-c,t[6]=o*a,t[10]=s*a}else if(e.order==="YZX"){let h=s*a,f=s*c,d=o*a,m=o*c;t[0]=a*l,t[4]=m-h*u,t[8]=d*u+f,t[1]=u,t[5]=s*l,t[9]=-o*l,t[2]=-c*l,t[6]=f*u+d,t[10]=h-m*u}else if(e.order==="XZY"){let h=s*a,f=s*c,d=o*a,m=o*c;t[0]=a*l,t[4]=-u,t[8]=c*l,t[1]=h*u+m,t[5]=s*l,t[9]=f*u-d,t[2]=d*u-f,t[6]=o*l,t[10]=m*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Tv,e,Ev)}lookAt(e,t,n){let i=this.elements;if(an.subVectors(e,t),an.lengthSq()===0)an.z=1;if(an.normalize(),Pi.crossVectors(n,an),Pi.lengthSq()===0){if(Math.abs(n.z)===1)an.x+=0.0001;else an.z+=0.0001;an.normalize(),Pi.crossVectors(n,an)}return Pi.normalize(),yo.crossVectors(an,Pi),i[0]=Pi.x,i[4]=yo.x,i[8]=an.x,i[1]=Pi.y,i[5]=yo.y,i[9]=an.y,i[2]=Pi.z,i[6]=yo.z,i[10]=an.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],c=n[12],l=n[1],u=n[5],h=n[9],f=n[13],d=n[2],m=n[6],x=n[10],p=n[14],g=n[3],A=n[7],E=n[11],y=n[15],w=i[0],T=i[4],R=i[8],_=i[12],S=i[1],U=i[5],C=i[9],z=i[13],j=i[2],F=i[6],H=i[10],V=i[14],O=i[3],K=i[7],Q=i[11],se=i[15];return r[0]=s*w+o*S+a*j+c*O,r[4]=s*T+o*U+a*F+c*K,r[8]=s*R+o*C+a*H+c*Q,r[12]=s*_+o*z+a*V+c*se,r[1]=l*w+u*S+h*j+f*O,r[5]=l*T+u*U+h*F+f*K,r[9]=l*R+u*C+h*H+f*Q,r[13]=l*_+u*z+h*V+f*se,r[2]=d*w+m*S+x*j+p*O,r[6]=d*T+m*U+x*F+p*K,r[10]=d*R+m*C+x*H+p*Q,r[14]=d*_+m*z+x*V+p*se,r[3]=g*w+A*S+E*j+y*O,r[7]=g*T+A*U+E*F+y*K,r[11]=g*R+A*C+E*H+y*Q,r[15]=g*_+A*z+E*V+y*se,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],c=e[13],l=e[2],u=e[6],h=e[10],f=e[14],d=e[3],m=e[7],x=e[11],p=e[15],g=a*f-c*h,A=o*f-c*u,E=o*h-a*u,y=s*f-c*l,w=s*h-a*l,T=s*u-o*l;return t*(m*g-x*A+p*E)-n*(d*g-x*y+p*w)+i*(d*A-m*y+p*T)-r*(d*E-m*w+x*T)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],s=e[5],o=e[9],a=e[2],c=e[6],l=e[10];return t*(s*l-o*c)-n*(r*l-o*a)+i*(r*c-s*a)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],m=e[13],x=e[14],p=e[15],g=t*o-n*s,A=t*a-i*s,E=t*c-r*s,y=n*a-i*o,w=n*c-r*o,T=i*c-r*a,R=l*m-u*d,_=l*x-h*d,S=l*p-f*d,U=u*x-h*m,C=u*p-f*m,z=h*p-f*x,j=g*z-A*C+E*U+y*S-w*_+T*R;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let F=1/j;return e[0]=(o*z-a*C+c*U)*F,e[1]=(i*C-n*z-r*U)*F,e[2]=(m*T-x*w+p*y)*F,e[3]=(h*w-u*T-f*y)*F,e[4]=(a*S-s*z-c*_)*F,e[5]=(t*z-i*S+r*_)*F,e[6]=(x*E-d*T-p*A)*F,e[7]=(l*T-h*E+f*A)*F,e[8]=(s*C-o*S+c*R)*F,e[9]=(n*S-t*C-r*R)*F,e[10]=(d*w-m*E+p*g)*F,e[11]=(u*E-l*w-f*g)*F,e[12]=(o*_-s*U-a*R)*F,e[13]=(t*U-n*_+i*R)*F,e[14]=(m*A-d*y-x*g)*F,e[15]=(l*y-u*A+h*g)*F,this}scale(e){let t=this.elements,{x:n,y:i,z:r}=e;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,{x:s,y:o,z:a}=e,c=r*s,l=r*o;return this.set(c*s+n,c*o-i*a,c*a+i*o,0,c*o+i*a,l*o+n,l*a-i*s,0,c*a-i*o,l*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:r,_y:s,_z:o,_w:a}=t,c=r+r,l=s+s,u=o+o,h=r*c,f=r*l,d=r*u,m=s*l,x=s*u,p=o*u,g=a*c,A=a*l,E=a*u,{x:y,y:w,z:T}=n;return i[0]=(1-(m+p))*y,i[1]=(f+E)*y,i[2]=(d-A)*y,i[3]=0,i[4]=(f-E)*w,i[5]=(1-(h+p))*w,i[6]=(x+g)*w,i[7]=0,i[8]=(d+A)*T,i[9]=(x-g)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let s=Cr.set(i[0],i[1],i[2]).length(),o=Cr.set(i[4],i[5],i[6]).length(),a=Cr.set(i[8],i[9],i[10]).length();if(r<0)s=-s;Rn.copy(this);let c=1/s,l=1/o,u=1/a;return Rn.elements[0]*=c,Rn.elements[1]*=c,Rn.elements[2]*=c,Rn.elements[4]*=l,Rn.elements[5]*=l,Rn.elements[6]*=l,Rn.elements[8]*=u,Rn.elements[9]*=u,Rn.elements[10]*=u,t.setFromRotationMatrix(Rn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2*r/(t-e),u=2*r/(n-i),h=(t+e)/(t-e),f=(n+i)/(n-i),d,m;if(a)d=r/(s-r),m=s*r/(s-r);else if(o===2000)d=-(s+r)/(s-r),m=-2*s*r/(s-r);else if(o===2001)d=-s/(s-r),m=-s*r/(s-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=2000,a=!1){let c=this.elements,l=2/(t-e),u=2/(n-i),h=-(t+e)/(t-e),f=-(n+i)/(n-i),d,m;if(a)d=1/(s-r),m=s/(s-r);else if(o===2000)d=-2/(s-r),m=-(s+r)/(s-r);else if(o===2001)d=-1/(s-r),m=-r/(s-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}var Cr=new N,Rn=new Fe,Tv=new N(0,0,0),Ev=new N(1,1,1),Pi=new N,yo=new N,an=new N,tf=new Fe,nf=new zt;class Zn{constructor(e=0,t=0,n=0,i=Zn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],c=i[5],l=i[9],u=i[2],h=i[6],f=i[10];switch(t){case"XYZ":if(this._y=Math.asin(We(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-l,f),this._z=Math.atan2(-s,r);else this._x=Math.atan2(h,c),this._z=0;break;case"YXZ":if(this._x=Math.asin(-We(l,-1,1)),Math.abs(l)<0.9999999)this._y=Math.atan2(o,f),this._z=Math.atan2(a,c);else this._y=Math.atan2(-u,r),this._z=0;break;case"ZXY":if(this._x=Math.asin(We(h,-1,1)),Math.abs(h)<0.9999999)this._y=Math.atan2(-u,f),this._z=Math.atan2(-s,c);else this._y=0,this._z=Math.atan2(a,r);break;case"ZYX":if(this._y=Math.asin(-We(u,-1,1)),Math.abs(u)<0.9999999)this._x=Math.atan2(h,f),this._z=Math.atan2(a,r);else this._x=0,this._z=Math.atan2(-s,c);break;case"YZX":if(this._z=Math.asin(We(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r);else this._x=0,this._y=Math.atan2(o,f);break;case"XZY":if(this._z=Math.asin(-We(s,-1,1)),Math.abs(s)<0.9999999)this._x=Math.atan2(h,c),this._y=Math.atan2(o,r);else this._x=Math.atan2(-l,f),this._y=0;break;default:Me("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return tf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tf,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return nf.setFromEuler(this),this.setFromQuaternion(nf,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Zn.DEFAULT_ORDER="XYZ";class ca{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}var Av=0,rf=new N,Pr=new zt,ui=new Fe,bo=new N,ps=new N,Rv=new N,Cv=new zt,sf=new N(1,0,0),of=new N(0,1,0),af=new N(0,0,1),cf={type:"added"},Pv={type:"removed"},Ir={type:"childadded",child:null},vc={type:"childremoved",child:null};class ot extends Fn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:Av++}),this.uuid=Nn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DEFAULT_UP.clone();let e=new N,t=new Zn,n=new zt,i=new N(1,1,1);function r(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new De}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ca,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pr.setFromAxisAngle(e,t),this.quaternion.multiply(Pr),this}rotateOnWorldAxis(e,t){return Pr.setFromAxisAngle(e,t),this.quaternion.premultiply(Pr),this}rotateX(e){return this.rotateOnAxis(sf,e)}rotateY(e){return this.rotateOnAxis(of,e)}rotateZ(e){return this.rotateOnAxis(af,e)}translateOnAxis(e,t){return rf.copy(e).applyQuaternion(this.quaternion),this.position.add(rf.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sf,e)}translateY(e){return this.translateOnAxis(of,e)}translateZ(e){return this.translateOnAxis(af,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ui.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)bo.copy(e);else bo.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),ps.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)ui.lookAt(ps,bo,this.up);else ui.lookAt(bo,ps,this.up);if(this.quaternion.setFromRotationMatrix(ui),i)ui.extractRotation(i.matrixWorld),Pr.setFromRotationMatrix(ui),this.quaternion.premultiply(Pr.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Ne("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cf),Ir.child=e,this.dispatchEvent(Ir),Ir.child=null;else Ne("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(Pv),vc.child=e,this.dispatchEvent(vc),vc.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),ui.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),ui.multiply(e.parent.matrixWorld);return e.applyMatrix4(ui),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cf),Ir.child=e,this.dispatchEvent(Ir),Ir.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ps,e,Rv),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ps,Cv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,this.name!=="")i.name=this.name;if(this.castShadow===!0)i.castShadow=!0;if(this.receiveShadow===!0)i.receiveShadow=!0;if(this.visible===!1)i.visible=!1;if(this.frustumCulled===!1)i.frustumCulled=!1;if(this.renderOrder!==0)i.renderOrder=this.renderOrder;if(this.static!==!1)i.static=this.static;if(Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)i.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((o)=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((o)=>({...o})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function r(o,a){if(o[a.uuid]===void 0)o[a.uuid]=a.toJSON(e);return a.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let c=0,l=a.length;c<l;c++){let u=a[c];r(e.shapes,u)}else r(e.shapes,a)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,c=this.material.length;a<c;a++)o.push(r(e.materials,this.material[a]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(r(e.animations,a))}}if(t){let o=s(e.geometries),a=s(e.materials),c=s(e.textures),l=s(e.images),u=s(e.shapes),h=s(e.skeletons),f=s(e.animations),d=s(e.nodes);if(o.length>0)n.geometries=o;if(a.length>0)n.materials=a;if(c.length>0)n.textures=c;if(l.length>0)n.images=l;if(u.length>0)n.shapes=u;if(h.length>0)n.skeletons=h;if(f.length>0)n.animations=f;if(d.length>0)n.nodes=d}return n.object=i,n;function s(o){let a=[];for(let c in o){let l=o[c];delete l.metadata,a.push(l)}return a}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}}ot.DEFAULT_UP=new N(0,1,0);ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Wn extends ot{constructor(){super();this.isGroup=!0,this.type="Group"}}var Iv={type:"move"};class Ns{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Wn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new Wn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Wn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,r=null,s=null,o=this._targetRay,a=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(let m of e.hand.values()){let x=t.getJointPose(m,n),p=this._getHandJoint(c,m);if(x!==null)p.matrix.fromArray(x.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=x.radius;p.visible=x!==null}let l=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=l.position.distanceTo(u.position),f=0.02,d=0.005;if(c.inputState.pinching&&h>f+d)c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!c.inputState.pinching&&h<=f-d)c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(a!==null&&e.gripSpace){if(r=t.getPose(e.gripSpace,n),r!==null){if(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity);else a.hasLinearVelocity=!1;if(r.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity);else a.hasAngularVelocity=!1;if(a.eventsEnabled)a.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(o!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null)i=r;if(i!==null){if(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity);else o.hasLinearVelocity=!1;if(i.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity);else o.hasAngularVelocity=!1;this.dispatchEvent(Iv)}}}if(o!==null)o.visible=i!==null;if(a!==null)a.visible=r!==null;if(c!==null)c.visible=s!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Wn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}var Id={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},Ii={h:0,s:0,l:0},So={h:0,s:0,l:0};function yc(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Le{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Ve.workingColorSpace){if(e=Gl(e,1),t=We(t,0,1),n=We(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=0.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=yc(s,r,e+0.3333333333333333),this.g=yc(s,r,e),this.b=yc(s,r,e-0.3333333333333333)}return Ve.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(r){if(r===void 0)return;if(parseFloat(r)<1)Me("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Me("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);else if(s===6)return this.setHex(parseInt(r,16),t);else Me("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=Id[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Me("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=gi(e.r),this.g=gi(e.g),this.b=gi(e.b),this}copyLinearToSRGB(e){return this.r=Hr(e.r),this.g=Hr(e.g),this.b=Hr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return Ve.workingToColorSpace(Zt.copy(this),e),Math.round(We(Zt.r*255,0,255))*65536+Math.round(We(Zt.g*255,0,255))*256+Math.round(We(Zt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.workingToColorSpace(Zt.copy(this),t);let{r:n,g:i,b:r}=Zt,s=Math.max(n,i,r),o=Math.min(n,i,r),a,c,l=(o+s)/2;if(o===s)a=0,c=0;else{let u=s-o;switch(c=l<=0.5?u/(s+o):u/(2-s-o),s){case n:a=(i-r)/u+(i<r?6:0);break;case i:a=(r-n)/u+2;break;case r:a=(n-i)/u+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getRGB(e,t=Ve.workingColorSpace){return Ve.workingToColorSpace(Zt.copy(this),t),e.r=Zt.r,e.g=Zt.g,e.b=Zt.b,e}getStyle(e="srgb"){Ve.workingToColorSpace(Zt.copy(this),e);let{r:t,g:n,b:i}=Zt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ii),this.setHSL(Ii.h+e,Ii.s+t,Ii.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ii),e.getHSL(So);let n=Ms(Ii.h,So.h,t),i=Ms(Ii.s,So.s,t),r=Ms(Ii.l,So.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var Zt=new Le;Le.NAMES=Id;class es extends ot{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Zn,this.environmentIntensity=1,this.environmentRotation=new Zn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){if(super.copy(e,t),e.background!==null)this.background=e.background.clone();if(e.environment!==null)this.environment=e.environment.clone();if(e.fog!==null)this.fog=e.fog.clone();if(this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null)this.overrideMaterial=e.overrideMaterial.clone();return this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)t.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)t.object.backgroundIntensity=this.backgroundIntensity;if(t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)t.object.environmentIntensity=this.environmentIntensity;return t.object.environmentRotation=this.environmentRotation.toArray(),t}}var Cn=new N,hi=new N,bc=new N,fi=new N,Lr=new N,Nr=new N,lf=new N,Sc=new N,Mc=new N,wc=new N,Tc=new rt,Ec=new rt,Ac=new rt;class bn{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Cn.subVectors(e,t),i.cross(Cn);let r=i.lengthSq();if(r>0)return i.multiplyScalar(1/Math.sqrt(r));return i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Cn.subVectors(i,t),hi.subVectors(n,t),bc.subVectors(e,t);let s=Cn.dot(Cn),o=Cn.dot(hi),a=Cn.dot(bc),c=hi.dot(hi),l=hi.dot(bc),u=s*c-o*o;if(u===0)return r.set(0,0,0),null;let h=1/u,f=(c*a-o*l)*h,d=(s*l-o*a)*h;return r.set(1-f-d,d,f)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,fi)===null)return!1;return fi.x>=0&&fi.y>=0&&fi.x+fi.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){if(this.getBarycoord(e,t,n,i,fi)===null){if(a.x=0,a.y=0,"z"in a)a.z=0;if("w"in a)a.w=0;return null}return a.setScalar(0),a.addScaledVector(r,fi.x),a.addScaledVector(s,fi.y),a.addScaledVector(o,fi.z),a}static getInterpolatedAttribute(e,t,n,i,r,s){return Tc.setScalar(0),Ec.setScalar(0),Ac.setScalar(0),Tc.fromBufferAttribute(e,t),Ec.fromBufferAttribute(e,n),Ac.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Tc,r.x),s.addScaledVector(Ec,r.y),s.addScaledVector(Ac,r.z),s}static isFrontFacing(e,t,n,i){return Cn.subVectors(n,t),hi.subVectors(e,t),Cn.cross(hi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Cn.subVectors(this.c,this.b),hi.subVectors(this.a,this.b),Cn.cross(hi).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return bn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return bn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return bn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return bn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return bn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,s,o;Lr.subVectors(i,n),Nr.subVectors(r,n),Sc.subVectors(e,n);let a=Lr.dot(Sc),c=Nr.dot(Sc);if(a<=0&&c<=0)return t.copy(n);Mc.subVectors(e,i);let l=Lr.dot(Mc),u=Nr.dot(Mc);if(l>=0&&u<=l)return t.copy(i);let h=a*u-l*c;if(h<=0&&a>=0&&l<=0)return s=a/(a-l),t.copy(n).addScaledVector(Lr,s);wc.subVectors(e,r);let f=Lr.dot(wc),d=Nr.dot(wc);if(d>=0&&f<=d)return t.copy(r);let m=f*c-a*d;if(m<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Nr,o);let x=l*d-f*u;if(x<=0&&u-l>=0&&f-d>=0)return lf.subVectors(r,i),o=(u-l)/(u-l+(f-d)),t.copy(i).addScaledVector(lf,o);let p=1/(x+m+h);return s=m*p,o=h*p,t.copy(n).addScaledVector(Lr,s).addScaledVector(Nr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Kt{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Pn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Pn.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=r.count;s<o;s++){if(e.isMesh===!0)e.getVertexPosition(s,Pn);else Pn.fromBufferAttribute(r,s);Pn.applyMatrix4(e.matrixWorld),this.expandByPoint(Pn)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();Mo.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();Mo.copy(n.boundingBox)}Mo.applyMatrix4(e.matrixWorld),this.union(Mo)}}let i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ms),wo.subVectors(this.max,ms),Dr.subVectors(e.a,ms),Or.subVectors(e.b,ms),Ur.subVectors(e.c,ms),Li.subVectors(Or,Dr),Ni.subVectors(Ur,Or),ir.subVectors(Dr,Ur);let t=[0,-Li.z,Li.y,0,-Ni.z,Ni.y,0,-ir.z,ir.y,Li.z,0,-Li.x,Ni.z,0,-Ni.x,ir.z,0,-ir.x,-Li.y,Li.x,0,-Ni.y,Ni.x,0,-ir.y,ir.x,0];if(!Rc(t,Dr,Or,Ur,wo))return!1;if(t=[1,0,0,0,1,0,0,0,1],!Rc(t,Dr,Or,Ur,wo))return!1;return To.crossVectors(Li,Ni),t=[To.x,To.y,To.z],Rc(t,Dr,Or,Ur,wo)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(Pn).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return di[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),di[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),di[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),di[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),di[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),di[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),di[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),di[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(di),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}var di=[new N,new N,new N,new N,new N,new N,new N,new N],Pn=new N,Mo=new Kt,Dr=new N,Or=new N,Ur=new N,Li=new N,Ni=new N,ir=new N,ms=new N,wo=new N,To=new N,rr=new N;function Rc(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){rr.fromArray(e,s);let a=r.x*Math.abs(rr.x)+r.y*Math.abs(rr.y)+r.z*Math.abs(rr.z),c=t.dot(rr),l=n.dot(rr),u=i.dot(rr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var Rt=new N,Eo=new Pe,Lv=0;class It extends Fn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Lv++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Eo.fromBufferAttribute(this,t),Eo.applyMatrix3(e),this.setXY(t,Eo.x,Eo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix3(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix4(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyNormalMatrix(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.transformDirection(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=Ln(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=it(n,this.array);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=Ln(t,this.array);return t}setX(e,t){if(this.normalized)t=it(t,this.array);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=Ln(t,this.array);return t}setY(e,t){if(this.normalized)t=it(t,this.array);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=Ln(t,this.array);return t}setZ(e,t){if(this.normalized)t=it(t,this.array);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=Ln(t,this.array);return t}setW(e,t){if(this.normalized)t=it(t,this.array);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=it(t,this.array),n=it(n,this.array);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=it(t,this.array),n=it(n,this.array),i=it(i,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e*=this.itemSize,this.normalized)t=it(t,this.array),n=it(n,this.array),i=it(i,this.array),r=it(r,this.array);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")e.name=this.name;if(this.usage!==35044)e.usage=this.usage;return e}dispose(){this.dispatchEvent({type:"dispose"})}}class la extends It{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ua extends It{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nn extends It{constructor(e,t,n){super(new Float32Array(e),t,n)}}var Nv=new Kt,gs=new N,Cc=new N;class un{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else Nv.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gs.subVectors(e,this.center);let t=gs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(gs,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else Cc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gs.copy(e.center).add(Cc)),this.expandByPoint(gs.copy(e.center).sub(Cc));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}var Dv=0,yn=new Fe,Pc=new ot,Fr=new N,cn=new Kt,_s=new Kt,Ft=new N;class Qt extends Fn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Dv++}),this.uuid=Nn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((rv(e))?ua:la)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let r=new De().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return yn.makeRotationFromQuaternion(e),this.applyMatrix4(yn),this}rotateX(e){return yn.makeRotationX(e),this.applyMatrix4(yn),this}rotateY(e){return yn.makeRotationY(e),this.applyMatrix4(yn),this}rotateZ(e){return yn.makeRotationZ(e),this.applyMatrix4(yn),this}translate(e,t,n){return yn.makeTranslation(e,t,n),this.applyMatrix4(yn),this}scale(e,t,n){return yn.makeScale(e,t,n),this.applyMatrix4(yn),this}lookAt(e){return Pc.lookAt(e),Pc.updateMatrix(),this.applyMatrix4(Pc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fr).negate(),this.translate(Fr.x,Fr.y,Fr.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];n.push(s.x,s.y,s.z||0)}this.setAttribute("position",new nn(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}if(e.length>t.count)Me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new Kt;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];if(cn.setFromBufferAttribute(r),this.morphTargetsRelative)Ft.addVectors(this.boundingBox.min,cn.min),this.boundingBox.expandByPoint(Ft),Ft.addVectors(this.boundingBox.max,cn.max),this.boundingBox.expandByPoint(Ft);else this.boundingBox.expandByPoint(cn.min),this.boundingBox.expandByPoint(cn.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Ne('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new un;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ne("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){let n=this.boundingSphere.center;if(cn.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];if(_s.setFromBufferAttribute(o),this.morphTargetsRelative)Ft.addVectors(cn.min,_s.min),cn.expandByPoint(Ft),Ft.addVectors(cn.max,_s.max),cn.expandByPoint(Ft);else cn.expandByPoint(_s.min),cn.expandByPoint(_s.max)}cn.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)Ft.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Ft));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],a=this.morphTargetsRelative;for(let c=0,l=o.count;c<l;c++){if(Ft.fromBufferAttribute(o,c),a)Fr.fromBufferAttribute(e,c),Ft.add(Fr);i=Math.max(i,n.distanceToSquared(Ft))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Ne('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ne("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:r}=t,s=this.getAttribute("tangent");if(s===void 0||s.count!==n.count)s=new It(new Float32Array(4*n.count),4),this.setAttribute("tangent",s);let o=[],a=[];for(let R=0;R<n.count;R++)o[R]=new N,a[R]=new N;let c=new N,l=new N,u=new N,h=new Pe,f=new Pe,d=new Pe,m=new N,x=new N;function p(R,_,S){c.fromBufferAttribute(n,R),l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,S),h.fromBufferAttribute(r,R),f.fromBufferAttribute(r,_),d.fromBufferAttribute(r,S),l.sub(c),u.sub(c),f.sub(h),d.sub(h);let U=1/(f.x*d.y-d.x*f.y);if(!isFinite(U))return;m.copy(l).multiplyScalar(d.y).addScaledVector(u,-f.y).multiplyScalar(U),x.copy(u).multiplyScalar(f.x).addScaledVector(l,-d.x).multiplyScalar(U),o[R].add(m),o[_].add(m),o[S].add(m),a[R].add(x),a[_].add(x),a[S].add(x)}let g=this.groups;if(g.length===0)g=[{start:0,count:e.count}];for(let R=0,_=g.length;R<_;++R){let S=g[R],{start:U,count:C}=S;for(let z=U,j=U+C;z<j;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}let A=new N,E=new N,y=new N,w=new N;function T(R){y.fromBufferAttribute(i,R),w.copy(y);let _=o[R];A.copy(_),A.sub(y.multiplyScalar(y.dot(_))).normalize(),E.crossVectors(w,_);let U=E.dot(a[R])<0?-1:1;s.setXYZW(R,A.x,A.y,A.z,U)}for(let R=0,_=g.length;R<_;++R){let S=g[R],{start:U,count:C}=S;for(let z=U,j=U+C;z<j;z+=3)T(e.getX(z+0)),T(e.getX(z+1)),T(e.getX(z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new It(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);let i=new N,r=new N,s=new N,o=new N,a=new N,c=new N,l=new N,u=new N;if(e)for(let h=0,f=e.count;h<f;h+=3){let d=e.getX(h+0),m=e.getX(h+1),x=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,m),c.fromBufferAttribute(n,x),o.add(l),a.add(l),c.add(l),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(x,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)i.fromBufferAttribute(t,h+0),r.fromBufferAttribute(t,h+1),s.fromBufferAttribute(t,h+2),l.subVectors(s,r),u.subVectors(i,r),l.cross(u),n.setXYZ(h+0,l.x,l.y,l.z),n.setXYZ(h+1,l.x,l.y,l.z),n.setXYZ(h+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ft.fromBufferAttribute(e,t),Ft.normalize(),e.setXYZ(t,Ft.x,Ft.y,Ft.z)}toNonIndexed(){function e(o,a){let{array:c,itemSize:l,normalized:u}=o,h=new c.constructor(a.length*l),f=0,d=0;for(let m=0,x=a.length;m<x;m++){if(o.isInterleavedBufferAttribute)f=a[m]*o.data.stride+o.offset;else f=a[m]*l;for(let p=0;p<l;p++)h[d++]=c[f++]}return new It(h,l,u)}if(this.index===null)return Me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Qt,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],c=e(a,n);t.setAttribute(o,c)}let r=this.morphAttributes;for(let o in r){let a=[],c=r[o];for(let l=0,u=c.length;l<u;l++){let h=c[l],f=e(h,n);a.push(f)}t.morphAttributes[o]=a}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,a=s.length;o<a;o++){let c=s[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!=="")e.name=this.name;if(Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let a=this.parameters;for(let c in a)if(a[c]!==void 0)e[c]=a[c];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let a in n){let c=n[a];e.data.attributes[a]=c.toJSON(e.data)}let i={},r=!1;for(let a in this.morphAttributes){let c=this.morphAttributes[a],l=[];for(let u=0,h=c.length;u<h;u++){let f=c[u];l.push(f.toJSON(e.data))}if(l.length>0)i[a]=l,r=!0}if(r)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;if(s.length>0)e.data.groups=JSON.parse(JSON.stringify(s));let o=this.boundingSphere;if(o!==null)e.data.boundingSphere=o.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let c in i){let l=i[c];this.setAttribute(c,l.clone(t))}let r=e.morphAttributes;for(let c in r){let l=[],u=r[c];for(let h=0,f=u.length;h<f;h++)l.push(u[h].clone(t));this.morphAttributes[c]=l}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let c=0,l=s.length;c<l;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;if(o!==null)this.boundingBox=o.clone();let a=e.boundingSphere;if(a!==null)this.boundingSphere=a.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ds{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=Nn()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Nn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=Nn();if(e.arrayBuffers[this.array.buffer._uuid]===void 0)e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var Jt=new N;class ts{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix4(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyNormalMatrix(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.transformDirection(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=Ln(n,this.array);return n}setComponent(e,t,n){if(this.normalized)n=it(n,this.array);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=it(t,this.array);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=it(t,this.array);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=it(t,this.array);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=it(t,this.array);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=Ln(t,this.array);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=Ln(t,this.array);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=Ln(t,this.array);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=Ln(t,this.array);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=it(t,this.array),n=it(n,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=it(t,this.array),n=it(n,this.array),i=it(i,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){if(e=e*this.data.stride+this.offset,this.normalized)t=it(t,this.array),n=it(n,this.array),i=it(i,this.array),r=it(r,this.array);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){ws("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new It(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new ts(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){ws("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var Ov=0;class rn extends Fn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ov++}),this.uuid=Nn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Le(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Me(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Me(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!=="")n.name=this.name;if(this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)n.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.shadowSide!==null)n.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)n.blending=this.blending;if(this.side!==0)n.side=this.side;if(this.vertexColors===!0)n.vertexColors=!0;if(this.opacity<1)n.opacity=this.opacity;if(this.transparent===!0)n.transparent=!0;if(this.blendSrc!==204)n.blendSrc=this.blendSrc;if(this.blendDst!==205)n.blendDst=this.blendDst;if(this.blendEquation!==100)n.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)n.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)n.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)n.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)n.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)n.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)n.depthFunc=this.depthFunc;if(this.depthTest===!1)n.depthTest=this.depthTest;if(this.depthWrite===!1)n.depthWrite=this.depthWrite;if(this.colorWrite===!1)n.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)n.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)n.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)n.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)n.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)n.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)n.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)n.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)n.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)n.rotation=this.rotation;if(this.polygonOffset===!0)n.polygonOffset=!0;if(this.polygonOffsetFactor!==0)n.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)n.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)n.linewidth=this.linewidth;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.dithering===!0)n.dithering=!0;if(this.alphaTest>0)n.alphaTest=this.alphaTest;if(this.alphaHash===!0)n.alphaHash=!0;if(this.alphaToCoverage===!0)n.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)n.premultipliedAlpha=!0;if(this.forceSinglePass===!0)n.forceSinglePass=!0;if(this.allowOverride===!1)n.allowOverride=!1;if(this.wireframe===!0)n.wireframe=!0;if(this.wireframeLinewidth>1)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)n.flatShading=!0;if(this.visible===!1)n.visible=!1;if(this.toneMapped===!1)n.toneMapped=!1;if(this.fog===!1)n.fog=!1;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(r){let s=[];for(let o in r){let a=r[o];delete a.metadata,s.push(a)}return s}if(t){let r=i(e.textures),s=i(e.images);if(r.length>0)n.textures=r;if(s.length>0)n.images=s}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Le().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessRange=e.iridescenceThicknessRange;if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new Pe().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new Pe().fromArray(e.clearcoatNormalScale);if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}}var pi=new N,Ic=new N,Ao=new N,Di=new N,Lc=new N,Ro=new N,Nc=new N;class Gi{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,pi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=pi.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return pi.copy(this.origin).addScaledVector(this.direction,t),pi.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){Ic.copy(e).add(t).multiplyScalar(0.5),Ao.copy(t).sub(e).normalize(),Di.copy(this.origin).sub(Ic);let r=e.distanceTo(t)*0.5,s=-this.direction.dot(Ao),o=Di.dot(this.direction),a=-Di.dot(Ao),c=Di.lengthSq(),l=Math.abs(1-s*s),u,h,f,d;if(l>0)if(u=s*a-o,h=s*o-a,d=r*l,u>=0)if(h>=-d)if(h<=d){let m=1/l;u*=m,h*=m,f=u*(u+s*h+2*o)+h*(s*u+h+2*a)+c}else h=r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;else h=-r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;else if(h<=-d)u=Math.max(0,-(-s*r+o)),h=u>0?-r:Math.min(Math.max(-r,-a),r),f=-u*u+h*(h+2*a)+c;else if(h<=d)u=0,h=Math.min(Math.max(-r,-a),r),f=h*(h+2*a)+c;else u=Math.max(0,-(s*r+o)),h=u>0?r:Math.min(Math.max(-r,-a),r),f=-u*u+h*(h+2*a)+c;else h=s>0?-r:r,u=Math.max(0,-(s*h+o)),f=-u*u+h*(h+2*a)+c;if(n)n.copy(this.origin).addScaledVector(this.direction,u);if(i)i.copy(Ic).addScaledVector(Ao,h);return f}intersectSphere(e,t){pi.subVectors(e.center,this.origin);let n=pi.dot(this.direction),i=pi.dot(pi)-n*n,r=e.radius*e.radius;if(i>r)return null;let s=Math.sqrt(r-i),o=n-s,a=n+s;if(a<0)return null;if(o<0)return this.at(a,t);return this.at(o,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,r,s,o,a,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;if(c>=0)n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c;else n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c;if(l>=0)r=(e.min.y-h.y)*l,s=(e.max.y-h.y)*l;else r=(e.max.y-h.y)*l,s=(e.min.y-h.y)*l;if(n>s||r>i)return null;if(r>n||isNaN(n))n=r;if(s<i||isNaN(i))i=s;if(u>=0)o=(e.min.z-h.z)*u,a=(e.max.z-h.z)*u;else o=(e.max.z-h.z)*u,a=(e.min.z-h.z)*u;if(n>a||o>i)return null;if(o>n||n!==n)n=o;if(a<i||i!==i)i=a;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,pi)!==null}intersectTriangle(e,t,n,i,r){Lc.subVectors(t,e),Ro.subVectors(n,e),Nc.crossVectors(Lc,Ro);let s=this.direction.dot(Nc),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;Di.subVectors(this.origin,e);let a=o*this.direction.dot(Ro.crossVectors(Di,Ro));if(a<0)return null;let c=o*this.direction.dot(Lc.cross(Di));if(c<0)return null;if(a+c>s)return null;let l=-o*Di.dot(Nc);if(l<0)return null;return this.at(l/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class jn extends rn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zn,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}var uf=new Fe,sr=new Gi,Co=new un,hf=new N,Po=new N,Io=new N,Lo=new N,Dc=new N,No=new N,ff=new N,Do=new N;class dt extends ot{constructor(e=new Qt,t=new jn){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){No.set(0,0,0);for(let a=0,c=r.length;a<c;a++){let l=o[a],u=r[a];if(l===0)continue;if(Dc.fromBufferAttribute(u,e),s)No.addScaledVector(Dc,l);else No.addScaledVector(Dc.sub(t),l)}t.add(No)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(Co.copy(n.boundingSphere),Co.applyMatrix4(r),sr.copy(e.ray).recast(e.near),Co.containsPoint(sr.origin)===!1){if(sr.intersectSphere(Co,hf)===null)return;if(sr.origin.distanceToSquared(hf)>(e.far-e.near)**2)return}if(uf.copy(r).invert(),sr.copy(e.ray).applyMatrix4(uf),n.boundingBox!==null){if(sr.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,sr)}_computeIntersections(e,t,n){let i,r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,c=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,{groups:h,drawRange:f}=r;if(o!==null)if(Array.isArray(s))for(let d=0,m=h.length;d<m;d++){let x=h[d],p=s[x.materialIndex],g=Math.max(x.start,f.start),A=Math.min(o.count,Math.min(x.start+x.count,f.start+f.count));for(let E=g,y=A;E<y;E+=3){let w=o.getX(E),T=o.getX(E+1),R=o.getX(E+2);if(i=Oo(this,p,e,n,c,l,u,w,T,R),i)i.faceIndex=Math.floor(E/3),i.face.materialIndex=x.materialIndex,t.push(i)}}else{let d=Math.max(0,f.start),m=Math.min(o.count,f.start+f.count);for(let x=d,p=m;x<p;x+=3){let g=o.getX(x),A=o.getX(x+1),E=o.getX(x+2);if(i=Oo(this,s,e,n,c,l,u,g,A,E),i)i.faceIndex=Math.floor(x/3),t.push(i)}}else if(a!==void 0)if(Array.isArray(s))for(let d=0,m=h.length;d<m;d++){let x=h[d],p=s[x.materialIndex],g=Math.max(x.start,f.start),A=Math.min(a.count,Math.min(x.start+x.count,f.start+f.count));for(let E=g,y=A;E<y;E+=3){let w=E,T=E+1,R=E+2;if(i=Oo(this,p,e,n,c,l,u,w,T,R),i)i.faceIndex=Math.floor(E/3),i.face.materialIndex=x.materialIndex,t.push(i)}}else{let d=Math.max(0,f.start),m=Math.min(a.count,f.start+f.count);for(let x=d,p=m;x<p;x+=3){let g=x,A=x+1,E=x+2;if(i=Oo(this,s,e,n,c,l,u,g,A,E),i)i.faceIndex=Math.floor(x/3),t.push(i)}}}}function Uv(e,t,n,i,r,s,o,a){let c;if(t.side===1)c=i.intersectTriangle(o,s,r,!0,a);else c=i.intersectTriangle(r,s,o,t.side===0,a);if(c===null)return null;Do.copy(a),Do.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(Do);if(l<n.near||l>n.far)return null;return{distance:l,point:Do.clone(),object:e}}function Oo(e,t,n,i,r,s,o,a,c,l){e.getVertexPosition(a,Po),e.getVertexPosition(c,Io),e.getVertexPosition(l,Lo);let u=Uv(e,t,n,i,Po,Io,Lo,ff);if(u){let h=new N;if(bn.getBarycoord(ff,Po,Io,Lo,h),r)u.uv=bn.getInterpolatedAttribute(r,a,c,l,h,new Pe);if(s)u.uv1=bn.getInterpolatedAttribute(s,a,c,l,h,new Pe);if(o){if(u.normal=bn.getInterpolatedAttribute(o,a,c,l,h,new N),u.normal.dot(i.direction)>0)u.normal.multiplyScalar(-1)}let f={a,b:c,c:l,normal:new N,materialIndex:0};bn.getNormal(Po,Io,Lo,f.normal),u.face=f,u.barycoord=h}return u}var xs=new rt,df=new rt,pf=new rt,Fv=new rt,mf=new Fe,Uo=new N,Oc=new un,gf=new Fe,Uc=new Gi;class ha extends dt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new Kt;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Uo),this.boundingBox.expandByPoint(Uo)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new un;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Uo),this.boundingSphere.expandByPoint(Uo)}copy(e,t){if(super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Oc.copy(this.boundingSphere),Oc.applyMatrix4(i),e.ray.intersectsSphere(Oc)===!1)return;if(gf.copy(i).invert(),Uc.copy(e.ray).applyMatrix4(gf),this.boundingBox!==null){if(Uc.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,Uc)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new rt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();if(r!==1/0)e.multiplyScalar(r);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Me("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(df.fromBufferAttribute(i.attributes.skinIndex,e),pf.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)xs.copy(t),t.set(0,0,0,0);else xs.set(...t,1),t.set(0,0,0);xs.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let s=pf.getComponent(r);if(s!==0){let o=df.getComponent(r);mf.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Fv.copy(xs).applyMatrix4(mf),s)}}if(t.isVector4)t.w=xs.w;return t.applyMatrix4(this.bindMatrixInverse)}}class Os extends ot{constructor(){super();this.isBone=!0,this.type="Bone"}}class Us extends St{constructor(e=null,t=1,n=1,i,r,s,o,a,c=1003,l=1003,u,h){super(null,s,o,a,c,l,i,r,u,h);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var _f=new Fe,zv=new Fe;class Fs{constructor(e=[],t=[]){this.uuid=Nn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Me("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Fe;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=e.length;r<s;r++){let o=e[r]?e[r].matrixWorld:zv;_f.multiplyMatrices(o,t[r]),_f.toArray(n,r*16)}if(i!==null)i.needsUpdate=!0}clone(){return new Fs(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new Us(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],s=t[r];if(s===void 0)Me("Skeleton: No bone found with UUID:",r),s=new Os;this.bones.push(s),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let s=t[i];e.bones.push(s.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}}class lr extends It{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}var zr=new Fe,xf=new Fe,Fo=[],vf=new Kt,kv=new Fe,vs=new dt,ys=new un;class ns extends dt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new lr(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,kv)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new Kt;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,zr),vf.copy(e.boundingBox).applyMatrix4(zr),this.boundingBox.union(vf)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new un;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,zr),ys.copy(e.boundingSphere).applyMatrix4(zr),this.boundingSphere.union(ys)}copy(e,t){if(super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null)this.morphTexture=e.morphTexture.clone();if(e.instanceColor!==null)this.instanceColor=e.instanceColor.clone();if(this.count=e.count,e.boundingBox!==null)this.boundingBox=e.boundingBox.clone();if(e.boundingSphere!==null)this.boundingSphere=e.boundingSphere.clone();return this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,s=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[s+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(vs.geometry=this.geometry,vs.material=this.material,vs.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(ys.copy(this.boundingSphere),ys.applyMatrix4(n),e.ray.intersectsSphere(ys)===!1)return;for(let r=0;r<i;r++){this.getMatrixAt(r,zr),xf.multiplyMatrices(n,zr),vs.matrixWorld=xf,vs.raycast(e,Fo);for(let s=0,o=Fo.length;s<o;s++){let a=Fo[s];a.instanceId=r,a.object=this,t.push(a)}Fo.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new lr(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new Us(new Float32Array(i*this.count),i,this.count,1028,1015);let r=this.morphTexture.source.data.data,s=0;for(let c=0;c<n.length;c++)s+=n[c];let o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;return r[a]=o,r.set(n,a+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var Fc=new N,Bv=new N,Gv=new De;class In{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Fc.subVectors(n,t).cross(Bv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(Fc),r=this.normal.dot(i);if(r===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let s=-(e.start.dot(this.normal)+this.constant)/r;if(n===!0&&(s<0||s>1))return null;return t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Gv.getNormalMatrix(e),i=this.coplanarPoint(Fc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}var or=new un,Hv=new Pe(0.5,0.5),zo=new N;class zs{constructor(e=new In,t=new In,n=new In,i=new In,r=new In,s=new In){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],c=r[3],l=r[4],u=r[5],h=r[6],f=r[7],d=r[8],m=r[9],x=r[10],p=r[11],g=r[12],A=r[13],E=r[14],y=r[15];if(i[0].setComponents(c-s,f-l,p-d,y-g).normalize(),i[1].setComponents(c+s,f+l,p+d,y+g).normalize(),i[2].setComponents(c+o,f+u,p+m,y+A).normalize(),i[3].setComponents(c-o,f-u,p-m,y-A).normalize(),n)i[4].setComponents(a,h,x,E).normalize(),i[5].setComponents(c-a,f-h,p-x,y-E).normalize();else if(i[4].setComponents(c-a,f-h,p-x,y-E).normalize(),t===2000)i[5].setComponents(c+a,f+h,p+x,y+E).normalize();else if(t===2001)i[5].setComponents(a,h,x,E).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();or.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();or.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(or)}intersectsSprite(e){or.center.set(0,0,0);let t=Hv.distanceTo(e.center);return or.radius=0.7071067811865476+t,or.applyMatrix4(e.matrixWorld),this.intersectsSphere(or)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(zo.x=i.normal.x>0?e.max.x:e.min.x,zo.y=i.normal.y>0?e.max.y:e.min.y,zo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(zo)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ks extends rn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}var Zo=new N,Xo=new N,yf=new Fe,bs=new Gi,ko=new un,zc=new N,bf=new N;class Hi extends ot{constructor(e=new Qt,t=new ks){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Zo.fromBufferAttribute(t,i-1),Xo.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Zo.distanceTo(Xo);e.setAttribute("lineDistance",new nn(n,1))}else Me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(ko.copy(n.boundingSphere),ko.applyMatrix4(i),ko.radius+=r,e.ray.intersectsSphere(ko)===!1)return;yf.copy(i).invert(),bs.copy(e.ray).applyMatrix4(yf);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=this.isLineSegments?2:1,l=n.index,h=n.attributes.position;if(l!==null){let f=Math.max(0,s.start),d=Math.min(l.count,s.start+s.count);for(let m=f,x=d-1;m<x;m+=c){let p=l.getX(m),g=l.getX(m+1),A=Bo(this,e,bs,a,p,g,m);if(A)t.push(A)}if(this.isLineLoop){let m=l.getX(d-1),x=l.getX(f),p=Bo(this,e,bs,a,m,x,d-1);if(p)t.push(p)}}else{let f=Math.max(0,s.start),d=Math.min(h.count,s.start+s.count);for(let m=f,x=d-1;m<x;m+=c){let p=Bo(this,e,bs,a,m,m+1,m);if(p)t.push(p)}if(this.isLineLoop){let m=Bo(this,e,bs,a,d-1,f,d-1);if(m)t.push(m)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Bo(e,t,n,i,r,s,o){let a=e.geometry.attributes.position;if(Zo.fromBufferAttribute(a,r),Xo.fromBufferAttribute(a,s),n.distanceSqToSegment(Zo,Xo,zc,bf)>i)return;zc.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(zc);if(l<t.near||l>t.far)return;return{distance:l,point:bf.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Sf=new N,Mf=new N;class fa extends Hi{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Sf.fromBufferAttribute(t,i),Mf.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Sf.distanceTo(Mf);e.setAttribute("lineDistance",new nn(n,1))}else Me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class da extends Hi{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}}class Bs extends rn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}var wf=new Fe,Gc=new Gi,Go=new un,Ho=new N;class is extends ot{constructor(e=new Qt,t=new Bs){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Go.copy(n.boundingSphere),Go.applyMatrix4(i),Go.radius+=r,e.ray.intersectsSphere(Go)===!1)return;wf.copy(i).invert(),Gc.copy(e.ray).applyMatrix4(wf);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=n.index,u=n.attributes.position;if(c!==null){let h=Math.max(0,s.start),f=Math.min(c.count,s.start+s.count);for(let d=h,m=f;d<m;d++){let x=c.getX(d);Ho.fromBufferAttribute(u,x),Tf(Ho,x,a,i,e,t,this)}}else{let h=Math.max(0,s.start),f=Math.min(u.count,s.start+s.count);for(let d=h,m=f;d<m;d++)Ho.fromBufferAttribute(u,d),Tf(Ho,d,a,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Tf(e,t,n,i,r,s,o){let a=Gc.distanceSqToPoint(e);if(a<n){let c=new N;Gc.closestPointToPoint(e,c),c.applyMatrix4(i);let l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class pa extends St{constructor(e=[],t=301,n,i,r,s,o,a,c,l){super(e,t,n,i,r,s,o,a,c,l);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Vi extends St{constructor(e,t,n=1014,i,r,s,o=1003,a=1003,c,l=1026,u=1){if(l!==1026&&l!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let h={width:e,height:t,depth:u};super(h,i,r,s,o,a,l,n,c);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ls(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);if(this.compareFunction!==null)t.compareFunction=this.compareFunction;return t}}class $l extends Vi{constructor(e,t=1014,n=301,i,r,s=1003,o=1003,a,c=1026){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,i,r,s,o,a,c);this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ma extends St{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Wi extends Qt{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};let o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);let a=[],c=[],l=[],u=[],h=0,f=0;d("z","y","x",-1,-1,n,t,e,s,r,0),d("z","y","x",1,-1,n,t,-e,s,r,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new nn(c,3)),this.setAttribute("normal",new nn(l,3)),this.setAttribute("uv",new nn(u,2));function d(m,x,p,g,A,E,y,w,T,R,_){let S=E/T,U=y/R,C=E/2,z=y/2,j=w/2,F=T+1,H=R+1,V=0,O=0,K=new N;for(let Q=0;Q<H;Q++){let se=Q*U-z;for(let me=0;me<F;me++){let _e=me*S-C;K[m]=_e*g,K[x]=se*A,K[p]=j,c.push(K.x,K.y,K.z),K[m]=0,K[x]=0,K[p]=w>0?1:-1,l.push(K.x,K.y,K.z),u.push(me/T),u.push(1-Q/R),V+=1}}for(let Q=0;Q<R;Q++)for(let se=0;se<T;se++){let me=h+se+F*Q,_e=h+se+F*(Q+1),Xe=h+(se+1)+F*(Q+1),Be=h+(se+1)+F*Q;a.push(me,_e,Be),a.push(_e,Xe,Be),O+=6}o.addGroup(f,O,_),f+=O,h+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Gs extends Qt{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),c=o+1,l=a+1,u=e/o,h=t/a,f=[],d=[],m=[],x=[];for(let p=0;p<l;p++){let g=p*h-s;for(let A=0;A<c;A++){let E=A*u-r;d.push(E,-g,0),m.push(0,0,1),x.push(A/o),x.push(1-p/a)}}for(let p=0;p<a;p++)for(let g=0;g<o;g++){let A=g+c*p,E=g+c*(p+1),y=g+1+c*(p+1),w=g+1+c*p;f.push(A,E,w),f.push(E,y,w)}this.setIndex(f),this.setAttribute("position",new nn(d,3)),this.setAttribute("normal",new nn(m,3)),this.setAttribute("uv",new nn(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gs(e.width,e.height,e.widthSegments,e.heightSegments)}}function gr(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let r=e[n][i];if(Ef(r))if(r.isRenderTargetTexture)Me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=r.clone();else if(Array.isArray(r))if(Ef(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();t[n][i]=s}else t[n][i]=r.slice();else t[n][i]=r}}return t}function qt(e){let t={};for(let n=0;n<e.length;n++){let i=gr(e[n]);for(let r in i)t[r]=i[r]}return t}function Ef(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Vv(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Zl(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return Ve.workingColorSpace}var Ld={clone:gr,merge:qt},Wv=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-}`,Tx=`void main() {
+}`,$v=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
-}`;class bn extends nn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=wx,this.fragmentShader=Tx,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cr(e.uniforms),this.uniformsGroups=Mx(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let s=this.uniforms[i].value;if(s&&s.isTexture)t.uniforms[i]={type:"t",value:s.toJSON(e).uuid};else if(s&&s.isColor)t.uniforms[i]={type:"c",value:s.getHex()};else if(s&&s.isVector2)t.uniforms[i]={type:"v2",value:s.toArray()};else if(s&&s.isVector3)t.uniforms[i]={type:"v3",value:s.toArray()};else if(s&&s.isVector4)t.uniforms[i]={type:"v4",value:s.toArray()};else if(s&&s.isMatrix3)t.uniforms[i]={type:"m3",value:s.toArray()};else if(s&&s.isMatrix4)t.uniforms[i]={type:"m4",value:s.toArray()};else t.uniforms[i]={value:s}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Le().setHex(i.value);break;case"v2":this.uniforms[n].value=new Pe().fromArray(i.value);break;case"v3":this.uniforms[n].value=new N().fromArray(i.value);break;case"v4":this.uniforms[n].value=new it().fromArray(i.value);break;case"m3":this.uniforms[n].value=new De().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Fe().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}}class Tl extends bn{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class fi extends nn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Le(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 Le(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 Hn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class un extends fi{constructor(e){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return We(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Le(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ra extends nn{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(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 Hn,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class El extends nn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Al extends nn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Io(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function Ex(e){function t(r,s){return e[r]-e[s]}let n=e.length,i=Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(t),i}function Bh(e,t,n){let i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){let a=n[s]*t;for(let c=0;c!==t;++c)r[o++]=e[a+c]}return r}function Ax(e,t,n,i){let r=1,s=e[0];while(s!==void 0&&s[i]===void 0)s=e[r++];if(s===void 0)return;let o=s[i];if(o===void 0)return;if(Array.isArray(o))do{if(o=s[i],o!==void 0)t.push(s.time),n.push(...o);s=e[r++]}while(s!==void 0);else if(o.toArray!==void 0)do{if(o=s[i],o!==void 0)t.push(s.time),o.toArray(n,n.length);s=e[r++]}while(s!==void 0);else do{if(o=s[i],o!==void 0)t.push(s.time),n.push(o);s=e[r++]}while(s!==void 0)}class di{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){let o=t[1];if(e<o)n=2,r=o;for(let a=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}while(n<s){let o=n+s>>>1;if(e<t[o])s=o;else n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class Rl extends di{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,s=e+1,o=i[r],a=i[s];if(o===void 0)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case 2401:s=e,a=2*n-t;break;case 2402:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}let c=(n-t)*0.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=s*l}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,h=this._weightNext,d=(n-t)/(i-t),g=d*d,b=g*d,p=-f*b+2*f*g-f*d,m=(1+f)*b+(-1.5-2*f)*g+(-0.5+f)*d+1,A=(-1-h)*b+(1.5+h)*g+0.5*d,T=h*b-h*g;for(let v=0;v!==o;++v)r[v]=p*s[l+v]+m*s[c+v]+A*s[a+v]+T*s[u+v];return r}}class sa extends di{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=(n-t)/(i-t),u=1-l;for(let f=0;f!==o;++f)r[f]=s[c+f]*u+s[a+f]*l;return r}}class Cl extends di{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Pl extends di{interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let d=(n-t)/(i-t),g=1-d;for(let b=0;b!==o;++b)r[b]=s[c+b]*g+s[a+b]*d;return r}let f=o*2,h=e-1;for(let d=0;d!==o;++d){let g=s[c+d],b=s[a+d],p=h*f+d*2,m=u[p],A=u[p+1],T=e*f+d*2,v=l[T],w=l[T+1],E=(n-t)/(i-t),R,_,S,F,C;for(let z=0;z<8;z++){R=E*E,_=R*E,S=1-E,F=S*S,C=F*S;let O=C*t+3*F*E*m+3*S*R*v+_*i-n;if(Math.abs(O)<0.0000000001)break;let H=3*F*(m-t)+6*S*E*(v-m)+3*R*(i-v);if(Math.abs(H)<0.0000000001)break;E=E-O/H,E=Math.max(0,Math.min(1,E))}r[d]=C*g+3*F*E*A+3*S*R*w+_*b}return r}}class hn{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Io(t,this.TimeBufferType),this.values=Io(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Io(e.times,Array),values:Io(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Cl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new sa(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Rl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Pl(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Me("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,s=i-1;while(r!==i&&n[r]<e)++r;while(s!==-1&&n[s]>t)--s;if(++s,r!==0||s!==i){if(r>=s)s=Math.max(s,1),r=s-1;let o=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*o,s*o)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Ne("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,r=n.length;if(r===0)Ne("KeyframeTrack: Track is empty.",this),e=!1;let s=null;for(let o=0;o!==r;o++){let a=n[o];if(typeof a==="number"&&isNaN(a)){Ne("KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(s!==null&&s>a){Ne("KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(i!==void 0){if(k0(i))for(let o=0,a=i.length;o!==a;++o){let c=i[o];if(isNaN(c)){Ne("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,r=e.length-1,s=1;for(let o=1;o<r;++o){let a=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==e[0]))if(!i){let u=o*n,f=u-n,h=u+n;for(let d=0;d!==n;++d){let g=t[u+d];if(g!==t[f+d]||g!==t[h+d]){a=!0;break}}}else a=!0;if(a){if(o!==s){e[s]=e[o];let u=o*n,f=s*n;for(let h=0;h!==n;++h)t[f+h]=t[u+h]}++s}}if(r>0){e[s]=e[r];for(let o=r*n,a=s*n,c=0;c!==n;++c)t[a+c]=t[o+c];++s}if(s!==e.length)this.times=e.slice(0,s),this.values=t.slice(0,s*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}hn.prototype.ValueTypeName="";hn.prototype.TimeBufferType=Float32Array;hn.prototype.ValueBufferType=Float32Array;hn.prototype.DefaultInterpolation=2301;class Ui extends hn{constructor(e,t,n){super(e,t,n)}}Ui.prototype.ValueTypeName="bool";Ui.prototype.ValueBufferType=Array;Ui.prototype.DefaultInterpolation=2300;Ui.prototype.InterpolantFactoryMethodLinear=void 0;Ui.prototype.InterpolantFactoryMethodSmooth=void 0;class oa extends hn{constructor(e,t,n,i){super(e,t,n,i)}}oa.prototype.ValueTypeName="color";class Oi extends hn{constructor(e,t,n,i){super(e,t,n,i)}}Oi.prototype.ValueTypeName="number";class Il extends di{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t),c=e*o;for(let l=c+o;c!==l;c+=4)zt.slerpFlat(r,0,s,c-o,s,c,a);return r}}class Fi extends hn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Il(this.times,this.values,this.getValueSize(),e)}}Fi.prototype.ValueTypeName="quaternion";Fi.prototype.InterpolantFactoryMethodSmooth=void 0;class zi extends hn{constructor(e,t,n){super(e,t,n)}}zi.prototype.ValueTypeName="string";zi.prototype.ValueBufferType=Array;zi.prototype.DefaultInterpolation=2300;zi.prototype.InterpolantFactoryMethodLinear=void 0;zi.prototype.InterpolantFactoryMethodSmooth=void 0;class lr extends hn{constructor(e,t,n,i){super(e,t,n,i)}}lr.prototype.ValueTypeName="vector";class zr{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Cn(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,o=n.length;s!==o;++s)t.push(Cx(n[s]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,s=n.length;r!==s;++r)t.push(hn.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,s=[];for(let o=0;o<r;o++){let a=[],c=[];a.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);let l=Ex(a);if(a=Bh(a,1,l),c=Bh(c,1,l),!i&&a[0]===0)a.push(r),c.push(c[0]);s.push(new Oi(".morphTargetInfluences["+t[o].name+"]",a,c).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.name.match(r);if(l&&l.length>1){let u=l[1],f=i[u];if(!f)i[u]=f=[];f.push(c)}}let s=[];for(let o in i)s.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return s}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Rx(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Oi;case"vector":case"vector2":case"vector3":case"vector4":return lr;case"color":return oa;case"quaternion":return Fi;case"bool":case"boolean":return Ui;case"string":return zi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Cx(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=Rx(e.type);if(e.times===void 0){let n=[],i=[];Ax(e.keys,n,i,"value"),e.times=n,e.values=i}if(t.parse!==void 0)return t.parse(e);else return new t(e.name,e.times,e.values,e.interpolation)}var Gn={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(Gh(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(Gh(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Gh(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class Ds{constructor(e,t,n){let i=this,r=!1,s=0,o=0,a=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(l){if(o++,r===!1){if(i.onStart!==void 0)i.onStart(l,s,o)}r=!0},this.itemEnd=function(l){if(s++,i.onProgress!==void 0)i.onProgress(l,s,o);if(s===o){if(r=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(l){if(i.onError!==void 0)i.onError(l)},this.resolveURL=function(l){if(l=l.normalize("NFC"),a)return a(l);return l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){let u=c.indexOf(l);if(u!==-1)c.splice(u,2);return this},this.getHandler=function(l){for(let u=0,f=c.length;u<f;u+=2){let h=c[u],d=c[u+1];if(h.global)h.lastIndex=0;if(h.test(l))return d}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var Xf=new Ds;class pi{constructor(e){if(this.manager=e!==void 0?e:Xf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}pi.DEFAULT_MATERIAL_NAME="__DEFAULT";var ci={};class qf extends Error{constructor(e,t){super(e);this.response=t}}class Us extends pi{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=Gn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(r);this.manager.itemEnd(e)},0);return}if(ci[e]!==void 0){ci[e].push({onLoad:t,onProgress:n,onError:i});return}ci[e]=[],ci[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,a=this.responseType;fetch(s).then((c)=>{if(c.status===200||c.status===0){if(c.status===0)Me("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let l=ci[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0,g=0,b=new ReadableStream({start(p){m();function m(){u.read().then(({done:A,value:T})=>{if(A)p.close();else{g+=T.byteLength;let v=new ProgressEvent("progress",{lengthComputable:d,loaded:g,total:h});for(let w=0,E=l.length;w<E;w++){let R=l[w];if(R.onProgress)R.onProgress(v)}p.enqueue(T),m()}},(A)=>{p.error(A)})}}});return new Response(b)}else throw new qf(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then((c)=>{switch(a){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then((l)=>new DOMParser().parseFromString(l,o));case"json":return c.json();default:if(o==="")return c.text();else{let u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then((d)=>h.decode(d))}}}).then((c)=>{Gn.add(`file:${e}`,c);let l=ci[e];delete ci[e];for(let u=0,f=l.length;u<f;u++){let h=l[u];if(h.onLoad)h.onLoad(c)}}).catch((c)=>{let l=ci[e];if(l===void 0)throw this.manager.itemError(e),c;delete ci[e];for(let u=0,f=l.length;u<f;u++){let h=l[u];if(h.onError)h.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Lr=new WeakMap;class Ll extends pi{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=Gn.get(`image:${e}`);if(s!==void 0){if(s.complete===!0)r.manager.itemStart(e),setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);else{let u=Lr.get(s);if(u===void 0)u=[],Lr.set(s,u);u.push({onLoad:t,onError:i})}return s}let o=Or("img");function a(){if(l(),t)t(this);let u=Lr.get(this)||[];for(let f=0;f<u.length;f++){let h=u[f];if(h.onLoad)h.onLoad(this)}Lr.delete(this),r.manager.itemEnd(e)}function c(u){if(l(),i)i(u);Gn.remove(`image:${e}`);let f=Lr.get(this)||[];for(let h=0;h<f.length;h++){let d=f[h];if(d.onError)d.onError(u)}Lr.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1)}if(o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)o.crossOrigin=this.crossOrigin}return Gn.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class aa extends pi{constructor(e){super(e)}load(e,t,n,i){let r=new St,s=new Ll(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(o){if(r.image=o,r.needsUpdate=!0,t!==void 0)t(r)},n,i),r}}class Jr extends ot{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class ca extends Jr{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Le(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}var _c=new Fe,Hh=new N,Vh=new N;class la{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ps,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new it(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;if(Hh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Hh),Vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Vh),t.updateMatrixWorld(),_c.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_c,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth)n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiply(_c)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};if(this.intensity!==1)e.intensity=this.intensity;if(this.bias!==0)e.bias=this.bias;if(this.normalBias!==0)e.normalBias=this.normalBias;if(this.radius!==1)e.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)e.mapSize=this.mapSize.toArray();return e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}var Lo=new N,No=new zt,kn=new N;class ua extends ot{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(Lo,No,kn),kn.x===1&&kn.y===1&&kn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Lo,No,kn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Lo,No,kn),kn.x===1&&kn.y===1&&kn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Lo,No,kn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Ti=new N,Wh=new Pe,$h=new Pe;class Pt extends ua{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=er*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ps*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return er*2*Math.atan(Math.tan(ps*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ti.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z),Ti.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z)}getViewSize(e,t){return this.getViewBounds(e,Wh,$h),t.subVectors($h,Wh)}setViewOffset(e,t,n,i,r,s){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(ps*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-0.5*i,s=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:a,fullHeight:c}=s;r+=s.offsetX*i/a,t-=s.offsetY*n/c,i*=s.width/a,n*=s.height/c}let o=this.filmOffset;if(o!==0)r+=e*o/this.getFilmWidth();this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Yf extends la{constructor(){super(new Pt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=er*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;if(n!==t.fov||i!==t.aspect||r!==t.far)t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class ha extends Jr{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Yf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}}class jf extends la{constructor(){super(new Pt(90,1,0.5,500));this.isPointLightShadow=!0}}class Kr extends Jr{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new jf}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class ur extends ua{constructor(e=-1,t=1,n=1,i=-1,r=0.1,s=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,s=n+e,o=i+t,a=i-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,s=r+c*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}}class Jf extends la{constructor(){super(new ur(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class Qr extends Jr{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.shadow=new Jf}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class ki{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}var xc=new WeakMap;class fa extends pi{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Me("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Me("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=Gn.get(`image-bitmap:${e}`);if(s!==void 0){if(r.manager.itemStart(e),s.then){s.then((c)=>{if(xc.has(s)===!0){if(i)i(xc.get(s));r.manager.itemError(e),r.manager.itemEnd(e)}else{if(t)t(c);r.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let a=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){if(Gn.add(`image-bitmap:${e}`,c),t)t(c);r.manager.itemEnd(e)}).catch(function(c){if(i)i(c);xc.set(a,c),Gn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Gn.add(`image-bitmap:${e}`,a),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Nr=-90,Dr=1;class Nl extends ot{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Pt(Nr,Dr,e,t);i.layers=this.layers,this.add(i);let r=new Pt(Nr,Dr,e,t);r.layers=this.layers,this.add(r);let s=new Pt(Nr,Dr,e,t);s.layers=this.layers,this.add(s);let o=new Pt(Nr,Dr,e,t);o.layers=this.layers,this.add(o);let a=new Pt(Nr,Dr,e,t);a.layers=this.layers,this.add(a);let c=new Pt(Nr,Dr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(let c of t)this.remove(c);if(e===2000)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),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(e===2001)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),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[r,s,o,a,c,l]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;if(e.isWebGLRenderer===!0)b=e.state.buffers.depth.getReversed();else b=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),b&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,1,i),b&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,2,i),b&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,3,i),b&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,4,i),b&&e.autoClear===!1)e.clearDepth();if(e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),b&&e.autoClear===!1)e.clearDepth();e.render(t,l),e.setRenderTarget(u,f,h),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Dl extends Pt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ul{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,s;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}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(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,s=this.cumulativeWeight;if(s===0){for(let o=0;o!==i;++o)n[r+o]=n[o];s=t}else{s+=t;let o=t/s;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let a=t*this._origIndex;this._mixBufferRegion(n,i,a,1-r,t)}if(s>0)this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let a=t,c=t+t;a!==c;++a)if(n[a]!==n[a+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=0.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){zt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let s=this._workIndex*r;zt.multiplyQuaternionsFlat(e,s,e,t,e,n),zt.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){let s=1-i;for(let o=0;o!==r;++o){let a=t+o;e[a]=e[a]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){let o=t+s;e[o]=e[o]+e[n+s]*i}}}var Ol="\\[\\]\\.:\\/",Px=new RegExp("["+Ol+"]","g"),Fl="[^"+Ol+"]",Ix="[^"+Ol.replace("\\.","")+"]",Lx=/((?:WC+[\/:])*)/.source.replace("WC",Fl),Nx=/(WCOD+)?/.source.replace("WCOD",Ix),Dx=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Fl),Ux=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Fl),Ox=new RegExp("^"+Lx+Nx+Dx+Ux+"$"),Fx=["material","materials","bones","map"];class Kf{constructor(e,t,n){let i=n||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class et{constructor(e,t,n){this.path=t,this.parsedPath=n||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new et(e,t,n);else return new et.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Px,"")}static parseTrackName(e){let t=Ox.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);if(Fx.indexOf(r)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=r}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let s=0;s<r.length;s++){let o=r[s];if(o.name===t||o.uuid===t)return o;let a=n(o.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:r}=t;if(!e)e=et.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Me("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ne("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ne("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let l=0;l<e.length;l++)if(e[l].name===c){c=l;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ne("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ne("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ne("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let s=e[i];if(s===void 0){let c=t.nodeName;Ne("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)o=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)o=this.Versioning.MatrixWorldNeedsUpdate;let a=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[r]!==void 0)r=e.morphTargetDictionary[r]}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else if(s.fromArray!==void 0&&s.toArray!==void 0)a=this.BindingType.HasFromToArray,this.resolvedProperty=s;else if(Array.isArray(s))a=this.BindingType.EntireArray,this.resolvedProperty=s;else this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}et.Composite=Kf;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class zl{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,s=r.length,o=Array(s),a={endingStart:2400,endingEnd:2400};for(let c=0;c!==s;++c){let l=r[c].createInterpolant(null);o[c]=l,l.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,s=r/i,o=i/r;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,s,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;if(e!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,s=this.timeScale,o=this._timeScaleInterpolant;if(o===null)o=i._lendControlInterpolant(),this._timeScaleInterpolant=o;let a=o.parameterPositions,c=o.sampleValues;return a[0]=r,a[1]=r+n,c[0]=e/s,c[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;if(e!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let a=(e-r)*n;if(a<0||n===0)t=0;else this._startTime=null,t=n*a}t*=this._updateTimeScale(e);let s=this._updateTime(t),o=this._updateWeight(e);if(o>0){let a=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulateAdditive(o);break;case 2500:default:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(this.stopFading(),i===0)this.enabled=!1}}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(t===0)this.paused=!0;else{if(this._restoreTimeScale!==null)t=this._restoreTimeScale;this.timeScale=t}this.stopWarping()}}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,s=n===2202;if(e===0){if(r===-1)return i;return s&&(r&1)===1?t-i:i}if(n===2200){if(r===-1)this._loopCount=0,this._setEndings(!0,!0,!1);e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1)if(e>=0)r=0,this._setEndings(!0,this.repetitions===0,s);else this._setEndings(this.repetitions===0,!0,s);if(i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let a=this.repetitions-r;if(a<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1})}else{if(a===1){let c=e<0;this._setEndings(c,!c,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(s&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;if(n)i.endingStart=2401,i.endingEnd=2401;else{if(e)i.endingStart=this.zeroSlopeAtStart?2401:2400;else i.endingStart=2402;if(t)i.endingEnd=this.zeroSlopeAtEnd?2401:2400;else i.endingEnd=2402}}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,s=this._weightInterpolant;if(s===null)s=i._lendControlInterpolant(),this._weightInterpolant=s;let o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}var zx=new Float32Array(1);class da extends Nn{constructor(e){super();if(this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,{_propertyBindings:s,_interpolants:o}=e,a=n.uuid,c=this._bindingsByRootAndName,l=c[a];if(l===void 0)l={},c[a]=l;for(let u=0;u!==r;++u){let f=i[u],h=f.name,d=l[h];if(d!==void 0)++d.referenceCount,s[u]=d;else{if(d=s[u],d!==void 0){if(d._cacheIndex===null)++d.referenceCount,this._addInactiveBinding(d,a,h);continue}let g=t&&t._propertyBindings[u].binding.parsedPath;d=new Ul(et.create(n,h,g),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,a,h),s[u]=d}o[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(r.useCount++===0)this._lendBinding(r),r.saveOriginalState()}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.useCount===0)r.restoreOriginalState(),this._takeBackBinding(r)}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{let o=s.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,c=a[a.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,f=(e._localRoot||this._root).uuid;if(delete u[f],a.length===0)delete s[r];this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.referenceCount===0)this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,s=i[t];if(s===void 0)s={},i[t]=s;s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],c=e._cacheIndex;if(a._cacheIndex=c,t[c]=a,t.pop(),delete o[r],Object.keys(o).length===0)delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];if(n===void 0)n=new sa(new Float32Array(2),new Float32Array(2),1,zx),n.__cacheIndex=t,e[t]=n;return n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,s=typeof e==="string"?zr.findByName(i,e):e,o=s!==null?s.uuid:e,a=this._actionsByClip[o],c=null;if(n===void 0)if(s!==null)n=s.blendMode;else n=2500;if(a!==void 0){let u=a.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;if(c=a.knownActions[0],s===null)s=c._clip}if(s===null)return null;let l=new zl(this,s,t,n);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e==="string"?zr.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];if(o!==void 0)return o.actionByRoot[i]||null;return null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,s);let o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let s=r.knownActions;for(let o=0,a=s.length;o!==a;++o){let c=s[o];this._deactivateAction(c);let l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let o=n[s].actionByRoot,a=o[t];if(a!==void 0)this._deactivateAction(a),this._removeInactiveAction(a)}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let s in r){let o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);if(n!==null)this._deactivateAction(n),this._removeInactiveAction(n)}}class Os{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=We(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){if(this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(e,n),this.phi=Math.acos(We(t/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class kl{static{kl.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}class pa extends Nn{constructor(e,t=null){super();this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Me("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=e}disconnect(){}dispose(){}update(){}}function Bl(e,t,n,i){let r=kx(i);switch(n){case 1021:return e*t;case 1028:return e*t/r.components*r.byteLength;case 1029:return e*t/r.components*r.byteLength;case 1030:return e*t*2/r.components*r.byteLength;case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:return e*t*4/r.components*r.byteLength;case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function kx(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));if(typeof window<"u")if(window.__THREE__)Me("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="185";function bd(){let e=null,t=!1,n=null,i=null;function r(s,o){n(s,o),i=e.requestAnimationFrame(r)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(r),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function Bx(e){let t=new WeakMap;function n(a,c){let{array:l,usage:u}=a,f=l.byteLength,h=e.createBuffer();e.bindBuffer(c,h),e.bufferData(c,l,u),a.onUploadCallback();let d;if(l instanceof Float32Array)d=e.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=e.HALF_FLOAT;else if(l instanceof Uint16Array)if(a.isFloat16BufferAttribute)d=e.HALF_FLOAT;else d=e.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=e.SHORT;else if(l instanceof Uint32Array)d=e.UNSIGNED_INT;else if(l instanceof Int32Array)d=e.INT;else if(l instanceof Int8Array)d=e.BYTE;else if(l instanceof Uint8Array)d=e.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:h,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,c,l){let{array:u,updateRanges:f}=c;if(e.bindBuffer(l,a),f.length===0)e.bufferSubData(l,0,u);else{f.sort((d,g)=>d.start-g.start);let h=0;for(let d=1;d<f.length;d++){let g=f[h],b=f[d];if(b.start<=g.start+g.count+1)g.count=Math.max(g.count,b.start+b.count-g.start);else++h,f[h]=b}f.length=h+1;for(let d=0,g=f.length;d<g;d++){let b=f[d];e.bufferSubData(l,b.start*u.BYTES_PER_ELEMENT,u,b.start,b.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(a){if(a.isInterleavedBufferAttribute)a=a.data;return t.get(a)}function s(a){if(a.isInterleavedBufferAttribute)a=a.data;let c=t.get(a);if(c)e.deleteBuffer(c.buffer),t.delete(a)}function o(a,c){if(a.isInterleavedBufferAttribute)a=a.data;if(a.isGLBufferAttribute){let u=t.get(a);if(!u||u.version<a.version)t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=t.get(a);if(l===void 0)t.set(a,n(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:r,remove:s,update:o}}var Gx=`#ifdef USE_ALPHAHASH
+}`;class wn extends rn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Wv,this.fragmentShader=$v,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=gr(e.uniforms),this.uniformsGroups=Vv(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let s=this.uniforms[i].value;if(s&&s.isTexture)t.uniforms[i]={type:"t",value:s.toJSON(e).uuid};else if(s&&s.isColor)t.uniforms[i]={type:"c",value:s.getHex()};else if(s&&s.isVector2)t.uniforms[i]={type:"v2",value:s.toArray()};else if(s&&s.isVector3)t.uniforms[i]={type:"v3",value:s.toArray()};else if(s&&s.isVector4)t.uniforms[i]={type:"v4",value:s.toArray()};else if(s&&s.isMatrix3)t.uniforms[i]={type:"m3",value:s.toArray()};else if(s&&s.isMatrix4)t.uniforms[i]={type:"m4",value:s.toArray()};else t.uniforms[i]={value:s}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Le().setHex(i.value);break;case"v2":this.uniforms[n].value=new Pe().fromArray(i.value);break;case"v3":this.uniforms[n].value=new N().fromArray(i.value);break;case"v4":this.uniforms[n].value=new rt().fromArray(i.value);break;case"m3":this.uniforms[n].value=new De().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Fe().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}}class Xl extends wn{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vi extends rn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Le(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 Le(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 Zn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hn extends vi{constructor(e){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return We(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Le(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ga extends rn{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(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 Zn,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ql extends rn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Yl extends rn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Vo(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function Zv(e){function t(r,s){return e[r]-e[s]}let n=e.length,i=Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(t),i}function Af(e,t,n){let i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){let a=n[s]*t;for(let c=0;c!==t;++c)r[o++]=e[a+c]}return r}function Xv(e,t,n,i){let r=1,s=e[0];while(s!==void 0&&s[i]===void 0)s=e[r++];if(s===void 0)return;let o=s[i];if(o===void 0)return;if(Array.isArray(o))do{if(o=s[i],o!==void 0)t.push(s.time),n.push(...o);s=e[r++]}while(s!==void 0);else if(o.toArray!==void 0)do{if(o=s[i],o!==void 0)t.push(s.time),o.toArray(n,n.length);s=e[r++]}while(s!==void 0);else do{if(o=s[i],o!==void 0)t.push(s.time),n.push(o);s=e[r++]}while(s!==void 0)}class yi{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){let o=t[1];if(e<o)n=2,r=o;for(let a=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}while(n<s){let o=n+s>>>1;if(e<t[o])s=o;else n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class jl extends yi{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,s=e+1,o=i[r],a=i[s];if(o===void 0)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case 2401:s=e,a=2*n-t;break;case 2402:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}let c=(n-t)*0.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=s*l}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,f=this._weightNext,d=(n-t)/(i-t),m=d*d,x=m*d,p=-h*x+2*h*m-h*d,g=(1+h)*x+(-1.5-2*h)*m+(-0.5+h)*d+1,A=(-1-f)*x+(1.5+f)*m+0.5*d,E=f*x-f*m;for(let y=0;y!==o;++y)r[y]=p*s[l+y]+g*s[c+y]+A*s[a+y]+E*s[u+y];return r}}class _a extends yi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=(n-t)/(i-t),u=1-l;for(let h=0;h!==o;++h)r[h]=s[c+h]*u+s[a+h]*l;return r}}class Jl extends yi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Kl extends yi{interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,c=a-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let d=(n-t)/(i-t),m=1-d;for(let x=0;x!==o;++x)r[x]=s[c+x]*m+s[a+x]*d;return r}let h=o*2,f=e-1;for(let d=0;d!==o;++d){let m=s[c+d],x=s[a+d],p=f*h+d*2,g=u[p],A=u[p+1],E=e*h+d*2,y=l[E],w=l[E+1],T=(n-t)/(i-t),R,_,S,U,C;for(let z=0;z<8;z++){R=T*T,_=R*T,S=1-T,U=S*S,C=U*S;let F=C*t+3*U*T*g+3*S*R*y+_*i-n;if(Math.abs(F)<0.0000000001)break;let H=3*U*(g-t)+6*S*T*(y-g)+3*R*(i-y);if(Math.abs(H)<0.0000000001)break;T=T-F/H,T=Math.max(0,Math.min(1,T))}r[d]=C*m+3*U*T*A+3*S*R*w+_*x}return r}}class fn{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Vo(t,this.TimeBufferType),this.values=Vo(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Vo(e.times,Array),values:Vo(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Jl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new _a(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new jl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Kl(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Me("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,s=i-1;while(r!==i&&n[r]<e)++r;while(s!==-1&&n[s]>t)--s;if(++s,r!==0||s!==i){if(r>=s)s=Math.max(s,1),r=s-1;let o=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*o,s*o)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Ne("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,r=n.length;if(r===0)Ne("KeyframeTrack: Track is empty.",this),e=!1;let s=null;for(let o=0;o!==r;o++){let a=n[o];if(typeof a==="number"&&isNaN(a)){Ne("KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(s!==null&&s>a){Ne("KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(i!==void 0){if(sv(i))for(let o=0,a=i.length;o!==a;++o){let c=i[o];if(isNaN(c)){Ne("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,r=e.length-1,s=1;for(let o=1;o<r;++o){let a=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==e[0]))if(!i){let u=o*n,h=u-n,f=u+n;for(let d=0;d!==n;++d){let m=t[u+d];if(m!==t[h+d]||m!==t[f+d]){a=!0;break}}}else a=!0;if(a){if(o!==s){e[s]=e[o];let u=o*n,h=s*n;for(let f=0;f!==n;++f)t[h+f]=t[u+f]}++s}}if(r>0){e[s]=e[r];for(let o=r*n,a=s*n,c=0;c!==n;++c)t[a+c]=t[o+c];++s}if(s!==e.length)this.times=e.slice(0,s),this.values=t.slice(0,s*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}fn.prototype.ValueTypeName="";fn.prototype.TimeBufferType=Float32Array;fn.prototype.ValueBufferType=Float32Array;fn.prototype.DefaultInterpolation=2301;class $i extends fn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="bool";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=2300;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class xa extends fn{constructor(e,t,n,i){super(e,t,n,i)}}xa.prototype.ValueTypeName="color";class Zi extends fn{constructor(e,t,n,i){super(e,t,n,i)}}Zi.prototype.ValueTypeName="number";class Ql extends yi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t),c=e*o;for(let l=c+o;c!==l;c+=4)zt.slerpFlat(r,0,s,c-o,s,c,a);return r}}class Xi extends fn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Ql(this.times,this.values,this.getValueSize(),e)}}Xi.prototype.ValueTypeName="quaternion";Xi.prototype.InterpolantFactoryMethodSmooth=void 0;class qi extends fn{constructor(e,t,n){super(e,t,n)}}qi.prototype.ValueTypeName="string";qi.prototype.ValueBufferType=Array;qi.prototype.DefaultInterpolation=2300;qi.prototype.InterpolantFactoryMethodLinear=void 0;qi.prototype.InterpolantFactoryMethodSmooth=void 0;class _r extends fn{constructor(e,t,n,i){super(e,t,n,i)}}_r.prototype.ValueTypeName="vector";class $r{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Nn(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,o=n.length;s!==o;++s)t.push(Yv(n[s]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,s=n.length;r!==s;++r)t.push(fn.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,s=[];for(let o=0;o<r;o++){let a=[],c=[];a.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);let l=Zv(a);if(a=Af(a,1,l),c=Af(c,1,l),!i&&a[0]===0)a.push(r),c.push(c[0]);s.push(new Zi(".morphTargetInfluences["+t[o].name+"]",a,c).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.name.match(r);if(l&&l.length>1){let u=l[1],h=i[u];if(!h)i[u]=h=[];h.push(c)}}let s=[];for(let o in i)s.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return s}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function qv(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zi;case"vector":case"vector2":case"vector3":case"vector4":return _r;case"color":return xa;case"quaternion":return Xi;case"bool":case"boolean":return $i;case"string":return qi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Yv(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=qv(e.type);if(e.times===void 0){let n=[],i=[];Xv(e.keys,n,i,"value"),e.times=n,e.values=i}if(t.parse!==void 0)return t.parse(e);else return new t(e.name,e.times,e.values,e.interpolation)}var $n={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(Rf(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(Rf(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Rf(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class Hs{constructor(e,t,n){let i=this,r=!1,s=0,o=0,a=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(l){if(o++,r===!1){if(i.onStart!==void 0)i.onStart(l,s,o)}r=!0},this.itemEnd=function(l){if(s++,i.onProgress!==void 0)i.onProgress(l,s,o);if(s===o){if(r=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(l){if(i.onError!==void 0)i.onError(l)},this.resolveURL=function(l){if(l=l.normalize("NFC"),a)return a(l);return l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){let u=c.indexOf(l);if(u!==-1)c.splice(u,2);return this},this.getHandler=function(l){for(let u=0,h=c.length;u<h;u+=2){let f=c[u],d=c[u+1];if(f.global)f.lastIndex=0;if(f.test(l))return d}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var Nd=new Hs;class bi{constructor(e){if(this.manager=e!==void 0?e:Nd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}bi.DEFAULT_MATERIAL_NAME="__DEFAULT";var mi={};class Dd extends Error{constructor(e,t){super(e);this.response=t}}class Vs extends bi{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=$n.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(r);this.manager.itemEnd(e)},0);return}if(mi[e]!==void 0){mi[e].push({onLoad:t,onProgress:n,onError:i});return}mi[e]=[],mi[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,a=this.responseType;fetch(s).then((c)=>{if(c.status===200||c.status===0){if(c.status===0)Me("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let l=mi[e],u=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=h?parseInt(h):0,d=f!==0,m=0,x=new ReadableStream({start(p){g();function g(){u.read().then(({done:A,value:E})=>{if(A)p.close();else{m+=E.byteLength;let y=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:f});for(let w=0,T=l.length;w<T;w++){let R=l[w];if(R.onProgress)R.onProgress(y)}p.enqueue(E),g()}},(A)=>{p.error(A)})}}});return new Response(x)}else throw new Dd(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then((c)=>{switch(a){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then((l)=>new DOMParser().parseFromString(l,o));case"json":return c.json();default:if(o==="")return c.text();else{let u=/charset="?([^;"\s]*)"?/i.exec(o),h=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(h);return c.arrayBuffer().then((d)=>f.decode(d))}}}).then((c)=>{$n.add(`file:${e}`,c);let l=mi[e];delete mi[e];for(let u=0,h=l.length;u<h;u++){let f=l[u];if(f.onLoad)f.onLoad(c)}}).catch((c)=>{let l=mi[e];if(l===void 0)throw this.manager.itemError(e),c;delete mi[e];for(let u=0,h=l.length;u<h;u++){let f=l[u];if(f.onError)f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var kr=new WeakMap;class eu extends bi{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=$n.get(`image:${e}`);if(s!==void 0){if(s.complete===!0)r.manager.itemStart(e),setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);else{let u=kr.get(s);if(u===void 0)u=[],kr.set(s,u);u.push({onLoad:t,onError:i})}return s}let o=Vr("img");function a(){if(l(),t)t(this);let u=kr.get(this)||[];for(let h=0;h<u.length;h++){let f=u[h];if(f.onLoad)f.onLoad(this)}kr.delete(this),r.manager.itemEnd(e)}function c(u){if(l(),i)i(u);$n.remove(`image:${e}`);let h=kr.get(this)||[];for(let f=0;f<h.length;f++){let d=h[f];if(d.onError)d.onError(u)}kr.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1)}if(o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)o.crossOrigin=this.crossOrigin}return $n.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class va extends bi{constructor(e){super(e)}load(e,t,n,i){let r=new St,s=new eu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(o){if(r.image=o,r.needsUpdate=!0,t!==void 0)t(r)},n,i),r}}class rs extends ot{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class ya extends rs{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Le(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}var kc=new Fe,Cf=new N,Pf=new N;class ba{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zs,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new rt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;if(Cf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cf),Pf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Pf),t.updateMatrixWorld(),kc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth)n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiply(kc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};if(this.intensity!==1)e.intensity=this.intensity;if(this.bias!==0)e.bias=this.bias;if(this.normalBias!==0)e.normalBias=this.normalBias;if(this.radius!==1)e.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)e.mapSize=this.mapSize.toArray();return e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}var Wo=new N,$o=new zt,Vn=new N;class Sa extends ot{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(Wo,$o,Vn),Vn.x===1&&Vn.y===1&&Vn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Wo,$o,Vn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Wo,$o,Vn),Vn.x===1&&Vn.y===1&&Vn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Wo,$o,Vn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Oi=new N,If=new Pe,Lf=new Pe;class Pt extends Sa{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=cr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ss*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return cr*2*Math.atan(Math.tan(Ss*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Oi.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(Oi.x,Oi.y).multiplyScalar(-e/Oi.z),Oi.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(Oi.x,Oi.y).multiplyScalar(-e/Oi.z)}getViewSize(e,t){return this.getViewBounds(e,If,Lf),t.subVectors(Lf,If)}setViewOffset(e,t,n,i,r,s){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ss*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-0.5*i,s=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:a,fullHeight:c}=s;r+=s.offsetX*i/a,t-=s.offsetY*n/c,i*=s.width/a,n*=s.height/c}let o=this.filmOffset;if(o!==0)r+=e*o/this.getFilmWidth();this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Od extends ba{constructor(){super(new Pt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=cr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;if(n!==t.fov||i!==t.aspect||r!==t.far)t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Ma extends rs{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Od}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}}class Ud extends ba{constructor(){super(new Pt(90,1,0.5,500));this.isPointLightShadow=!0}}class ss extends rs{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ud}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class xr extends Sa{constructor(e=-1,t=1,n=1,i=-1,r=0.1,s=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,s=n+e,o=i+t,a=i-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,s=r+c*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}}class Fd extends ba{constructor(){super(new xr(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class os extends rs{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.shadow=new Fd}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Yi{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}var Bc=new WeakMap;class wa extends bi{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Me("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Me("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let r=this,s=$n.get(`image-bitmap:${e}`);if(s!==void 0){if(r.manager.itemStart(e),s.then){s.then((c)=>{if(Bc.has(s)===!0){if(i)i(Bc.get(s));r.manager.itemError(e),r.manager.itemEnd(e)}else{if(t)t(c);r.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(s);r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let a=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){if($n.add(`image-bitmap:${e}`,c),t)t(c);r.manager.itemEnd(e)}).catch(function(c){if(i)i(c);Bc.set(a,c),$n.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});$n.add(`image-bitmap:${e}`,a),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Br=-90,Gr=1;class tu extends ot{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Pt(Br,Gr,e,t);i.layers=this.layers,this.add(i);let r=new Pt(Br,Gr,e,t);r.layers=this.layers,this.add(r);let s=new Pt(Br,Gr,e,t);s.layers=this.layers,this.add(s);let o=new Pt(Br,Gr,e,t);o.layers=this.layers,this.add(o);let a=new Pt(Br,Gr,e,t);a.layers=this.layers,this.add(a);let c=new Pt(Br,Gr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(let c of t)this.remove(c);if(e===2000)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),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(e===2001)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),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[r,s,o,a,c,l]=this.children,u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let x=!1;if(e.isWebGLRenderer===!0)x=e.state.buffers.depth.getReversed();else x=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,1,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,2,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,3,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,4,i),x&&e.autoClear===!1)e.clearDepth();if(e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),x&&e.autoClear===!1)e.clearDepth();e.render(t,l),e.setRenderTarget(u,h,f),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class nu extends Pt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class iu{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,s;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}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(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,s=this.cumulativeWeight;if(s===0){for(let o=0;o!==i;++o)n[r+o]=n[o];s=t}else{s+=t;let o=t/s;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let a=t*this._origIndex;this._mixBufferRegion(n,i,a,1-r,t)}if(s>0)this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let a=t,c=t+t;a!==c;++a)if(n[a]!==n[a+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=0.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){zt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let s=this._workIndex*r;zt.multiplyQuaternionsFlat(e,s,e,t,e,n),zt.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){let s=1-i;for(let o=0;o!==r;++o){let a=t+o;e[a]=e[a]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){let o=t+s;e[o]=e[o]+e[n+s]*i}}}var ru="\\[\\]\\.:\\/",jv=new RegExp("["+ru+"]","g"),su="[^"+ru+"]",Jv="[^"+ru.replace("\\.","")+"]",Kv=/((?:WC+[\/:])*)/.source.replace("WC",su),Qv=/(WCOD+)?/.source.replace("WCOD",Jv),ey=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",su),ty=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",su),ny=new RegExp("^"+Kv+Qv+ey+ty+"$"),iy=["material","materials","bones","map"];class zd{constructor(e,t,n){let i=n||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class et{constructor(e,t,n){this.path=t,this.parsedPath=n||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new et(e,t,n);else return new et.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(jv,"")}static parseTrackName(e){let t=ny.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);if(iy.indexOf(r)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=r}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let s=0;s<r.length;s++){let o=r[s];if(o.name===t||o.uuid===t)return o;let a=n(o.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:r}=t;if(!e)e=et.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Me("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ne("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ne("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let l=0;l<e.length;l++)if(e[l].name===c){c=l;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ne("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ne("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ne("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ne("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let s=e[i];if(s===void 0){let c=t.nodeName;Ne("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)o=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)o=this.Versioning.MatrixWorldNeedsUpdate;let a=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ne("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[r]!==void 0)r=e.morphTargetDictionary[r]}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else if(s.fromArray!==void 0&&s.toArray!==void 0)a=this.BindingType.HasFromToArray,this.resolvedProperty=s;else if(Array.isArray(s))a=this.BindingType.EntireArray,this.resolvedProperty=s;else this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}et.Composite=zd;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class ou{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,s=r.length,o=Array(s),a={endingStart:2400,endingEnd:2400};for(let c=0;c!==s;++c){let l=r[c].createInterpolant(null);o[c]=l,l.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,s=r/i,o=i/r;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,s,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;if(e!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,s=this.timeScale,o=this._timeScaleInterpolant;if(o===null)o=i._lendControlInterpolant(),this._timeScaleInterpolant=o;let a=o.parameterPositions,c=o.sampleValues;return a[0]=r,a[1]=r+n,c[0]=e/s,c[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;if(e!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e);return this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let a=(e-r)*n;if(a<0||n===0)t=0;else this._startTime=null,t=n*a}t*=this._updateTimeScale(e);let s=this._updateTime(t),o=this._updateWeight(e);if(o>0){let a=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulateAdditive(o);break;case 2500:default:for(let l=0,u=a.length;l!==u;++l)a[l].evaluate(s),c[l].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(this.stopFading(),i===0)this.enabled=!1}}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];if(t*=i,e>n.parameterPositions[1]){if(t===0)this.paused=!0;else{if(this._restoreTimeScale!==null)t=this._restoreTimeScale;this.timeScale=t}this.stopWarping()}}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,s=n===2202;if(e===0){if(r===-1)return i;return s&&(r&1)===1?t-i:i}if(n===2200){if(r===-1)this._loopCount=0,this._setEndings(!0,!0,!1);e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1)if(e>=0)r=0,this._setEndings(!0,this.repetitions===0,s);else this._setEndings(this.repetitions===0,!0,s);if(i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let a=this.repetitions-r;if(a<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1})}else{if(a===1){let c=e<0;this._setEndings(c,!c,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(s&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;if(n)i.endingStart=2401,i.endingEnd=2401;else{if(e)i.endingStart=this.zeroSlopeAtStart?2401:2400;else i.endingStart=2402;if(t)i.endingEnd=this.zeroSlopeAtEnd?2401:2400;else i.endingEnd=2402}}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,s=this._weightInterpolant;if(s===null)s=i._lendControlInterpolant(),this._weightInterpolant=s;let o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}var ry=new Float32Array(1);class Ta extends Fn{constructor(e){super();if(this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,{_propertyBindings:s,_interpolants:o}=e,a=n.uuid,c=this._bindingsByRootAndName,l=c[a];if(l===void 0)l={},c[a]=l;for(let u=0;u!==r;++u){let h=i[u],f=h.name,d=l[f];if(d!==void 0)++d.referenceCount,s[u]=d;else{if(d=s[u],d!==void 0){if(d._cacheIndex===null)++d.referenceCount,this._addInactiveBinding(d,a,f);continue}let m=t&&t._propertyBindings[u].binding.parsedPath;d=new iu(et.create(n,f,m),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,a,f),s[u]=d}o[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(r.useCount++===0)this._lendBinding(r),r.saveOriginalState()}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.useCount===0)r.restoreOriginalState(),this._takeBackBinding(r)}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{let o=s.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,c=a[a.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,h=(e._localRoot||this._root).uuid;if(delete u[h],a.length===0)delete s[r];this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];if(--r.referenceCount===0)this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,s=i[t];if(s===void 0)s={},i[t]=s;s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],c=e._cacheIndex;if(a._cacheIndex=c,t[c]=a,t.pop(),delete o[r],Object.keys(o).length===0)delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];if(n===void 0)n=new _a(new Float32Array(2),new Float32Array(2),1,ry),n.__cacheIndex=t,e[t]=n;return n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,s=typeof e==="string"?$r.findByName(i,e):e,o=s!==null?s.uuid:e,a=this._actionsByClip[o],c=null;if(n===void 0)if(s!==null)n=s.blendMode;else n=2500;if(a!==void 0){let u=a.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;if(c=a.knownActions[0],s===null)s=c._clip}if(s===null)return null;let l=new ou(this,s,t,n);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e==="string"?$r.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];if(o!==void 0)return o.actionByRoot[i]||null;return null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,s);let o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let s=r.knownActions;for(let o=0,a=s.length;o!==a;++o){let c=s[o];this._deactivateAction(c);let l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let o=n[s].actionByRoot,a=o[t];if(a!==void 0)this._deactivateAction(a),this._removeInactiveAction(a)}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let s in r){let o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);if(n!==null)this._deactivateAction(n),this._removeInactiveAction(n)}}class Ws{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=We(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){if(this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(e,n),this.phi=Math.acos(We(t/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class au{static{au.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}class Ea extends Fn{constructor(e,t=null){super();this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Me("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=e}disconnect(){}dispose(){}update(){}}function cu(e,t,n,i){let r=sy(i);switch(n){case 1021:return e*t;case 1028:return e*t/r.components*r.byteLength;case 1029:return e*t/r.components*r.byteLength;case 1030:return e*t*2/r.components*r.byteLength;case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:return e*t*4/r.components*r.byteLength;case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function sy(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));if(typeof window<"u")if(window.__THREE__)Me("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="185";function ap(){let e=null,t=!1,n=null,i=null;function r(s,o){n(s,o),i=e.requestAnimationFrame(r)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(r),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function oy(e){let t=new WeakMap;function n(a,c){let{array:l,usage:u}=a,h=l.byteLength,f=e.createBuffer();e.bindBuffer(c,f),e.bufferData(c,l,u),a.onUploadCallback();let d;if(l instanceof Float32Array)d=e.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=e.HALF_FLOAT;else if(l instanceof Uint16Array)if(a.isFloat16BufferAttribute)d=e.HALF_FLOAT;else d=e.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=e.SHORT;else if(l instanceof Uint32Array)d=e.UNSIGNED_INT;else if(l instanceof Int32Array)d=e.INT;else if(l instanceof Int8Array)d=e.BYTE;else if(l instanceof Uint8Array)d=e.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:f,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,c,l){let{array:u,updateRanges:h}=c;if(e.bindBuffer(l,a),h.length===0)e.bufferSubData(l,0,u);else{h.sort((d,m)=>d.start-m.start);let f=0;for(let d=1;d<h.length;d++){let m=h[f],x=h[d];if(x.start<=m.start+m.count+1)m.count=Math.max(m.count,x.start+x.count-m.start);else++f,h[f]=x}h.length=f+1;for(let d=0,m=h.length;d<m;d++){let x=h[d];e.bufferSubData(l,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(a){if(a.isInterleavedBufferAttribute)a=a.data;return t.get(a)}function s(a){if(a.isInterleavedBufferAttribute)a=a.data;let c=t.get(a);if(c)e.deleteBuffer(c.buffer),t.delete(a)}function o(a,c){if(a.isInterleavedBufferAttribute)a=a.data;if(a.isGLBufferAttribute){let u=t.get(a);if(!u||u.version<a.version)t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=t.get(a);if(l===void 0)t.set(a,n(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:r,remove:s,update:o}}var ay=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
-#endif`,Hx=`#ifdef USE_ALPHAHASH
+#endif`,cy=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -157,20 +157,20 @@
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
-#endif`,Vx=`#ifdef USE_ALPHAMAP
+#endif`,ly=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
-#endif`,Wx=`#ifdef USE_ALPHAMAP
+#endif`,uy=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,$x=`#ifdef USE_ALPHATEST
+#endif`,hy=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
-#endif`,Zx=`#ifdef USE_ALPHATEST
+#endif`,fy=`#ifdef USE_ALPHATEST
uniform float alphaTest;
-#endif`,Xx=`#ifdef USE_AOMAP
+#endif`,dy=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
@@ -183,10 +183,10 @@
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
-#endif`,qx=`#ifdef USE_AOMAP
+#endif`,py=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
-#endif`,Yx=`#ifdef USE_BATCHING
+#endif`,my=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
@@ -220,15 +220,15 @@
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
}
-#endif`,jx=`#ifdef USE_BATCHING
+#endif`,gy=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
-#endif`,Jx=`vec3 transformed = vec3( position );
+#endif`,_y=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
-#endif`,Kx=`vec3 objectNormal = vec3( normal );
+#endif`,xy=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
-#endif`,Qx=`float G_BlinnPhong_Implicit( ) {
+#endif`,vy=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -242,7 +242,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
-} // validated`,ev=`#ifdef USE_IRIDESCENCE
+} // validated`,yy=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
@@ -305,7 +305,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
}
return max( I, vec3( 0.0 ) );
}
-#endif`,tv=`#ifdef USE_BUMPMAP
+#endif`,by=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
@@ -326,7 +326,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
-#endif`,nv=`#if NUM_CLIPPING_PLANES > 0
+#endif`,Sy=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -372,20 +372,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`,iv=`#if NUM_CLIPPING_PLANES > 0
+#endif`,My=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
-#endif`,rv=`#if NUM_CLIPPING_PLANES > 0
+#endif`,wy=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
-#endif`,sv=`#if NUM_CLIPPING_PLANES > 0
+#endif`,Ty=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`,ov=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,Ey=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
-#endif`,av=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,Ay=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
varying vec4 vColor;
-#endif`,cv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,Ry=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec4 vColor;
-#endif`,lv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,Cy=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
@@ -398,7 +398,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#endif
#ifdef USE_BATCHING_COLOR
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
-#endif`,uv=`#define PI 3.141592653589793
+#endif`,Py=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -469,7 +469,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
-} // validated`,hv=`#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`,Iy=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -562,7 +562,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`,fv=`vec3 transformedNormal = objectNormal;
+#endif`,Ly=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -588,21 +588,21 @@ transformedNormal = normalMatrix * transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
-#endif`,dv=`#ifdef USE_DISPLACEMENTMAP
+#endif`,Ny=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`,pv=`#ifdef USE_DISPLACEMENTMAP
+#endif`,Dy=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`,mv=`#ifdef USE_EMISSIVEMAP
+#endif`,Oy=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`,gv=`#ifdef USE_EMISSIVEMAP
+#endif`,Uy=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`,_v="gl_FragColor = linearToOutputTexel( gl_FragColor );",xv=`vec4 LinearTransferOETF( in vec4 value ) {
+#endif`,Fy="gl_FragColor = linearToOutputTexel( gl_FragColor );",zy=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -610,7 +610,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
}
vec4 sRGBTransferOETF( in vec4 value ) {
return 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 );
-}`,vv=`#ifdef USE_ENVMAP
+}`,ky=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -637,7 +637,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif
-#endif`,yv=`#ifdef USE_ENVMAP
+#endif`,By=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
@@ -645,7 +645,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
uniform sampler2D envMap;
#endif
-#endif`,bv=`#ifdef USE_ENVMAP
+#endif`,Gy=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -656,7 +656,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`,Sv=`#ifdef USE_ENVMAP
+#endif`,Hy=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -667,7 +667,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`,Mv=`#ifdef USE_ENVMAP
+#endif`,Vy=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -684,18 +684,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`,wv=`#ifdef USE_FOG
+#endif`,Wy=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
-#endif`,Tv=`#ifdef USE_FOG
+#endif`,$y=`#ifdef USE_FOG
varying float vFogDepth;
-#endif`,Ev=`#ifdef USE_FOG
+#endif`,Zy=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
-#endif`,Av=`#ifdef USE_FOG
+#endif`,Xy=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -704,7 +704,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`,Rv=`#ifdef USE_GRADIENTMAP
+#endif`,qy=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -716,12 +716,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`,Cv=`#ifdef USE_LIGHTMAP
+}`,Yy=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`,Pv=`LambertMaterial material;
+#endif`,jy=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`,Iv=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,Jy=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -735,7 +735,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Lv=`uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ky=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -852,7 +852,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
return irradiance;
}
#endif
-#include <lightprobes_pars_fragment>`,Nv=`#ifdef USE_ENVMAP
+#include <lightprobes_pars_fragment>`,Qy=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -885,8 +885,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`,Dv=`ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`,Uv=`varying vec3 vViewPosition;
+#endif`,eb=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,tb=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -898,11 +898,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Ov=`BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,nb=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`,Fv=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,ib=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -919,7 +919,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,zv=`PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,rb=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
@@ -1009,7 +1009,7 @@ material.roughness = min( material.roughness, 1.0 );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
-#endif`,kv=`uniform sampler2D dfgLUT;
+#endif`,sb=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
vec3 diffuseColor;
vec3 diffuseContribution;
@@ -1369,7 +1369,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`,Bv=`
+}`,ob=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1491,7 +1491,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`,Gv=`#if defined( RE_IndirectDiffuse )
+#endif`,ab=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1512,7 +1512,7 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`,Hv=`#if defined( RE_IndirectDiffuse )
+#endif`,cb=`#if defined( RE_IndirectDiffuse )
#if defined( LAMBERT ) || defined( PHONG )
irradiance += iblIrradiance;
#endif
@@ -1520,7 +1520,7 @@ IncidentLight directLight;
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
-#endif`,Vv=`#ifdef USE_LIGHT_PROBES_GRID
+#endif`,lb=`#ifdef USE_LIGHT_PROBES_GRID
uniform highp sampler3D probesSH;
uniform vec3 probesMin;
uniform vec3 probesMax;
@@ -1565,27 +1565,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
result += c8 * 0.429043 * ( x * x - y * y );
return max( result, vec3( 0.0 ) );
}
-#endif`,Wv=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,ub=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`,$v=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,hb=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,Zv=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,fb=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,Xv=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,db=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`,qv=`#ifdef USE_MAP
+#endif`,pb=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`,Yv=`#ifdef USE_MAP
+#endif`,mb=`#ifdef USE_MAP
uniform sampler2D map;
-#endif`,jv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`,gb=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -1597,7 +1597,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`,Jv=`#if defined( USE_POINTS_UV )
+#endif`,_b=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1609,19 +1609,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,Kv=`float metalnessFactor = metalness;
+#endif`,xb=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`,Qv=`#ifdef USE_METALNESSMAP
+#endif`,vb=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`,ey=`#ifdef USE_INSTANCING_MORPH
+#endif`,yb=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
-#endif`,ty=`#if defined( USE_MORPHCOLORS )
+#endif`,bb=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -1630,12 +1630,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`,ny=`#ifdef USE_MORPHNORMALS
+#endif`,Sb=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,iy=`#ifdef USE_MORPHTARGETS
+#endif`,Mb=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1649,12 +1649,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`,ry=`#ifdef USE_MORPHTARGETS
+#endif`,wb=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,sy=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`,Tb=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -1695,7 +1695,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`,oy=`#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`,Eb=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -1713,19 +1713,19 @@ vec3 nonPerturbedNormal = normal;`,oy=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`,ay=`#ifndef FLAT_SHADED
+#endif`,Ab=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,cy=`#ifndef FLAT_SHADED
+#endif`,Rb=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,ly=`#ifndef FLAT_SHADED
+#endif`,Cb=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
@@ -1734,7 +1734,7 @@ vec3 nonPerturbedNormal = normal;`,oy=`#ifdef USE_NORMALMAP_OBJECTSPACE
vBitangent = - vBitangent;
#endif
#endif
-#endif`,uy=`#ifdef USE_NORMALMAP
+#endif`,Pb=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -1756,13 +1756,13 @@ vec3 nonPerturbedNormal = normal;`,oy=`#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`,hy=`#ifdef USE_CLEARCOAT
+#endif`,Ib=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`,fy=`#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`,Lb=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`,dy=`#ifdef USE_CLEARCOATMAP
+#endif`,Nb=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -1771,18 +1771,18 @@ vec3 nonPerturbedNormal = normal;`,oy=`#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`,py=`#ifdef USE_IRIDESCENCEMAP
+#endif`,Db=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`,my=`#ifdef OPAQUE
+#endif`,Ob=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,gy=`vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Ub=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1861,9 +1861,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
#else
return ( near * far ) / ( ( far - near ) * depth - far );
#endif
-}`,_y=`#ifdef PREMULTIPLIED_ALPHA
+}`,Fb=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`,xy=`vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`,zb=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -1871,22 +1871,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`,kb=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`,yy=`#ifdef DITHERING
+#endif`,Bb=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
-#endif`,by=`float roughnessFactor = roughness;
+#endif`,Gb=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`,Sy=`#ifdef USE_ROUGHNESSMAP
+#endif`,Hb=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`,My=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,Vb=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -2086,7 +2086,7 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
}
#endif
#endif
-#endif`,wy=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,Wb=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -2127,7 +2127,7 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`,Ty=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`,$b=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
#ifdef HAS_NORMAL
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
#else
@@ -2163,7 +2163,7 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`,Ey=`float getShadowMask() {
+#endif`,Zb=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2195,12 +2195,12 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
#endif
#endif
return shadow;
-}`,Ay=`#ifdef USE_SKINNING
+}`,Xb=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`,Ry=`#ifdef USE_SKINNING
+#endif`,qb=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -2215,7 +2215,7 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`,Cy=`#ifdef USE_SKINNING
+#endif`,Yb=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2223,7 +2223,7 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`,Py=`#ifdef USE_SKINNING
+#endif`,jb=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -2234,17 +2234,17 @@ gl_Position = projectionMatrix * mvPosition;`,vy=`#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`,Iy=`float specularStrength;
+#endif`,Jb=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`,Ly=`#ifdef USE_SPECULARMAP
+#endif`,Kb=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`,Ny=`#if defined( TONE_MAPPING )
+#endif`,Qb=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`,Dy=`#ifndef saturate
+#endif`,eS=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -2341,7 +2341,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`,tS=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -2362,7 +2362,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`,Oy=`#ifdef USE_TRANSMISSION
+#endif`,nS=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -2488,7 +2488,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`,Fy=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,iS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2558,7 +2558,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,zy=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,rS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2652,7 +2652,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,ky=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,sS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -2723,7 +2723,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`,By=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`,oS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
@@ -2732,12 +2732,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Uy=`#ifdef USE_TRANSMISS
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
-#endif`,Gy=`varying vec2 vUv;
+#endif`,aS=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
-}`,Hy=`uniform sampler2D t2D;
+}`,cS=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
@@ -2749,14 +2749,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,Vy=`varying vec3 vWorldDirection;
+}`,lS=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`,Wy=`#ifdef ENVMAP_TYPE_CUBE
+}`,uS=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
@@ -2778,14 +2778,14 @@ void main() {
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,$y=`varying vec3 vWorldDirection;
+}`,hS=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
-}`,Zy=`uniform samplerCube tCube;
+}`,fS=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -2795,7 +2795,7 @@ void main() {
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,Xy=`#include <common>
+}`,dS=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
@@ -2822,7 +2822,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
-}`,qy=`#if DEPTH_PACKING == 3200
+}`,pS=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
@@ -2860,7 +2860,7 @@ void main() {
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
-}`,Yy=`#define DISTANCE
+}`,mS=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
@@ -2887,7 +2887,7 @@ void main() {
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
-}`;var jy=`#define DISTANCE
+}`;var gS=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
@@ -2910,13 +2910,13 @@ void main() {
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
-}`,Jy=`varying vec3 vWorldDirection;
+}`,_S=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
-}`,Ky=`uniform sampler2D tEquirect;
+}`,xS=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
@@ -2925,7 +2925,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
-}`,Qy=`uniform float scale;
+}`,vS=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
@@ -2947,7 +2947,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`,eb=`uniform vec3 diffuse;
+}`,yS=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
@@ -2975,7 +2975,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,tb=`#include <common>
+}`,bS=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
@@ -3007,7 +3007,7 @@ void main() {
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
-}`,nb=`uniform vec3 diffuse;
+}`,SS=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
@@ -3055,7 +3055,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,ib=`#define LAMBERT
+}`,MS=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3094,7 +3094,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,rb=`#define LAMBERT
+}`,wS=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3152,7 +3152,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,sb=`#define MATCAP
+}`,TS=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3186,7 +3186,7 @@ void main() {
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
-}`,ob=`#define MATCAP
+}`,ES=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
@@ -3232,7 +3232,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,ab=`#define NORMAL
+}`,AS=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
@@ -3265,7 +3265,7 @@ void main() {
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
-}`,cb=`#define NORMAL
+}`,RS=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
@@ -3286,7 +3286,7 @@ void main() {
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
-}`,lb=`#define PHONG
+}`,CS=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3325,7 +3325,7 @@ void main() {
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,ub=`#define PHONG
+}`,PS=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
@@ -3385,7 +3385,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,hb=`#define STANDARD
+}`,IS=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
@@ -3428,7 +3428,7 @@ void main() {
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
-}`,fb=`#define STANDARD
+}`,LS=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
@@ -3553,7 +3553,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,db=`#define TOON
+}`,NS=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
@@ -3590,7 +3590,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,pb=`#define TOON
+}`,DS=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3642,7 +3642,7 @@ void main() {
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
-}`,mb=`uniform float size;
+}`,OS=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
@@ -3673,7 +3673,7 @@ void main() {
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
-}`,gb=`uniform vec3 diffuse;
+}`,US=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
@@ -3698,7 +3698,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,_b=`#include <common>
+}`,FS=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
@@ -3721,7 +3721,7 @@ void main() {
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
-}`,xb=`uniform vec3 color;
+}`,zS=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
@@ -3737,7 +3737,7 @@ void main() {
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
-}`,vb=`uniform float rotation;
+}`,kS=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
@@ -3761,7 +3761,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
-}`,yb=`uniform vec3 diffuse;
+}`,BS=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
@@ -3786,7 +3786,7 @@ void main() {
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
-}`,Ge={alphahash_fragment:Gx,alphahash_pars_fragment:Hx,alphamap_fragment:Vx,alphamap_pars_fragment:Wx,alphatest_fragment:$x,alphatest_pars_fragment:Zx,aomap_fragment:Xx,aomap_pars_fragment:qx,batching_pars_vertex:Yx,batching_vertex:jx,begin_vertex:Jx,beginnormal_vertex:Kx,bsdfs:Qx,iridescence_fragment:ev,bumpmap_pars_fragment:tv,clipping_planes_fragment:nv,clipping_planes_pars_fragment:iv,clipping_planes_pars_vertex:rv,clipping_planes_vertex:sv,color_fragment:ov,color_pars_fragment:av,color_pars_vertex:cv,color_vertex:lv,common:uv,cube_uv_reflection_fragment:hv,defaultnormal_vertex:fv,displacementmap_pars_vertex:dv,displacementmap_vertex:pv,emissivemap_fragment:mv,emissivemap_pars_fragment:gv,colorspace_fragment:_v,colorspace_pars_fragment:xv,envmap_fragment:vv,envmap_common_pars_fragment:yv,envmap_pars_fragment:bv,envmap_pars_vertex:Sv,envmap_physical_pars_fragment:Nv,envmap_vertex:Mv,fog_vertex:wv,fog_pars_vertex:Tv,fog_fragment:Ev,fog_pars_fragment:Av,gradientmap_pars_fragment:Rv,lightmap_pars_fragment:Cv,lights_lambert_fragment:Pv,lights_lambert_pars_fragment:Iv,lights_pars_begin:Lv,lights_toon_fragment:Dv,lights_toon_pars_fragment:Uv,lights_phong_fragment:Ov,lights_phong_pars_fragment:Fv,lights_physical_fragment:zv,lights_physical_pars_fragment:kv,lights_fragment_begin:Bv,lights_fragment_maps:Gv,lights_fragment_end:Hv,lightprobes_pars_fragment:Vv,logdepthbuf_fragment:Wv,logdepthbuf_pars_fragment:$v,logdepthbuf_pars_vertex:Zv,logdepthbuf_vertex:Xv,map_fragment:qv,map_pars_fragment:Yv,map_particle_fragment:jv,map_particle_pars_fragment:Jv,metalnessmap_fragment:Kv,metalnessmap_pars_fragment:Qv,morphinstance_vertex:ey,morphcolor_vertex:ty,morphnormal_vertex:ny,morphtarget_pars_vertex:iy,morphtarget_vertex:ry,normal_fragment_begin:sy,normal_fragment_maps:oy,normal_pars_fragment:ay,normal_pars_vertex:cy,normal_vertex:ly,normalmap_pars_fragment:uy,clearcoat_normal_fragment_begin:hy,clearcoat_normal_fragment_maps:fy,clearcoat_pars_fragment:dy,iridescence_pars_fragment:py,opaque_fragment:my,packing:gy,premultiplied_alpha_fragment:_y,project_vertex:xy,dithering_fragment:vy,dithering_pars_fragment:yy,roughnessmap_fragment:by,roughnessmap_pars_fragment:Sy,shadowmap_pars_fragment:My,shadowmap_pars_vertex:wy,shadowmap_vertex:Ty,shadowmask_pars_fragment:Ey,skinbase_vertex:Ay,skinning_pars_vertex:Ry,skinning_vertex:Cy,skinnormal_vertex:Py,specularmap_fragment:Iy,specularmap_pars_fragment:Ly,tonemapping_fragment:Ny,tonemapping_pars_fragment:Dy,transmission_fragment:Uy,transmission_pars_fragment:Oy,uv_pars_fragment:Fy,uv_pars_vertex:zy,uv_vertex:ky,worldpos_vertex:By,background_vert:Gy,background_frag:Hy,backgroundCube_vert:Vy,backgroundCube_frag:Wy,cube_vert:$y,cube_frag:Zy,depth_vert:Xy,depth_frag:qy,distance_vert:Yy,distance_frag:jy,equirect_vert:Jy,equirect_frag:Ky,linedashed_vert:Qy,linedashed_frag:eb,meshbasic_vert:tb,meshbasic_frag:nb,meshlambert_vert:ib,meshlambert_frag:rb,meshmatcap_vert:sb,meshmatcap_frag:ob,meshnormal_vert:ab,meshnormal_frag:cb,meshphong_vert:lb,meshphong_frag:ub,meshphysical_vert:hb,meshphysical_frag:fb,meshtoon_vert:db,meshtoon_frag:pb,points_vert:mb,points_frag:gb,shadow_vert:_b,shadow_frag:xb,sprite_vert:vb,sprite_frag:yb},he={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new N},probesMax:{value:new N},probesResolution:{value:new N}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Pe(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},qn={basic:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:Ge.meshbasic_vert,fragmentShader:Ge.meshbasic_frag},lambert:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},envMapIntensity:{value:1}}]),vertexShader:Ge.meshlambert_vert,fragmentShader:Ge.meshlambert_frag},phong:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ge.meshphong_vert,fragmentShader:Ge.meshphong_frag},standard:{uniforms:qt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag},toon:{uniforms:qt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ge.meshtoon_vert,fragmentShader:Ge.meshtoon_frag},matcap:{uniforms:qt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:Ge.meshmatcap_vert,fragmentShader:Ge.meshmatcap_frag},points:{uniforms:qt([he.points,he.fog]),vertexShader:Ge.points_vert,fragmentShader:Ge.points_frag},dashed:{uniforms:qt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ge.linedashed_vert,fragmentShader:Ge.linedashed_frag},depth:{uniforms:qt([he.common,he.displacementmap]),vertexShader:Ge.depth_vert,fragmentShader:Ge.depth_frag},normal:{uniforms:qt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:Ge.meshnormal_vert,fragmentShader:Ge.meshnormal_frag},sprite:{uniforms:qt([he.sprite,he.fog]),vertexShader:Ge.sprite_vert,fragmentShader:Ge.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ge.background_vert,fragmentShader:Ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:Ge.backgroundCube_vert,fragmentShader:Ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ge.cube_vert,fragmentShader:Ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ge.equirect_vert,fragmentShader:Ge.equirect_frag},distance:{uniforms:qt([he.common,he.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:Ge.distance_vert,fragmentShader:Ge.distance_frag},shadow:{uniforms:qt([he.lights,he.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:Ge.shadow_vert,fragmentShader:Ge.shadow_frag}};qn.physical={uniforms:qt([qn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag};var ma={r:0,b:0,g:0},bb=new Fe,Sd=new De;Sd.set(-1,0,0,0,1,0,0,0,1);function Sb(e,t,n,i,r,s){let o=new Le(0),a=r===!0?0:1,c,l,u=null,f=0,h=null;function d(A){let T=A.isScene===!0?A.background:null;if(T&&T.isTexture){let v=A.backgroundBlurriness>0;T=t.get(T,v)}return T}function g(A){let T=!1,v=d(A);if(v===null)p(o,a);else if(v&&v.isColor)p(v,1),T=!0;let w=e.xr.getEnvironmentBlendMode();if(w==="additive")n.buffers.color.setClear(0,0,0,1,s);else if(w==="alpha-blend")n.buffers.color.setClear(0,0,0,0,s);if(e.autoClear||T)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function b(A,T){let v=d(T);if(v&&(v.isCubeTexture||v.mapping===ys)){if(l===void 0)l=new dt(new Di(1,1,1),new bn({name:"BackgroundCubeMaterial",uniforms:cr(qn.backgroundCube.uniforms),vertexShader:qn.backgroundCube.vertexShader,fragmentShader:qn.backgroundCube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,E,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l);if(l.material.uniforms.envMap.value=v,l.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(bb.makeRotationFromEuler(T.backgroundRotation)).transpose(),v.isCubeTexture&&v.isRenderTargetTexture===!1)l.material.uniforms.backgroundRotation.value.premultiply(Sd);if(l.material.toneMapped=Ve.getTransfer(v.colorSpace)!==ut,u!==v||f!==v.version||h!==e.toneMapping)l.material.needsUpdate=!0,u=v,f=v.version,h=e.toneMapping;l.layers.enableAll(),A.unshift(l,l.geometry,l.material,0,0,null)}else if(v&&v.isTexture){if(c===void 0)c=new dt(new Ns(2,2),new bn({name:"BackgroundMaterial",uniforms:cr(qn.background.uniforms),vertexShader:qn.background.vertexShader,fragmentShader:qn.background.fragmentShader,side:Ri,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c);if(c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Ve.getTransfer(v.colorSpace)!==ut,v.matrixAutoUpdate===!0)v.updateMatrix();if(c.material.uniforms.uvTransform.value.copy(v.matrix),u!==v||f!==v.version||h!==e.toneMapping)c.material.needsUpdate=!0,u=v,f=v.version,h=e.toneMapping;c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null)}}function p(A,T){A.getRGB(ma,wl(e)),n.buffers.color.setClear(ma.r,ma.g,ma.b,T,s)}function m(){if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0;if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0}return{getClearColor:function(){return o},setClearColor:function(A,T=1){o.set(A),a=T,p(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(A){a=A,p(o,a)},render:g,addToRenderList:b,dispose:m}}function Mb(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=h(null),s=r,o=!1;function a(C,z,J,O,H){let V=!1,U=f(C,O,J,z);if(s!==U)s=U,l(s.object);if(V=d(C,O,J,H),V)g(C,O,J,H);if(H!==null)t.update(H,e.ELEMENT_ARRAY_BUFFER);if(V||o){if(o=!1,v(C,z,J,O),H!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(H).buffer)}}function c(){return e.createVertexArray()}function l(C){return e.bindVertexArray(C)}function u(C){return e.deleteVertexArray(C)}function f(C,z,J,O){let H=O.wireframe===!0,V=i[z.id];if(V===void 0)V={},i[z.id]=V;let U=C.isInstancedMesh===!0?C.id:0,K=V[U];if(K===void 0)K={},V[U]=K;let Q=K[J.id];if(Q===void 0)Q={},K[J.id]=Q;let se=Q[H];if(se===void 0)se=h(c()),Q[H]=se;return se}function h(C){let z=[],J=[],O=[];for(let H=0;H<n;H++)z[H]=0,J[H]=0,O[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:J,attributeDivisors:O,object:C,attributes:{},index:null}}function d(C,z,J,O){let H=s.attributes,V=z.attributes,U=0,K=J.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=H[Q],_e=V[Q];if(_e===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)_e=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)_e=C.instanceColor}if(me===void 0)return!0;if(me.attribute!==_e)return!0;if(_e&&me.data!==_e.data)return!0;U++}if(s.attributesNum!==U)return!0;if(s.index!==O)return!0;return!1}function g(C,z,J,O){let H={},V=z.attributes,U=0,K=J.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=V[Q];if(me===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)me=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)me=C.instanceColor}let _e={};if(_e.attribute=me,me&&me.data)_e.data=me.data;H[Q]=_e,U++}s.attributes=H,s.attributesNum=U,s.index=O}function b(){let C=s.newAttributes;for(let z=0,J=C.length;z<J;z++)C[z]=0}function p(C){m(C,0)}function m(C,z){let J=s.newAttributes,O=s.enabledAttributes,H=s.attributeDivisors;if(J[C]=1,O[C]===0)e.enableVertexAttribArray(C),O[C]=1;if(H[C]!==z)e.vertexAttribDivisor(C,z),H[C]=z}function A(){let C=s.newAttributes,z=s.enabledAttributes;for(let J=0,O=z.length;J<O;J++)if(z[J]!==C[J])e.disableVertexAttribArray(J),z[J]=0}function T(C,z,J,O,H,V,U){if(U===!0)e.vertexAttribIPointer(C,z,J,H,V);else e.vertexAttribPointer(C,z,J,O,H,V)}function v(C,z,J,O){b();let H=O.attributes,V=J.getAttributes(),U=z.defaultAttributeValues;for(let K in V){let Q=V[K];if(Q.location>=0){let se=H[K];if(se===void 0){if(K==="instanceMatrix"&&C.instanceMatrix)se=C.instanceMatrix;if(K==="instanceColor"&&C.instanceColor)se=C.instanceColor}if(se!==void 0){let me=se.normalized,_e=se.itemSize,Xe=t.get(se);if(Xe===void 0)continue;let{buffer:Be,type:Z,bytesPerElement:ne}=Xe,fe=Z===e.INT||Z===e.UNSIGNED_INT||se.gpuType===Ic;if(se.isInterleavedBufferAttribute){let de=se.data,Re=de.stride,$e=se.offset;if(de.isInstancedInterleavedBuffer){for(let Ue=0;Ue<Q.locationSize;Ue++)m(Q.location+Ue,de.meshPerAttribute);if(C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0)O._maxInstanceCount=de.meshPerAttribute*de.count}else for(let Ue=0;Ue<Q.locationSize;Ue++)p(Q.location+Ue);e.bindBuffer(e.ARRAY_BUFFER,Be);for(let Ue=0;Ue<Q.locationSize;Ue++)T(Q.location+Ue,_e/Q.locationSize,Z,me,Re*ne,($e+_e/Q.locationSize*Ue)*ne,fe)}else{if(se.isInstancedBufferAttribute){for(let de=0;de<Q.locationSize;de++)m(Q.location+de,se.meshPerAttribute);if(C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0)O._maxInstanceCount=se.meshPerAttribute*se.count}else for(let de=0;de<Q.locationSize;de++)p(Q.location+de);e.bindBuffer(e.ARRAY_BUFFER,Be);for(let de=0;de<Q.locationSize;de++)T(Q.location+de,_e/Q.locationSize,Z,me,_e*ne,_e/Q.locationSize*de*ne,fe)}}else if(U!==void 0){let me=U[K];if(me!==void 0)switch(me.length){case 2:e.vertexAttrib2fv(Q.location,me);break;case 3:e.vertexAttrib3fv(Q.location,me);break;case 4:e.vertexAttrib4fv(Q.location,me);break;default:e.vertexAttrib1fv(Q.location,me)}}}}A()}function w(){S();for(let C in i){let z=i[C];for(let J in z){let O=z[J];for(let H in O){let V=O[H];for(let U in V)u(V[U].object),delete V[U];delete O[H]}}delete i[C]}}function E(C){if(i[C.id]===void 0)return;let z=i[C.id];for(let J in z){let O=z[J];for(let H in O){let V=O[H];for(let U in V)u(V[U].object),delete V[U];delete O[H]}}delete i[C.id]}function R(C){for(let z in i){let J=i[z];for(let O in J){let H=J[O];if(H[C.id]===void 0)continue;let V=H[C.id];for(let U in V)u(V[U].object),delete V[U];delete H[C.id]}}}function _(C){for(let z in i){let J=i[z],O=C.isInstancedMesh===!0?C.id:0,H=J[O];if(H===void 0)continue;for(let V in H){let U=H[V];for(let K in U)u(U[K].object),delete U[K];delete H[V]}if(delete J[O],Object.keys(J).length===0)delete i[z]}}function S(){if(F(),o=!0,s===r)return;s=r,l(s.object)}function F(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:S,resetDefaultState:F,dispose:w,releaseStatesOfGeometry:E,releaseStatesOfObject:_,releaseStatesOfProgram:R,initAttributes:b,enableAttribute:p,disableUnusedAttributes:A}}function wb(e,t,n){let i;function r(c){i=c}function s(c,l){e.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){if(u===0)return;e.drawArraysInstanced(i,c,l,u),n.update(l,i,u)}function a(c,l,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let h=0;for(let d=0;d<u;d++)h+=l[d];n.update(h,i,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Tb(e,t,n,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let R=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(R){if(R!==$n&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function a(R){let _=R===hi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(R!==Ln&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==ui&&!_)return!1;return!0}function c(R){if(R==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";R="mediump"}if(R==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let l=n.precision!==void 0?n.precision:"highp",u=c(l);if(u!==l)Me("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u;let f=n.logarithmicDepthBuffer===!0,h=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control");if(n.reversedDepthBuffer===!0&&h===!1)Me("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),g=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),A=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),T=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),w=e.getParameter(e.MAX_SAMPLES),E=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:g,maxTextureSize:b,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:A,maxVaryings:T,maxFragmentUniforms:v,maxSamples:w,samples:E}}function Eb(e){let t=this,n=null,i=0,r=!1,s=!1,o=new An,a=new De,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let d=f.length!==0||h||i!==0||r;return r=h,i=f.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,d){let{clippingPlanes:g,clipIntersection:b,clipShadows:p}=f,m=e.get(f);if(!r||g===null||g.length===0||s&&!p)if(s)u(null);else l();else{let A=s?0:i,T=A*4,v=m.clippingState||null;c.value=v,v=u(g,h,T,d);for(let w=0;w!==T;++w)v[w]=n[w];m.clippingState=v,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=A}};function l(){if(c.value!==n)c.value=n,c.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function u(f,h,d,g){let b=f!==null?f.length:0,p=null;if(b!==0){if(p=c.value,g!==!0||p===null){let m=d+b*4,A=h.matrixWorldInverse;if(a.getNormalMatrix(A),p===null||p.length<m)p=new Float32Array(m);for(let T=0,v=d;T!==b;++T,v+=4)o.copy(f[T]).applyMatrix4(A,a),o.normal.toArray(p,v),p[v+3]=o.constant}c.value=p,c.needsUpdate=!0}return t.numPlanes=b,t.numIntersection=0,p}}var Bi=4,Qf=[0.125,0.215,0.35,0.446,0.526,0.582],hr=20,Ab=256,Fs=new ur,ed=new Le,Gl=null,Hl=0,Vl=0,Wl=!1,Rb=new N;class Gs{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=0.1,i=100,r={}){let{size:s=256,position:o=Rb}=r;Gl=this._renderer.getRenderTarget(),Hl=this._renderer.getActiveCubeFace(),Vl=this._renderer.getActiveMipmapLevel(),Wl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);let a=this._allocateTargets();if(a.depthBuffer=!0,this._sceneToCubeUV(e,n,i,a,o),t>0)this._blur(a,0,0,t);return this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=id(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=nd(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Gl,Hl,Vl),this._renderer.xr.enabled=Wl,e.scissorTest=!1,es(e,0,0,e.width,e.height)}_fromTexture(e,t){if(e.mapping===Gr||e.mapping===nr)this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);Gl=this._renderer.getRenderTarget(),Hl=this._renderer.getActiveCubeFace(),Vl=this._renderer.getActiveMipmapLevel(),Wl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:kt,minFilter:kt,generateMipmaps:!1,type:hi,format:$n,colorSpace:cn,depthBuffer:!1},i=td(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=td(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Cb(r)),this._blurMaterial=Ib(r,e,t),this._ggxMaterial=Pb(r,e,t)}return i}_compileMaterial(e){let t=new dt(new Kt,e);this._renderer.compile(t,Fs)}_sceneToCubeUV(e,t,n,i,r){let a=new Pt(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,{autoClear:f,toneMapping:h}=u;if(u.getClearColor(ed),u.toneMapping=Pn,u.autoClear=!1,u.state.buffers.depth.getReversed())u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new dt(new Di,new Zn({name:"PMREM.Background",side:Xt,depthWrite:!1,depthTest:!1}));let g=this._backgroundBox,b=g.material,p=!1,m=e.background;if(m){if(m.isColor)b.color.copy(m),e.background=null,p=!0}else b.color.copy(ed),p=!0;for(let A=0;A<6;A++){let T=A%3;if(T===0)a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+l[A],r.y,r.z);else if(T===1)a.up.set(0,0,c[A]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+l[A],r.z);else a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+l[A]);let v=this._cubeSize;if(es(i,T*v,A>2?v:0,v,v),u.setRenderTarget(i),p)u.render(g,a);u.render(e,a)}u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===Gr||e.mapping===nr;if(i){if(this._cubemapMaterial===null)this._cubemapMaterial=id();this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=nd();let r=i?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r;let o=r.uniforms;o.envMap.value=e;let a=this._cubeSize;es(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,Fs)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,o=this._lodMeshes[n];o.material=s;let a=s.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l),f=0+c*1.25,h=u*f,{_lodMax:d}=this,g=this._sizeLods[n],b=3*g*(n>d-Bi?n-d+Bi:0),p=4*(this._cubeSize-g);a.envMap.value=e.texture,a.roughness.value=h,a.mipInt.value=d-t,es(r,b,p,3*g,2*g),i.setRenderTarget(r),i.render(o,Fs),a.envMap.value=r.texture,a.roughness.value=0,a.mipInt.value=d-n,es(e,b,p,3*g,2*g),i.setRenderTarget(e),i.render(o,Fs)}_blur(e,t,n,i,r){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){let a=this._renderer,c=this._blurMaterial;if(s!=="latitudinal"&&s!=="longitudinal")Ne("blur direction must be either latitudinal or longitudinal!");let l=3,u=this._lodMeshes[i];u.material=c;let f=c.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/(2*hr-1),g=r/d,b=isFinite(r)?1+Math.floor(l*g):hr;if(b>hr)Me(`sigmaRadians, ${r}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${hr}`);let p=[],m=0;for(let E=0;E<hr;++E){let R=E/g,_=Math.exp(-R*R/2);if(p.push(_),E===0)m+=_;else if(E<b)m+=2*_}for(let E=0;E<p.length;E++)p[E]=p[E]/m;if(f.envMap.value=e.texture,f.samples.value=b,f.weights.value=p,f.latitudinal.value=s==="latitudinal",o)f.poleAxis.value=o;let{_lodMax:A}=this;f.dTheta.value=d,f.mipInt.value=A-n;let T=this._sizeLods[i],v=3*T*(i>A-Bi?i-A+Bi:0),w=4*(this._cubeSize-T);es(t,v,w,3*T,2*T),a.setRenderTarget(t),a.render(u,Fs)}}function Cb(e){let t=[],n=[],i=[],r=e,s=e-Bi+1+Qf.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);t.push(a);let c=1/a;if(o>e-Bi)c=Qf[o-e+Bi-1];else if(o===0)c=0;n.push(c);let l=1/(a-2),u=-l,f=1+l,h=[u,u,f,u,f,f,u,u,f,f,u,f],d=6,g=6,b=3,p=2,m=1,A=new Float32Array(b*g*d),T=new Float32Array(p*g*d),v=new Float32Array(m*g*d);for(let E=0;E<d;E++){let R=E%3*2/3-1,_=E>2?0:-1,S=[R,_,0,R+0.6666666666666666,_,0,R+0.6666666666666666,_+1,0,R,_,0,R+0.6666666666666666,_+1,0,R,_+1,0];A.set(S,b*g*E),T.set(h,p*g*E);let F=[E,E,E,E,E,E];v.set(F,m*g*E)}let w=new Kt;if(w.setAttribute("position",new It(A,b)),w.setAttribute("uv",new It(T,p)),w.setAttribute("faceIndex",new It(v,m)),i.push(new dt(w,null)),r>Bi)r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}function td(e,t,n){let i=new yn(e,t,n);return i.texture.mapping=ys,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function es(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Pb(e,t,n){return new bn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Ab,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:_a(),fragmentShader:`
+}`,Ge={alphahash_fragment:ay,alphahash_pars_fragment:cy,alphamap_fragment:ly,alphamap_pars_fragment:uy,alphatest_fragment:hy,alphatest_pars_fragment:fy,aomap_fragment:dy,aomap_pars_fragment:py,batching_pars_vertex:my,batching_vertex:gy,begin_vertex:_y,beginnormal_vertex:xy,bsdfs:vy,iridescence_fragment:yy,bumpmap_pars_fragment:by,clipping_planes_fragment:Sy,clipping_planes_pars_fragment:My,clipping_planes_pars_vertex:wy,clipping_planes_vertex:Ty,color_fragment:Ey,color_pars_fragment:Ay,color_pars_vertex:Ry,color_vertex:Cy,common:Py,cube_uv_reflection_fragment:Iy,defaultnormal_vertex:Ly,displacementmap_pars_vertex:Ny,displacementmap_vertex:Dy,emissivemap_fragment:Oy,emissivemap_pars_fragment:Uy,colorspace_fragment:Fy,colorspace_pars_fragment:zy,envmap_fragment:ky,envmap_common_pars_fragment:By,envmap_pars_fragment:Gy,envmap_pars_vertex:Hy,envmap_physical_pars_fragment:Qy,envmap_vertex:Vy,fog_vertex:Wy,fog_pars_vertex:$y,fog_fragment:Zy,fog_pars_fragment:Xy,gradientmap_pars_fragment:qy,lightmap_pars_fragment:Yy,lights_lambert_fragment:jy,lights_lambert_pars_fragment:Jy,lights_pars_begin:Ky,lights_toon_fragment:eb,lights_toon_pars_fragment:tb,lights_phong_fragment:nb,lights_phong_pars_fragment:ib,lights_physical_fragment:rb,lights_physical_pars_fragment:sb,lights_fragment_begin:ob,lights_fragment_maps:ab,lights_fragment_end:cb,lightprobes_pars_fragment:lb,logdepthbuf_fragment:ub,logdepthbuf_pars_fragment:hb,logdepthbuf_pars_vertex:fb,logdepthbuf_vertex:db,map_fragment:pb,map_pars_fragment:mb,map_particle_fragment:gb,map_particle_pars_fragment:_b,metalnessmap_fragment:xb,metalnessmap_pars_fragment:vb,morphinstance_vertex:yb,morphcolor_vertex:bb,morphnormal_vertex:Sb,morphtarget_pars_vertex:Mb,morphtarget_vertex:wb,normal_fragment_begin:Tb,normal_fragment_maps:Eb,normal_pars_fragment:Ab,normal_pars_vertex:Rb,normal_vertex:Cb,normalmap_pars_fragment:Pb,clearcoat_normal_fragment_begin:Ib,clearcoat_normal_fragment_maps:Lb,clearcoat_pars_fragment:Nb,iridescence_pars_fragment:Db,opaque_fragment:Ob,packing:Ub,premultiplied_alpha_fragment:Fb,project_vertex:zb,dithering_fragment:kb,dithering_pars_fragment:Bb,roughnessmap_fragment:Gb,roughnessmap_pars_fragment:Hb,shadowmap_pars_fragment:Vb,shadowmap_pars_vertex:Wb,shadowmap_vertex:$b,shadowmask_pars_fragment:Zb,skinbase_vertex:Xb,skinning_pars_vertex:qb,skinning_vertex:Yb,skinnormal_vertex:jb,specularmap_fragment:Jb,specularmap_pars_fragment:Kb,tonemapping_fragment:Qb,tonemapping_pars_fragment:eS,transmission_fragment:tS,transmission_pars_fragment:nS,uv_pars_fragment:iS,uv_pars_vertex:rS,uv_vertex:sS,worldpos_vertex:oS,background_vert:aS,background_frag:cS,backgroundCube_vert:lS,backgroundCube_frag:uS,cube_vert:hS,cube_frag:fS,depth_vert:dS,depth_frag:pS,distance_vert:mS,distance_frag:gS,equirect_vert:_S,equirect_frag:xS,linedashed_vert:vS,linedashed_frag:yS,meshbasic_vert:bS,meshbasic_frag:SS,meshlambert_vert:MS,meshlambert_frag:wS,meshmatcap_vert:TS,meshmatcap_frag:ES,meshnormal_vert:AS,meshnormal_frag:RS,meshphong_vert:CS,meshphong_frag:PS,meshphysical_vert:IS,meshphysical_frag:LS,meshtoon_vert:NS,meshtoon_frag:DS,points_vert:OS,points_frag:US,shadow_vert:FS,shadow_frag:zS,sprite_vert:kS,sprite_frag:BS},he={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new N},probesMax:{value:new N},probesResolution:{value:new N}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Pe(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},Kn={basic:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:Ge.meshbasic_vert,fragmentShader:Ge.meshbasic_frag},lambert:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},envMapIntensity:{value:1}}]),vertexShader:Ge.meshlambert_vert,fragmentShader:Ge.meshlambert_frag},phong:{uniforms:qt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ge.meshphong_vert,fragmentShader:Ge.meshphong_frag},standard:{uniforms:qt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag},toon:{uniforms:qt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ge.meshtoon_vert,fragmentShader:Ge.meshtoon_frag},matcap:{uniforms:qt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:Ge.meshmatcap_vert,fragmentShader:Ge.meshmatcap_frag},points:{uniforms:qt([he.points,he.fog]),vertexShader:Ge.points_vert,fragmentShader:Ge.points_frag},dashed:{uniforms:qt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ge.linedashed_vert,fragmentShader:Ge.linedashed_frag},depth:{uniforms:qt([he.common,he.displacementmap]),vertexShader:Ge.depth_vert,fragmentShader:Ge.depth_frag},normal:{uniforms:qt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:Ge.meshnormal_vert,fragmentShader:Ge.meshnormal_frag},sprite:{uniforms:qt([he.sprite,he.fog]),vertexShader:Ge.sprite_vert,fragmentShader:Ge.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ge.background_vert,fragmentShader:Ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:Ge.backgroundCube_vert,fragmentShader:Ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ge.cube_vert,fragmentShader:Ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ge.equirect_vert,fragmentShader:Ge.equirect_frag},distance:{uniforms:qt([he.common,he.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:Ge.distance_vert,fragmentShader:Ge.distance_frag},shadow:{uniforms:qt([he.lights,he.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:Ge.shadow_vert,fragmentShader:Ge.shadow_frag}};Kn.physical={uniforms:qt([Kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag};var Aa={r:0,b:0,g:0},GS=new Fe,cp=new De;cp.set(-1,0,0,0,1,0,0,0,1);function HS(e,t,n,i,r,s){let o=new Le(0),a=r===!0?0:1,c,l,u=null,h=0,f=null;function d(A){let E=A.isScene===!0?A.background:null;if(E&&E.isTexture){let y=A.backgroundBlurriness>0;E=t.get(E,y)}return E}function m(A){let E=!1,y=d(A);if(y===null)p(o,a);else if(y&&y.isColor)p(y,1),E=!0;let w=e.xr.getEnvironmentBlendMode();if(w==="additive")n.buffers.color.setClear(0,0,0,1,s);else if(w==="alpha-blend")n.buffers.color.setClear(0,0,0,0,s);if(e.autoClear||E)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function x(A,E){let y=d(E);if(y&&(y.isCubeTexture||y.mapping===Rs)){if(l===void 0)l=new dt(new Wi(1,1,1),new wn({name:"BackgroundCubeMaterial",uniforms:gr(Kn.backgroundCube.uniforms),vertexShader:Kn.backgroundCube.vertexShader,fragmentShader:Kn.backgroundCube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,T,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l);if(l.material.uniforms.envMap.value=y,l.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(GS.makeRotationFromEuler(E.backgroundRotation)).transpose(),y.isCubeTexture&&y.isRenderTargetTexture===!1)l.material.uniforms.backgroundRotation.value.premultiply(cp);if(l.material.toneMapped=Ve.getTransfer(y.colorSpace)!==ut,u!==y||h!==y.version||f!==e.toneMapping)l.material.needsUpdate=!0,u=y,h=y.version,f=e.toneMapping;l.layers.enableAll(),A.unshift(l,l.geometry,l.material,0,0,null)}else if(y&&y.isTexture){if(c===void 0)c=new dt(new Gs(2,2),new wn({name:"BackgroundMaterial",uniforms:gr(Kn.background.uniforms),vertexShader:Kn.background.vertexShader,fragmentShader:Kn.background.fragmentShader,side:zi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c);if(c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=Ve.getTransfer(y.colorSpace)!==ut,y.matrixAutoUpdate===!0)y.updateMatrix();if(c.material.uniforms.uvTransform.value.copy(y.matrix),u!==y||h!==y.version||f!==e.toneMapping)c.material.needsUpdate=!0,u=y,h=y.version,f=e.toneMapping;c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null)}}function p(A,E){A.getRGB(Aa,Zl(e)),n.buffers.color.setClear(Aa.r,Aa.g,Aa.b,E,s)}function g(){if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0;if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0}return{getClearColor:function(){return o},setClearColor:function(A,E=1){o.set(A),a=E,p(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(A){a=A,p(o,a)},render:m,addToRenderList:x,dispose:g}}function VS(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=f(null),s=r,o=!1;function a(C,z,j,F,H){let V=!1,O=h(C,F,j,z);if(s!==O)s=O,l(s.object);if(V=d(C,F,j,H),V)m(C,F,j,H);if(H!==null)t.update(H,e.ELEMENT_ARRAY_BUFFER);if(V||o){if(o=!1,y(C,z,j,F),H!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(H).buffer)}}function c(){return e.createVertexArray()}function l(C){return e.bindVertexArray(C)}function u(C){return e.deleteVertexArray(C)}function h(C,z,j,F){let H=F.wireframe===!0,V=i[z.id];if(V===void 0)V={},i[z.id]=V;let O=C.isInstancedMesh===!0?C.id:0,K=V[O];if(K===void 0)K={},V[O]=K;let Q=K[j.id];if(Q===void 0)Q={},K[j.id]=Q;let se=Q[H];if(se===void 0)se=f(c()),Q[H]=se;return se}function f(C){let z=[],j=[],F=[];for(let H=0;H<n;H++)z[H]=0,j[H]=0,F[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:j,attributeDivisors:F,object:C,attributes:{},index:null}}function d(C,z,j,F){let H=s.attributes,V=z.attributes,O=0,K=j.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=H[Q],_e=V[Q];if(_e===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)_e=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)_e=C.instanceColor}if(me===void 0)return!0;if(me.attribute!==_e)return!0;if(_e&&me.data!==_e.data)return!0;O++}if(s.attributesNum!==O)return!0;if(s.index!==F)return!0;return!1}function m(C,z,j,F){let H={},V=z.attributes,O=0,K=j.getAttributes();for(let Q in K)if(K[Q].location>=0){let me=V[Q];if(me===void 0){if(Q==="instanceMatrix"&&C.instanceMatrix)me=C.instanceMatrix;if(Q==="instanceColor"&&C.instanceColor)me=C.instanceColor}let _e={};if(_e.attribute=me,me&&me.data)_e.data=me.data;H[Q]=_e,O++}s.attributes=H,s.attributesNum=O,s.index=F}function x(){let C=s.newAttributes;for(let z=0,j=C.length;z<j;z++)C[z]=0}function p(C){g(C,0)}function g(C,z){let j=s.newAttributes,F=s.enabledAttributes,H=s.attributeDivisors;if(j[C]=1,F[C]===0)e.enableVertexAttribArray(C),F[C]=1;if(H[C]!==z)e.vertexAttribDivisor(C,z),H[C]=z}function A(){let C=s.newAttributes,z=s.enabledAttributes;for(let j=0,F=z.length;j<F;j++)if(z[j]!==C[j])e.disableVertexAttribArray(j),z[j]=0}function E(C,z,j,F,H,V,O){if(O===!0)e.vertexAttribIPointer(C,z,j,H,V);else e.vertexAttribPointer(C,z,j,F,H,V)}function y(C,z,j,F){x();let H=F.attributes,V=j.getAttributes(),O=z.defaultAttributeValues;for(let K in V){let Q=V[K];if(Q.location>=0){let se=H[K];if(se===void 0){if(K==="instanceMatrix"&&C.instanceMatrix)se=C.instanceMatrix;if(K==="instanceColor"&&C.instanceColor)se=C.instanceColor}if(se!==void 0){let me=se.normalized,_e=se.itemSize,Xe=t.get(se);if(Xe===void 0)continue;let{buffer:Be,type:Z,bytesPerElement:ne}=Xe,fe=Z===e.INT||Z===e.UNSIGNED_INT||se.gpuType===Qc;if(se.isInterleavedBufferAttribute){let de=se.data,Re=de.stride,$e=se.offset;if(de.isInstancedInterleavedBuffer){for(let Oe=0;Oe<Q.locationSize;Oe++)g(Q.location+Oe,de.meshPerAttribute);if(C.isInstancedMesh!==!0&&F._maxInstanceCount===void 0)F._maxInstanceCount=de.meshPerAttribute*de.count}else for(let Oe=0;Oe<Q.locationSize;Oe++)p(Q.location+Oe);e.bindBuffer(e.ARRAY_BUFFER,Be);for(let Oe=0;Oe<Q.locationSize;Oe++)E(Q.location+Oe,_e/Q.locationSize,Z,me,Re*ne,($e+_e/Q.locationSize*Oe)*ne,fe)}else{if(se.isInstancedBufferAttribute){for(let de=0;de<Q.locationSize;de++)g(Q.location+de,se.meshPerAttribute);if(C.isInstancedMesh!==!0&&F._maxInstanceCount===void 0)F._maxInstanceCount=se.meshPerAttribute*se.count}else for(let de=0;de<Q.locationSize;de++)p(Q.location+de);e.bindBuffer(e.ARRAY_BUFFER,Be);for(let de=0;de<Q.locationSize;de++)E(Q.location+de,_e/Q.locationSize,Z,me,_e*ne,_e/Q.locationSize*de*ne,fe)}}else if(O!==void 0){let me=O[K];if(me!==void 0)switch(me.length){case 2:e.vertexAttrib2fv(Q.location,me);break;case 3:e.vertexAttrib3fv(Q.location,me);break;case 4:e.vertexAttrib4fv(Q.location,me);break;default:e.vertexAttrib1fv(Q.location,me)}}}}A()}function w(){S();for(let C in i){let z=i[C];for(let j in z){let F=z[j];for(let H in F){let V=F[H];for(let O in V)u(V[O].object),delete V[O];delete F[H]}}delete i[C]}}function T(C){if(i[C.id]===void 0)return;let z=i[C.id];for(let j in z){let F=z[j];for(let H in F){let V=F[H];for(let O in V)u(V[O].object),delete V[O];delete F[H]}}delete i[C.id]}function R(C){for(let z in i){let j=i[z];for(let F in j){let H=j[F];if(H[C.id]===void 0)continue;let V=H[C.id];for(let O in V)u(V[O].object),delete V[O];delete H[C.id]}}}function _(C){for(let z in i){let j=i[z],F=C.isInstancedMesh===!0?C.id:0,H=j[F];if(H===void 0)continue;for(let V in H){let O=H[V];for(let K in O)u(O[K].object),delete O[K];delete H[V]}if(delete j[F],Object.keys(j).length===0)delete i[z]}}function S(){if(U(),o=!0,s===r)return;s=r,l(s.object)}function U(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:S,resetDefaultState:U,dispose:w,releaseStatesOfGeometry:T,releaseStatesOfObject:_,releaseStatesOfProgram:R,initAttributes:x,enableAttribute:p,disableUnusedAttributes:A}}function WS(e,t,n){let i;function r(c){i=c}function s(c,l){e.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){if(u===0)return;e.drawArraysInstanced(i,c,l,u),n.update(l,i,u)}function a(c,l,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let f=0;for(let d=0;d<u;d++)f+=l[d];n.update(f,i,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function $S(e,t,n,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let R=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(R){if(R!==Yn&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function a(R){let _=R===xi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(R!==Un&&i.convert(R)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==_i&&!_)return!1;return!0}function c(R){if(R==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";R="mediump"}if(R==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let l=n.precision!==void 0?n.precision:"highp",u=c(l);if(u!==l)Me("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u;let h=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control");if(n.reversedDepthBuffer===!0&&f===!1)Me("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),g=e.getParameter(e.MAX_VERTEX_ATTRIBS),A=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),E=e.getParameter(e.MAX_VARYING_VECTORS),y=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),w=e.getParameter(e.MAX_SAMPLES),T=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:p,maxAttributes:g,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:y,maxSamples:w,samples:T}}function ZS(e){let t=this,n=null,i=0,r=!1,s=!1,o=new In,a=new De,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let d=h.length!==0||f||i!==0||r;return r=f,i=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){n=u(h,f,0)},this.setState=function(h,f,d){let{clippingPlanes:m,clipIntersection:x,clipShadows:p}=h,g=e.get(h);if(!r||m===null||m.length===0||s&&!p)if(s)u(null);else l();else{let A=s?0:i,E=A*4,y=g.clippingState||null;c.value=y,y=u(m,f,E,d);for(let w=0;w!==E;++w)y[w]=n[w];g.clippingState=y,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=A}};function l(){if(c.value!==n)c.value=n,c.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function u(h,f,d,m){let x=h!==null?h.length:0,p=null;if(x!==0){if(p=c.value,m!==!0||p===null){let g=d+x*4,A=f.matrixWorldInverse;if(a.getNormalMatrix(A),p===null||p.length<g)p=new Float32Array(g);for(let E=0,y=d;E!==x;++E,y+=4)o.copy(h[E]).applyMatrix4(A,a),o.normal.toArray(p,y),p[y+3]=o.constant}c.value=p,c.needsUpdate=!0}return t.numPlanes=x,t.numIntersection=0,p}}var ji=4,kd=[0.125,0.215,0.35,0.446,0.526,0.582],vr=20,XS=256,$s=new xr,Bd=new Le,lu=null,uu=0,hu=0,fu=!1,qS=new N;class Ys{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=0.1,i=100,r={}){let{size:s=256,position:o=qS}=r;lu=this._renderer.getRenderTarget(),uu=this._renderer.getActiveCubeFace(),hu=this._renderer.getActiveMipmapLevel(),fu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);let a=this._allocateTargets();if(a.depthBuffer=!0,this._sceneToCubeUV(e,n,i,a,o),t>0)this._blur(a,0,0,t);return this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=Vd(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=Hd(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lu,uu,hu),this._renderer.xr.enabled=fu,e.scissorTest=!1,as(e,0,0,e.width,e.height)}_fromTexture(e,t){if(e.mapping===qr||e.mapping===ur)this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);lu=this._renderer.getRenderTarget(),uu=this._renderer.getActiveCubeFace(),hu=this._renderer.getActiveMipmapLevel(),fu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:kt,minFilter:kt,generateMipmaps:!1,type:xi,format:Yn,colorSpace:ln,depthBuffer:!1},i=Gd(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=Gd(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=YS(r)),this._blurMaterial=JS(r,e,t),this._ggxMaterial=jS(r,e,t)}return i}_compileMaterial(e){let t=new dt(new Qt,e);this._renderer.compile(t,$s)}_sceneToCubeUV(e,t,n,i,r){let a=new Pt(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,{autoClear:h,toneMapping:f}=u;if(u.getClearColor(Bd),u.toneMapping=Dn,u.autoClear=!1,u.state.buffers.depth.getReversed())u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new dt(new Wi,new jn({name:"PMREM.Background",side:Xt,depthWrite:!1,depthTest:!1}));let m=this._backgroundBox,x=m.material,p=!1,g=e.background;if(g){if(g.isColor)x.color.copy(g),e.background=null,p=!0}else x.color.copy(Bd),p=!0;for(let A=0;A<6;A++){let E=A%3;if(E===0)a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+l[A],r.y,r.z);else if(E===1)a.up.set(0,0,c[A]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+l[A],r.z);else a.up.set(0,c[A],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+l[A]);let y=this._cubeSize;if(as(i,E*y,A>2?y:0,y,y),u.setRenderTarget(i),p)u.render(m,a);u.render(e,a)}u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===qr||e.mapping===ur;if(i){if(this._cubemapMaterial===null)this._cubemapMaterial=Vd();this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=Hd();let r=i?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r;let o=r.uniforms;o.envMap.value=e;let a=this._cubeSize;as(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,$s)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,o=this._lodMeshes[n];o.material=s;let a=s.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l),h=0+c*1.25,f=u*h,{_lodMax:d}=this,m=this._sizeLods[n],x=3*m*(n>d-ji?n-d+ji:0),p=4*(this._cubeSize-m);a.envMap.value=e.texture,a.roughness.value=f,a.mipInt.value=d-t,as(r,x,p,3*m,2*m),i.setRenderTarget(r),i.render(o,$s),a.envMap.value=r.texture,a.roughness.value=0,a.mipInt.value=d-n,as(e,x,p,3*m,2*m),i.setRenderTarget(e),i.render(o,$s)}_blur(e,t,n,i,r){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){let a=this._renderer,c=this._blurMaterial;if(s!=="latitudinal"&&s!=="longitudinal")Ne("blur direction must be either latitudinal or longitudinal!");let l=3,u=this._lodMeshes[i];u.material=c;let h=c.uniforms,f=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*vr-1),m=r/d,x=isFinite(r)?1+Math.floor(l*m):vr;if(x>vr)Me(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${vr}`);let p=[],g=0;for(let T=0;T<vr;++T){let R=T/m,_=Math.exp(-R*R/2);if(p.push(_),T===0)g+=_;else if(T<x)g+=2*_}for(let T=0;T<p.length;T++)p[T]=p[T]/g;if(h.envMap.value=e.texture,h.samples.value=x,h.weights.value=p,h.latitudinal.value=s==="latitudinal",o)h.poleAxis.value=o;let{_lodMax:A}=this;h.dTheta.value=d,h.mipInt.value=A-n;let E=this._sizeLods[i],y=3*E*(i>A-ji?i-A+ji:0),w=4*(this._cubeSize-E);as(t,y,w,3*E,2*E),a.setRenderTarget(t),a.render(u,$s)}}function YS(e){let t=[],n=[],i=[],r=e,s=e-ji+1+kd.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);t.push(a);let c=1/a;if(o>e-ji)c=kd[o-e+ji-1];else if(o===0)c=0;n.push(c);let l=1/(a-2),u=-l,h=1+l,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,x=3,p=2,g=1,A=new Float32Array(x*m*d),E=new Float32Array(p*m*d),y=new Float32Array(g*m*d);for(let T=0;T<d;T++){let R=T%3*2/3-1,_=T>2?0:-1,S=[R,_,0,R+0.6666666666666666,_,0,R+0.6666666666666666,_+1,0,R,_,0,R+0.6666666666666666,_+1,0,R,_+1,0];A.set(S,x*m*T),E.set(f,p*m*T);let U=[T,T,T,T,T,T];y.set(U,g*m*T)}let w=new Qt;if(w.setAttribute("position",new It(A,x)),w.setAttribute("uv",new It(E,p)),w.setAttribute("faceIndex",new It(y,g)),i.push(new dt(w,null)),r>ji)r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}function Gd(e,t,n){let i=new Mn(e,t,n);return i.texture.mapping=Rs,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function as(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function jS(e,t,n){return new wn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:XS,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ca(),fragmentShader:`
precision highp float;
precision highp int;
@@ -3890,7 +3890,7 @@ void main() {
gl_FragColor = vec4(prefilteredColor, 1.0);
}
- `,blending:Vn,depthTest:!1,depthWrite:!1})}function Ib(e,t,n){let i=new Float32Array(hr),r=new N(0,1,0);return new bn({name:"SphericalGaussianBlur",defines:{n:hr,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:_a(),fragmentShader:`
+ `,blending:Xn,depthTest:!1,depthWrite:!1})}function JS(e,t,n){let i=new Float32Array(vr),r=new N(0,1,0);return new wn({name:"SphericalGaussianBlur",defines:{n:vr,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ca(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3950,7 +3950,7 @@ void main() {
}
}
- `,blending:Vn,depthTest:!1,depthWrite:!1})}function nd(){return new bn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_a(),fragmentShader:`
+ `,blending:Xn,depthTest:!1,depthWrite:!1})}function Hd(){return new wn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ca(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3969,7 +3969,7 @@ void main() {
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
- `,blending:Vn,depthTest:!1,depthWrite:!1})}function id(){return new bn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_a(),fragmentShader:`
+ `,blending:Xn,depthTest:!1,depthWrite:!1})}function Vd(){return new wn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ca(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3985,7 +3985,7 @@ void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
- `,blending:Vn,depthTest:!1,depthWrite:!1})}function _a(){return`
+ `,blending:Xn,depthTest:!1,depthWrite:!1})}function Ca(){return`
precision mediump float;
precision mediump int;
@@ -4040,7 +4040,7 @@ void main() {
gl_Position = vec4( position, 1.0 );
}
- `}class Yl extends yn{constructor(e=1,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new na(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
+ `}class _u extends Mn{constructor(e=1,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pa(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
@@ -4075,7 +4075,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
}
- `},i=new Di(5,5,5),r=new bn({name:"CubemapFromEquirect",uniforms:cr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xt,blending:Vn});r.uniforms.tEquirect.value=t;let s=new dt(i,r),o=t.minFilter;if(t.minFilter===Wn)t.minFilter=kt;return new Nl(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}}function Lb(e){let t=new WeakMap,n=new WeakMap,i=null;function r(h,d=!1){if(h===null||h===void 0)return null;if(d)return o(h);return s(h)}function s(h){if(h&&h.isTexture){let d=h.mapping;if(d===Oo||d===Fo)if(t.has(h)){let g=t.get(h).texture;return a(g,h.mapping)}else{let g=h.image;if(g&&g.height>0){let b=new Yl(g.height);return b.fromEquirectangularTexture(e,h),t.set(h,b),h.addEventListener("dispose",l),a(b.texture,h.mapping)}else return null}}return h}function o(h){if(h&&h.isTexture){let d=h.mapping,g=d===Oo||d===Fo,b=d===Gr||d===nr;if(g||b){let p=n.get(h),m=p!==void 0?p.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==m){if(i===null)i=new Gs(e);return p=g?i.fromEquirectangular(h,p):i.fromCubemap(h,p),p.texture.pmremVersion=h.pmremVersion,n.set(h,p),p.texture}else if(p!==void 0)return p.texture;else{let A=h.image;if(g&&A&&A.height>0||b&&A&&c(A)){if(i===null)i=new Gs(e);return p=g?i.fromEquirectangular(h):i.fromCubemap(h),p.texture.pmremVersion=h.pmremVersion,n.set(h,p),h.addEventListener("dispose",u),p.texture}else return null}}}return h}function a(h,d){if(d===Oo)h.mapping=Gr;else if(d===Fo)h.mapping=nr;return h}function c(h){let d=0,g=6;for(let b=0;b<g;b++)if(h[b]!==void 0)d++;return d===g}function l(h){let d=h.target;d.removeEventListener("dispose",l);let g=t.get(d);if(g!==void 0)t.delete(d),g.dispose()}function u(h){let d=h.target;d.removeEventListener("dispose",u);let g=n.get(d);if(g!==void 0)n.delete(d),g.dispose()}function f(){if(t=new WeakMap,n=new WeakMap,i!==null)i.dispose(),i=null}return{get:r,dispose:f}}function Nb(e){let t={};function n(i){if(t[i]!==void 0)return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(i){return n(i)!==null},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(i){let r=n(i);if(r===null)Qi("WebGLRenderer: "+i+" extension not supported.");return r}}}function Db(e,t,n,i){let r={},s=new WeakMap;function o(f){let h=f.target;if(h.index!==null)t.remove(h.index);for(let g in h.attributes)t.remove(h.attributes[g]);h.removeEventListener("dispose",o),delete r[h.id];let d=s.get(h);if(d)t.remove(d),s.delete(h);if(i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0)delete h._maxInstanceCount;n.memory.geometries--}function a(f,h){if(r[h.id]===!0)return h;return h.addEventListener("dispose",o),r[h.id]=!0,n.memory.geometries++,h}function c(f){let h=f.attributes;for(let d in h)t.update(h[d],e.ARRAY_BUFFER)}function l(f){let h=[],d=f.index,g=f.attributes.position,b=0;if(g===void 0)return;if(d!==null){let A=d.array;b=d.version;for(let T=0,v=A.length;T<v;T+=3){let w=A[T+0],E=A[T+1],R=A[T+2];h.push(w,E,E,R,R,w)}}else{let A=g.array;b=g.version;for(let T=0,v=A.length/3-1;T<v;T+=3){let w=T+0,E=T+1,R=T+2;h.push(w,E,E,R,R,w)}}let p=new(g.count>=65535?Ko:Jo)(h,1);p.version=b;let m=s.get(f);if(m)t.remove(m);s.set(f,p)}function u(f){let h=s.get(f);if(h){let d=f.index;if(d!==null){if(h.version<d.version)l(f)}}else l(f);return s.get(f)}return{get:a,update:c,getWireframeAttribute:u}}function Ub(e,t,n){let i;function r(f){i=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function c(f,h){e.drawElements(i,h,s,f*o),n.update(h,i,1)}function l(f,h,d){if(d===0)return;e.drawElementsInstanced(i,h,s,f*o,d),n.update(h,i,d)}function u(f,h,d){if(d===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,h,0,s,f,0,d);let b=0;for(let p=0;p<d;p++)b+=h[p];n.update(b,i,1)}this.setMode=r,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function Ob(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(n.calls++,o){case e.TRIANGLES:n.triangles+=a*(s/3);break;case e.LINES:n.lines+=a*(s/2);break;case e.LINE_STRIP:n.lines+=a*(s-1);break;case e.LINE_LOOP:n.lines+=a*s;break;case e.POINTS:n.points+=a*s;break;default:Ne("WebGLInfo: Unknown draw mode:",o);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function Fb(e,t,n){let i=new WeakMap,r=new it;function s(o,a,c){let l=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,h=i.get(a);if(h===void 0||h.count!==f){let S=function(){R.dispose(),i.delete(a),a.removeEventListener("dispose",S)};if(h!==void 0)h.texture.dispose();let d=a.morphAttributes.position!==void 0,g=a.morphAttributes.normal!==void 0,b=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],m=a.morphAttributes.normal||[],A=a.morphAttributes.color||[],T=0;if(d===!0)T=1;if(g===!0)T=2;if(b===!0)T=3;let v=a.attributes.position.count*T,w=1;if(v>t.maxTextureSize)w=Math.ceil(v/t.maxTextureSize),v=t.maxTextureSize;let E=new Float32Array(v*w*4*f),R=new Yo(E,v,w,f);R.type=ui,R.needsUpdate=!0;let _=T*4;for(let F=0;F<f;F++){let C=p[F],z=m[F],J=A[F],O=v*w*4*F;for(let H=0;H<C.count;H++){let V=H*_;if(d===!0)r.fromBufferAttribute(C,H),E[O+V+0]=r.x,E[O+V+1]=r.y,E[O+V+2]=r.z,E[O+V+3]=0;if(g===!0)r.fromBufferAttribute(z,H),E[O+V+4]=r.x,E[O+V+5]=r.y,E[O+V+6]=r.z,E[O+V+7]=0;if(b===!0)r.fromBufferAttribute(J,H),E[O+V+8]=r.x,E[O+V+9]=r.y,E[O+V+10]=r.z,E[O+V+11]=J.itemSize===4?r.w:1}}h={count:f,texture:R,size:new Pe(v,w)},i.set(a,h),a.addEventListener("dispose",S)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(e,"morphTexture",o.morphTexture,n);else{let d=0;for(let b=0;b<l.length;b++)d+=l[b];let g=a.morphTargetsRelative?1:1-d;c.getUniforms().setValue(e,"morphTargetBaseInfluence",g),c.getUniforms().setValue(e,"morphTargetInfluences",l)}c.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}return{update:s}}function zb(e,t,n,i,r){let s=new WeakMap;function o(l){let u=r.render.frame,f=l.geometry,h=t.get(l,f);if(s.get(h)!==u)t.update(h),s.set(h,u);if(l.isInstancedMesh){if(l.hasEventListener("dispose",c)===!1)l.addEventListener("dispose",c);if(s.get(l)!==u){if(n.update(l.instanceMatrix,e.ARRAY_BUFFER),l.instanceColor!==null)n.update(l.instanceColor,e.ARRAY_BUFFER);s.set(l,u)}}if(l.isSkinnedMesh){let d=l.skeleton;if(s.get(d)!==u)d.update(),s.set(d,u)}return h}function a(){s=new WeakMap}function c(l){let u=l.target;if(u.removeEventListener("dispose",c),i.releaseStatesOfObject(u),n.remove(u.instanceMatrix),u.instanceColor!==null)n.remove(u.instanceColor)}return{update:o,dispose:a}}var kb={[Tc]:"LINEAR_TONE_MAPPING",[Ec]:"REINHARD_TONE_MAPPING",[Ac]:"CINEON_TONE_MAPPING",[vs]:"ACES_FILMIC_TONE_MAPPING",[Cc]:"AGX_TONE_MAPPING",[Pc]:"NEUTRAL_TONE_MAPPING",[Rc]:"CUSTOM_TONE_MAPPING"};function Bb(e,t,n,i,r,s){let o=new yn(t,n,{type:e,depthBuffer:r,stencilBuffer:s,samples:i?4:0,depthTexture:r?new Ni(t,n):void 0}),a=new yn(t,n,{type:hi,depthBuffer:!1,stencilBuffer:!1}),c=new Kt;c.setAttribute("position",new tn([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new tn([0,2,0,0,2,0],2));let l=new Tl({uniforms:{tDiffuse:{value:null}},vertexShader:`
+ `},i=new Wi(5,5,5),r=new wn({name:"CubemapFromEquirect",uniforms:gr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xt,blending:Xn});r.uniforms.tEquirect.value=t;let s=new dt(i,r),o=t.minFilter;if(t.minFilter===qn)t.minFilter=kt;return new tu(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}}function KS(e){let t=new WeakMap,n=new WeakMap,i=null;function r(f,d=!1){if(f===null||f===void 0)return null;if(d)return o(f);return s(f)}function s(f){if(f&&f.isTexture){let d=f.mapping;if(d===qo||d===Yo)if(t.has(f)){let m=t.get(f).texture;return a(m,f.mapping)}else{let m=f.image;if(m&&m.height>0){let x=new _u(m.height);return x.fromEquirectangularTexture(e,f),t.set(f,x),f.addEventListener("dispose",l),a(x.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture){let d=f.mapping,m=d===qo||d===Yo,x=d===qr||d===ur;if(m||x){let p=n.get(f),g=p!==void 0?p.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==g){if(i===null)i=new Ys(e);return p=m?i.fromEquirectangular(f,p):i.fromCubemap(f,p),p.texture.pmremVersion=f.pmremVersion,n.set(f,p),p.texture}else if(p!==void 0)return p.texture;else{let A=f.image;if(m&&A&&A.height>0||x&&A&&c(A)){if(i===null)i=new Ys(e);return p=m?i.fromEquirectangular(f):i.fromCubemap(f),p.texture.pmremVersion=f.pmremVersion,n.set(f,p),f.addEventListener("dispose",u),p.texture}else return null}}}return f}function a(f,d){if(d===qo)f.mapping=qr;else if(d===Yo)f.mapping=ur;return f}function c(f){let d=0,m=6;for(let x=0;x<m;x++)if(f[x]!==void 0)d++;return d===m}function l(f){let d=f.target;d.removeEventListener("dispose",l);let m=t.get(d);if(m!==void 0)t.delete(d),m.dispose()}function u(f){let d=f.target;d.removeEventListener("dispose",u);let m=n.get(d);if(m!==void 0)n.delete(d),m.dispose()}function h(){if(t=new WeakMap,n=new WeakMap,i!==null)i.dispose(),i=null}return{get:r,dispose:h}}function QS(e){let t={};function n(i){if(t[i]!==void 0)return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(i){return n(i)!==null},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(i){let r=n(i);if(r===null)ar("WebGLRenderer: "+i+" extension not supported.");return r}}}function eM(e,t,n,i){let r={},s=new WeakMap;function o(h){let f=h.target;if(f.index!==null)t.remove(f.index);for(let m in f.attributes)t.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete r[f.id];let d=s.get(f);if(d)t.remove(d),s.delete(f);if(i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0)delete f._maxInstanceCount;n.memory.geometries--}function a(h,f){if(r[f.id]===!0)return f;return f.addEventListener("dispose",o),r[f.id]=!0,n.memory.geometries++,f}function c(h){let f=h.attributes;for(let d in f)t.update(f[d],e.ARRAY_BUFFER)}function l(h){let f=[],d=h.index,m=h.attributes.position,x=0;if(m===void 0)return;if(d!==null){let A=d.array;x=d.version;for(let E=0,y=A.length;E<y;E+=3){let w=A[E+0],T=A[E+1],R=A[E+2];f.push(w,T,T,R,R,w)}}else{let A=m.array;x=m.version;for(let E=0,y=A.length/3-1;E<y;E+=3){let w=E+0,T=E+1,R=E+2;f.push(w,T,T,R,R,w)}}let p=new(m.count>=65535?ua:la)(f,1);p.version=x;let g=s.get(h);if(g)t.remove(g);s.set(h,p)}function u(h){let f=s.get(h);if(f){let d=h.index;if(d!==null){if(f.version<d.version)l(h)}}else l(h);return s.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function tM(e,t,n){let i;function r(h){i=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function c(h,f){e.drawElements(i,f,s,h*o),n.update(f,i,1)}function l(h,f,d){if(d===0)return;e.drawElementsInstanced(i,f,s,h*o,d),n.update(f,i,d)}function u(h,f,d){if(d===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,f,0,s,h,0,d);let x=0;for(let p=0;p<d;p++)x+=f[p];n.update(x,i,1)}this.setMode=r,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function nM(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(n.calls++,o){case e.TRIANGLES:n.triangles+=a*(s/3);break;case e.LINES:n.lines+=a*(s/2);break;case e.LINE_STRIP:n.lines+=a*(s-1);break;case e.LINE_LOOP:n.lines+=a*s;break;case e.POINTS:n.points+=a*s;break;default:Ne("WebGLInfo: Unknown draw mode:",o);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function iM(e,t,n){let i=new WeakMap,r=new rt;function s(o,a,c){let l=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0,f=i.get(a);if(f===void 0||f.count!==h){let S=function(){R.dispose(),i.delete(a),a.removeEventListener("dispose",S)};if(f!==void 0)f.texture.dispose();let d=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],A=a.morphAttributes.color||[],E=0;if(d===!0)E=1;if(m===!0)E=2;if(x===!0)E=3;let y=a.attributes.position.count*E,w=1;if(y>t.maxTextureSize)w=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize;let T=new Float32Array(y*w*4*h),R=new aa(T,y,w,h);R.type=_i,R.needsUpdate=!0;let _=E*4;for(let U=0;U<h;U++){let C=p[U],z=g[U],j=A[U],F=y*w*4*U;for(let H=0;H<C.count;H++){let V=H*_;if(d===!0)r.fromBufferAttribute(C,H),T[F+V+0]=r.x,T[F+V+1]=r.y,T[F+V+2]=r.z,T[F+V+3]=0;if(m===!0)r.fromBufferAttribute(z,H),T[F+V+4]=r.x,T[F+V+5]=r.y,T[F+V+6]=r.z,T[F+V+7]=0;if(x===!0)r.fromBufferAttribute(j,H),T[F+V+8]=r.x,T[F+V+9]=r.y,T[F+V+10]=r.z,T[F+V+11]=j.itemSize===4?r.w:1}}f={count:h,texture:R,size:new Pe(y,w)},i.set(a,f),a.addEventListener("dispose",S)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(e,"morphTexture",o.morphTexture,n);else{let d=0;for(let x=0;x<l.length;x++)d+=l[x];let m=a.morphTargetsRelative?1:1-d;c.getUniforms().setValue(e,"morphTargetBaseInfluence",m),c.getUniforms().setValue(e,"morphTargetInfluences",l)}c.getUniforms().setValue(e,"morphTargetsTexture",f.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",f.size)}return{update:s}}function rM(e,t,n,i,r){let s=new WeakMap;function o(l){let u=r.render.frame,h=l.geometry,f=t.get(l,h);if(s.get(f)!==u)t.update(f),s.set(f,u);if(l.isInstancedMesh){if(l.hasEventListener("dispose",c)===!1)l.addEventListener("dispose",c);if(s.get(l)!==u){if(n.update(l.instanceMatrix,e.ARRAY_BUFFER),l.instanceColor!==null)n.update(l.instanceColor,e.ARRAY_BUFFER);s.set(l,u)}}if(l.isSkinnedMesh){let d=l.skeleton;if(s.get(d)!==u)d.update(),s.set(d,u)}return f}function a(){s=new WeakMap}function c(l){let u=l.target;if(u.removeEventListener("dispose",c),i.releaseStatesOfObject(u),n.remove(u.instanceMatrix),u.instanceColor!==null)n.remove(u.instanceColor)}return{update:o,dispose:a}}var sM={[Xc]:"LINEAR_TONE_MAPPING",[qc]:"REINHARD_TONE_MAPPING",[Yc]:"CINEON_TONE_MAPPING",[As]:"ACES_FILMIC_TONE_MAPPING",[Jc]:"AGX_TONE_MAPPING",[Kc]:"NEUTRAL_TONE_MAPPING",[jc]:"CUSTOM_TONE_MAPPING"};function oM(e,t,n,i,r,s){let o=new Mn(t,n,{type:e,depthBuffer:r,stencilBuffer:s,samples:i?4:0,depthTexture:r?new Vi(t,n):void 0}),a=new Mn(t,n,{type:xi,depthBuffer:!1,stencilBuffer:!1}),c=new Qt;c.setAttribute("position",new nn([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new nn([0,2,0,0,2,0],2));let l=new Xl({uniforms:{tDiffuse:{value:null}},vertexShader:`
precision highp float;
uniform mat4 modelViewMatrix;
@@ -4121,17 +4121,17 @@ void main() {
#ifdef SRGB_TRANSFER
gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif
- }`,depthTest:!1,depthWrite:!1}),u=new dt(c,l),f=new ur(-1,1,1,-1,0,1),h=null,d=null,g=!1,b,p=null,m=[],A=!1;this.setSize=function(T,v){o.setSize(T,v),a.setSize(T,v);for(let w=0;w<m.length;w++){let E=m[w];if(E.setSize)E.setSize(T,v)}},this.setEffects=function(T){m=T,A=m.length>0&&m[0].isRenderPass===!0;let{width:v,height:w}=o;for(let E=0;E<m.length;E++){let R=m[E];if(R.setSize)R.setSize(v,w)}},this.begin=function(T,v){if(g)return!1;if(T.toneMapping===Pn&&m.length===0)return!1;if(p=v,v!==null){let{width:w,height:E}=v;if(o.width!==w||o.height!==E)this.setSize(w,E)}if(A===!1)T.setRenderTarget(o);return b=T.toneMapping,T.toneMapping=Pn,!0},this.hasRenderPass=function(){return A},this.end=function(T,v){T.toneMapping=b,g=!0;let w=o,E=a;for(let R=0;R<m.length;R++){let _=m[R];if(_.enabled===!1)continue;if(_.render(T,E,w,v),_.needsSwap!==!1){let S=w;w=E,E=S}}if(h!==T.outputColorSpace||d!==T.toneMapping){if(h=T.outputColorSpace,d=T.toneMapping,l.defines={},Ve.getTransfer(h)===ut)l.defines.SRGB_TRANSFER="";let R=kb[d];if(R)l.defines[R]="";l.needsUpdate=!0}l.uniforms.tDiffuse.value=w.texture,T.setRenderTarget(p),T.render(u,f),p=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){if(o.depthTexture)o.depthTexture.dispose();o.dispose(),a.dispose(),c.dispose(),l.dispose()}}var Md=new St,Xl=new Ni(1,1),wd=new Yo,Td=new Sl,Ed=new na,rd=[],sd=[],od=new Float32Array(16),ad=new Float32Array(9),cd=new Float32Array(4);function ts(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,s=rd[r];if(s===void 0)s=new Float32Array(r),rd[r]=s;if(t!==0){i.toArray(s,0);for(let o=1,a=0;o!==t;++o)a+=n,e[o].toArray(s,a)}return s}function Lt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Nt(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function xa(e,t){let n=sd[t];if(n===void 0)n=new Int32Array(t),sd[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Gb(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function Hb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2fv(this.addr,t),Nt(n,t)}}function Vb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(Lt(n,t))return;e.uniform3fv(this.addr,t),Nt(n,t)}}function Wb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4fv(this.addr,t),Nt(n,t)}}function $b(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;cd.set(i),e.uniformMatrix2fv(this.addr,!1,cd),Nt(n,i)}}function Zb(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;ad.set(i),e.uniformMatrix3fv(this.addr,!1,ad),Nt(n,i)}}function Xb(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;od.set(i),e.uniformMatrix4fv(this.addr,!1,od),Nt(n,i)}}function qb(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function Yb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2iv(this.addr,t),Nt(n,t)}}function jb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Lt(n,t))return;e.uniform3iv(this.addr,t),Nt(n,t)}}function Jb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4iv(this.addr,t),Nt(n,t)}}function Kb(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function Qb(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2uiv(this.addr,t),Nt(n,t)}}function eS(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Lt(n,t))return;e.uniform3uiv(this.addr,t),Nt(n,t)}}function tS(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4uiv(this.addr,t),Nt(n,t)}}function nS(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;let s;if(this.type===e.SAMPLER_2D_SHADOW)Xl.compareFunction=n.isReversedDepthBuffer()?qo:Xo,s=Xl;else s=Md;n.setTexture2D(t||s,r)}function iS(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture3D(t||Td,r)}function rS(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTextureCube(t||Ed,r)}function sS(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture2DArray(t||wd,r)}function oS(e){switch(e){case 5126:return Gb;case 35664:return Hb;case 35665:return Vb;case 35666:return Wb;case 35674:return $b;case 35675:return Zb;case 35676:return Xb;case 5124:case 35670:return qb;case 35667:case 35671:return Yb;case 35668:case 35672:return jb;case 35669:case 35673:return Jb;case 5125:return Kb;case 36294:return Qb;case 36295:return eS;case 36296:return tS;case 35678:case 36198:case 36298:case 36306:case 35682:return nS;case 35679:case 36299:case 36307:return iS;case 35680:case 36300:case 36308:case 36293:return rS;case 36289:case 36303:case 36311:case 36292:return sS}}function aS(e,t){e.uniform1fv(this.addr,t)}function cS(e,t){let n=ts(t,this.size,2);e.uniform2fv(this.addr,n)}function lS(e,t){let n=ts(t,this.size,3);e.uniform3fv(this.addr,n)}function uS(e,t){let n=ts(t,this.size,4);e.uniform4fv(this.addr,n)}function hS(e,t){let n=ts(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function fS(e,t){let n=ts(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function dS(e,t){let n=ts(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function pS(e,t){e.uniform1iv(this.addr,t)}function mS(e,t){e.uniform2iv(this.addr,t)}function gS(e,t){e.uniform3iv(this.addr,t)}function _S(e,t){e.uniform4iv(this.addr,t)}function xS(e,t){e.uniform1uiv(this.addr,t)}function vS(e,t){e.uniform2uiv(this.addr,t)}function yS(e,t){e.uniform3uiv(this.addr,t)}function bS(e,t){e.uniform4uiv(this.addr,t)}function SS(e,t,n){let i=this.cache,r=t.length,s=xa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);let o;if(this.type===e.SAMPLER_2D_SHADOW)o=Xl;else o=Md;for(let a=0;a!==r;++a)n.setTexture2D(t[a]||o,s[a])}function MS(e,t,n){let i=this.cache,r=t.length,s=xa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTexture3D(t[o]||Td,s[o])}function wS(e,t,n){let i=this.cache,r=t.length,s=xa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTextureCube(t[o]||Ed,s[o])}function TS(e,t,n){let i=this.cache,r=t.length,s=xa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTexture2DArray(t[o]||wd,s[o])}function ES(e){switch(e){case 5126:return aS;case 35664:return cS;case 35665:return lS;case 35666:return uS;case 35674:return hS;case 35675:return fS;case 35676:return dS;case 5124:case 35670:return pS;case 35667:case 35671:return mS;case 35668:case 35672:return gS;case 35669:case 35673:return _S;case 5125:return xS;case 36294:return vS;case 36295:return yS;case 36296:return bS;case 35678:case 36198:case 36298:case 36306:case 35682:return SS;case 35679:case 36299:case 36307:return MS;case 35680:case 36300:case 36308:case 36293:return wS;case 36289:case 36303:case 36311:case 36292:return TS}}class Ad{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=oS(t.type)}}class Rd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ES(t.type)}}class Cd{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,s=i.length;r!==s;++r){let o=i[r];o.setValue(e,t[o.id],n)}}}var $l=/(\w+)(\])?(\[|\.)?/g;function ld(e,t){e.seq.push(t),e.map[t.id]=t}function AS(e,t,n){let i=e.name,r=i.length;$l.lastIndex=0;while(!0){let s=$l.exec(i),o=$l.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c)a=a|0;if(l===void 0||l==="["&&o+2===r){ld(n,l===void 0?new Ad(a,e,t):new Rd(a,e,t));break}else{let f=n.map[a];if(f===void 0)f=new Cd(a),ld(n,f);n=f}}}class Bs{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let o=e.getActiveUniform(t,s),a=e.getUniformLocation(t,o.name);AS(o,a,this)}let i=[],r=[];for(let s of this.seq)if(s.type===e.SAMPLER_2D_SHADOW||s.type===e.SAMPLER_CUBE_SHADOW||s.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(s);else r.push(s);if(i.length>0)this.seq=i.concat(r)}setValue(e,t,n,i){let r=this.map[t];if(r!==void 0)r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){let o=t[r],a=n[o.id];if(a.needsUpdate!==!1)o.setValue(e,a.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let s=e[i];if(s.id in t)n.push(s)}return n}}function ud(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var RS=37297,CS=0;function PS(e,t){let n=e.split(`
+ }`,depthTest:!1,depthWrite:!1}),u=new dt(c,l),h=new xr(-1,1,1,-1,0,1),f=null,d=null,m=!1,x,p=null,g=[],A=!1;this.setSize=function(E,y){o.setSize(E,y),a.setSize(E,y);for(let w=0;w<g.length;w++){let T=g[w];if(T.setSize)T.setSize(E,y)}},this.setEffects=function(E){g=E,A=g.length>0&&g[0].isRenderPass===!0;let{width:y,height:w}=o;for(let T=0;T<g.length;T++){let R=g[T];if(R.setSize)R.setSize(y,w)}},this.begin=function(E,y){if(m)return!1;if(E.toneMapping===Dn&&g.length===0)return!1;if(p=y,y!==null){let{width:w,height:T}=y;if(o.width!==w||o.height!==T)this.setSize(w,T)}if(A===!1)E.setRenderTarget(o);return x=E.toneMapping,E.toneMapping=Dn,!0},this.hasRenderPass=function(){return A},this.end=function(E,y){E.toneMapping=x,m=!0;let w=o,T=a;for(let R=0;R<g.length;R++){let _=g[R];if(_.enabled===!1)continue;if(_.render(E,T,w,y),_.needsSwap!==!1){let S=w;w=T,T=S}}if(f!==E.outputColorSpace||d!==E.toneMapping){if(f=E.outputColorSpace,d=E.toneMapping,l.defines={},Ve.getTransfer(f)===ut)l.defines.SRGB_TRANSFER="";let R=sM[d];if(R)l.defines[R]="";l.needsUpdate=!0}l.uniforms.tDiffuse.value=w.texture,E.setRenderTarget(p),E.render(u,h),p=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){if(o.depthTexture)o.depthTexture.dispose();o.dispose(),a.dispose(),c.dispose(),l.dispose()}}var lp=new St,mu=new Vi(1,1),up=new aa,hp=new Wl,fp=new pa,Wd=[],$d=[],Zd=new Float32Array(16),Xd=new Float32Array(9),qd=new Float32Array(4);function cs(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,s=Wd[r];if(s===void 0)s=new Float32Array(r),Wd[r]=s;if(t!==0){i.toArray(s,0);for(let o=1,a=0;o!==t;++o)a+=n,e[o].toArray(s,a)}return s}function Lt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Nt(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function Pa(e,t){let n=$d[t];if(n===void 0)n=new Int32Array(t),$d[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function aM(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function cM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2fv(this.addr,t),Nt(n,t)}}function lM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(Lt(n,t))return;e.uniform3fv(this.addr,t),Nt(n,t)}}function uM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4fv(this.addr,t),Nt(n,t)}}function hM(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;qd.set(i),e.uniformMatrix2fv(this.addr,!1,qd),Nt(n,i)}}function fM(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;Xd.set(i),e.uniformMatrix3fv(this.addr,!1,Xd),Nt(n,i)}}function dM(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(Lt(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Nt(n,t)}else{if(Lt(n,i))return;Zd.set(i),e.uniformMatrix4fv(this.addr,!1,Zd),Nt(n,i)}}function pM(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function mM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2iv(this.addr,t),Nt(n,t)}}function gM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Lt(n,t))return;e.uniform3iv(this.addr,t),Nt(n,t)}}function _M(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4iv(this.addr,t),Nt(n,t)}}function xM(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function vM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(Lt(n,t))return;e.uniform2uiv(this.addr,t),Nt(n,t)}}function yM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(Lt(n,t))return;e.uniform3uiv(this.addr,t),Nt(n,t)}}function bM(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(Lt(n,t))return;e.uniform4uiv(this.addr,t),Nt(n,t)}}function SM(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;let s;if(this.type===e.SAMPLER_2D_SHADOW)mu.compareFunction=n.isReversedDepthBuffer()?oa:sa,s=mu;else s=lp;n.setTexture2D(t||s,r)}function MM(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture3D(t||hp,r)}function wM(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTextureCube(t||fp,r)}function TM(e,t,n){let i=this.cache,r=n.allocateTextureUnit();if(i[0]!==r)e.uniform1i(this.addr,r),i[0]=r;n.setTexture2DArray(t||up,r)}function EM(e){switch(e){case 5126:return aM;case 35664:return cM;case 35665:return lM;case 35666:return uM;case 35674:return hM;case 35675:return fM;case 35676:return dM;case 5124:case 35670:return pM;case 35667:case 35671:return mM;case 35668:case 35672:return gM;case 35669:case 35673:return _M;case 5125:return xM;case 36294:return vM;case 36295:return yM;case 36296:return bM;case 35678:case 36198:case 36298:case 36306:case 35682:return SM;case 35679:case 36299:case 36307:return MM;case 35680:case 36300:case 36308:case 36293:return wM;case 36289:case 36303:case 36311:case 36292:return TM}}function AM(e,t){e.uniform1fv(this.addr,t)}function RM(e,t){let n=cs(t,this.size,2);e.uniform2fv(this.addr,n)}function CM(e,t){let n=cs(t,this.size,3);e.uniform3fv(this.addr,n)}function PM(e,t){let n=cs(t,this.size,4);e.uniform4fv(this.addr,n)}function IM(e,t){let n=cs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function LM(e,t){let n=cs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function NM(e,t){let n=cs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function DM(e,t){e.uniform1iv(this.addr,t)}function OM(e,t){e.uniform2iv(this.addr,t)}function UM(e,t){e.uniform3iv(this.addr,t)}function FM(e,t){e.uniform4iv(this.addr,t)}function zM(e,t){e.uniform1uiv(this.addr,t)}function kM(e,t){e.uniform2uiv(this.addr,t)}function BM(e,t){e.uniform3uiv(this.addr,t)}function GM(e,t){e.uniform4uiv(this.addr,t)}function HM(e,t,n){let i=this.cache,r=t.length,s=Pa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);let o;if(this.type===e.SAMPLER_2D_SHADOW)o=mu;else o=lp;for(let a=0;a!==r;++a)n.setTexture2D(t[a]||o,s[a])}function VM(e,t,n){let i=this.cache,r=t.length,s=Pa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTexture3D(t[o]||hp,s[o])}function WM(e,t,n){let i=this.cache,r=t.length,s=Pa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTextureCube(t[o]||fp,s[o])}function $M(e,t,n){let i=this.cache,r=t.length,s=Pa(n,r);if(!Lt(i,s))e.uniform1iv(this.addr,s),Nt(i,s);for(let o=0;o!==r;++o)n.setTexture2DArray(t[o]||up,s[o])}function ZM(e){switch(e){case 5126:return AM;case 35664:return RM;case 35665:return CM;case 35666:return PM;case 35674:return IM;case 35675:return LM;case 35676:return NM;case 5124:case 35670:return DM;case 35667:case 35671:return OM;case 35668:case 35672:return UM;case 35669:case 35673:return FM;case 5125:return zM;case 36294:return kM;case 36295:return BM;case 36296:return GM;case 35678:case 36198:case 36298:case 36306:case 35682:return HM;case 35679:case 36299:case 36307:return VM;case 35680:case 36300:case 36308:case 36293:return WM;case 36289:case 36303:case 36311:case 36292:return $M}}class dp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=EM(t.type)}}class pp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ZM(t.type)}}class mp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,s=i.length;r!==s;++r){let o=i[r];o.setValue(e,t[o.id],n)}}}var du=/(\w+)(\])?(\[|\.)?/g;function Yd(e,t){e.seq.push(t),e.map[t.id]=t}function XM(e,t,n){let i=e.name,r=i.length;du.lastIndex=0;while(!0){let s=du.exec(i),o=du.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c)a=a|0;if(l===void 0||l==="["&&o+2===r){Yd(n,l===void 0?new dp(a,e,t):new pp(a,e,t));break}else{let h=n.map[a];if(h===void 0)h=new mp(a),Yd(n,h);n=h}}}class qs{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){let o=e.getActiveUniform(t,s),a=e.getUniformLocation(t,o.name);XM(o,a,this)}let i=[],r=[];for(let s of this.seq)if(s.type===e.SAMPLER_2D_SHADOW||s.type===e.SAMPLER_CUBE_SHADOW||s.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(s);else r.push(s);if(i.length>0)this.seq=i.concat(r)}setValue(e,t,n,i){let r=this.map[t];if(r!==void 0)r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){let o=t[r],a=n[o.id];if(a.needsUpdate!==!1)o.setValue(e,a.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let s=e[i];if(s.id in t)n.push(s)}return n}}function jd(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var qM=37297,YM=0;function jM(e,t){let n=e.split(`
`),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let o=r;o<s;o++){let a=o+1;i.push(`${a===t?">":" "} ${a}: ${n[o]}`)}return i.join(`
-`)}var hd=new De;function IS(e){Ve._getMatrix(hd,Ve.workingColorSpace,e);let t=`mat3( ${hd.elements.map((n)=>n.toFixed(4))} )`;switch(Ve.getTransfer(e)){case gl:return[t,"LinearTransferOETF"];case ut:return[t,"sRGBTransferOETF"];default:return Me("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function fd(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),s=(e.getShaderInfoLog(t)||"").trim();if(i&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return n.toUpperCase()+`
+`)}var Jd=new De;function JM(e){Ve._getMatrix(Jd,Ve.workingColorSpace,e);let t=`mat3( ${Jd.elements.map((n)=>n.toFixed(4))} )`;switch(Ve.getTransfer(e)){case zl:return[t,"LinearTransferOETF"];case ut:return[t,"sRGBTransferOETF"];default:return Me("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function Kd(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),s=(e.getShaderInfoLog(t)||"").trim();if(i&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return n.toUpperCase()+`
`+s+`
-`+PS(e.getShaderSource(t),a)}else return s}function LS(e,t){let n=IS(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
-`)}var NS={[Tc]:"Linear",[Ec]:"Reinhard",[Ac]:"Cineon",[vs]:"ACESFilmic",[Cc]:"AgX",[Pc]:"Neutral",[Rc]:"Custom"};function DS(e,t){let n=NS[t];if(n===void 0)return Me("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var ga=new N;function US(){Ve.getLuminanceCoefficients(ga);let e=ga.x.toFixed(4),t=ga.y.toFixed(4),n=ga.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join(`
-`)}function OS(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ks).join(`
-`)}function FS(e){let t=[];for(let n in e){let i=e[n];if(i===!1)continue;t.push("#define "+n+" "+i)}return t.join(`
-`)}function zS(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let s=e.getActiveAttrib(t,r),o=s.name,a=1;if(s.type===e.FLOAT_MAT2)a=2;if(s.type===e.FLOAT_MAT3)a=3;if(s.type===e.FLOAT_MAT4)a=4;n[o]={type:s.type,location:e.getAttribLocation(t,o),locationSize:a}}return n}function ks(e){return e!==""}function dd(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function pd(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var kS=/^[ \t]*#include +<([\w\d./]+)>/gm;function ql(e){return e.replace(kS,GS)}var BS=new Map;function GS(e,t){let n=Ge[t];if(n===void 0){let i=BS.get(t);if(i!==void 0)n=Ge[i],Me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return ql(n)}var HS=/#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 md(e){return e.replace(HS,VS)}function VS(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function gd(e){let t=`precision ${e.precision} float;
+`+jM(e.getShaderSource(t),a)}else return s}function KM(e,t){let n=JM(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
+`)}var QM={[Xc]:"Linear",[qc]:"Reinhard",[Yc]:"Cineon",[As]:"ACESFilmic",[Jc]:"AgX",[Kc]:"Neutral",[jc]:"Custom"};function ew(e,t){let n=QM[t];if(n===void 0)return Me("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var Ra=new N;function tw(){Ve.getLuminanceCoefficients(Ra);let e=Ra.x.toFixed(4),t=Ra.y.toFixed(4),n=Ra.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join(`
+`)}function nw(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Xs).join(`
+`)}function iw(e){let t=[];for(let n in e){let i=e[n];if(i===!1)continue;t.push("#define "+n+" "+i)}return t.join(`
+`)}function rw(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let s=e.getActiveAttrib(t,r),o=s.name,a=1;if(s.type===e.FLOAT_MAT2)a=2;if(s.type===e.FLOAT_MAT3)a=3;if(s.type===e.FLOAT_MAT4)a=4;n[o]={type:s.type,location:e.getAttribLocation(t,o),locationSize:a}}return n}function Xs(e){return e!==""}function Qd(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ep(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var sw=/^[ \t]*#include +<([\w\d./]+)>/gm;function gu(e){return e.replace(sw,aw)}var ow=new Map;function aw(e,t){let n=Ge[t];if(n===void 0){let i=ow.get(t);if(i!==void 0)n=Ge[i],Me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return gu(n)}var cw=/#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 tp(e){return e.replace(cw,lw)}function lw(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function np(e){let t=`precision ${e.precision} float;
precision ${e.precision} int;
precision ${e.precision} sampler2D;
precision ${e.precision} samplerCube;
@@ -4151,30 +4151,30 @@ void main() {
`;if(e.precision==="highp")t+=`
#define HIGH_PRECISION`;else if(e.precision==="mediump")t+=`
#define MEDIUM_PRECISION`;else if(e.precision==="lowp")t+=`
-#define LOW_PRECISION`;return t}var WS={[_s]:"SHADOWMAP_TYPE_PCF",[kr]:"SHADOWMAP_TYPE_VSM"};function $S(e){return WS[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var ZS={[Gr]:"ENVMAP_TYPE_CUBE",[nr]:"ENVMAP_TYPE_CUBE",[ys]:"ENVMAP_TYPE_CUBE_UV"};function XS(e){if(e.envMap===!1)return"ENVMAP_TYPE_CUBE";return ZS[e.envMapMode]||"ENVMAP_TYPE_CUBE"}var qS={[nr]:"ENVMAP_MODE_REFRACTION"};function YS(e){if(e.envMap===!1)return"ENVMAP_MODE_REFLECTION";return qS[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}var jS={[wf]:"ENVMAP_BLENDING_MULTIPLY",[Tf]:"ENVMAP_BLENDING_MIX",[Ef]:"ENVMAP_BLENDING_ADD"};function JS(e){if(e.envMap===!1)return"ENVMAP_BLENDING_NONE";return jS[e.combine]||"ENVMAP_BLENDING_NONE"}function KS(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function QS(e,t,n,i){let r=e.getContext(),{defines:s,vertexShader:o,fragmentShader:a}=n,c=$S(n),l=XS(n),u=YS(n),f=JS(n),h=KS(n),d=OS(n),g=FS(s),b=r.createProgram(),p,m,A=n.glslVersion?"#version "+n.glslVersion+`
-`:"";if(n.isRawShaderMaterial){if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(ks).join(`
+#define LOW_PRECISION`;return t}var uw={[Ts]:"SHADOWMAP_TYPE_PCF",[Zr]:"SHADOWMAP_TYPE_VSM"};function hw(e){return uw[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var fw={[qr]:"ENVMAP_TYPE_CUBE",[ur]:"ENVMAP_TYPE_CUBE",[Rs]:"ENVMAP_TYPE_CUBE_UV"};function dw(e){if(e.envMap===!1)return"ENVMAP_TYPE_CUBE";return fw[e.envMapMode]||"ENVMAP_TYPE_CUBE"}var pw={[ur]:"ENVMAP_MODE_REFRACTION"};function mw(e){if(e.envMap===!1)return"ENVMAP_MODE_REFLECTION";return pw[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}var gw={[ud]:"ENVMAP_BLENDING_MULTIPLY",[hd]:"ENVMAP_BLENDING_MIX",[fd]:"ENVMAP_BLENDING_ADD"};function _w(e){if(e.envMap===!1)return"ENVMAP_BLENDING_NONE";return gw[e.combine]||"ENVMAP_BLENDING_NONE"}function xw(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function vw(e,t,n,i){let r=e.getContext(),{defines:s,vertexShader:o,fragmentShader:a}=n,c=hw(n),l=dw(n),u=mw(n),h=_w(n),f=xw(n),d=nw(n),m=iw(s),x=r.createProgram(),p,g,A=n.glslVersion?"#version "+n.glslVersion+`
+`:"";if(n.isRawShaderMaterial){if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Xs).join(`
`),p.length>0)p+=`
-`;if(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(ks).join(`
-`),m.length>0)m+=`
-`}else p=[gd(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,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 "+u:"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",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&&n.flatShading===!1?"#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 "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
-`].filter(ks).join(`
-`),m=[gd(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,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 "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pn?"#define TONE_MAPPING":"",n.toneMapping!==Pn?Ge.tonemapping_pars_fragment:"",n.toneMapping!==Pn?DS("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ge.colorspace_pars_fragment,LS("linearToOutputTexel",n.outputColorSpace),US(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
-`].filter(ks).join(`
-`);if(o=ql(o),o=dd(o,n),o=pd(o,n),a=ql(a),a=dd(a,n),a=pd(a,n),o=md(o),a=md(a),n.isRawShaderMaterial!==!0)A=`#version 300 es
+`;if(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Xs).join(`
+`),g.length>0)g+=`
+`}else p=[np(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,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 "+u:"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",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&&n.flatShading===!1?"#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 "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
+`].filter(Xs).join(`
+`),g=[np(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,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 "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Dn?"#define TONE_MAPPING":"",n.toneMapping!==Dn?Ge.tonemapping_pars_fragment:"",n.toneMapping!==Dn?ew("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ge.colorspace_pars_fragment,KM("linearToOutputTexel",n.outputColorSpace),tw(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
+`].filter(Xs).join(`
+`);if(o=gu(o),o=Qd(o,n),o=ep(o,n),a=gu(a),a=Qd(a,n),a=ep(a,n),o=tp(o),a=tp(a),n.isRawShaderMaterial!==!0)A=`#version 300 es
`,p=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
-`+p,m=["#define varying in",n.glslVersion===_l?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===_l?"":"#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(`
+`+p,g=["#define varying in",n.glslVersion===kl?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===kl?"":"#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(`
`)+`
-`+m;let T=A+p+o,v=A+m+a,w=ud(r,r.VERTEX_SHADER,T),E=ud(r,r.FRAGMENT_SHADER,v);if(r.attachShader(b,w),r.attachShader(b,E),n.index0AttributeName!==void 0)r.bindAttribLocation(b,0,n.index0AttributeName);else if(n.hasPositionAttribute===!0)r.bindAttribLocation(b,0,"position");r.linkProgram(b);function R(C){if(e.debug.checkShaderErrors){let z=r.getProgramInfoLog(b)||"",J=r.getShaderInfoLog(w)||"",O=r.getShaderInfoLog(E)||"",H=z.trim(),V=J.trim(),U=O.trim(),K=!0,Q=!0;if(r.getProgramParameter(b,r.LINK_STATUS)===!1)if(K=!1,typeof e.debug.onShaderError==="function")e.debug.onShaderError(r,b,w,E);else{let se=fd(r,w,"vertex"),me=fd(r,E,"fragment");Ne("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(b,r.VALIDATE_STATUS)+`
+`+g;let E=A+p+o,y=A+g+a,w=jd(r,r.VERTEX_SHADER,E),T=jd(r,r.FRAGMENT_SHADER,y);if(r.attachShader(x,w),r.attachShader(x,T),n.index0AttributeName!==void 0)r.bindAttribLocation(x,0,n.index0AttributeName);else if(n.hasPositionAttribute===!0)r.bindAttribLocation(x,0,"position");r.linkProgram(x);function R(C){if(e.debug.checkShaderErrors){let z=r.getProgramInfoLog(x)||"",j=r.getShaderInfoLog(w)||"",F=r.getShaderInfoLog(T)||"",H=z.trim(),V=j.trim(),O=F.trim(),K=!0,Q=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(K=!1,typeof e.debug.onShaderError==="function")e.debug.onShaderError(r,x,w,T);else{let se=Kd(r,w,"vertex"),me=Kd(r,T,"fragment");Ne("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
Material Name: `+C.name+`
Material Type: `+C.type+`
Program Info Log: `+H+`
`+se+`
-`+me)}else if(H!=="")Me("WebGLProgram: Program Info Log:",H);else if(V===""||U==="")Q=!1;if(Q)C.diagnostics={runnable:K,programLog:H,vertexShader:{log:V,prefix:p},fragmentShader:{log:U,prefix:m}}}r.deleteShader(w),r.deleteShader(E),_=new Bs(r,b),S=zS(r,b)}let _;this.getUniforms=function(){if(_===void 0)R(this);return _};let S;this.getAttributes=function(){if(S===void 0)R(this);return S};let F=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(F===!1)F=r.getProgramParameter(b,RS);return F},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=CS++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=w,this.fragmentShader=E,this}var eM=0;class Pd{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new Id(e),t.set(e,n);return n}}class Id{constructor(e){this.id=eM++,this.code=e,this.usedTimes=0}}function tM(e){return e===or||e===Wo||e===$o}function nM(e,t,n,i,r,s){let o=new jo,a=new Pd,c=new Set,l=[],u=new Map,{logarithmicDepthBuffer:f,precision:h}=i,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 g(_){if(c.add(_),_===0)return"uv";return`uv${_}`}function b(_,S,F,C,z,J){let O=C.fog,H=z.geometry,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?C.environment:null,U=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,K=t.get(_.envMap||V,U),Q=!!K&&K.mapping===ys?K.image.height:null,se=d[_.type];if(_.precision!==null){if(h=i.getMaxPrecision(_.precision),h!==_.precision)Me("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead.")}let me=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,_e=me!==void 0?me.length:0,Xe=0;if(H.morphAttributes.position!==void 0)Xe=1;if(H.morphAttributes.normal!==void 0)Xe=2;if(H.morphAttributes.color!==void 0)Xe=3;let Be,Z,ne,fe;if(se){let Oe=qn[se];Be=Oe.vertexShader,Z=Oe.fragmentShader}else{Be=_.vertexShader,Z=_.fragmentShader;let Oe=a.getVertexShaderStage(_),yt=a.getFragmentShaderStage(_);a.update(_,Oe,yt),ne=Oe.id,fe=yt.id}let de=e.getRenderTarget(),Re=e.state.buffers.depth.getReversed(),$e=z.isInstancedMesh===!0,Ue=z.isBatchedMesh===!0,ze=!!_.map,Je=!!_.matcap,qe=!!K,je=!!_.aoMap,Ut=!!_.lightMap,pn=!!_.bumpMap&&_.wireframe===!1,pt=!!_.normalMap,Gt=!!_.displacementMap,Ot=!!_.emissiveMap,Ct=!!_.metalnessMap,L=!!_.roughnessMap,mn=_.anisotropy>0,tt=_.clearcoat>0,mt=_.dispersion>0,M=_.iridescence>0,x=_.sheen>0,P=_.transmission>0,W=mn&&!!_.anisotropyMap,te=tt&&!!_.clearcoatMap,ie=tt&&!!_.clearcoatNormalMap,le=tt&&!!_.clearcoatRoughnessMap,X=M&&!!_.iridescenceMap,j=M&&!!_.iridescenceThicknessMap,xe=x&&!!_.sheenColorMap,we=x&&!!_.sheenRoughnessMap,ue=!!_.specularMap,re=!!_.specularColorMap,Ce=!!_.specularIntensityMap,Ie=P&&!!_.transmissionMap,Qe=P&&!!_.thicknessMap,I=!!_.gradientMap,oe=!!_.alphaMap,Y=_.alphaTest>0,ae=!!_.alphaHash,ve=!!_.extensions,ee=Pn;if(_.toneMapped){if(de===null||de.isXRRenderTarget===!0)ee=e.toneMapping}let ce={shaderID:se,shaderType:_.type,shaderName:_.name,vertexShader:Be,fragmentShader:Z,defines:_.defines,customVertexShaderID:ne,customFragmentShaderID:fe,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Ue,batchingColor:Ue&&z._colorsTexture!==null,instancing:$e,instancingColor:$e&&z.instanceColor!==null,instancingMorph:$e&&z.morphTexture!==null,outputColorSpace:de===null?e.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:Ve.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ze,matcap:Je,envMap:qe,envMapMode:qe&&K.mapping,envMapCubeUVHeight:Q,aoMap:je,lightMap:Ut,bumpMap:pn,normalMap:pt,displacementMap:Gt,emissiveMap:Ot,normalMapObjectSpace:pt&&_.normalMapType===Df,normalMapTangentSpace:pt&&_.normalMapType===ml,packedNormalMap:pt&&_.normalMapType===ml&&tM(_.normalMap.format),metalnessMap:Ct,roughnessMap:L,anisotropy:mn,anisotropyMap:W,clearcoat:tt,clearcoatMap:te,clearcoatNormalMap:ie,clearcoatRoughnessMap:le,dispersion:mt,iridescence:M,iridescenceMap:X,iridescenceThicknessMap:j,sheen:x,sheenColorMap:xe,sheenRoughnessMap:we,specularMap:ue,specularColorMap:re,specularIntensityMap:Ce,transmission:P,transmissionMap:Ie,thicknessMap:Qe,gradientMap:I,opaque:_.transparent===!1&&_.blending===xs&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Y,alphaHash:ae,combine:_.combine,mapUv:ze&&g(_.map.channel),aoMapUv:je&&g(_.aoMap.channel),lightMapUv:Ut&&g(_.lightMap.channel),bumpMapUv:pn&&g(_.bumpMap.channel),normalMapUv:pt&&g(_.normalMap.channel),displacementMapUv:Gt&&g(_.displacementMap.channel),emissiveMapUv:Ot&&g(_.emissiveMap.channel),metalnessMapUv:Ct&&g(_.metalnessMap.channel),roughnessMapUv:L&&g(_.roughnessMap.channel),anisotropyMapUv:W&&g(_.anisotropyMap.channel),clearcoatMapUv:te&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:ie&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:le&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:j&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:we&&g(_.sheenRoughnessMap.channel),specularMapUv:ue&&g(_.specularMap.channel),specularColorMapUv:re&&g(_.specularColorMap.channel),specularIntensityMapUv:Ce&&g(_.specularIntensityMap.channel),transmissionMapUv:Ie&&g(_.transmissionMap.channel),thicknessMapUv:Qe&&g(_.thicknessMap.channel),alphaMapUv:oe&&g(_.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(pt||mn),vertexNormals:!!H.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!H.attributes.uv&&(ze||oe),fog:!!O,useFog:_.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||H.attributes.normal===void 0&&pt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Re,skinning:z.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Xe,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:J.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&F.length>0,shadowMapType:e.shadowMap.type,toneMapping:ee,decodeVideoTexture:ze&&_.map.isVideoTexture===!0&&Ve.getTransfer(_.map.colorSpace)===ut,decodeVideoTextureEmissive:Ot&&_.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(_.emissiveMap.colorSpace)===ut,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===vn,flipSided:_.side===Xt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ve&&_.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&_.extensions.multiDraw===!0||Ue)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ce.vertexUv1s=c.has(1),ce.vertexUv2s=c.has(2),ce.vertexUv3s=c.has(3),c.clear(),ce}function p(_){let S=[];if(_.shaderID)S.push(_.shaderID);else S.push(_.customVertexShaderID),S.push(_.customFragmentShaderID);if(_.defines!==void 0)for(let F in _.defines)S.push(F),S.push(_.defines[F]);if(_.isRawShaderMaterial===!1)m(S,_),A(S,_),S.push(e.outputColorSpace);return S.push(_.customProgramCacheKey),S.join()}function m(_,S){_.push(S.precision),_.push(S.outputColorSpace),_.push(S.envMapMode),_.push(S.envMapCubeUVHeight),_.push(S.mapUv),_.push(S.alphaMapUv),_.push(S.lightMapUv),_.push(S.aoMapUv),_.push(S.bumpMapUv),_.push(S.normalMapUv),_.push(S.displacementMapUv),_.push(S.emissiveMapUv),_.push(S.metalnessMapUv),_.push(S.roughnessMapUv),_.push(S.anisotropyMapUv),_.push(S.clearcoatMapUv),_.push(S.clearcoatNormalMapUv),_.push(S.clearcoatRoughnessMapUv),_.push(S.iridescenceMapUv),_.push(S.iridescenceThicknessMapUv),_.push(S.sheenColorMapUv),_.push(S.sheenRoughnessMapUv),_.push(S.specularMapUv),_.push(S.specularColorMapUv),_.push(S.specularIntensityMapUv),_.push(S.transmissionMapUv),_.push(S.thicknessMapUv),_.push(S.combine),_.push(S.fogExp2),_.push(S.sizeAttenuation),_.push(S.morphTargetsCount),_.push(S.morphAttributeCount),_.push(S.numDirLights),_.push(S.numPointLights),_.push(S.numSpotLights),_.push(S.numSpotLightMaps),_.push(S.numHemiLights),_.push(S.numRectAreaLights),_.push(S.numDirLightShadows),_.push(S.numPointLightShadows),_.push(S.numSpotLightShadows),_.push(S.numSpotLightShadowsWithMaps),_.push(S.numLightProbes),_.push(S.shadowMapType),_.push(S.toneMapping),_.push(S.numClippingPlanes),_.push(S.numClipIntersection),_.push(S.depthPacking)}function A(_,S){if(o.disableAll(),S.instancing)o.enable(0);if(S.instancingColor)o.enable(1);if(S.instancingMorph)o.enable(2);if(S.matcap)o.enable(3);if(S.envMap)o.enable(4);if(S.normalMapObjectSpace)o.enable(5);if(S.normalMapTangentSpace)o.enable(6);if(S.clearcoat)o.enable(7);if(S.iridescence)o.enable(8);if(S.alphaTest)o.enable(9);if(S.vertexColors)o.enable(10);if(S.vertexAlphas)o.enable(11);if(S.vertexUv1s)o.enable(12);if(S.vertexUv2s)o.enable(13);if(S.vertexUv3s)o.enable(14);if(S.vertexTangents)o.enable(15);if(S.anisotropy)o.enable(16);if(S.alphaHash)o.enable(17);if(S.batching)o.enable(18);if(S.dispersion)o.enable(19);if(S.batchingColor)o.enable(20);if(S.gradientMap)o.enable(21);if(S.packedNormalMap)o.enable(22);if(S.vertexNormals)o.enable(23);if(_.push(o.mask),o.disableAll(),S.fog)o.enable(0);if(S.useFog)o.enable(1);if(S.flatShading)o.enable(2);if(S.logarithmicDepthBuffer)o.enable(3);if(S.reversedDepthBuffer)o.enable(4);if(S.skinning)o.enable(5);if(S.morphTargets)o.enable(6);if(S.morphNormals)o.enable(7);if(S.morphColors)o.enable(8);if(S.premultipliedAlpha)o.enable(9);if(S.shadowMapEnabled)o.enable(10);if(S.doubleSided)o.enable(11);if(S.flipSided)o.enable(12);if(S.useDepthPacking)o.enable(13);if(S.dithering)o.enable(14);if(S.transmission)o.enable(15);if(S.sheen)o.enable(16);if(S.opaque)o.enable(17);if(S.pointsUvs)o.enable(18);if(S.decodeVideoTexture)o.enable(19);if(S.decodeVideoTextureEmissive)o.enable(20);if(S.alphaToCoverage)o.enable(21);if(S.numLightProbeGrids>0)o.enable(22);if(S.hasPositionAttribute)o.enable(23);_.push(o.mask)}function T(_){let S=d[_.type],F;if(S){let C=qn[S];F=Zf.clone(C.uniforms)}else F=_.uniforms;return F}function v(_,S){let F=u.get(S);if(F!==void 0)++F.usedTimes;else F=new QS(e,S,_,r),l.push(F),u.set(S,F);return F}function w(_){if(--_.usedTimes===0){let S=l.indexOf(_);l[S]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function E(_){a.remove(_)}function R(){a.dispose()}return{getParameters:b,getProgramCacheKey:p,getUniforms:T,acquireProgram:v,releaseProgram:w,releaseShaderCache:E,programs:l,dispose:R}}function iM(){let e=new WeakMap;function t(o){return e.has(o)}function n(o){let a=e.get(o);if(a===void 0)a={},e.set(o,a);return a}function i(o){e.delete(o)}function r(o,a,c){e.get(o)[a]=c}function s(){e=new WeakMap}return{has:t,get:n,remove:i,update:r,dispose:s}}function rM(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function _d(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function xd(){let e=[],t=0,n=[],i=[],r=[];function s(){t=0,n.length=0,i.length=0,r.length=0}function o(h){let d=0;if(h.isInstancedMesh)d+=2;if(h.isSkinnedMesh)d+=1;return d}function a(h,d,g,b,p,m){let A=e[t];if(A===void 0)A={id:h.id,object:h,geometry:d,material:g,materialVariant:o(h),groupOrder:b,renderOrder:h.renderOrder,z:p,group:m},e[t]=A;else A.id=h.id,A.object=h,A.geometry=d,A.material=g,A.materialVariant=o(h),A.groupOrder=b,A.renderOrder=h.renderOrder,A.z=p,A.group=m;return t++,A}function c(h,d,g,b,p,m){let A=a(h,d,g,b,p,m);if(g.transmission>0)i.push(A);else if(g.transparent===!0)r.push(A);else n.push(A)}function l(h,d,g,b,p,m){let A=a(h,d,g,b,p,m);if(g.transmission>0)i.unshift(A);else if(g.transparent===!0)r.unshift(A);else n.unshift(A)}function u(h,d,g){if(n.length>1)n.sort(h||rM);if(i.length>1)i.sort(d||_d);if(r.length>1)r.sort(d||_d);if(g)n.reverse(),i.reverse(),r.reverse()}function f(){for(let h=t,d=e.length;h<d;h++){let g=e[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:c,unshift:l,finish:f,sort:u}}function sM(){let e=new WeakMap;function t(i,r){let s=e.get(i),o;if(s===void 0)o=new xd,e.set(i,[o]);else if(r>=s.length)o=new xd,s.push(o);else o=s[r];return o}function n(){e=new WeakMap}return{get:t,dispose:n}}function oM(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new N,color:new Le};break;case"SpotLight":n={position:new N,direction:new N,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new N,color:new Le,distance:0,decay:0};break;case"HemisphereLight":n={direction:new N,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":n={color:new Le,position:new N,halfWidth:new N,halfHeight:new N};break}return e[t.id]=n,n}}}function aM(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;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:1000};break}return e[t.id]=n,n}}}var cM=0;function lM(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function uM(e){let t=new oM,n=aM(),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 l=0;l<9;l++)i.probe.push(new N);let r=new N,s=new Fe,o=new Fe;function a(l){let u=0,f=0,h=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let d=0,g=0,b=0,p=0,m=0,A=0,T=0,v=0,w=0,E=0,R=0;l.sort(lM);for(let S=0,F=l.length;S<F;S++){let C=l[S],{color:z,intensity:J,distance:O}=C,H=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===or)H=C.shadow.map.texture;else H=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)u+=z.r*J,f+=z.g*J,h+=z.b*J;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],J);R++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let U=C.shadow,K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.directionalShadow[d]=K,i.directionalShadowMap[d]=H,i.directionalShadowMatrix[d]=C.shadow.matrix,A++}i.directional[d]=V,d++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(z).multiplyScalar(J),V.distance=O,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[b]=V;let U=C.shadow;if(C.map){if(i.spotLightMap[w]=C.map,w++,U.updateMatrices(C),C.castShadow)E++}if(i.spotLightMatrix[b]=U.matrix,C.castShadow){let K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.spotShadow[b]=K,i.spotShadowMap[b]=H,v++}b++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(z).multiplyScalar(J),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let U=C.shadow,K=n.get(C);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,K.shadowCameraNear=U.camera.near,K.shadowCameraFar=U.camera.far,i.pointShadow[g]=K,i.pointShadowMap[g]=H,i.pointShadowMatrix[g]=C.shadow.matrix,T++}i.point[g]=V,g++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(J),V.groundColor.copy(C.groundColor).multiplyScalar(J),i.hemi[m]=V,m++}}if(p>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2;else i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2;i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;let _=i.hash;if(_.directionalLength!==d||_.pointLength!==g||_.spotLength!==b||_.rectAreaLength!==p||_.hemiLength!==m||_.numDirectionalShadows!==A||_.numPointShadows!==T||_.numSpotShadows!==v||_.numSpotMaps!==w||_.numLightProbes!==R)i.directional.length=d,i.spot.length=b,i.rectArea.length=p,i.point.length=g,i.hemi.length=m,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=T,i.pointShadowMap.length=T,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=T,i.spotLightMatrix.length=v+w-E,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=R,_.directionalLength=d,_.pointLength=g,_.spotLength=b,_.rectAreaLength=p,_.hemiLength=m,_.numDirectionalShadows=A,_.numPointShadows=T,_.numSpotShadows=v,_.numSpotMaps=w,_.numLightProbes=R,i.version=cM++}function c(l,u){let f=0,h=0,d=0,g=0,b=0,p=u.matrixWorldInverse;for(let m=0,A=l.length;m<A;m++){let T=l[m];if(T.isDirectionalLight){let v=i.directional[f];v.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),f++}else if(T.isSpotLight){let v=i.spot[d];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),v.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),d++}else if(T.isRectAreaLight){let v=i.rectArea[g];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),o.identity(),s.copy(T.matrixWorld),s.premultiply(p),o.extractRotation(s),v.halfWidth.set(T.width*0.5,0,0),v.halfHeight.set(0,T.height*0.5,0),v.halfWidth.applyMatrix4(o),v.halfHeight.applyMatrix4(o),g++}else if(T.isPointLight){let v=i.point[h];v.position.setFromMatrixPosition(T.matrixWorld),v.position.applyMatrix4(p),h++}else if(T.isHemisphereLight){let v=i.hemi[b];v.direction.setFromMatrixPosition(T.matrixWorld),v.direction.transformDirection(p),b++}}}return{setup:a,setupView:c,state:i}}function vd(e){let t=new uM(e),n=[],i=[],r=[];function s(h){f.camera=h,n.length=0,i.length=0,r.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function c(h){r.push(h)}function l(){t.setup(n)}function u(h){t.setupView(n,h)}let f={lightsArray:n,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function hM(e){let t=new WeakMap;function n(r,s=0){let o=t.get(r),a;if(o===void 0)a=new vd(e),t.set(r,[a]);else if(s>=o.length)a=new vd(e),o.push(a);else a=o[s];return a}function i(){t=new WeakMap}return{get:n,dispose:i}}var fM=`void main() {
+`+me)}else if(H!=="")Me("WebGLProgram: Program Info Log:",H);else if(V===""||O==="")Q=!1;if(Q)C.diagnostics={runnable:K,programLog:H,vertexShader:{log:V,prefix:p},fragmentShader:{log:O,prefix:g}}}r.deleteShader(w),r.deleteShader(T),_=new qs(r,x),S=rw(r,x)}let _;this.getUniforms=function(){if(_===void 0)R(this);return _};let S;this.getAttributes=function(){if(S===void 0)R(this);return S};let U=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(U===!1)U=r.getProgramParameter(x,qM);return U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=YM++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=T,this}var yw=0;class gp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new _p(e),t.set(e,n);return n}}class _p{constructor(e){this.id=yw++,this.code=e,this.usedTimes=0}}function bw(e){return e===pr||e===na||e===ia}function Sw(e,t,n,i,r,s){let o=new ca,a=new gp,c=new Set,l=[],u=new Map,{logarithmicDepthBuffer:h,precision:f}=i,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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(_){if(c.add(_),_===0)return"uv";return`uv${_}`}function x(_,S,U,C,z,j){let F=C.fog,H=z.geometry,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?C.environment:null,O=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,K=t.get(_.envMap||V,O),Q=!!K&&K.mapping===Rs?K.image.height:null,se=d[_.type];if(_.precision!==null){if(f=i.getMaxPrecision(_.precision),f!==_.precision)Me("WebGLProgram.getParameters:",_.precision,"not supported, using",f,"instead.")}let me=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,_e=me!==void 0?me.length:0,Xe=0;if(H.morphAttributes.position!==void 0)Xe=1;if(H.morphAttributes.normal!==void 0)Xe=2;if(H.morphAttributes.color!==void 0)Xe=3;let Be,Z,ne,fe;if(se){let Ue=Kn[se];Be=Ue.vertexShader,Z=Ue.fragmentShader}else{Be=_.vertexShader,Z=_.fragmentShader;let Ue=a.getVertexShaderStage(_),yt=a.getFragmentShaderStage(_);a.update(_,Ue,yt),ne=Ue.id,fe=yt.id}let de=e.getRenderTarget(),Re=e.state.buffers.depth.getReversed(),$e=z.isInstancedMesh===!0,Oe=z.isBatchedMesh===!0,ze=!!_.map,Je=!!_.matcap,qe=!!K,je=!!_.aoMap,Ot=!!_.lightMap,_n=!!_.bumpMap&&_.wireframe===!1,pt=!!_.normalMap,Ht=!!_.displacementMap,Ut=!!_.emissiveMap,Ct=!!_.metalnessMap,L=!!_.roughnessMap,xn=_.anisotropy>0,nt=_.clearcoat>0,mt=_.dispersion>0,M=_.iridescence>0,v=_.sheen>0,P=_.transmission>0,W=xn&&!!_.anisotropyMap,te=nt&&!!_.clearcoatMap,ie=nt&&!!_.clearcoatNormalMap,le=nt&&!!_.clearcoatRoughnessMap,X=M&&!!_.iridescenceMap,J=M&&!!_.iridescenceThicknessMap,xe=v&&!!_.sheenColorMap,we=v&&!!_.sheenRoughnessMap,ue=!!_.specularMap,re=!!_.specularColorMap,Ce=!!_.specularIntensityMap,Ie=P&&!!_.transmissionMap,Qe=P&&!!_.thicknessMap,I=!!_.gradientMap,oe=!!_.alphaMap,Y=_.alphaTest>0,ae=!!_.alphaHash,ve=!!_.extensions,ee=Dn;if(_.toneMapped){if(de===null||de.isXRRenderTarget===!0)ee=e.toneMapping}let ce={shaderID:se,shaderType:_.type,shaderName:_.name,vertexShader:Be,fragmentShader:Z,defines:_.defines,customVertexShaderID:ne,customFragmentShaderID:fe,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:f,batching:Oe,batchingColor:Oe&&z._colorsTexture!==null,instancing:$e,instancingColor:$e&&z.instanceColor!==null,instancingMorph:$e&&z.morphTexture!==null,outputColorSpace:de===null?e.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:Ve.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ze,matcap:Je,envMap:qe,envMapMode:qe&&K.mapping,envMapCubeUVHeight:Q,aoMap:je,lightMap:Ot,bumpMap:_n,normalMap:pt,displacementMap:Ht,emissiveMap:Ut,normalMapObjectSpace:pt&&_.normalMapType===yd,normalMapTangentSpace:pt&&_.normalMapType===Fl,packedNormalMap:pt&&_.normalMapType===Fl&&bw(_.normalMap.format),metalnessMap:Ct,roughnessMap:L,anisotropy:xn,anisotropyMap:W,clearcoat:nt,clearcoatMap:te,clearcoatNormalMap:ie,clearcoatRoughnessMap:le,dispersion:mt,iridescence:M,iridescenceMap:X,iridescenceThicknessMap:J,sheen:v,sheenColorMap:xe,sheenRoughnessMap:we,specularMap:ue,specularColorMap:re,specularIntensityMap:Ce,transmission:P,transmissionMap:Ie,thicknessMap:Qe,gradientMap:I,opaque:_.transparent===!1&&_.blending===Es&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Y,alphaHash:ae,combine:_.combine,mapUv:ze&&m(_.map.channel),aoMapUv:je&&m(_.aoMap.channel),lightMapUv:Ot&&m(_.lightMap.channel),bumpMapUv:_n&&m(_.bumpMap.channel),normalMapUv:pt&&m(_.normalMap.channel),displacementMapUv:Ht&&m(_.displacementMap.channel),emissiveMapUv:Ut&&m(_.emissiveMap.channel),metalnessMapUv:Ct&&m(_.metalnessMap.channel),roughnessMapUv:L&&m(_.roughnessMap.channel),anisotropyMapUv:W&&m(_.anisotropyMap.channel),clearcoatMapUv:te&&m(_.clearcoatMap.channel),clearcoatNormalMapUv:ie&&m(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:le&&m(_.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&m(_.iridescenceMap.channel),iridescenceThicknessMapUv:J&&m(_.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&m(_.sheenColorMap.channel),sheenRoughnessMapUv:we&&m(_.sheenRoughnessMap.channel),specularMapUv:ue&&m(_.specularMap.channel),specularColorMapUv:re&&m(_.specularColorMap.channel),specularIntensityMapUv:Ce&&m(_.specularIntensityMap.channel),transmissionMapUv:Ie&&m(_.transmissionMap.channel),thicknessMapUv:Qe&&m(_.thicknessMap.channel),alphaMapUv:oe&&m(_.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(pt||xn),vertexNormals:!!H.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!H.attributes.uv&&(ze||oe),fog:!!F,useFog:_.fog===!0,fogExp2:!!F&&F.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||H.attributes.normal===void 0&&pt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Re,skinning:z.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Xe,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:j.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&U.length>0,shadowMapType:e.shadowMap.type,toneMapping:ee,decodeVideoTexture:ze&&_.map.isVideoTexture===!0&&Ve.getTransfer(_.map.colorSpace)===ut,decodeVideoTextureEmissive:Ut&&_.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(_.emissiveMap.colorSpace)===ut,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Sn,flipSided:_.side===Xt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ve&&_.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&_.extensions.multiDraw===!0||Oe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ce.vertexUv1s=c.has(1),ce.vertexUv2s=c.has(2),ce.vertexUv3s=c.has(3),c.clear(),ce}function p(_){let S=[];if(_.shaderID)S.push(_.shaderID);else S.push(_.customVertexShaderID),S.push(_.customFragmentShaderID);if(_.defines!==void 0)for(let U in _.defines)S.push(U),S.push(_.defines[U]);if(_.isRawShaderMaterial===!1)g(S,_),A(S,_),S.push(e.outputColorSpace);return S.push(_.customProgramCacheKey),S.join()}function g(_,S){_.push(S.precision),_.push(S.outputColorSpace),_.push(S.envMapMode),_.push(S.envMapCubeUVHeight),_.push(S.mapUv),_.push(S.alphaMapUv),_.push(S.lightMapUv),_.push(S.aoMapUv),_.push(S.bumpMapUv),_.push(S.normalMapUv),_.push(S.displacementMapUv),_.push(S.emissiveMapUv),_.push(S.metalnessMapUv),_.push(S.roughnessMapUv),_.push(S.anisotropyMapUv),_.push(S.clearcoatMapUv),_.push(S.clearcoatNormalMapUv),_.push(S.clearcoatRoughnessMapUv),_.push(S.iridescenceMapUv),_.push(S.iridescenceThicknessMapUv),_.push(S.sheenColorMapUv),_.push(S.sheenRoughnessMapUv),_.push(S.specularMapUv),_.push(S.specularColorMapUv),_.push(S.specularIntensityMapUv),_.push(S.transmissionMapUv),_.push(S.thicknessMapUv),_.push(S.combine),_.push(S.fogExp2),_.push(S.sizeAttenuation),_.push(S.morphTargetsCount),_.push(S.morphAttributeCount),_.push(S.numDirLights),_.push(S.numPointLights),_.push(S.numSpotLights),_.push(S.numSpotLightMaps),_.push(S.numHemiLights),_.push(S.numRectAreaLights),_.push(S.numDirLightShadows),_.push(S.numPointLightShadows),_.push(S.numSpotLightShadows),_.push(S.numSpotLightShadowsWithMaps),_.push(S.numLightProbes),_.push(S.shadowMapType),_.push(S.toneMapping),_.push(S.numClippingPlanes),_.push(S.numClipIntersection),_.push(S.depthPacking)}function A(_,S){if(o.disableAll(),S.instancing)o.enable(0);if(S.instancingColor)o.enable(1);if(S.instancingMorph)o.enable(2);if(S.matcap)o.enable(3);if(S.envMap)o.enable(4);if(S.normalMapObjectSpace)o.enable(5);if(S.normalMapTangentSpace)o.enable(6);if(S.clearcoat)o.enable(7);if(S.iridescence)o.enable(8);if(S.alphaTest)o.enable(9);if(S.vertexColors)o.enable(10);if(S.vertexAlphas)o.enable(11);if(S.vertexUv1s)o.enable(12);if(S.vertexUv2s)o.enable(13);if(S.vertexUv3s)o.enable(14);if(S.vertexTangents)o.enable(15);if(S.anisotropy)o.enable(16);if(S.alphaHash)o.enable(17);if(S.batching)o.enable(18);if(S.dispersion)o.enable(19);if(S.batchingColor)o.enable(20);if(S.gradientMap)o.enable(21);if(S.packedNormalMap)o.enable(22);if(S.vertexNormals)o.enable(23);if(_.push(o.mask),o.disableAll(),S.fog)o.enable(0);if(S.useFog)o.enable(1);if(S.flatShading)o.enable(2);if(S.logarithmicDepthBuffer)o.enable(3);if(S.reversedDepthBuffer)o.enable(4);if(S.skinning)o.enable(5);if(S.morphTargets)o.enable(6);if(S.morphNormals)o.enable(7);if(S.morphColors)o.enable(8);if(S.premultipliedAlpha)o.enable(9);if(S.shadowMapEnabled)o.enable(10);if(S.doubleSided)o.enable(11);if(S.flipSided)o.enable(12);if(S.useDepthPacking)o.enable(13);if(S.dithering)o.enable(14);if(S.transmission)o.enable(15);if(S.sheen)o.enable(16);if(S.opaque)o.enable(17);if(S.pointsUvs)o.enable(18);if(S.decodeVideoTexture)o.enable(19);if(S.decodeVideoTextureEmissive)o.enable(20);if(S.alphaToCoverage)o.enable(21);if(S.numLightProbeGrids>0)o.enable(22);if(S.hasPositionAttribute)o.enable(23);_.push(o.mask)}function E(_){let S=d[_.type],U;if(S){let C=Kn[S];U=Ld.clone(C.uniforms)}else U=_.uniforms;return U}function y(_,S){let U=u.get(S);if(U!==void 0)++U.usedTimes;else U=new vw(e,S,_,r),l.push(U),u.set(S,U);return U}function w(_){if(--_.usedTimes===0){let S=l.indexOf(_);l[S]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function T(_){a.remove(_)}function R(){a.dispose()}return{getParameters:x,getProgramCacheKey:p,getUniforms:E,acquireProgram:y,releaseProgram:w,releaseShaderCache:T,programs:l,dispose:R}}function Mw(){let e=new WeakMap;function t(o){return e.has(o)}function n(o){let a=e.get(o);if(a===void 0)a={},e.set(o,a);return a}function i(o){e.delete(o)}function r(o,a,c){e.get(o)[a]=c}function s(){e=new WeakMap}return{has:t,get:n,remove:i,update:r,dispose:s}}function ww(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function ip(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function rp(){let e=[],t=0,n=[],i=[],r=[];function s(){t=0,n.length=0,i.length=0,r.length=0}function o(f){let d=0;if(f.isInstancedMesh)d+=2;if(f.isSkinnedMesh)d+=1;return d}function a(f,d,m,x,p,g){let A=e[t];if(A===void 0)A={id:f.id,object:f,geometry:d,material:m,materialVariant:o(f),groupOrder:x,renderOrder:f.renderOrder,z:p,group:g},e[t]=A;else A.id=f.id,A.object=f,A.geometry=d,A.material=m,A.materialVariant=o(f),A.groupOrder=x,A.renderOrder=f.renderOrder,A.z=p,A.group=g;return t++,A}function c(f,d,m,x,p,g){let A=a(f,d,m,x,p,g);if(m.transmission>0)i.push(A);else if(m.transparent===!0)r.push(A);else n.push(A)}function l(f,d,m,x,p,g){let A=a(f,d,m,x,p,g);if(m.transmission>0)i.unshift(A);else if(m.transparent===!0)r.unshift(A);else n.unshift(A)}function u(f,d,m){if(n.length>1)n.sort(f||ww);if(i.length>1)i.sort(d||ip);if(r.length>1)r.sort(d||ip);if(m)n.reverse(),i.reverse(),r.reverse()}function h(){for(let f=t,d=e.length;f<d;f++){let m=e[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:c,unshift:l,finish:h,sort:u}}function Tw(){let e=new WeakMap;function t(i,r){let s=e.get(i),o;if(s===void 0)o=new rp,e.set(i,[o]);else if(r>=s.length)o=new rp,s.push(o);else o=s[r];return o}function n(){e=new WeakMap}return{get:t,dispose:n}}function Ew(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new N,color:new Le};break;case"SpotLight":n={position:new N,direction:new N,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new N,color:new Le,distance:0,decay:0};break;case"HemisphereLight":n={direction:new N,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":n={color:new Le,position:new N,halfWidth:new N,halfHeight:new N};break}return e[t.id]=n,n}}}function Aw(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;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:1000};break}return e[t.id]=n,n}}}var Rw=0;function Cw(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Pw(e){let t=new Ew,n=Aw(),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 l=0;l<9;l++)i.probe.push(new N);let r=new N,s=new Fe,o=new Fe;function a(l){let u=0,h=0,f=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let d=0,m=0,x=0,p=0,g=0,A=0,E=0,y=0,w=0,T=0,R=0;l.sort(Cw);for(let S=0,U=l.length;S<U;S++){let C=l[S],{color:z,intensity:j,distance:F}=C,H=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===pr)H=C.shadow.map.texture;else H=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)u+=z.r*j,h+=z.g*j,f+=z.b*j;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],j);R++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let O=C.shadow,K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,i.directionalShadow[d]=K,i.directionalShadowMap[d]=H,i.directionalShadowMatrix[d]=C.shadow.matrix,A++}i.directional[d]=V,d++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(z).multiplyScalar(j),V.distance=F,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[x]=V;let O=C.shadow;if(C.map){if(i.spotLightMap[w]=C.map,w++,O.updateMatrices(C),C.castShadow)T++}if(i.spotLightMatrix[x]=O.matrix,C.castShadow){let K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,i.spotShadow[x]=K,i.spotShadowMap[x]=H,y++}x++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(z).multiplyScalar(j),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let O=C.shadow,K=n.get(C);K.shadowIntensity=O.intensity,K.shadowBias=O.bias,K.shadowNormalBias=O.normalBias,K.shadowRadius=O.radius,K.shadowMapSize=O.mapSize,K.shadowCameraNear=O.camera.near,K.shadowCameraFar=O.camera.far,i.pointShadow[m]=K,i.pointShadowMap[m]=H,i.pointShadowMatrix[m]=C.shadow.matrix,E++}i.point[m]=V,m++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(j),V.groundColor.copy(C.groundColor).multiplyScalar(j),i.hemi[g]=V,g++}}if(p>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2;else i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2;i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=f;let _=i.hash;if(_.directionalLength!==d||_.pointLength!==m||_.spotLength!==x||_.rectAreaLength!==p||_.hemiLength!==g||_.numDirectionalShadows!==A||_.numPointShadows!==E||_.numSpotShadows!==y||_.numSpotMaps!==w||_.numLightProbes!==R)i.directional.length=d,i.spot.length=x,i.rectArea.length=p,i.point.length=m,i.hemi.length=g,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=E,i.pointShadowMap.length=E,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=E,i.spotLightMatrix.length=y+w-T,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=T,i.numLightProbes=R,_.directionalLength=d,_.pointLength=m,_.spotLength=x,_.rectAreaLength=p,_.hemiLength=g,_.numDirectionalShadows=A,_.numPointShadows=E,_.numSpotShadows=y,_.numSpotMaps=w,_.numLightProbes=R,i.version=Rw++}function c(l,u){let h=0,f=0,d=0,m=0,x=0,p=u.matrixWorldInverse;for(let g=0,A=l.length;g<A;g++){let E=l[g];if(E.isDirectionalLight){let y=i.directional[h];y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(p),h++}else if(E.isSpotLight){let y=i.spot[d];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),y.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(p),d++}else if(E.isRectAreaLight){let y=i.rectArea[m];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),o.identity(),s.copy(E.matrixWorld),s.premultiply(p),o.extractRotation(s),y.halfWidth.set(E.width*0.5,0,0),y.halfHeight.set(0,E.height*0.5,0),y.halfWidth.applyMatrix4(o),y.halfHeight.applyMatrix4(o),m++}else if(E.isPointLight){let y=i.point[f];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(p),f++}else if(E.isHemisphereLight){let y=i.hemi[x];y.direction.setFromMatrixPosition(E.matrixWorld),y.direction.transformDirection(p),x++}}}return{setup:a,setupView:c,state:i}}function sp(e){let t=new Pw(e),n=[],i=[],r=[];function s(f){h.camera=f,n.length=0,i.length=0,r.length=0}function o(f){n.push(f)}function a(f){i.push(f)}function c(f){r.push(f)}function l(){t.setup(n)}function u(f){t.setupView(n,f)}let h={lightsArray:n,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:h,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function Iw(e){let t=new WeakMap;function n(r,s=0){let o=t.get(r),a;if(o===void 0)a=new sp(e),t.set(r,[a]);else if(s>=o.length)a=new sp(e),o.push(a);else a=o[s];return a}function i(){t=new WeakMap}return{get:n,dispose:i}}var Lw=`void main() {
gl_Position = vec4( position, 1.0 );
-}`,dM=`uniform sampler2D shadow_pass;
+}`,Nw=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
@@ -4199,12 +4199,12 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
-}`,pM=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],mM=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],yd=new Fe,zs=new N,Zl=new N;function gM(e,t,n){let i=new Ps,r=new Pe,s=new Pe,o=new it,a=new El,c=new Al,l={},u=n.maxTextureSize,f={[Ri]:Xt,[Xt]:Ri,[vn]:vn},h=new bn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:fM,fragmentShader:dM}),d=h.clone();d.defines.HORIZONTAL_PASS=1;let g=new Kt;g.setAttribute("position",new It(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let b=new dt(g,h),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=_s;let m=this.type;this.render=function(E,R,_){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(E.length===0)return;if(this.type===Yh)Me("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=_s;let S=e.getRenderTarget(),F=e.getActiveCubeFace(),C=e.getActiveMipmapLevel(),z=e.state;if(z.setBlending(Vn),z.buffers.depth.getReversed()===!0)z.buffers.color.setClear(0,0,0,0);else z.buffers.color.setClear(1,1,1,1);z.buffers.depth.setTest(!0),z.setScissorTest(!1);let J=m!==this.type;if(J)R.traverse(function(O){if(O.material)if(Array.isArray(O.material))O.material.forEach((H)=>H.needsUpdate=!0);else O.material.needsUpdate=!0});for(let O=0,H=E.length;O<H;O++){let V=E[O],U=V.shadow;if(U===void 0){Me("WebGLShadowMap:",V,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;r.copy(U.mapSize);let K=U.getFrameExtents();if(r.multiply(K),s.copy(U.mapSize),r.x>u||r.y>u){if(r.x>u)s.x=Math.floor(u/K.x),r.x=s.x*K.x,U.mapSize.x=s.x;if(r.y>u)s.y=Math.floor(u/K.y),r.y=s.y*K.y,U.mapSize.y=s.y}let Q=e.state.buffers.depth.getReversed();if(U.camera._reversedDepth=Q,U.map===null||J===!0){if(U.map!==null){if(U.map.depthTexture!==null)U.map.depthTexture.dispose(),U.map.depthTexture=null;U.map.dispose()}if(this.type===kr){if(V.isPointLight){Me("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}U.map=new yn(r.x,r.y,{format:or,type:hi,minFilter:kt,magFilter:kt,generateMipmaps:!1}),U.map.texture.name=V.name+".shadowMap",U.map.depthTexture=new Ni(r.x,r.y,ui),U.map.depthTexture.name=V.name+".shadowMapDepth",U.map.depthTexture.format=rr,U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=In,U.map.depthTexture.magFilter=In}else{if(V.isPointLight)U.map=new Yl(r.x),U.map.depthTexture=new Ml(r.x,Ci);else U.map=new yn(r.x,r.y),U.map.depthTexture=new Ni(r.x,r.y,Ci);if(U.map.depthTexture.name=V.name+".shadowMap",U.map.depthTexture.format=rr,this.type===_s)U.map.depthTexture.compareFunction=Q?qo:Xo,U.map.depthTexture.minFilter=kt,U.map.depthTexture.magFilter=kt;else U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=In,U.map.depthTexture.magFilter=In}U.camera.updateProjectionMatrix()}let se=U.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me<se;me++){if(U.map.isWebGLCubeRenderTarget)e.setRenderTarget(U.map,me),e.clear();else{if(me===0)e.setRenderTarget(U.map),e.clear();let _e=U.getViewport(me);o.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),z.viewport(o)}if(V.isPointLight){let{camera:_e,matrix:Xe}=U,Be=V.distance||_e.far;if(Be!==_e.far)_e.far=Be,_e.updateProjectionMatrix();zs.setFromMatrixPosition(V.matrixWorld),_e.position.copy(zs),Zl.copy(_e.position),Zl.add(pM[me]),_e.up.copy(mM[me]),_e.lookAt(Zl),_e.updateMatrixWorld(),Xe.makeTranslation(-zs.x,-zs.y,-zs.z),yd.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),U._frustum.setFromProjectionMatrix(yd,_e.coordinateSystem,_e.reversedDepth)}else U.updateMatrices(V);i=U.getFrustum(),v(R,_,U.camera,V,this.type)}if(U.isPointLightShadow!==!0&&this.type===kr)A(U,_);U.needsUpdate=!1}m=this.type,p.needsUpdate=!1,e.setRenderTarget(S,F,C)};function A(E,R){let _=t.update(b);if(h.defines.VSM_SAMPLES!==E.blurSamples)h.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,h.needsUpdate=!0,d.needsUpdate=!0;if(E.mapPass===null)E.mapPass=new yn(r.x,r.y,{format:or,type:hi});h.uniforms.shadow_pass.value=E.map.depthTexture,h.uniforms.resolution.value=E.mapSize,h.uniforms.radius.value=E.radius,e.setRenderTarget(E.mapPass),e.clear(),e.renderBufferDirect(R,null,_,h,b,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,e.setRenderTarget(E.map),e.clear(),e.renderBufferDirect(R,null,_,d,b,null)}function T(E,R,_,S){let F=null,C=_.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(C!==void 0)F=C;else if(F=_.isPointLight===!0?c:a,e.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){let z=F.uuid,J=R.uuid,O=l[z];if(O===void 0)O={},l[z]=O;let H=O[J];if(H===void 0)H=F.clone(),O[J]=H,R.addEventListener("dispose",w);F=H}if(F.visible=R.visible,F.wireframe=R.wireframe,S===kr)F.side=R.shadowSide!==null?R.shadowSide:R.side;else F.side=R.shadowSide!==null?R.shadowSide:f[R.side];if(F.alphaMap=R.alphaMap,F.alphaTest=R.alphaToCoverage===!0?0.5:R.alphaTest,F.map=R.map,F.clipShadows=R.clipShadows,F.clippingPlanes=R.clippingPlanes,F.clipIntersection=R.clipIntersection,F.displacementMap=R.displacementMap,F.displacementScale=R.displacementScale,F.displacementBias=R.displacementBias,F.wireframeLinewidth=R.wireframeLinewidth,F.linewidth=R.linewidth,_.isPointLight===!0&&F.isMeshDistanceMaterial===!0){let z=e.properties.get(F);z.light=_}return F}function v(E,R,_,S,F){if(E.visible===!1)return;if(E.layers.test(R.layers)&&(E.isMesh||E.isLine||E.isPoints)){if((E.castShadow||E.receiveShadow&&F===kr)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,E.matrixWorld);let J=t.update(E),O=E.material;if(Array.isArray(O)){let H=J.groups;for(let V=0,U=H.length;V<U;V++){let K=H[V],Q=O[K.materialIndex];if(Q&&Q.visible){let se=T(E,Q,S,F);E.onBeforeShadow(e,E,R,_,J,se,K),e.renderBufferDirect(_,null,J,se,E,K),E.onAfterShadow(e,E,R,_,J,se,K)}}}else if(O.visible){let H=T(E,O,S,F);E.onBeforeShadow(e,E,R,_,J,H,null),e.renderBufferDirect(_,null,J,H,E,null),E.onAfterShadow(e,E,R,_,J,H,null)}}}let z=E.children;for(let J=0,O=z.length;J<O;J++)v(z[J],R,_,S,F)}function w(E){E.target.removeEventListener("dispose",w);for(let _ in l){let S=l[_],F=E.target.uuid;if(F in S)S[F].dispose(),delete S[F]}}}function _M(e,t){function n(){let I=!1,oe=new it,Y=null,ae=new it(0,0,0,0);return{setMask:function(ve){if(Y!==ve&&!I)e.colorMask(ve,ve,ve,ve),Y=ve},setLocked:function(ve){I=ve},setClear:function(ve,ee,ce,Oe,yt){if(yt===!0)ve*=Oe,ee*=Oe,ce*=Oe;if(oe.set(ve,ee,ce,Oe),ae.equals(oe)===!1)e.clearColor(ve,ee,ce,Oe),ae.copy(oe)},reset:function(){I=!1,Y=null,ae.set(-1,0,0,0)}}}function i(){let I=!1,oe=!1,Y=null,ae=null,ve=null;return{setReversed:function(ee){if(oe!==ee){let ce=t.get("EXT_clip_control");if(ee)ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.ZERO_TO_ONE_EXT);else ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.NEGATIVE_ONE_TO_ONE_EXT);oe=ee;let Oe=ve;ve=null,this.setClear(Oe)}},getReversed:function(){return oe},setTest:function(ee){if(ee)de(e.DEPTH_TEST);else Re(e.DEPTH_TEST)},setMask:function(ee){if(Y!==ee&&!I)e.depthMask(ee),Y=ee},setFunc:function(ee){if(oe)ee=Wf[ee];if(ae!==ee){switch(ee){case _f:e.depthFunc(e.NEVER);break;case xf:e.depthFunc(e.ALWAYS);break;case vf:e.depthFunc(e.LESS);break;case wc:e.depthFunc(e.LEQUAL);break;case yf:e.depthFunc(e.EQUAL);break;case bf:e.depthFunc(e.GEQUAL);break;case Sf:e.depthFunc(e.GREATER);break;case Mf:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}ae=ee}},setLocked:function(ee){I=ee},setClear:function(ee){if(ve!==ee){if(ve=ee,oe)ee=1-ee;e.clearDepth(ee)}},reset:function(){I=!1,Y=null,ae=null,ve=null,oe=!1}}}function r(){let I=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Oe=null,yt=null;return{setTest:function(ht){if(!I)if(ht)de(e.STENCIL_TEST);else Re(e.STENCIL_TEST)},setMask:function(ht){if(oe!==ht&&!I)e.stencilMask(ht),oe=ht},setFunc:function(ht,Fn,ni){if(Y!==ht||ae!==Fn||ve!==ni)e.stencilFunc(ht,Fn,ni),Y=ht,ae=Fn,ve=ni},setOp:function(ht,Fn,ni){if(ee!==ht||ce!==Fn||Oe!==ni)e.stencilOp(ht,Fn,ni),ee=ht,ce=Fn,Oe=ni},setLocked:function(ht){I=ht},setClear:function(ht){if(yt!==ht)e.clearStencil(ht),yt=ht},reset:function(){I=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Oe=null,yt=null}}}let s=new n,o=new i,a=new r,c=new WeakMap,l=new WeakMap,u={},f={},h={},d=new WeakMap,g=[],b=null,p=!1,m=null,A=null,T=null,v=null,w=null,E=null,R=null,_=new Le(0,0,0),S=0,F=!1,C=null,z=null,J=null,O=null,H=null,V=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),U=!1,K=0,Q=e.getParameter(e.VERSION);if(Q.indexOf("WebGL")!==-1)K=parseFloat(/^WebGL (\d)/.exec(Q)[1]),U=K>=1;else if(Q.indexOf("OpenGL ES")!==-1)K=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),U=K>=2;let se=null,me={},_e=e.getParameter(e.SCISSOR_BOX),Xe=e.getParameter(e.VIEWPORT),Be=new it().fromArray(_e),Z=new it().fromArray(Xe);function ne(I,oe,Y,ae){let ve=new Uint8Array(4),ee=e.createTexture();e.bindTexture(I,ee),e.texParameteri(I,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(I,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let ce=0;ce<Y;ce++)if(I===e.TEXTURE_3D||I===e.TEXTURE_2D_ARRAY)e.texImage3D(oe,0,e.RGBA,1,1,ae,0,e.RGBA,e.UNSIGNED_BYTE,ve);else e.texImage2D(oe+ce,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,ve);return ee}let fe={};fe[e.TEXTURE_2D]=ne(e.TEXTURE_2D,e.TEXTURE_2D,1),fe[e.TEXTURE_CUBE_MAP]=ne(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[e.TEXTURE_2D_ARRAY]=ne(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),fe[e.TEXTURE_3D]=ne(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),de(e.DEPTH_TEST),o.setFunc(wc),pn(!1),pt(yc),de(e.CULL_FACE),je(Vn);function de(I){if(u[I]!==!0)e.enable(I),u[I]=!0}function Re(I){if(u[I]!==!1)e.disable(I),u[I]=!1}function $e(I,oe){if(h[I]!==oe){if(e.bindFramebuffer(I,oe),h[I]=oe,I===e.DRAW_FRAMEBUFFER)h[e.FRAMEBUFFER]=oe;if(I===e.FRAMEBUFFER)h[e.DRAW_FRAMEBUFFER]=oe;return!0}return!1}function Ue(I,oe){let Y=g,ae=!1;if(I){if(Y=d.get(oe),Y===void 0)Y=[],d.set(oe,Y);let ve=I.textures;if(Y.length!==ve.length||Y[0]!==e.COLOR_ATTACHMENT0){for(let ee=0,ce=ve.length;ee<ce;ee++)Y[ee]=e.COLOR_ATTACHMENT0+ee;Y.length=ve.length,ae=!0}}else if(Y[0]!==e.BACK)Y[0]=e.BACK,ae=!0;if(ae)e.drawBuffers(Y)}function ze(I){if(b!==I)return e.useProgram(I),b=I,!0;return!1}let Je={[Br]:e.FUNC_ADD,[Jh]:e.FUNC_SUBTRACT,[Kh]:e.FUNC_REVERSE_SUBTRACT};Je[Qh]=e.MIN,Je[ef]=e.MAX;let qe={[tf]:e.ZERO,[nf]:e.ONE,[rf]:e.SRC_COLOR,[of]:e.SRC_ALPHA,[ff]:e.SRC_ALPHA_SATURATE,[uf]:e.DST_COLOR,[cf]:e.DST_ALPHA,[sf]:e.ONE_MINUS_SRC_COLOR,[af]:e.ONE_MINUS_SRC_ALPHA,[hf]:e.ONE_MINUS_DST_COLOR,[lf]:e.ONE_MINUS_DST_ALPHA,[df]:e.CONSTANT_COLOR,[pf]:e.ONE_MINUS_CONSTANT_COLOR,[mf]:e.CONSTANT_ALPHA,[gf]:e.ONE_MINUS_CONSTANT_ALPHA};function je(I,oe,Y,ae,ve,ee,ce,Oe,yt,ht){if(I===Vn){if(p===!0)Re(e.BLEND),p=!1;return}if(p===!1)de(e.BLEND),p=!0;if(I!==jh){if(I!==m||ht!==F){if(A!==Br||w!==Br)e.blendEquation(e.FUNC_ADD),A=Br,w=Br;if(ht)switch(I){case xs:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case bc:e.blendFunc(e.ONE,e.ONE);break;case Sc:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Mc:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Ne("WebGLState: Invalid blending: ",I);break}else switch(I){case xs:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case bc:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Sc:Ne("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Mc:Ne("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ne("WebGLState: Invalid blending: ",I);break}T=null,v=null,E=null,R=null,_.set(0,0,0),S=0,m=I,F=ht}return}if(ve=ve||oe,ee=ee||Y,ce=ce||ae,oe!==A||ve!==w)e.blendEquationSeparate(Je[oe],Je[ve]),A=oe,w=ve;if(Y!==T||ae!==v||ee!==E||ce!==R)e.blendFuncSeparate(qe[Y],qe[ae],qe[ee],qe[ce]),T=Y,v=ae,E=ee,R=ce;if(Oe.equals(_)===!1||yt!==S)e.blendColor(Oe.r,Oe.g,Oe.b,yt),_.copy(Oe),S=yt;m=I,F=!1}function Ut(I,oe){I.side===vn?Re(e.CULL_FACE):de(e.CULL_FACE);let Y=I.side===Xt;if(oe)Y=!Y;pn(Y),I.blending===xs&&I.transparent===!1?je(Vn):je(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),o.setFunc(I.depthFunc),o.setTest(I.depthTest),o.setMask(I.depthWrite),s.setMask(I.colorWrite);let ae=I.stencilWrite;if(a.setTest(ae),ae)a.setMask(I.stencilWriteMask),a.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),a.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass);Ot(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?de(e.SAMPLE_ALPHA_TO_COVERAGE):Re(e.SAMPLE_ALPHA_TO_COVERAGE)}function pn(I){if(C!==I){if(I)e.frontFace(e.CW);else e.frontFace(e.CCW);C=I}}function pt(I){if(I!==Xh){if(de(e.CULL_FACE),I!==z)if(I===yc)e.cullFace(e.BACK);else if(I===qh)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else Re(e.CULL_FACE);z=I}function Gt(I){if(I!==J){if(U)e.lineWidth(I);J=I}}function Ot(I,oe,Y){if(I){if(de(e.POLYGON_OFFSET_FILL),O!==oe||H!==Y){if(O=oe,H=Y,o.getReversed())oe=-oe;e.polygonOffset(oe,Y)}}else Re(e.POLYGON_OFFSET_FILL)}function Ct(I){if(I)de(e.SCISSOR_TEST);else Re(e.SCISSOR_TEST)}function L(I){if(I===void 0)I=e.TEXTURE0+V-1;if(se!==I)e.activeTexture(I),se=I}function mn(I,oe,Y){if(Y===void 0)if(se===null)Y=e.TEXTURE0+V-1;else Y=se;let ae=me[Y];if(ae===void 0)ae={type:void 0,texture:void 0},me[Y]=ae;if(ae.type!==I||ae.texture!==oe){if(se!==Y)e.activeTexture(Y),se=Y;e.bindTexture(I,oe||fe[I]),ae.type=I,ae.texture=oe}}function tt(){let I=me[se];if(I!==void 0&&I.type!==void 0)e.bindTexture(I.type,null),I.type=void 0,I.texture=void 0}function mt(){try{e.compressedTexImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function M(){try{e.compressedTexImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function x(){try{e.texSubImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function P(){try{e.texSubImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function W(){try{e.compressedTexSubImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function te(){try{e.compressedTexSubImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function ie(){try{e.texStorage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function le(){try{e.texStorage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function X(){try{e.texImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function j(){try{e.texImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function xe(I){if(f[I]!==void 0)return f[I];else return e.getParameter(I)}function we(I,oe){if(f[I]!==oe)e.pixelStorei(I,oe),f[I]=oe}function ue(I){if(Be.equals(I)===!1)e.scissor(I.x,I.y,I.z,I.w),Be.copy(I)}function re(I){if(Z.equals(I)===!1)e.viewport(I.x,I.y,I.z,I.w),Z.copy(I)}function Ce(I,oe){let Y=l.get(oe);if(Y===void 0)Y=new WeakMap,l.set(oe,Y);let ae=Y.get(I);if(ae===void 0)ae=e.getUniformBlockIndex(oe,I.name),Y.set(I,ae)}function Ie(I,oe){let ae=l.get(oe).get(I);if(c.get(oe)!==ae)e.uniformBlockBinding(oe,ae,I.__bindingPointIndex),c.set(oe,ae)}function Qe(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},f={},se=null,me={},h={},d=new WeakMap,g=[],b=null,p=!1,m=null,A=null,T=null,v=null,w=null,E=null,R=null,_=new Le(0,0,0),S=0,F=!1,C=null,z=null,J=null,O=null,H=null,Be.set(0,0,e.canvas.width,e.canvas.height),Z.set(0,0,e.canvas.width,e.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:de,disable:Re,bindFramebuffer:$e,drawBuffers:Ue,useProgram:ze,setBlending:je,setMaterial:Ut,setFlipSided:pn,setCullFace:pt,setLineWidth:Gt,setPolygonOffset:Ot,setScissorTest:Ct,activeTexture:L,bindTexture:mn,unbindTexture:tt,compressedTexImage2D:mt,compressedTexImage3D:M,texImage2D:X,texImage3D:j,pixelStorei:we,getParameter:xe,updateUBOMapping:Ce,uniformBlockBinding:Ie,texStorage2D:ie,texStorage3D:le,texSubImage2D:x,texSubImage3D:P,compressedTexSubImage2D:W,compressedTexSubImage3D:te,scissor:ue,viewport:re,reset:Qe}}function xM(e,t,n,i,r,s,o){let a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Pe,u=new WeakMap,f=new Set,h,d=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(M){}function b(M,x){return g?new OffscreenCanvas(M,x):Or("canvas")}function p(M,x,P){let W=1,te=mt(M);if(te.width>P||te.height>P)W=P/Math.max(te.width,te.height);if(W<1)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap||typeof VideoFrame<"u"&&M instanceof VideoFrame){let ie=Math.floor(W*te.width),le=Math.floor(W*te.height);if(h===void 0)h=b(ie,le);let X=x?b(ie,le):h;return X.width=ie,X.height=le,X.getContext("2d").drawImage(M,0,0,ie,le),Me("WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+le+")."),X}else{if("data"in M)Me("WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+").");return M}return M}function m(M){return M.generateMipmaps}function A(M){e.generateMipmap(M)}function T(M){if(M.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(M.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function v(M,x,P,W,te,ie=!1){if(M!==null){if(e[M]!==void 0)return e[M];Me("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let le;if(W){if(le=t.get("EXT_texture_norm16"),!le)Me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let X=x;if(x===e.RED){if(P===e.FLOAT)X=e.R32F;if(P===e.HALF_FLOAT)X=e.R16F;if(P===e.UNSIGNED_BYTE)X=e.R8;if(P===e.UNSIGNED_SHORT&&le)X=le.R16_EXT;if(P===e.SHORT&&le)X=le.R16_SNORM_EXT}if(x===e.RED_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.R8UI;if(P===e.UNSIGNED_SHORT)X=e.R16UI;if(P===e.UNSIGNED_INT)X=e.R32UI;if(P===e.BYTE)X=e.R8I;if(P===e.SHORT)X=e.R16I;if(P===e.INT)X=e.R32I}if(x===e.RG){if(P===e.FLOAT)X=e.RG32F;if(P===e.HALF_FLOAT)X=e.RG16F;if(P===e.UNSIGNED_BYTE)X=e.RG8;if(P===e.UNSIGNED_SHORT&&le)X=le.RG16_EXT;if(P===e.SHORT&&le)X=le.RG16_SNORM_EXT}if(x===e.RG_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RG8UI;if(P===e.UNSIGNED_SHORT)X=e.RG16UI;if(P===e.UNSIGNED_INT)X=e.RG32UI;if(P===e.BYTE)X=e.RG8I;if(P===e.SHORT)X=e.RG16I;if(P===e.INT)X=e.RG32I}if(x===e.RGB_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RGB8UI;if(P===e.UNSIGNED_SHORT)X=e.RGB16UI;if(P===e.UNSIGNED_INT)X=e.RGB32UI;if(P===e.BYTE)X=e.RGB8I;if(P===e.SHORT)X=e.RGB16I;if(P===e.INT)X=e.RGB32I}if(x===e.RGBA_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RGBA8UI;if(P===e.UNSIGNED_SHORT)X=e.RGBA16UI;if(P===e.UNSIGNED_INT)X=e.RGBA32UI;if(P===e.BYTE)X=e.RGBA8I;if(P===e.SHORT)X=e.RGBA16I;if(P===e.INT)X=e.RGBA32I}if(x===e.RGB){if(P===e.UNSIGNED_SHORT&&le)X=le.RGB16_EXT;if(P===e.SHORT&&le)X=le.RGB16_SNORM_EXT;if(P===e.UNSIGNED_INT_5_9_9_9_REV)X=e.RGB9_E5;if(P===e.UNSIGNED_INT_10F_11F_11F_REV)X=e.R11F_G11F_B10F}if(x===e.RGBA){let j=ie?gl:Ve.getTransfer(te);if(P===e.FLOAT)X=e.RGBA32F;if(P===e.HALF_FLOAT)X=e.RGBA16F;if(P===e.UNSIGNED_BYTE)X=j===ut?e.SRGB8_ALPHA8:e.RGBA8;if(P===e.UNSIGNED_SHORT&&le)X=le.RGBA16_EXT;if(P===e.SHORT&&le)X=le.RGBA16_SNORM_EXT;if(P===e.UNSIGNED_SHORT_4_4_4_4)X=e.RGBA4;if(P===e.UNSIGNED_SHORT_5_5_5_1)X=e.RGB5_A1}if(X===e.R16F||X===e.R32F||X===e.RG16F||X===e.RG32F||X===e.RGBA16F||X===e.RGBA32F)t.get("EXT_color_buffer_float");return X}function w(M,x){let P;if(M){if(x===null||x===Ci||x===$r)P=e.DEPTH24_STENCIL8;else if(x===ui)P=e.DEPTH32F_STENCIL8;else if(x===bs)P=e.DEPTH24_STENCIL8,Me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(x===null||x===Ci||x===$r)P=e.DEPTH_COMPONENT24;else if(x===ui)P=e.DEPTH_COMPONENT32F;else if(x===bs)P=e.DEPTH_COMPONENT16;return P}function E(M,x){if(m(M)===!0||M.isFramebufferTexture&&M.minFilter!==In&&M.minFilter!==kt)return Math.log2(Math.max(x.width,x.height))+1;else if(M.mipmaps!==void 0&&M.mipmaps.length>0)return M.mipmaps.length;else if(M.isCompressedTexture&&Array.isArray(M.image))return x.mipmaps.length;else return 1}function R(M){let x=M.target;if(x.removeEventListener("dispose",R),S(x),x.isVideoTexture)u.delete(x);if(x.isHTMLTexture)f.delete(x)}function _(M){let x=M.target;x.removeEventListener("dispose",_),C(x)}function S(M){let x=i.get(M);if(x.__webglInit===void 0)return;let P=M.source,W=d.get(P);if(W){let te=W[x.__cacheKey];if(te.usedTimes--,te.usedTimes===0)F(M);if(Object.keys(W).length===0)d.delete(P)}i.remove(M)}function F(M){let x=i.get(M);e.deleteTexture(x.__webglTexture);let P=M.source,W=d.get(P);delete W[x.__cacheKey],o.memory.textures--}function C(M){let x=i.get(M);if(M.depthTexture)M.depthTexture.dispose(),i.remove(M.depthTexture);if(M.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(x.__webglFramebuffer[W]))for(let te=0;te<x.__webglFramebuffer[W].length;te++)e.deleteFramebuffer(x.__webglFramebuffer[W][te]);else e.deleteFramebuffer(x.__webglFramebuffer[W]);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer[W])}else{if(Array.isArray(x.__webglFramebuffer))for(let W=0;W<x.__webglFramebuffer.length;W++)e.deleteFramebuffer(x.__webglFramebuffer[W]);else e.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer);if(x.__webglMultisampledFramebuffer)e.deleteFramebuffer(x.__webglMultisampledFramebuffer);if(x.__webglColorRenderbuffer){for(let W=0;W<x.__webglColorRenderbuffer.length;W++)if(x.__webglColorRenderbuffer[W])e.deleteRenderbuffer(x.__webglColorRenderbuffer[W])}if(x.__webglDepthRenderbuffer)e.deleteRenderbuffer(x.__webglDepthRenderbuffer)}let P=M.textures;for(let W=0,te=P.length;W<te;W++){let ie=i.get(P[W]);if(ie.__webglTexture)e.deleteTexture(ie.__webglTexture),o.memory.textures--;i.remove(P[W])}i.remove(M)}let z=0;function J(){z=0}function O(){return z}function H(M){z=M}function V(){let M=z;if(M>=r.maxTextures)Me("WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+r.maxTextures);return z+=1,M}function U(M){let x=[];return x.push(M.wrapS),x.push(M.wrapT),x.push(M.wrapR||0),x.push(M.magFilter),x.push(M.minFilter),x.push(M.anisotropy),x.push(M.internalFormat),x.push(M.format),x.push(M.type),x.push(M.generateMipmaps),x.push(M.premultiplyAlpha),x.push(M.flipY),x.push(M.unpackAlignment),x.push(M.colorSpace),x.join()}function K(M,x){let P=i.get(M);if(M.isVideoTexture)mn(M);if(M.isRenderTargetTexture===!1&&M.isExternalTexture!==!0&&M.version>0&&P.__version!==M.version){let W=M.image;if(W===null)Me("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)Me("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(P,M,x);return}}else if(M.isExternalTexture)P.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,P.__webglTexture,e.TEXTURE0+x)}function Q(M,x){let P=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&P.__version!==M.version){Re(P,M,x);return}else if(M.isExternalTexture)P.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,P.__webglTexture,e.TEXTURE0+x)}function se(M,x){let P=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&P.__version!==M.version){Re(P,M,x);return}n.bindTexture(e.TEXTURE_3D,P.__webglTexture,e.TEXTURE0+x)}function me(M,x){let P=i.get(M);if(M.isCubeDepthTexture!==!0&&M.version>0&&P.__version!==M.version){$e(P,M,x);return}n.bindTexture(e.TEXTURE_CUBE_MAP,P.__webglTexture,e.TEXTURE0+x)}let _e={[Hr]:e.REPEAT,[Vr]:e.CLAMP_TO_EDGE,[zo]:e.MIRRORED_REPEAT},Xe={[In]:e.NEAREST,[ko]:e.NEAREST_MIPMAP_NEAREST,[ir]:e.NEAREST_MIPMAP_LINEAR,[kt]:e.LINEAR,[Wr]:e.LINEAR_MIPMAP_NEAREST,[Wn]:e.LINEAR_MIPMAP_LINEAR},Be={[Uf]:e.NEVER,[Bf]:e.ALWAYS,[Of]:e.LESS,[Xo]:e.LEQUAL,[Ff]:e.EQUAL,[qo]:e.GEQUAL,[zf]:e.GREATER,[kf]:e.NOTEQUAL};function Z(M,x){if(x.type===ui&&t.has("OES_texture_float_linear")===!1&&(x.magFilter===kt||x.magFilter===Wr||x.magFilter===ir||x.magFilter===Wn||x.minFilter===kt||x.minFilter===Wr||x.minFilter===ir||x.minFilter===Wn))Me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(M,e.TEXTURE_WRAP_S,_e[x.wrapS]),e.texParameteri(M,e.TEXTURE_WRAP_T,_e[x.wrapT]),M===e.TEXTURE_3D||M===e.TEXTURE_2D_ARRAY)e.texParameteri(M,e.TEXTURE_WRAP_R,_e[x.wrapR]);if(e.texParameteri(M,e.TEXTURE_MAG_FILTER,Xe[x.magFilter]),e.texParameteri(M,e.TEXTURE_MIN_FILTER,Xe[x.minFilter]),x.compareFunction)e.texParameteri(M,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(M,e.TEXTURE_COMPARE_FUNC,Be[x.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===In)return;if(x.minFilter!==ir&&x.minFilter!==Wn)return;if(x.type===ui&&t.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||i.get(x).__currentAnisotropy){let P=t.get("EXT_texture_filter_anisotropic");e.texParameterf(M,P.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,r.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy}}}function ne(M,x){let P=!1;if(M.__webglInit===void 0)M.__webglInit=!0,x.addEventListener("dispose",R);let W=x.source,te=d.get(W);if(te===void 0)te={},d.set(W,te);let ie=U(x);if(ie!==M.__cacheKey){if(te[ie]===void 0)te[ie]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,P=!0;te[ie].usedTimes++;let le=te[M.__cacheKey];if(le!==void 0){if(te[M.__cacheKey].usedTimes--,le.usedTimes===0)F(x)}M.__cacheKey=ie,M.__webglTexture=te[ie].texture}return P}function fe(M,x,P){return Math.floor(Math.floor(M/P)/x)}function de(M,x,P,W){let ie=M.updateRanges;if(ie.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,x.width,x.height,P,W,x.data);else{ie.sort((we,ue)=>we.start-ue.start);let le=0;for(let we=1;we<ie.length;we++){let ue=ie[le],re=ie[we],Ce=ue.start+ue.count,Ie=fe(re.start,x.width,4),Qe=fe(ue.start,x.width,4);if(re.start<=Ce+1&&Ie===Qe&&fe(re.start+re.count-1,x.width,4)===Ie)ue.count=Math.max(ue.count,re.start+re.count-ue.start);else++le,ie[le]=re}ie.length=le+1;let X=n.getParameter(e.UNPACK_ROW_LENGTH),j=n.getParameter(e.UNPACK_SKIP_PIXELS),xe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,x.width);for(let we=0,ue=ie.length;we<ue;we++){let re=ie[we],Ce=Math.floor(re.start/4),Ie=Math.ceil(re.count/4),Qe=Ce%x.width,I=Math.floor(Ce/x.width),oe=Ie,Y=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,Qe),n.pixelStorei(e.UNPACK_SKIP_ROWS,I),n.texSubImage2D(e.TEXTURE_2D,0,Qe,I,oe,1,P,W,x.data)}M.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,X),n.pixelStorei(e.UNPACK_SKIP_PIXELS,j),n.pixelStorei(e.UNPACK_SKIP_ROWS,xe)}}function Re(M,x,P){let W=e.TEXTURE_2D;if(x.isDataArrayTexture||x.isCompressedArrayTexture)W=e.TEXTURE_2D_ARRAY;if(x.isData3DTexture)W=e.TEXTURE_3D;let te=ne(M,x),ie=x.source;n.bindTexture(W,M.__webglTexture,e.TEXTURE0+P);let le=i.get(ie);if(ie.version!==le.__version||te===!0){if(n.activeTexture(e.TEXTURE0+P),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){let Y=Ve.getPrimaries(Ve.workingColorSpace),ae=x.colorSpace===ar?null:Ve.getPrimaries(x.colorSpace),ve=x.colorSpace===ar||Y===ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve)}n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment);let j=p(x.image,!1,r.maxTextureSize);j=tt(x,j);let xe=s.convert(x.format,x.colorSpace),we=s.convert(x.type),ue=v(x.internalFormat,xe,we,x.normalized,x.colorSpace,x.isVideoTexture);Z(W,x);let re,Ce=x.mipmaps,Ie=x.isVideoTexture!==!0,Qe=le.__version===void 0||te===!0,I=ie.dataReady,oe=E(x,j);if(x.isDepthTexture){if(ue=w(x.format===sr,x.type),Qe)if(Ie)n.texStorage2D(e.TEXTURE_2D,1,ue,j.width,j.height);else n.texImage2D(e.TEXTURE_2D,0,ue,j.width,j.height,0,xe,we,null)}else if(x.isDataTexture)if(Ce.length>0){if(Ie&&Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data);x.generateMipmaps=!1}else if(Ie){if(Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,j.width,j.height);if(I)de(x,j,xe,we)}else n.texImage2D(e.TEXTURE_2D,0,ue,j.width,j.height,0,xe,we,j.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){if(Ie&&Qe)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,Ce[0].width,Ce[0].height,j.depth);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],x.format!==$n)if(xe!==null)if(Ie){if(I)if(x.layerUpdates.size>0){let ve=Bl(re.width,re.height,x.format,x.type);for(let ee of x.layerUpdates){let ce=re.data.subarray(ee*ve/re.data.BYTES_PER_ELEMENT,(ee+1)*ve/re.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,ee,re.width,re.height,1,xe,ce)}x.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,j.depth,xe,re.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,j.depth,0,re.data,0,0);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Ie){if(I)n.texSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,j.depth,xe,we,re.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,j.depth,0,xe,we,re.data)}else{if(Ie&&Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],x.format!==$n)if(xe!==null)if(Ie){if(I)n.compressedTexSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,re.data)}else n.compressedTexImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,re.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data)}else if(x.isDataArrayTexture)if(Ie){if(Qe)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,j.width,j.height,j.depth);if(I)if(x.layerUpdates.size>0){let Y=Bl(j.width,j.height,x.format,x.type);for(let ae of x.layerUpdates){let ve=j.data.subarray(ae*Y/j.data.BYTES_PER_ELEMENT,(ae+1)*Y/j.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,ae,j.width,j.height,1,xe,we,ve)}x.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,xe,we,j.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,ue,j.width,j.height,j.depth,0,xe,we,j.data);else if(x.isData3DTexture)if(Ie){if(Qe)n.texStorage3D(e.TEXTURE_3D,oe,ue,j.width,j.height,j.depth);if(I)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,xe,we,j.data)}else n.texImage3D(e.TEXTURE_3D,0,ue,j.width,j.height,j.depth,0,xe,we,j.data);else if(x.isFramebufferTexture){if(Qe)if(Ie)n.texStorage2D(e.TEXTURE_2D,oe,ue,j.width,j.height);else{let Y=j.width,ae=j.height;for(let ve=0;ve<oe;ve++)n.texImage2D(e.TEXTURE_2D,ve,ue,Y,ae,0,xe,we,null),Y>>=1,ae>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in e){let Y=e.canvas;if(!Y.hasAttribute("layoutsubtree"))Y.setAttribute("layoutsubtree","true");if(j.parentNode!==Y){Y.appendChild(j),f.add(x),Y.onpaint=(ae)=>{let ve=ae.changedElements;for(let ee of f)if(ve.includes(ee.image))ee.needsUpdate=!0},Y.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,j);else{let{RGBA:ve,RGBA:ee,UNSIGNED_BYTE:ce}=e;e.texElementImage2D(e.TEXTURE_2D,0,ve,ee,ce,j)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(Ce.length>0){if(Ie&&Qe){let Y=mt(Ce[0]);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,xe,we,re)}else n.texImage2D(e.TEXTURE_2D,Y,ue,xe,we,re);x.generateMipmaps=!1}else if(Ie){if(Qe){let Y=mt(j);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}if(I)n.texSubImage2D(e.TEXTURE_2D,0,0,0,xe,we,j)}else n.texImage2D(e.TEXTURE_2D,0,ue,xe,we,j);if(m(x))A(W);if(le.__version=ie.version,x.onUpdate)x.onUpdate(x)}M.__version=x.version}function $e(M,x,P){if(x.image.length!==6)return;let W=ne(M,x),te=x.source;n.bindTexture(e.TEXTURE_CUBE_MAP,M.__webglTexture,e.TEXTURE0+P);let ie=i.get(te);if(te.version!==ie.__version||W===!0){n.activeTexture(e.TEXTURE0+P);let le=Ve.getPrimaries(Ve.workingColorSpace),X=x.colorSpace===ar?null:Ve.getPrimaries(x.colorSpace),j=x.colorSpace===ar||le===X?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,j);let xe=x.isCompressedTexture||x.image[0].isCompressedTexture,we=x.image[0]&&x.image[0].isDataTexture,ue=[];for(let ee=0;ee<6;ee++){if(!xe&&!we)ue[ee]=p(x.image[ee],!0,r.maxCubemapSize);else ue[ee]=we?x.image[ee].image:x.image[ee];ue[ee]=tt(x,ue[ee])}let re=ue[0],Ce=s.convert(x.format,x.colorSpace),Ie=s.convert(x.type),Qe=v(x.internalFormat,Ce,Ie,x.normalized,x.colorSpace),I=x.isVideoTexture!==!0,oe=ie.__version===void 0||W===!0,Y=te.dataReady,ae=E(x,re);Z(e.TEXTURE_CUBE_MAP,x);let ve;if(xe){if(I&&oe)n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,Qe,re.width,re.height);for(let ee=0;ee<6;ee++){ve=ue[ee].mipmaps;for(let ce=0;ce<ve.length;ce++){let Oe=ve[ce];if(x.format!==$n)if(Ce!==null)if(I){if(Y)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Oe.width,Oe.height,Ce,Oe.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,Qe,Oe.width,Oe.height,0,Oe.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Oe.width,Oe.height,Ce,Ie,Oe.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,Qe,Oe.width,Oe.height,0,Ce,Ie,Oe.data)}}}else{if(ve=x.mipmaps,I&&oe){if(ve.length>0)ae++;let ee=mt(ue[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,Qe,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(we){if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ue[ee].width,ue[ee].height,Ce,Ie,ue[ee].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Qe,ue[ee].width,ue[ee].height,0,Ce,Ie,ue[ee].data);for(let ce=0;ce<ve.length;ce++){let yt=ve[ce].image[ee].image;if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,yt.width,yt.height,Ce,Ie,yt.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,Qe,yt.width,yt.height,0,Ce,Ie,yt.data)}}else{if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ce,Ie,ue[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Qe,Ce,Ie,ue[ee]);for(let ce=0;ce<ve.length;ce++){let Oe=ve[ce];if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,Ce,Ie,Oe.image[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,Qe,Ce,Ie,Oe.image[ee])}}}if(m(x))A(e.TEXTURE_CUBE_MAP);if(ie.__version=te.version,x.onUpdate)x.onUpdate(x)}M.__version=x.version}function Ue(M,x,P,W,te,ie){let le=s.convert(P.format,P.colorSpace),X=s.convert(P.type),j=v(P.internalFormat,le,X,P.normalized,P.colorSpace),xe=i.get(x),we=i.get(P);if(we.__renderTarget=x,!xe.__hasExternalTextures){let ue=Math.max(1,x.width>>ie),re=Math.max(1,x.height>>ie);if(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)n.texImage3D(te,ie,j,ue,re,x.depth,0,le,X,null);else n.texImage2D(te,ie,j,ue,re,0,le,X,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,M),L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,W,te,we.__webglTexture,0,Ct(x));else if(te===e.TEXTURE_2D||te>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,W,te,we.__webglTexture,ie);n.bindFramebuffer(e.FRAMEBUFFER,null)}function ze(M,x,P){if(e.bindRenderbuffer(e.RENDERBUFFER,M),x.depthBuffer){let W=x.depthTexture,te=W&&W.isDepthTexture?W.type:null,ie=w(x.stencilBuffer,te),le=x.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(L(x))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Ct(x),ie,x.width,x.height);else if(P)e.renderbufferStorageMultisample(e.RENDERBUFFER,Ct(x),ie,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,ie,x.width,x.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,le,e.RENDERBUFFER,M)}else{let W=x.textures;for(let te=0;te<W.length;te++){let ie=W[te],le=s.convert(ie.format,ie.colorSpace),X=s.convert(ie.type),j=v(ie.internalFormat,le,X,ie.normalized,ie.colorSpace);if(L(x))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Ct(x),j,x.width,x.height);else if(P)e.renderbufferStorageMultisample(e.RENDERBUFFER,Ct(x),j,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,j,x.width,x.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Je(M,x,P){let W=x.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,M),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let te=i.get(x.depthTexture);if(te.__renderTarget=x,!te.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0;if(W){if(te.__webglInit===void 0)te.__webglInit=!0,x.depthTexture.addEventListener("dispose",R);if(te.__webglTexture===void 0){te.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture),Z(e.TEXTURE_CUBE_MAP,x.depthTexture);let xe=s.convert(x.depthTexture.format),we=s.convert(x.depthTexture.type),ue;if(x.depthTexture.format===rr)ue=e.DEPTH_COMPONENT24;else if(x.depthTexture.format===sr)ue=e.DEPTH24_STENCIL8;for(let re=0;re<6;re++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+re,0,ue,x.width,x.height,0,xe,we,null)}}else K(x.depthTexture,0);let ie=te.__webglTexture,le=Ct(x),X=W?e.TEXTURE_CUBE_MAP_POSITIVE_X+P:e.TEXTURE_2D,j=x.depthTexture.format===sr?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(x.depthTexture.format===rr)if(L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,j,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,j,X,ie,0);else if(x.depthTexture.format===sr)if(L(x))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,j,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,j,X,ie,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function qe(M){let x=i.get(M),P=M.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==M.depthTexture){let W=M.depthTexture;if(x.__depthDisposeCallback)x.__depthDisposeCallback();if(W){let te=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,W.removeEventListener("dispose",te)};W.addEventListener("dispose",te),x.__depthDisposeCallback=te}x.__boundDepthTexture=W}if(M.depthTexture&&!x.__autoAllocateDepthBuffer)if(P)for(let W=0;W<6;W++)Je(x.__webglFramebuffer[W],M,W);else{let W=M.texture.mipmaps;if(W&&W.length>0)Je(x.__webglFramebuffer[0],M,0);else Je(x.__webglFramebuffer,M,0)}else if(P){x.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[W]),x.__webglDepthbuffer[W]===void 0)x.__webglDepthbuffer[W]=e.createRenderbuffer(),ze(x.__webglDepthbuffer[W],M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=x.__webglDepthbuffer[W];e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}else{let W=M.texture.mipmaps;if(W&&W.length>0)n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer);if(x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=e.createRenderbuffer(),ze(x.__webglDepthbuffer,M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=x.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function je(M,x,P){let W=i.get(M);if(x!==void 0)Ue(W.__webglFramebuffer,M,M.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(P!==void 0)qe(M)}function Ut(M){let x=M.texture,P=i.get(M),W=i.get(x);M.addEventListener("dispose",_);let te=M.textures,ie=M.isWebGLCubeRenderTarget===!0,le=te.length>1;if(!le){if(W.__webglTexture===void 0)W.__webglTexture=e.createTexture();W.__version=x.version,o.memory.textures++}if(ie){P.__webglFramebuffer=[];for(let X=0;X<6;X++)if(x.mipmaps&&x.mipmaps.length>0){P.__webglFramebuffer[X]=[];for(let j=0;j<x.mipmaps.length;j++)P.__webglFramebuffer[X][j]=e.createFramebuffer()}else P.__webglFramebuffer[X]=e.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){P.__webglFramebuffer=[];for(let X=0;X<x.mipmaps.length;X++)P.__webglFramebuffer[X]=e.createFramebuffer()}else P.__webglFramebuffer=e.createFramebuffer();if(le)for(let X=0,j=te.length;X<j;X++){let xe=i.get(te[X]);if(xe.__webglTexture===void 0)xe.__webglTexture=e.createTexture(),o.memory.textures++}if(M.samples>0&&L(M)===!1){P.__webglMultisampledFramebuffer=e.createFramebuffer(),P.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,P.__webglMultisampledFramebuffer);for(let X=0;X<te.length;X++){let j=te[X];P.__webglColorRenderbuffer[X]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,P.__webglColorRenderbuffer[X]);let xe=s.convert(j.format,j.colorSpace),we=s.convert(j.type),ue=v(j.internalFormat,xe,we,j.normalized,j.colorSpace,M.isXRRenderTarget===!0),re=Ct(M);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,ue,M.width,M.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+X,e.RENDERBUFFER,P.__webglColorRenderbuffer[X])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),M.depthBuffer)P.__webglDepthRenderbuffer=e.createRenderbuffer(),ze(P.__webglDepthRenderbuffer,M,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(ie){n.bindTexture(e.TEXTURE_CUBE_MAP,W.__webglTexture),Z(e.TEXTURE_CUBE_MAP,x);for(let X=0;X<6;X++)if(x.mipmaps&&x.mipmaps.length>0)for(let j=0;j<x.mipmaps.length;j++)Ue(P.__webglFramebuffer[X][j],M,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,j);else Ue(P.__webglFramebuffer[X],M,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);if(m(x))A(e.TEXTURE_CUBE_MAP);n.unbindTexture()}else if(le){for(let X=0,j=te.length;X<j;X++){let xe=te[X],we=i.get(xe),ue=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)ue=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(ue,we.__webglTexture),Z(ue,xe),Ue(P.__webglFramebuffer,M,xe,e.COLOR_ATTACHMENT0+X,ue,0),m(xe))A(ue)}n.unbindTexture()}else{let X=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)X=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,W.__webglTexture),Z(X,x),x.mipmaps&&x.mipmaps.length>0)for(let j=0;j<x.mipmaps.length;j++)Ue(P.__webglFramebuffer[j],M,x,e.COLOR_ATTACHMENT0,X,j);else Ue(P.__webglFramebuffer,M,x,e.COLOR_ATTACHMENT0,X,0);if(m(x))A(X);n.unbindTexture()}if(M.depthBuffer)qe(M)}function pn(M){let x=M.textures;for(let P=0,W=x.length;P<W;P++){let te=x[P];if(m(te)){let ie=T(M),le=i.get(te).__webglTexture;n.bindTexture(ie,le),A(ie),n.unbindTexture()}}}let pt=[],Gt=[];function Ot(M){if(M.samples>0){if(L(M)===!1){let{textures:x,width:P,height:W}=M,te=e.COLOR_BUFFER_BIT,ie=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,le=i.get(M),X=x.length>1;if(X)for(let xe=0;xe<x.length;xe++)n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,le.__webglMultisampledFramebuffer);let j=M.texture.mipmaps;if(j&&j.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer);for(let xe=0;xe<x.length;xe++){if(M.resolveDepthBuffer){if(M.depthBuffer)te|=e.DEPTH_BUFFER_BIT;if(M.stencilBuffer&&M.resolveStencilBuffer)te|=e.STENCIL_BUFFER_BIT}if(X){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(x[xe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,we,0)}if(e.blitFramebuffer(0,0,P,W,0,0,P,W,te,e.NEAREST),c===!0){if(pt.length=0,Gt.length=0,pt.push(e.COLOR_ATTACHMENT0+xe),M.depthBuffer&&M.resolveDepthBuffer===!1)pt.push(ie),Gt.push(ie),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,Gt);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,pt)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),X)for(let xe=0;xe<x.length;xe++){n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(x[xe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,we,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&c){let x=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[x])}}}function Ct(M){return Math.min(r.maxSamples,M.samples)}function L(M){let x=i.get(M);return M.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function mn(M){let x=o.render.frame;if(u.get(M)!==x)u.set(M,x),M.update()}function tt(M,x){let{colorSpace:P,format:W,type:te}=M;if(M.isCompressedTexture===!0||M.isVideoTexture===!0)return x;if(P!==cn&&P!==ar)if(Ve.getTransfer(P)===ut){if(W!==$n||te!==Ln)Me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Ne("WebGLTextures: Unsupported texture color space:",P);return x}function mt(M){if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement)l.width=M.naturalWidth||M.width,l.height=M.naturalHeight||M.height;else if(typeof VideoFrame<"u"&&M instanceof VideoFrame)l.width=M.displayWidth,l.height=M.displayHeight;else l.width=M.width,l.height=M.height;return l}this.allocateTextureUnit=V,this.resetTextureUnits=J,this.getTextureUnits=O,this.setTextureUnits=H,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=se,this.setTextureCube=me,this.rebindTextures=je,this.setupRenderTarget=Ut,this.updateRenderTargetMipmap=pn,this.updateMultisampleRenderTarget=Ot,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=L,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function vM(e,t){function n(i,r=ar){let s,o=Ve.getTransfer(r);if(i===Ln)return e.UNSIGNED_BYTE;if(i===Lc)return e.UNSIGNED_SHORT_4_4_4_4;if(i===Nc)return e.UNSIGNED_SHORT_5_5_5_1;if(i===Cf)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===Pf)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===Af)return e.BYTE;if(i===Rf)return e.SHORT;if(i===bs)return e.UNSIGNED_SHORT;if(i===Ic)return e.INT;if(i===Ci)return e.UNSIGNED_INT;if(i===ui)return e.FLOAT;if(i===hi)return e.HALF_FLOAT;if(i===If)return e.ALPHA;if(i===Lf)return e.RGB;if(i===$n)return e.RGBA;if(i===rr)return e.DEPTH_COMPONENT;if(i===sr)return e.DEPTH_STENCIL;if(i===Nf)return e.RED;if(i===Dc)return e.RED_INTEGER;if(i===or)return e.RG;if(i===Uc)return e.RG_INTEGER;if(i===Oc)return e.RGBA_INTEGER;if(i===Bo||i===Go||i===Ho||i===Vo)if(o===ut)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Bo)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Go)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Ho)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Vo)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Bo)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Go)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Ho)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Vo)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Fc||i===zc||i===kc||i===Bc)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Fc)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===zc)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===kc)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Bc)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Gc||i===Hc||i===Vc||i===Wc||i===$c||i===Wo||i===Zc)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Gc||i===Hc)return o===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Vc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Wc)return s.COMPRESSED_R11_EAC;if(i===$c)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Wo)return s.COMPRESSED_RG11_EAC;if(i===Zc)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Xc||i===qc||i===Yc||i===jc||i===Jc||i===Kc||i===Qc||i===el||i===tl||i===nl||i===il||i===rl||i===sl||i===ol)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Xc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===qc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Yc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===jc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Jc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Kc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Qc)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===el)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===tl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===nl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===il)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===rl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===sl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===ol)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===al||i===cl||i===ll)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(i===al)return o===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===cl)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ll)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ul||i===hl||i===$o||i===fl)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(i===ul)return s.COMPRESSED_RED_RGTC1_EXT;if(i===hl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===$o)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===fl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===$r)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}var yM=`
+}`,Dw=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],Ow=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],op=new Fe,Zs=new N,pu=new N;function Uw(e,t,n){let i=new zs,r=new Pe,s=new Pe,o=new rt,a=new ql,c=new Yl,l={},u=n.maxTextureSize,h={[zi]:Xt,[Xt]:zi,[Sn]:Sn},f=new wn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:Lw,fragmentShader:Nw}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let m=new Qt;m.setAttribute("position",new It(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let x=new dt(m,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ts;let g=this.type;this.render=function(T,R,_){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(T.length===0)return;if(this.type===Uf)Me("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Ts;let S=e.getRenderTarget(),U=e.getActiveCubeFace(),C=e.getActiveMipmapLevel(),z=e.state;if(z.setBlending(Xn),z.buffers.depth.getReversed()===!0)z.buffers.color.setClear(0,0,0,0);else z.buffers.color.setClear(1,1,1,1);z.buffers.depth.setTest(!0),z.setScissorTest(!1);let j=g!==this.type;if(j)R.traverse(function(F){if(F.material)if(Array.isArray(F.material))F.material.forEach((H)=>H.needsUpdate=!0);else F.material.needsUpdate=!0});for(let F=0,H=T.length;F<H;F++){let V=T[F],O=V.shadow;if(O===void 0){Me("WebGLShadowMap:",V,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;r.copy(O.mapSize);let K=O.getFrameExtents();if(r.multiply(K),s.copy(O.mapSize),r.x>u||r.y>u){if(r.x>u)s.x=Math.floor(u/K.x),r.x=s.x*K.x,O.mapSize.x=s.x;if(r.y>u)s.y=Math.floor(u/K.y),r.y=s.y*K.y,O.mapSize.y=s.y}let Q=e.state.buffers.depth.getReversed();if(O.camera._reversedDepth=Q,O.map===null||j===!0){if(O.map!==null){if(O.map.depthTexture!==null)O.map.depthTexture.dispose(),O.map.depthTexture=null;O.map.dispose()}if(this.type===Zr){if(V.isPointLight){Me("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}O.map=new Mn(r.x,r.y,{format:pr,type:xi,minFilter:kt,magFilter:kt,generateMipmaps:!1}),O.map.texture.name=V.name+".shadowMap",O.map.depthTexture=new Vi(r.x,r.y,_i),O.map.depthTexture.name=V.name+".shadowMapDepth",O.map.depthTexture.format=fr,O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=On,O.map.depthTexture.magFilter=On}else{if(V.isPointLight)O.map=new _u(r.x),O.map.depthTexture=new $l(r.x,ki);else O.map=new Mn(r.x,r.y),O.map.depthTexture=new Vi(r.x,r.y,ki);if(O.map.depthTexture.name=V.name+".shadowMap",O.map.depthTexture.format=fr,this.type===Ts)O.map.depthTexture.compareFunction=Q?oa:sa,O.map.depthTexture.minFilter=kt,O.map.depthTexture.magFilter=kt;else O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=On,O.map.depthTexture.magFilter=On}O.camera.updateProjectionMatrix()}let se=O.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me<se;me++){if(O.map.isWebGLCubeRenderTarget)e.setRenderTarget(O.map,me),e.clear();else{if(me===0)e.setRenderTarget(O.map),e.clear();let _e=O.getViewport(me);o.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),z.viewport(o)}if(V.isPointLight){let{camera:_e,matrix:Xe}=O,Be=V.distance||_e.far;if(Be!==_e.far)_e.far=Be,_e.updateProjectionMatrix();Zs.setFromMatrixPosition(V.matrixWorld),_e.position.copy(Zs),pu.copy(_e.position),pu.add(Dw[me]),_e.up.copy(Ow[me]),_e.lookAt(pu),_e.updateMatrixWorld(),Xe.makeTranslation(-Zs.x,-Zs.y,-Zs.z),op.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),O._frustum.setFromProjectionMatrix(op,_e.coordinateSystem,_e.reversedDepth)}else O.updateMatrices(V);i=O.getFrustum(),y(R,_,O.camera,V,this.type)}if(O.isPointLightShadow!==!0&&this.type===Zr)A(O,_);O.needsUpdate=!1}g=this.type,p.needsUpdate=!1,e.setRenderTarget(S,U,C)};function A(T,R){let _=t.update(x);if(f.defines.VSM_SAMPLES!==T.blurSamples)f.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0;if(T.mapPass===null)T.mapPass=new Mn(r.x,r.y,{format:pr,type:xi});f.uniforms.shadow_pass.value=T.map.depthTexture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,e.setRenderTarget(T.mapPass),e.clear(),e.renderBufferDirect(R,null,_,f,x,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,e.setRenderTarget(T.map),e.clear(),e.renderBufferDirect(R,null,_,d,x,null)}function E(T,R,_,S){let U=null,C=_.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(C!==void 0)U=C;else if(U=_.isPointLight===!0?c:a,e.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){let z=U.uuid,j=R.uuid,F=l[z];if(F===void 0)F={},l[z]=F;let H=F[j];if(H===void 0)H=U.clone(),F[j]=H,R.addEventListener("dispose",w);U=H}if(U.visible=R.visible,U.wireframe=R.wireframe,S===Zr)U.side=R.shadowSide!==null?R.shadowSide:R.side;else U.side=R.shadowSide!==null?R.shadowSide:h[R.side];if(U.alphaMap=R.alphaMap,U.alphaTest=R.alphaToCoverage===!0?0.5:R.alphaTest,U.map=R.map,U.clipShadows=R.clipShadows,U.clippingPlanes=R.clippingPlanes,U.clipIntersection=R.clipIntersection,U.displacementMap=R.displacementMap,U.displacementScale=R.displacementScale,U.displacementBias=R.displacementBias,U.wireframeLinewidth=R.wireframeLinewidth,U.linewidth=R.linewidth,_.isPointLight===!0&&U.isMeshDistanceMaterial===!0){let z=e.properties.get(U);z.light=_}return U}function y(T,R,_,S,U){if(T.visible===!1)return;if(T.layers.test(R.layers)&&(T.isMesh||T.isLine||T.isPoints)){if((T.castShadow||T.receiveShadow&&U===Zr)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,T.matrixWorld);let j=t.update(T),F=T.material;if(Array.isArray(F)){let H=j.groups;for(let V=0,O=H.length;V<O;V++){let K=H[V],Q=F[K.materialIndex];if(Q&&Q.visible){let se=E(T,Q,S,U);T.onBeforeShadow(e,T,R,_,j,se,K),e.renderBufferDirect(_,null,j,se,T,K),T.onAfterShadow(e,T,R,_,j,se,K)}}}else if(F.visible){let H=E(T,F,S,U);T.onBeforeShadow(e,T,R,_,j,H,null),e.renderBufferDirect(_,null,j,H,T,null),T.onAfterShadow(e,T,R,_,j,H,null)}}}let z=T.children;for(let j=0,F=z.length;j<F;j++)y(z[j],R,_,S,U)}function w(T){T.target.removeEventListener("dispose",w);for(let _ in l){let S=l[_],U=T.target.uuid;if(U in S)S[U].dispose(),delete S[U]}}}function Fw(e,t){function n(){let I=!1,oe=new rt,Y=null,ae=new rt(0,0,0,0);return{setMask:function(ve){if(Y!==ve&&!I)e.colorMask(ve,ve,ve,ve),Y=ve},setLocked:function(ve){I=ve},setClear:function(ve,ee,ce,Ue,yt){if(yt===!0)ve*=Ue,ee*=Ue,ce*=Ue;if(oe.set(ve,ee,ce,Ue),ae.equals(oe)===!1)e.clearColor(ve,ee,ce,Ue),ae.copy(oe)},reset:function(){I=!1,Y=null,ae.set(-1,0,0,0)}}}function i(){let I=!1,oe=!1,Y=null,ae=null,ve=null;return{setReversed:function(ee){if(oe!==ee){let ce=t.get("EXT_clip_control");if(ee)ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.ZERO_TO_ONE_EXT);else ce.clipControlEXT(ce.LOWER_LEFT_EXT,ce.NEGATIVE_ONE_TO_ONE_EXT);oe=ee;let Ue=ve;ve=null,this.setClear(Ue)}},getReversed:function(){return oe},setTest:function(ee){if(ee)de(e.DEPTH_TEST);else Re(e.DEPTH_TEST)},setMask:function(ee){if(Y!==ee&&!I)e.depthMask(ee),Y=ee},setFunc:function(ee){if(oe)ee=Pd[ee];if(ae!==ee){switch(ee){case id:e.depthFunc(e.NEVER);break;case rd:e.depthFunc(e.ALWAYS);break;case sd:e.depthFunc(e.LESS);break;case Zc:e.depthFunc(e.LEQUAL);break;case od:e.depthFunc(e.EQUAL);break;case ad:e.depthFunc(e.GEQUAL);break;case cd:e.depthFunc(e.GREATER);break;case ld:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}ae=ee}},setLocked:function(ee){I=ee},setClear:function(ee){if(ve!==ee){if(ve=ee,oe)ee=1-ee;e.clearDepth(ee)}},reset:function(){I=!1,Y=null,ae=null,ve=null,oe=!1}}}function r(){let I=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Ue=null,yt=null;return{setTest:function(ht){if(!I)if(ht)de(e.STENCIL_TEST);else Re(e.STENCIL_TEST)},setMask:function(ht){if(oe!==ht&&!I)e.stencilMask(ht),oe=ht},setFunc:function(ht,Gn,li){if(Y!==ht||ae!==Gn||ve!==li)e.stencilFunc(ht,Gn,li),Y=ht,ae=Gn,ve=li},setOp:function(ht,Gn,li){if(ee!==ht||ce!==Gn||Ue!==li)e.stencilOp(ht,Gn,li),ee=ht,ce=Gn,Ue=li},setLocked:function(ht){I=ht},setClear:function(ht){if(yt!==ht)e.clearStencil(ht),yt=ht},reset:function(){I=!1,oe=null,Y=null,ae=null,ve=null,ee=null,ce=null,Ue=null,yt=null}}}let s=new n,o=new i,a=new r,c=new WeakMap,l=new WeakMap,u={},h={},f={},d=new WeakMap,m=[],x=null,p=!1,g=null,A=null,E=null,y=null,w=null,T=null,R=null,_=new Le(0,0,0),S=0,U=!1,C=null,z=null,j=null,F=null,H=null,V=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=!1,K=0,Q=e.getParameter(e.VERSION);if(Q.indexOf("WebGL")!==-1)K=parseFloat(/^WebGL (\d)/.exec(Q)[1]),O=K>=1;else if(Q.indexOf("OpenGL ES")!==-1)K=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),O=K>=2;let se=null,me={},_e=e.getParameter(e.SCISSOR_BOX),Xe=e.getParameter(e.VIEWPORT),Be=new rt().fromArray(_e),Z=new rt().fromArray(Xe);function ne(I,oe,Y,ae){let ve=new Uint8Array(4),ee=e.createTexture();e.bindTexture(I,ee),e.texParameteri(I,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(I,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let ce=0;ce<Y;ce++)if(I===e.TEXTURE_3D||I===e.TEXTURE_2D_ARRAY)e.texImage3D(oe,0,e.RGBA,1,1,ae,0,e.RGBA,e.UNSIGNED_BYTE,ve);else e.texImage2D(oe+ce,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,ve);return ee}let fe={};fe[e.TEXTURE_2D]=ne(e.TEXTURE_2D,e.TEXTURE_2D,1),fe[e.TEXTURE_CUBE_MAP]=ne(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[e.TEXTURE_2D_ARRAY]=ne(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),fe[e.TEXTURE_3D]=ne(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),de(e.DEPTH_TEST),o.setFunc(Zc),_n(!1),pt(Hc),de(e.CULL_FACE),je(Xn);function de(I){if(u[I]!==!0)e.enable(I),u[I]=!0}function Re(I){if(u[I]!==!1)e.disable(I),u[I]=!1}function $e(I,oe){if(f[I]!==oe){if(e.bindFramebuffer(I,oe),f[I]=oe,I===e.DRAW_FRAMEBUFFER)f[e.FRAMEBUFFER]=oe;if(I===e.FRAMEBUFFER)f[e.DRAW_FRAMEBUFFER]=oe;return!0}return!1}function Oe(I,oe){let Y=m,ae=!1;if(I){if(Y=d.get(oe),Y===void 0)Y=[],d.set(oe,Y);let ve=I.textures;if(Y.length!==ve.length||Y[0]!==e.COLOR_ATTACHMENT0){for(let ee=0,ce=ve.length;ee<ce;ee++)Y[ee]=e.COLOR_ATTACHMENT0+ee;Y.length=ve.length,ae=!0}}else if(Y[0]!==e.BACK)Y[0]=e.BACK,ae=!0;if(ae)e.drawBuffers(Y)}function ze(I){if(x!==I)return e.useProgram(I),x=I,!0;return!1}let Je={[Xr]:e.FUNC_ADD,[zf]:e.FUNC_SUBTRACT,[kf]:e.FUNC_REVERSE_SUBTRACT};Je[Bf]=e.MIN,Je[Gf]=e.MAX;let qe={[Hf]:e.ZERO,[Vf]:e.ONE,[Wf]:e.SRC_COLOR,[Zf]:e.SRC_ALPHA,[Kf]:e.SRC_ALPHA_SATURATE,[jf]:e.DST_COLOR,[qf]:e.DST_ALPHA,[$f]:e.ONE_MINUS_SRC_COLOR,[Xf]:e.ONE_MINUS_SRC_ALPHA,[Jf]:e.ONE_MINUS_DST_COLOR,[Yf]:e.ONE_MINUS_DST_ALPHA,[Qf]:e.CONSTANT_COLOR,[ed]:e.ONE_MINUS_CONSTANT_COLOR,[td]:e.CONSTANT_ALPHA,[nd]:e.ONE_MINUS_CONSTANT_ALPHA};function je(I,oe,Y,ae,ve,ee,ce,Ue,yt,ht){if(I===Xn){if(p===!0)Re(e.BLEND),p=!1;return}if(p===!1)de(e.BLEND),p=!0;if(I!==Ff){if(I!==g||ht!==U){if(A!==Xr||w!==Xr)e.blendEquation(e.FUNC_ADD),A=Xr,w=Xr;if(ht)switch(I){case Es:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case Vc:e.blendFunc(e.ONE,e.ONE);break;case Wc:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case $c:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Ne("WebGLState: Invalid blending: ",I);break}else switch(I){case Es:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case Vc:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Wc:Ne("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case $c:Ne("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ne("WebGLState: Invalid blending: ",I);break}E=null,y=null,T=null,R=null,_.set(0,0,0),S=0,g=I,U=ht}return}if(ve=ve||oe,ee=ee||Y,ce=ce||ae,oe!==A||ve!==w)e.blendEquationSeparate(Je[oe],Je[ve]),A=oe,w=ve;if(Y!==E||ae!==y||ee!==T||ce!==R)e.blendFuncSeparate(qe[Y],qe[ae],qe[ee],qe[ce]),E=Y,y=ae,T=ee,R=ce;if(Ue.equals(_)===!1||yt!==S)e.blendColor(Ue.r,Ue.g,Ue.b,yt),_.copy(Ue),S=yt;g=I,U=!1}function Ot(I,oe){I.side===Sn?Re(e.CULL_FACE):de(e.CULL_FACE);let Y=I.side===Xt;if(oe)Y=!Y;_n(Y),I.blending===Es&&I.transparent===!1?je(Xn):je(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),o.setFunc(I.depthFunc),o.setTest(I.depthTest),o.setMask(I.depthWrite),s.setMask(I.colorWrite);let ae=I.stencilWrite;if(a.setTest(ae),ae)a.setMask(I.stencilWriteMask),a.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),a.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass);Ut(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?de(e.SAMPLE_ALPHA_TO_COVERAGE):Re(e.SAMPLE_ALPHA_TO_COVERAGE)}function _n(I){if(C!==I){if(I)e.frontFace(e.CW);else e.frontFace(e.CCW);C=I}}function pt(I){if(I!==Df){if(de(e.CULL_FACE),I!==z)if(I===Hc)e.cullFace(e.BACK);else if(I===Of)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else Re(e.CULL_FACE);z=I}function Ht(I){if(I!==j){if(O)e.lineWidth(I);j=I}}function Ut(I,oe,Y){if(I){if(de(e.POLYGON_OFFSET_FILL),F!==oe||H!==Y){if(F=oe,H=Y,o.getReversed())oe=-oe;e.polygonOffset(oe,Y)}}else Re(e.POLYGON_OFFSET_FILL)}function Ct(I){if(I)de(e.SCISSOR_TEST);else Re(e.SCISSOR_TEST)}function L(I){if(I===void 0)I=e.TEXTURE0+V-1;if(se!==I)e.activeTexture(I),se=I}function xn(I,oe,Y){if(Y===void 0)if(se===null)Y=e.TEXTURE0+V-1;else Y=se;let ae=me[Y];if(ae===void 0)ae={type:void 0,texture:void 0},me[Y]=ae;if(ae.type!==I||ae.texture!==oe){if(se!==Y)e.activeTexture(Y),se=Y;e.bindTexture(I,oe||fe[I]),ae.type=I,ae.texture=oe}}function nt(){let I=me[se];if(I!==void 0&&I.type!==void 0)e.bindTexture(I.type,null),I.type=void 0,I.texture=void 0}function mt(){try{e.compressedTexImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function M(){try{e.compressedTexImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function v(){try{e.texSubImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function P(){try{e.texSubImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function W(){try{e.compressedTexSubImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function te(){try{e.compressedTexSubImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function ie(){try{e.texStorage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function le(){try{e.texStorage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function X(){try{e.texImage2D(...arguments)}catch(I){Ne("WebGLState:",I)}}function J(){try{e.texImage3D(...arguments)}catch(I){Ne("WebGLState:",I)}}function xe(I){if(h[I]!==void 0)return h[I];else return e.getParameter(I)}function we(I,oe){if(h[I]!==oe)e.pixelStorei(I,oe),h[I]=oe}function ue(I){if(Be.equals(I)===!1)e.scissor(I.x,I.y,I.z,I.w),Be.copy(I)}function re(I){if(Z.equals(I)===!1)e.viewport(I.x,I.y,I.z,I.w),Z.copy(I)}function Ce(I,oe){let Y=l.get(oe);if(Y===void 0)Y=new WeakMap,l.set(oe,Y);let ae=Y.get(I);if(ae===void 0)ae=e.getUniformBlockIndex(oe,I.name),Y.set(I,ae)}function Ie(I,oe){let ae=l.get(oe).get(I);if(c.get(oe)!==ae)e.uniformBlockBinding(oe,ae,I.__bindingPointIndex),c.set(oe,ae)}function Qe(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},h={},se=null,me={},f={},d=new WeakMap,m=[],x=null,p=!1,g=null,A=null,E=null,y=null,w=null,T=null,R=null,_=new Le(0,0,0),S=0,U=!1,C=null,z=null,j=null,F=null,H=null,Be.set(0,0,e.canvas.width,e.canvas.height),Z.set(0,0,e.canvas.width,e.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:de,disable:Re,bindFramebuffer:$e,drawBuffers:Oe,useProgram:ze,setBlending:je,setMaterial:Ot,setFlipSided:_n,setCullFace:pt,setLineWidth:Ht,setPolygonOffset:Ut,setScissorTest:Ct,activeTexture:L,bindTexture:xn,unbindTexture:nt,compressedTexImage2D:mt,compressedTexImage3D:M,texImage2D:X,texImage3D:J,pixelStorei:we,getParameter:xe,updateUBOMapping:Ce,uniformBlockBinding:Ie,texStorage2D:ie,texStorage3D:le,texSubImage2D:v,texSubImage3D:P,compressedTexSubImage2D:W,compressedTexSubImage3D:te,scissor:ue,viewport:re,reset:Qe}}function zw(e,t,n,i,r,s,o){let a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Pe,u=new WeakMap,h=new Set,f,d=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(M){}function x(M,v){return m?new OffscreenCanvas(M,v):Vr("canvas")}function p(M,v,P){let W=1,te=mt(M);if(te.width>P||te.height>P)W=P/Math.max(te.width,te.height);if(W<1)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap||typeof VideoFrame<"u"&&M instanceof VideoFrame){let ie=Math.floor(W*te.width),le=Math.floor(W*te.height);if(f===void 0)f=x(ie,le);let X=v?x(ie,le):f;return X.width=ie,X.height=le,X.getContext("2d").drawImage(M,0,0,ie,le),Me("WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+le+")."),X}else{if("data"in M)Me("WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+").");return M}return M}function g(M){return M.generateMipmaps}function A(M){e.generateMipmap(M)}function E(M){if(M.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(M.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function y(M,v,P,W,te,ie=!1){if(M!==null){if(e[M]!==void 0)return e[M];Me("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let le;if(W){if(le=t.get("EXT_texture_norm16"),!le)Me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let X=v;if(v===e.RED){if(P===e.FLOAT)X=e.R32F;if(P===e.HALF_FLOAT)X=e.R16F;if(P===e.UNSIGNED_BYTE)X=e.R8;if(P===e.UNSIGNED_SHORT&&le)X=le.R16_EXT;if(P===e.SHORT&&le)X=le.R16_SNORM_EXT}if(v===e.RED_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.R8UI;if(P===e.UNSIGNED_SHORT)X=e.R16UI;if(P===e.UNSIGNED_INT)X=e.R32UI;if(P===e.BYTE)X=e.R8I;if(P===e.SHORT)X=e.R16I;if(P===e.INT)X=e.R32I}if(v===e.RG){if(P===e.FLOAT)X=e.RG32F;if(P===e.HALF_FLOAT)X=e.RG16F;if(P===e.UNSIGNED_BYTE)X=e.RG8;if(P===e.UNSIGNED_SHORT&&le)X=le.RG16_EXT;if(P===e.SHORT&&le)X=le.RG16_SNORM_EXT}if(v===e.RG_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RG8UI;if(P===e.UNSIGNED_SHORT)X=e.RG16UI;if(P===e.UNSIGNED_INT)X=e.RG32UI;if(P===e.BYTE)X=e.RG8I;if(P===e.SHORT)X=e.RG16I;if(P===e.INT)X=e.RG32I}if(v===e.RGB_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RGB8UI;if(P===e.UNSIGNED_SHORT)X=e.RGB16UI;if(P===e.UNSIGNED_INT)X=e.RGB32UI;if(P===e.BYTE)X=e.RGB8I;if(P===e.SHORT)X=e.RGB16I;if(P===e.INT)X=e.RGB32I}if(v===e.RGBA_INTEGER){if(P===e.UNSIGNED_BYTE)X=e.RGBA8UI;if(P===e.UNSIGNED_SHORT)X=e.RGBA16UI;if(P===e.UNSIGNED_INT)X=e.RGBA32UI;if(P===e.BYTE)X=e.RGBA8I;if(P===e.SHORT)X=e.RGBA16I;if(P===e.INT)X=e.RGBA32I}if(v===e.RGB){if(P===e.UNSIGNED_SHORT&&le)X=le.RGB16_EXT;if(P===e.SHORT&&le)X=le.RGB16_SNORM_EXT;if(P===e.UNSIGNED_INT_5_9_9_9_REV)X=e.RGB9_E5;if(P===e.UNSIGNED_INT_10F_11F_11F_REV)X=e.R11F_G11F_B10F}if(v===e.RGBA){let J=ie?zl:Ve.getTransfer(te);if(P===e.FLOAT)X=e.RGBA32F;if(P===e.HALF_FLOAT)X=e.RGBA16F;if(P===e.UNSIGNED_BYTE)X=J===ut?e.SRGB8_ALPHA8:e.RGBA8;if(P===e.UNSIGNED_SHORT&&le)X=le.RGBA16_EXT;if(P===e.SHORT&&le)X=le.RGBA16_SNORM_EXT;if(P===e.UNSIGNED_SHORT_4_4_4_4)X=e.RGBA4;if(P===e.UNSIGNED_SHORT_5_5_5_1)X=e.RGB5_A1}if(X===e.R16F||X===e.R32F||X===e.RG16F||X===e.RG32F||X===e.RGBA16F||X===e.RGBA32F)t.get("EXT_color_buffer_float");return X}function w(M,v){let P;if(M){if(v===null||v===ki||v===Kr)P=e.DEPTH24_STENCIL8;else if(v===_i)P=e.DEPTH32F_STENCIL8;else if(v===Cs)P=e.DEPTH24_STENCIL8,Me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(v===null||v===ki||v===Kr)P=e.DEPTH_COMPONENT24;else if(v===_i)P=e.DEPTH_COMPONENT32F;else if(v===Cs)P=e.DEPTH_COMPONENT16;return P}function T(M,v){if(g(M)===!0||M.isFramebufferTexture&&M.minFilter!==On&&M.minFilter!==kt)return Math.log2(Math.max(v.width,v.height))+1;else if(M.mipmaps!==void 0&&M.mipmaps.length>0)return M.mipmaps.length;else if(M.isCompressedTexture&&Array.isArray(M.image))return v.mipmaps.length;else return 1}function R(M){let v=M.target;if(v.removeEventListener("dispose",R),S(v),v.isVideoTexture)u.delete(v);if(v.isHTMLTexture)h.delete(v)}function _(M){let v=M.target;v.removeEventListener("dispose",_),C(v)}function S(M){let v=i.get(M);if(v.__webglInit===void 0)return;let P=M.source,W=d.get(P);if(W){let te=W[v.__cacheKey];if(te.usedTimes--,te.usedTimes===0)U(M);if(Object.keys(W).length===0)d.delete(P)}i.remove(M)}function U(M){let v=i.get(M);e.deleteTexture(v.__webglTexture);let P=M.source,W=d.get(P);delete W[v.__cacheKey],o.memory.textures--}function C(M){let v=i.get(M);if(M.depthTexture)M.depthTexture.dispose(),i.remove(M.depthTexture);if(M.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(v.__webglFramebuffer[W]))for(let te=0;te<v.__webglFramebuffer[W].length;te++)e.deleteFramebuffer(v.__webglFramebuffer[W][te]);else e.deleteFramebuffer(v.__webglFramebuffer[W]);if(v.__webglDepthbuffer)e.deleteRenderbuffer(v.__webglDepthbuffer[W])}else{if(Array.isArray(v.__webglFramebuffer))for(let W=0;W<v.__webglFramebuffer.length;W++)e.deleteFramebuffer(v.__webglFramebuffer[W]);else e.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer)e.deleteRenderbuffer(v.__webglDepthbuffer);if(v.__webglMultisampledFramebuffer)e.deleteFramebuffer(v.__webglMultisampledFramebuffer);if(v.__webglColorRenderbuffer){for(let W=0;W<v.__webglColorRenderbuffer.length;W++)if(v.__webglColorRenderbuffer[W])e.deleteRenderbuffer(v.__webglColorRenderbuffer[W])}if(v.__webglDepthRenderbuffer)e.deleteRenderbuffer(v.__webglDepthRenderbuffer)}let P=M.textures;for(let W=0,te=P.length;W<te;W++){let ie=i.get(P[W]);if(ie.__webglTexture)e.deleteTexture(ie.__webglTexture),o.memory.textures--;i.remove(P[W])}i.remove(M)}let z=0;function j(){z=0}function F(){return z}function H(M){z=M}function V(){let M=z;if(M>=r.maxTextures)Me("WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+r.maxTextures);return z+=1,M}function O(M){let v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function K(M,v){let P=i.get(M);if(M.isVideoTexture)xn(M);if(M.isRenderTargetTexture===!1&&M.isExternalTexture!==!0&&M.version>0&&P.__version!==M.version){let W=M.image;if(W===null)Me("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)Me("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(P,M,v);return}}else if(M.isExternalTexture)P.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,P.__webglTexture,e.TEXTURE0+v)}function Q(M,v){let P=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&P.__version!==M.version){Re(P,M,v);return}else if(M.isExternalTexture)P.__webglTexture=M.sourceTexture?M.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,P.__webglTexture,e.TEXTURE0+v)}function se(M,v){let P=i.get(M);if(M.isRenderTargetTexture===!1&&M.version>0&&P.__version!==M.version){Re(P,M,v);return}n.bindTexture(e.TEXTURE_3D,P.__webglTexture,e.TEXTURE0+v)}function me(M,v){let P=i.get(M);if(M.isCubeDepthTexture!==!0&&M.version>0&&P.__version!==M.version){$e(P,M,v);return}n.bindTexture(e.TEXTURE_CUBE_MAP,P.__webglTexture,e.TEXTURE0+v)}let _e={[Yr]:e.REPEAT,[jr]:e.CLAMP_TO_EDGE,[jo]:e.MIRRORED_REPEAT},Xe={[On]:e.NEAREST,[Jo]:e.NEAREST_MIPMAP_NEAREST,[hr]:e.NEAREST_MIPMAP_LINEAR,[kt]:e.LINEAR,[Jr]:e.LINEAR_MIPMAP_NEAREST,[qn]:e.LINEAR_MIPMAP_LINEAR},Be={[bd]:e.NEVER,[Ed]:e.ALWAYS,[Sd]:e.LESS,[sa]:e.LEQUAL,[Md]:e.EQUAL,[oa]:e.GEQUAL,[wd]:e.GREATER,[Td]:e.NOTEQUAL};function Z(M,v){if(v.type===_i&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===kt||v.magFilter===Jr||v.magFilter===hr||v.magFilter===qn||v.minFilter===kt||v.minFilter===Jr||v.minFilter===hr||v.minFilter===qn))Me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(M,e.TEXTURE_WRAP_S,_e[v.wrapS]),e.texParameteri(M,e.TEXTURE_WRAP_T,_e[v.wrapT]),M===e.TEXTURE_3D||M===e.TEXTURE_2D_ARRAY)e.texParameteri(M,e.TEXTURE_WRAP_R,_e[v.wrapR]);if(e.texParameteri(M,e.TEXTURE_MAG_FILTER,Xe[v.magFilter]),e.texParameteri(M,e.TEXTURE_MIN_FILTER,Xe[v.minFilter]),v.compareFunction)e.texParameteri(M,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(M,e.TEXTURE_COMPARE_FUNC,Be[v.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===On)return;if(v.minFilter!==hr&&v.minFilter!==qn)return;if(v.type===_i&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){let P=t.get("EXT_texture_filter_anisotropic");e.texParameterf(M,P.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function ne(M,v){let P=!1;if(M.__webglInit===void 0)M.__webglInit=!0,v.addEventListener("dispose",R);let W=v.source,te=d.get(W);if(te===void 0)te={},d.set(W,te);let ie=O(v);if(ie!==M.__cacheKey){if(te[ie]===void 0)te[ie]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,P=!0;te[ie].usedTimes++;let le=te[M.__cacheKey];if(le!==void 0){if(te[M.__cacheKey].usedTimes--,le.usedTimes===0)U(v)}M.__cacheKey=ie,M.__webglTexture=te[ie].texture}return P}function fe(M,v,P){return Math.floor(Math.floor(M/P)/v)}function de(M,v,P,W){let ie=M.updateRanges;if(ie.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,v.width,v.height,P,W,v.data);else{ie.sort((we,ue)=>we.start-ue.start);let le=0;for(let we=1;we<ie.length;we++){let ue=ie[le],re=ie[we],Ce=ue.start+ue.count,Ie=fe(re.start,v.width,4),Qe=fe(ue.start,v.width,4);if(re.start<=Ce+1&&Ie===Qe&&fe(re.start+re.count-1,v.width,4)===Ie)ue.count=Math.max(ue.count,re.start+re.count-ue.start);else++le,ie[le]=re}ie.length=le+1;let X=n.getParameter(e.UNPACK_ROW_LENGTH),J=n.getParameter(e.UNPACK_SKIP_PIXELS),xe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,v.width);for(let we=0,ue=ie.length;we<ue;we++){let re=ie[we],Ce=Math.floor(re.start/4),Ie=Math.ceil(re.count/4),Qe=Ce%v.width,I=Math.floor(Ce/v.width),oe=Ie,Y=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,Qe),n.pixelStorei(e.UNPACK_SKIP_ROWS,I),n.texSubImage2D(e.TEXTURE_2D,0,Qe,I,oe,1,P,W,v.data)}M.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,X),n.pixelStorei(e.UNPACK_SKIP_PIXELS,J),n.pixelStorei(e.UNPACK_SKIP_ROWS,xe)}}function Re(M,v,P){let W=e.TEXTURE_2D;if(v.isDataArrayTexture||v.isCompressedArrayTexture)W=e.TEXTURE_2D_ARRAY;if(v.isData3DTexture)W=e.TEXTURE_3D;let te=ne(M,v),ie=v.source;n.bindTexture(W,M.__webglTexture,e.TEXTURE0+P);let le=i.get(ie);if(ie.version!==le.__version||te===!0){if(n.activeTexture(e.TEXTURE0+P),(typeof ImageBitmap<"u"&&v.image instanceof ImageBitmap)===!1){let Y=Ve.getPrimaries(Ve.workingColorSpace),ae=v.colorSpace===mr?null:Ve.getPrimaries(v.colorSpace),ve=v.colorSpace===mr||Y===ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,v.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve)}n.pixelStorei(e.UNPACK_ALIGNMENT,v.unpackAlignment);let J=p(v.image,!1,r.maxTextureSize);J=nt(v,J);let xe=s.convert(v.format,v.colorSpace),we=s.convert(v.type),ue=y(v.internalFormat,xe,we,v.normalized,v.colorSpace,v.isVideoTexture);Z(W,v);let re,Ce=v.mipmaps,Ie=v.isVideoTexture!==!0,Qe=le.__version===void 0||te===!0,I=ie.dataReady,oe=T(v,J);if(v.isDepthTexture){if(ue=w(v.format===dr,v.type),Qe)if(Ie)n.texStorage2D(e.TEXTURE_2D,1,ue,J.width,J.height);else n.texImage2D(e.TEXTURE_2D,0,ue,J.width,J.height,0,xe,we,null)}else if(v.isDataTexture)if(Ce.length>0){if(Ie&&Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data);v.generateMipmaps=!1}else if(Ie){if(Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,J.width,J.height);if(I)de(v,J,xe,we)}else n.texImage2D(e.TEXTURE_2D,0,ue,J.width,J.height,0,xe,we,J.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){if(Ie&&Qe)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,Ce[0].width,Ce[0].height,J.depth);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],v.format!==Yn)if(xe!==null)if(Ie){if(I)if(v.layerUpdates.size>0){let ve=cu(re.width,re.height,v.format,v.type);for(let ee of v.layerUpdates){let ce=re.data.subarray(ee*ve/re.data.BYTES_PER_ELEMENT,(ee+1)*ve/re.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,ee,re.width,re.height,1,xe,ce)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,J.depth,xe,re.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,J.depth,0,re.data,0,0);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Ie){if(I)n.texSubImage3D(e.TEXTURE_2D_ARRAY,Y,0,0,0,re.width,re.height,J.depth,xe,we,re.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,Y,ue,re.width,re.height,J.depth,0,xe,we,re.data)}else{if(Ie&&Qe)n.texStorage2D(e.TEXTURE_2D,oe,ue,Ce[0].width,Ce[0].height);for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],v.format!==Yn)if(xe!==null)if(Ie){if(I)n.compressedTexSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,re.data)}else n.compressedTexImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,re.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,re.width,re.height,xe,we,re.data)}else n.texImage2D(e.TEXTURE_2D,Y,ue,re.width,re.height,0,xe,we,re.data)}else if(v.isDataArrayTexture)if(Ie){if(Qe)n.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ue,J.width,J.height,J.depth);if(I)if(v.layerUpdates.size>0){let Y=cu(J.width,J.height,v.format,v.type);for(let ae of v.layerUpdates){let ve=J.data.subarray(ae*Y/J.data.BYTES_PER_ELEMENT,(ae+1)*Y/J.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,ae,J.width,J.height,1,xe,we,ve)}v.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,xe,we,J.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,ue,J.width,J.height,J.depth,0,xe,we,J.data);else if(v.isData3DTexture)if(Ie){if(Qe)n.texStorage3D(e.TEXTURE_3D,oe,ue,J.width,J.height,J.depth);if(I)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,xe,we,J.data)}else n.texImage3D(e.TEXTURE_3D,0,ue,J.width,J.height,J.depth,0,xe,we,J.data);else if(v.isFramebufferTexture){if(Qe)if(Ie)n.texStorage2D(e.TEXTURE_2D,oe,ue,J.width,J.height);else{let Y=J.width,ae=J.height;for(let ve=0;ve<oe;ve++)n.texImage2D(e.TEXTURE_2D,ve,ue,Y,ae,0,xe,we,null),Y>>=1,ae>>=1}}else if(v.isHTMLTexture){if("texElementImage2D"in e){let Y=e.canvas;if(!Y.hasAttribute("layoutsubtree"))Y.setAttribute("layoutsubtree","true");if(J.parentNode!==Y){Y.appendChild(J),h.add(v),Y.onpaint=(ae)=>{let ve=ae.changedElements;for(let ee of h)if(ve.includes(ee.image))ee.needsUpdate=!0},Y.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,J);else{let{RGBA:ve,RGBA:ee,UNSIGNED_BYTE:ce}=e;e.texElementImage2D(e.TEXTURE_2D,0,ve,ee,ce,J)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(Ce.length>0){if(Ie&&Qe){let Y=mt(Ce[0]);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}for(let Y=0,ae=Ce.length;Y<ae;Y++)if(re=Ce[Y],Ie){if(I)n.texSubImage2D(e.TEXTURE_2D,Y,0,0,xe,we,re)}else n.texImage2D(e.TEXTURE_2D,Y,ue,xe,we,re);v.generateMipmaps=!1}else if(Ie){if(Qe){let Y=mt(J);n.texStorage2D(e.TEXTURE_2D,oe,ue,Y.width,Y.height)}if(I)n.texSubImage2D(e.TEXTURE_2D,0,0,0,xe,we,J)}else n.texImage2D(e.TEXTURE_2D,0,ue,xe,we,J);if(g(v))A(W);if(le.__version=ie.version,v.onUpdate)v.onUpdate(v)}M.__version=v.version}function $e(M,v,P){if(v.image.length!==6)return;let W=ne(M,v),te=v.source;n.bindTexture(e.TEXTURE_CUBE_MAP,M.__webglTexture,e.TEXTURE0+P);let ie=i.get(te);if(te.version!==ie.__version||W===!0){n.activeTexture(e.TEXTURE0+P);let le=Ve.getPrimaries(Ve.workingColorSpace),X=v.colorSpace===mr?null:Ve.getPrimaries(v.colorSpace),J=v.colorSpace===mr||le===X?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,v.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,v.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,J);let xe=v.isCompressedTexture||v.image[0].isCompressedTexture,we=v.image[0]&&v.image[0].isDataTexture,ue=[];for(let ee=0;ee<6;ee++){if(!xe&&!we)ue[ee]=p(v.image[ee],!0,r.maxCubemapSize);else ue[ee]=we?v.image[ee].image:v.image[ee];ue[ee]=nt(v,ue[ee])}let re=ue[0],Ce=s.convert(v.format,v.colorSpace),Ie=s.convert(v.type),Qe=y(v.internalFormat,Ce,Ie,v.normalized,v.colorSpace),I=v.isVideoTexture!==!0,oe=ie.__version===void 0||W===!0,Y=te.dataReady,ae=T(v,re);Z(e.TEXTURE_CUBE_MAP,v);let ve;if(xe){if(I&&oe)n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,Qe,re.width,re.height);for(let ee=0;ee<6;ee++){ve=ue[ee].mipmaps;for(let ce=0;ce<ve.length;ce++){let Ue=ve[ce];if(v.format!==Yn)if(Ce!==null)if(I){if(Y)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Ue.width,Ue.height,Ce,Ue.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,Qe,Ue.width,Ue.height,0,Ue.data);else Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,0,0,Ue.width,Ue.height,Ce,Ie,Ue.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce,Qe,Ue.width,Ue.height,0,Ce,Ie,Ue.data)}}}else{if(ve=v.mipmaps,I&&oe){if(ve.length>0)ae++;let ee=mt(ue[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ae,Qe,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(we){if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ue[ee].width,ue[ee].height,Ce,Ie,ue[ee].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Qe,ue[ee].width,ue[ee].height,0,Ce,Ie,ue[ee].data);for(let ce=0;ce<ve.length;ce++){let yt=ve[ce].image[ee].image;if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,yt.width,yt.height,Ce,Ie,yt.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,Qe,yt.width,yt.height,0,Ce,Ie,yt.data)}}else{if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ce,Ie,ue[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Qe,Ce,Ie,ue[ee]);for(let ce=0;ce<ve.length;ce++){let Ue=ve[ce];if(I){if(Y)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,0,0,Ce,Ie,Ue.image[ee])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ee,ce+1,Qe,Ce,Ie,Ue.image[ee])}}}if(g(v))A(e.TEXTURE_CUBE_MAP);if(ie.__version=te.version,v.onUpdate)v.onUpdate(v)}M.__version=v.version}function Oe(M,v,P,W,te,ie){let le=s.convert(P.format,P.colorSpace),X=s.convert(P.type),J=y(P.internalFormat,le,X,P.normalized,P.colorSpace),xe=i.get(v),we=i.get(P);if(we.__renderTarget=v,!xe.__hasExternalTextures){let ue=Math.max(1,v.width>>ie),re=Math.max(1,v.height>>ie);if(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)n.texImage3D(te,ie,J,ue,re,v.depth,0,le,X,null);else n.texImage2D(te,ie,J,ue,re,0,le,X,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,M),L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,W,te,we.__webglTexture,0,Ct(v));else if(te===e.TEXTURE_2D||te>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,W,te,we.__webglTexture,ie);n.bindFramebuffer(e.FRAMEBUFFER,null)}function ze(M,v,P){if(e.bindRenderbuffer(e.RENDERBUFFER,M),v.depthBuffer){let W=v.depthTexture,te=W&&W.isDepthTexture?W.type:null,ie=w(v.stencilBuffer,te),le=v.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(L(v))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Ct(v),ie,v.width,v.height);else if(P)e.renderbufferStorageMultisample(e.RENDERBUFFER,Ct(v),ie,v.width,v.height);else e.renderbufferStorage(e.RENDERBUFFER,ie,v.width,v.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,le,e.RENDERBUFFER,M)}else{let W=v.textures;for(let te=0;te<W.length;te++){let ie=W[te],le=s.convert(ie.format,ie.colorSpace),X=s.convert(ie.type),J=y(ie.internalFormat,le,X,ie.normalized,ie.colorSpace);if(L(v))a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Ct(v),J,v.width,v.height);else if(P)e.renderbufferStorageMultisample(e.RENDERBUFFER,Ct(v),J,v.width,v.height);else e.renderbufferStorage(e.RENDERBUFFER,J,v.width,v.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Je(M,v,P){let W=v.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,M),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let te=i.get(v.depthTexture);if(te.__renderTarget=v,!te.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0;if(W){if(te.__webglInit===void 0)te.__webglInit=!0,v.depthTexture.addEventListener("dispose",R);if(te.__webglTexture===void 0){te.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture),Z(e.TEXTURE_CUBE_MAP,v.depthTexture);let xe=s.convert(v.depthTexture.format),we=s.convert(v.depthTexture.type),ue;if(v.depthTexture.format===fr)ue=e.DEPTH_COMPONENT24;else if(v.depthTexture.format===dr)ue=e.DEPTH24_STENCIL8;for(let re=0;re<6;re++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+re,0,ue,v.width,v.height,0,xe,we,null)}}else K(v.depthTexture,0);let ie=te.__webglTexture,le=Ct(v),X=W?e.TEXTURE_CUBE_MAP_POSITIVE_X+P:e.TEXTURE_2D,J=v.depthTexture.format===dr?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(v.depthTexture.format===fr)if(L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,J,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,J,X,ie,0);else if(v.depthTexture.format===dr)if(L(v))a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,J,X,ie,0,le);else e.framebufferTexture2D(e.FRAMEBUFFER,J,X,ie,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function qe(M){let v=i.get(M),P=M.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==M.depthTexture){let W=M.depthTexture;if(v.__depthDisposeCallback)v.__depthDisposeCallback();if(W){let te=()=>{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,W.removeEventListener("dispose",te)};W.addEventListener("dispose",te),v.__depthDisposeCallback=te}v.__boundDepthTexture=W}if(M.depthTexture&&!v.__autoAllocateDepthBuffer)if(P)for(let W=0;W<6;W++)Je(v.__webglFramebuffer[W],M,W);else{let W=M.texture.mipmaps;if(W&&W.length>0)Je(v.__webglFramebuffer[0],M,0);else Je(v.__webglFramebuffer,M,0)}else if(P){v.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer[W]),v.__webglDepthbuffer[W]===void 0)v.__webglDepthbuffer[W]=e.createRenderbuffer(),ze(v.__webglDepthbuffer[W],M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=v.__webglDepthbuffer[W];e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}else{let W=M.texture.mipmaps;if(W&&W.length>0)n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,v.__webglFramebuffer);if(v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=e.createRenderbuffer(),ze(v.__webglDepthbuffer,M,!1);else{let te=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=v.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,ie),e.framebufferRenderbuffer(e.FRAMEBUFFER,te,e.RENDERBUFFER,ie)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function je(M,v,P){let W=i.get(M);if(v!==void 0)Oe(W.__webglFramebuffer,M,M.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(P!==void 0)qe(M)}function Ot(M){let v=M.texture,P=i.get(M),W=i.get(v);M.addEventListener("dispose",_);let te=M.textures,ie=M.isWebGLCubeRenderTarget===!0,le=te.length>1;if(!le){if(W.__webglTexture===void 0)W.__webglTexture=e.createTexture();W.__version=v.version,o.memory.textures++}if(ie){P.__webglFramebuffer=[];for(let X=0;X<6;X++)if(v.mipmaps&&v.mipmaps.length>0){P.__webglFramebuffer[X]=[];for(let J=0;J<v.mipmaps.length;J++)P.__webglFramebuffer[X][J]=e.createFramebuffer()}else P.__webglFramebuffer[X]=e.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){P.__webglFramebuffer=[];for(let X=0;X<v.mipmaps.length;X++)P.__webglFramebuffer[X]=e.createFramebuffer()}else P.__webglFramebuffer=e.createFramebuffer();if(le)for(let X=0,J=te.length;X<J;X++){let xe=i.get(te[X]);if(xe.__webglTexture===void 0)xe.__webglTexture=e.createTexture(),o.memory.textures++}if(M.samples>0&&L(M)===!1){P.__webglMultisampledFramebuffer=e.createFramebuffer(),P.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,P.__webglMultisampledFramebuffer);for(let X=0;X<te.length;X++){let J=te[X];P.__webglColorRenderbuffer[X]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,P.__webglColorRenderbuffer[X]);let xe=s.convert(J.format,J.colorSpace),we=s.convert(J.type),ue=y(J.internalFormat,xe,we,J.normalized,J.colorSpace,M.isXRRenderTarget===!0),re=Ct(M);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,ue,M.width,M.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+X,e.RENDERBUFFER,P.__webglColorRenderbuffer[X])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),M.depthBuffer)P.__webglDepthRenderbuffer=e.createRenderbuffer(),ze(P.__webglDepthRenderbuffer,M,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(ie){n.bindTexture(e.TEXTURE_CUBE_MAP,W.__webglTexture),Z(e.TEXTURE_CUBE_MAP,v);for(let X=0;X<6;X++)if(v.mipmaps&&v.mipmaps.length>0)for(let J=0;J<v.mipmaps.length;J++)Oe(P.__webglFramebuffer[X][J],M,v,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,J);else Oe(P.__webglFramebuffer[X],M,v,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);if(g(v))A(e.TEXTURE_CUBE_MAP);n.unbindTexture()}else if(le){for(let X=0,J=te.length;X<J;X++){let xe=te[X],we=i.get(xe),ue=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)ue=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(ue,we.__webglTexture),Z(ue,xe),Oe(P.__webglFramebuffer,M,xe,e.COLOR_ATTACHMENT0+X,ue,0),g(xe))A(ue)}n.unbindTexture()}else{let X=e.TEXTURE_2D;if(M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)X=M.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,W.__webglTexture),Z(X,v),v.mipmaps&&v.mipmaps.length>0)for(let J=0;J<v.mipmaps.length;J++)Oe(P.__webglFramebuffer[J],M,v,e.COLOR_ATTACHMENT0,X,J);else Oe(P.__webglFramebuffer,M,v,e.COLOR_ATTACHMENT0,X,0);if(g(v))A(X);n.unbindTexture()}if(M.depthBuffer)qe(M)}function _n(M){let v=M.textures;for(let P=0,W=v.length;P<W;P++){let te=v[P];if(g(te)){let ie=E(M),le=i.get(te).__webglTexture;n.bindTexture(ie,le),A(ie),n.unbindTexture()}}}let pt=[],Ht=[];function Ut(M){if(M.samples>0){if(L(M)===!1){let{textures:v,width:P,height:W}=M,te=e.COLOR_BUFFER_BIT,ie=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,le=i.get(M),X=v.length>1;if(X)for(let xe=0;xe<v.length;xe++)n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,le.__webglMultisampledFramebuffer);let J=M.texture.mipmaps;if(J&&J.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglFramebuffer);for(let xe=0;xe<v.length;xe++){if(M.resolveDepthBuffer){if(M.depthBuffer)te|=e.DEPTH_BUFFER_BIT;if(M.stencilBuffer&&M.resolveStencilBuffer)te|=e.STENCIL_BUFFER_BIT}if(X){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(v[xe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,we,0)}if(e.blitFramebuffer(0,0,P,W,0,0,P,W,te,e.NEAREST),c===!0){if(pt.length=0,Ht.length=0,pt.push(e.COLOR_ATTACHMENT0+xe),M.depthBuffer&&M.resolveDepthBuffer===!1)pt.push(ie),Ht.push(ie),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,Ht);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,pt)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),X)for(let xe=0;xe<v.length;xe++){n.bindFramebuffer(e.FRAMEBUFFER,le.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.RENDERBUFFER,le.__webglColorRenderbuffer[xe]);let we=i.get(v[xe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,le.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+xe,e.TEXTURE_2D,we,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,le.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&c){let v=M.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[v])}}}function Ct(M){return Math.min(r.maxSamples,M.samples)}function L(M){let v=i.get(M);return M.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function xn(M){let v=o.render.frame;if(u.get(M)!==v)u.set(M,v),M.update()}function nt(M,v){let{colorSpace:P,format:W,type:te}=M;if(M.isCompressedTexture===!0||M.isVideoTexture===!0)return v;if(P!==ln&&P!==mr)if(Ve.getTransfer(P)===ut){if(W!==Yn||te!==Un)Me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Ne("WebGLTextures: Unsupported texture color space:",P);return v}function mt(M){if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement)l.width=M.naturalWidth||M.width,l.height=M.naturalHeight||M.height;else if(typeof VideoFrame<"u"&&M instanceof VideoFrame)l.width=M.displayWidth,l.height=M.displayHeight;else l.width=M.width,l.height=M.height;return l}this.allocateTextureUnit=V,this.resetTextureUnits=j,this.getTextureUnits=F,this.setTextureUnits=H,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=se,this.setTextureCube=me,this.rebindTextures=je,this.setupRenderTarget=Ot,this.updateRenderTargetMipmap=_n,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=Oe,this.useMultisampledRTT=L,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function kw(e,t){function n(i,r=mr){let s,o=Ve.getTransfer(r);if(i===Un)return e.UNSIGNED_BYTE;if(i===el)return e.UNSIGNED_SHORT_4_4_4_4;if(i===tl)return e.UNSIGNED_SHORT_5_5_5_1;if(i===md)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===gd)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===dd)return e.BYTE;if(i===pd)return e.SHORT;if(i===Cs)return e.UNSIGNED_SHORT;if(i===Qc)return e.INT;if(i===ki)return e.UNSIGNED_INT;if(i===_i)return e.FLOAT;if(i===xi)return e.HALF_FLOAT;if(i===_d)return e.ALPHA;if(i===xd)return e.RGB;if(i===Yn)return e.RGBA;if(i===fr)return e.DEPTH_COMPONENT;if(i===dr)return e.DEPTH_STENCIL;if(i===vd)return e.RED;if(i===nl)return e.RED_INTEGER;if(i===pr)return e.RG;if(i===il)return e.RG_INTEGER;if(i===rl)return e.RGBA_INTEGER;if(i===Ko||i===Qo||i===ea||i===ta)if(o===ut)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ko)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Qo)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ea)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ta)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ko)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Qo)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ea)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ta)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===sl||i===ol||i===al||i===cl)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===sl)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ol)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===al)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===cl)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===ll||i===ul||i===hl||i===fl||i===dl||i===na||i===pl)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(i===ll||i===ul)return o===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===hl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===fl)return s.COMPRESSED_R11_EAC;if(i===dl)return s.COMPRESSED_SIGNED_R11_EAC;if(i===na)return s.COMPRESSED_RG11_EAC;if(i===pl)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===ml||i===gl||i===_l||i===xl||i===vl||i===yl||i===bl||i===Sl||i===Ml||i===wl||i===Tl||i===El||i===Al||i===Rl)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(i===ml)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===gl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===_l)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===xl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===vl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===yl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===bl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Sl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ml)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===wl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Tl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===El)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Al)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Rl)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Cl||i===Pl||i===Il)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(i===Cl)return o===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Pl)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Il)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Ll||i===Nl||i===ia||i===Dl)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(i===Ll)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Nl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ia)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Dl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===Kr)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}var Bw=`
void main() {
gl_Position = vec4( position, 1.0 );
-}`,bM=`
+}`,Gw=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
@@ -4223,75 +4223,68 @@ void main() {
}
-}`;class Ld{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new ia(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new bn({vertexShader:yM,fragmentShader:bM,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new dt(new Ns(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Nd extends Nn{constructor(e,t){super();let n=this,i=null,r=1,s=null,o="local-floor",a=1,c=null,l=null,u=null,f=null,h=null,d=null,g=typeof XRWebGLBinding<"u",b=new Ld,p={},m=t.getContextAttributes(),A=null,T=null,v=[],w=[],E=new Pe,R=null,_=new Pt;_.viewport=new it;let S=new Pt;S.viewport=new it;let F=[_,S],C=new Dl,z=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=v[Z];if(ne===void 0)ne=new Ts,v[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=v[Z];if(ne===void 0)ne=new Ts,v[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=v[Z];if(ne===void 0)ne=new Ts,v[Z]=ne;return ne.getHandSpace()};function O(Z){let ne=w.indexOf(Z.inputSource);if(ne===-1)return;let fe=v[ne];if(fe!==void 0)fe.update(Z.inputSource,Z.frame,c||s),fe.dispatchEvent({type:Z.type,data:Z.inputSource})}function H(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",V);for(let Z=0;Z<v.length;Z++){let ne=w[Z];if(ne===null)continue;w[Z]=null,v[Z].disconnect(ne)}z=null,J=null,b.reset();for(let Z in p)delete p[Z];e.setRenderTarget(A),h=null,f=null,u=null,i=null,T=null,Be.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(E.width,E.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(r=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(o=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){if(u===null&&g)u=new XRWebGLBinding(i,t);return u},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",O),i.addEventListener("selectstart",O),i.addEventListener("selectend",O),i.addEventListener("squeeze",O),i.addEventListener("squeezestart",O),i.addEventListener("squeezeend",O),i.addEventListener("end",H),i.addEventListener("inputsourceschange",V),m.xrCompatible!==!0)await t.makeXRCompatible();if(R=e.getPixelRatio(),e.getSize(E),!(g&&("createProjectionLayer"in XRWebGLBinding.prototype))){let fe={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:h}),e.setPixelRatio(1),e.setSize(h.framebufferWidth,h.framebufferHeight,!1),T=new yn(h.framebufferWidth,h.framebufferHeight,{format:$n,type:Ln,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{let fe=null,de=null,Re=null;if(m.depth)Re=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=m.stencil?sr:rr,de=m.stencil?$r:Ci;let $e={colorFormat:t.RGBA8,depthFormat:Re,scaleFactor:r};u=this.getBinding(),f=u.createProjectionLayer($e),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),T=new yn(f.textureWidth,f.textureHeight,{format:$n,type:Ln,depthTexture:new Ni(f.textureWidth,f.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(a),c=null,s=await i.requestReferenceSpace(o),Be.setContext(i),Be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return b.getDepthTexture()};function V(Z){for(let ne=0;ne<Z.removed.length;ne++){let fe=Z.removed[ne],de=w.indexOf(fe);if(de>=0)w[de]=null,v[de].disconnect(fe)}for(let ne=0;ne<Z.added.length;ne++){let fe=Z.added[ne],de=w.indexOf(fe);if(de===-1){for(let $e=0;$e<v.length;$e++)if($e>=w.length){w.push(fe),de=$e;break}else if(w[$e]===null){w[$e]=fe,de=$e;break}if(de===-1)break}let Re=v[de];if(Re)Re.connect(fe)}}let U=new N,K=new N;function Q(Z,ne,fe){U.setFromMatrixPosition(ne.matrixWorld),K.setFromMatrixPosition(fe.matrixWorld);let de=U.distanceTo(K),Re=ne.projectionMatrix.elements,$e=fe.projectionMatrix.elements,Ue=Re[14]/(Re[10]-1),ze=Re[14]/(Re[10]+1),Je=(Re[9]+1)/Re[5],qe=(Re[9]-1)/Re[5],je=(Re[8]-1)/Re[0],Ut=($e[8]+1)/$e[0],pn=Ue*je,pt=Ue*Ut,Gt=de/(-je+Ut),Ot=Gt*-je;if(ne.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(Ot),Z.translateZ(Gt),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Re[10]===-1)Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{let Ct=Ue+Gt,L=ze+Gt,mn=pn-Ot,tt=pt+(de-Ot),mt=Je*ze/L*Ct,M=qe*ze/L*Ct;Z.projectionMatrix.makePerspective(mn,tt,mt,M,Ct,L),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function se(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:fe}=Z;if(b.texture!==null){if(b.depthNear>0)ne=b.depthNear;if(b.depthFar>0)fe=b.depthFar}if(C.near=S.near=_.near=ne,C.far=S.far=_.far=fe,z!==C.near||J!==C.far)i.updateRenderState({depthNear:C.near,depthFar:C.far}),z=C.near,J=C.far;C.layers.mask=Z.layers.mask|6,_.layers.mask=C.layers.mask&-5,S.layers.mask=C.layers.mask&-3;let de=Z.parent,Re=C.cameras;se(C,de);for(let $e=0;$e<Re.length;$e++)se(Re[$e],de);if(Re.length===2)Q(C,_,S);else C.projectionMatrix.copy(_.projectionMatrix);me(Z,C,de)};function me(Z,ne,fe){if(fe===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(fe.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=er*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return C},this.getFoveation=function(){if(f===null&&h===null)return;return a},this.setFoveation=function(Z){if(a=Z,f!==null)f.fixedFoveation=Z;if(h!==null&&h.fixedFoveation!==void 0)h.fixedFoveation=Z},this.hasDepthSensing=function(){return b.texture!==null},this.getDepthSensingMesh=function(){return b.getMesh(C)},this.getCameraTexture=function(Z){return p[Z]};let _e=null;function Xe(Z,ne){if(l=ne.getViewerPose(c||s),d=ne,l!==null){let fe=l.views;if(h!==null)e.setRenderTargetFramebuffer(T,h.framebuffer),e.setRenderTarget(T);let de=!1;if(fe.length!==C.cameras.length)C.cameras.length=0,de=!0;for(let ze=0;ze<fe.length;ze++){let Je=fe[ze],qe=null;if(h!==null)qe=h.getViewport(Je);else{let Ut=u.getViewSubImage(f,Je);if(qe=Ut.viewport,ze===0)e.setRenderTargetTextures(T,Ut.colorTexture,Ut.depthStencilTexture),e.setRenderTarget(T)}let je=F[ze];if(je===void 0)je=new Pt,je.layers.enable(ze),je.viewport=new it,F[ze]=je;if(je.matrix.fromArray(Je.transform.matrix),je.matrix.decompose(je.position,je.quaternion,je.scale),je.projectionMatrix.fromArray(Je.projectionMatrix),je.projectionMatrixInverse.copy(je.projectionMatrix).invert(),je.viewport.set(qe.x,qe.y,qe.width,qe.height),ze===0)C.matrix.copy(je.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale);if(de===!0)C.cameras.push(je)}let Re=i.enabledFeatures;if(Re&&Re.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&g){u=n.getBinding();let ze=u.getDepthInformation(fe[0]);if(ze&&ze.isValid&&ze.texture)b.init(ze,i.renderState)}if(Re&&Re.includes("camera-access")&&g){e.state.unbindTexture(),u=n.getBinding();for(let ze=0;ze<fe.length;ze++){let Je=fe[ze].camera;if(Je){let qe=p[Je];if(!qe)qe=new ia,p[Je]=qe;let je=u.getCameraImage(Je);qe.sourceTexture=je}}}}for(let fe=0;fe<v.length;fe++){let de=w[fe],Re=v[fe];if(de!==null&&Re!==void 0)Re.update(de,ne,c||s)}if(_e)_e(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});d=null}let Be=new bd;Be.setAnimationLoop(Xe),this.setAnimationLoop=function(Z){_e=Z},this.dispose=function(){}}}var SM=new Fe,Dd=new De;Dd.set(-1,0,0,0,1,0,0,0,1);function MM(e,t){function n(p,m){if(p.matrixAutoUpdate===!0)p.updateMatrix();m.value.copy(p.matrix)}function i(p,m){if(m.color.getRGB(p.fogColor.value,wl(e)),m.isFog)p.fogNear.value=m.near,p.fogFar.value=m.far;else if(m.isFogExp2)p.fogDensity.value=m.density}function r(p,m,A,T,v){if(m.isNodeMaterial)m.uniformsNeedUpdate=!1;else if(m.isMeshBasicMaterial)s(p,m);else if(m.isMeshLambertMaterial){if(s(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshToonMaterial)s(p,m),f(p,m);else if(m.isMeshPhongMaterial){if(s(p,m),u(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshStandardMaterial){if(s(p,m),h(p,m),m.isMeshPhysicalMaterial)d(p,m,v)}else if(m.isMeshMatcapMaterial)s(p,m),g(p,m);else if(m.isMeshDepthMaterial)s(p,m);else if(m.isMeshDistanceMaterial)s(p,m),b(p,m);else if(m.isMeshNormalMaterial)s(p,m);else if(m.isLineBasicMaterial){if(o(p,m),m.isLineDashedMaterial)a(p,m)}else if(m.isPointsMaterial)c(p,m,A,T);else if(m.isSpriteMaterial)l(p,m);else if(m.isShadowMaterial)p.color.value.copy(m.color),p.opacity.value=m.opacity;else if(m.isShaderMaterial)m.uniformsNeedUpdate=!1}function s(p,m){if(p.opacity.value=m.opacity,m.color)p.diffuse.value.copy(m.color);if(m.emissive)p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity);if(m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.bumpMap){if(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Xt)p.bumpScale.value*=-1}if(m.normalMap){if(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Xt)p.normalScale.value.negate()}if(m.displacementMap)p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias;if(m.emissiveMap)p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform);if(m.specularMap)p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest;let A=t.get(m),{envMap:T,envMapRotation:v}=A;if(T){if(p.envMap.value=T,p.envMapRotation.value.setFromMatrix4(SM.makeRotationFromEuler(v)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(Dd);p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio}if(m.lightMap)p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform);if(m.aoMap)p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform)}function o(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map)p.map.value=m.map,n(m.map,p.mapTransform)}function a(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function c(p,m,A,T){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*A,p.scale.value=T*0.5,m.map)p.map.value=m.map,n(m.map,p.uvTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function l(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function u(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,0.0001)}function f(p,m){if(m.gradientMap)p.gradientMap.value=m.gradientMap}function h(p,m){if(p.metalness.value=m.metalness,m.metalnessMap)p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=m.roughness,m.roughnessMap)p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform);if(m.envMap)p.envMapIntensity.value=m.envMapIntensity}function d(p,m,A){if(p.ior.value=m.ior,m.sheen>0){if(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap)p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform);if(m.sheenRoughnessMap)p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(m.clearcoat>0){if(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap)p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform);if(m.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(m.clearcoatNormalMap){if(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Xt)p.clearcoatNormalScale.value.negate()}}if(m.dispersion>0)p.dispersion.value=m.dispersion;if(m.iridescence>0){if(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap)p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform);if(m.iridescenceThicknessMap)p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(m.transmission>0){if(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),m.transmissionMap)p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=m.thickness,m.thicknessMap)p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)}if(m.anisotropy>0){if(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap)p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap)p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform);if(m.specularIntensityMap)p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform)}function g(p,m){if(m.matcap)p.matcap.value=m.matcap}function b(p,m){let A=t.get(m).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function wM(e,t,n,i){let r={},s={},o=[],a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(v,w){let E=w.program;i.uniformBlockBinding(v,E)}function l(v,w){let E=r[v.id];if(E===void 0)p(v),E=u(v),r[v.id]=E,v.addEventListener("dispose",A);let R=w.program;i.updateUBOMapping(v,R);let _=t.render.frame;if(s[v.id]!==_)h(v),s[v.id]=_}function u(v){let w=f();v.__bindingPointIndex=w;let E=e.createBuffer(),{__size:R,usage:_}=v;return e.bindBuffer(e.UNIFORM_BUFFER,E),e.bufferData(e.UNIFORM_BUFFER,R,_),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,w,E),E}function f(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return Ne("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(v){let w=r[v.id],{uniforms:E,__cache:R}=v;e.bindBuffer(e.UNIFORM_BUFFER,w);for(let _=0,S=E.length;_<S;_++){let F=E[_];if(Array.isArray(F))for(let C=0,z=F.length;C<z;C++)d(F[C],_,C,R);else d(F,_,0,R)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function d(v,w,E,R){if(b(v,w,E,R)===!0){let{__offset:_,value:S}=v;if(Array.isArray(S)){let F=0;for(let C=0;C<S.length;C++){let z=S[C],J=m(z);if(g(z,v.__data,F),typeof z!=="number"&&typeof z!=="boolean"&&!z.isMatrix3&&!ArrayBuffer.isView(z))F+=J.storage/Float32Array.BYTES_PER_ELEMENT}}else g(S,v.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,_,v.__data)}}function g(v,w,E){if(typeof v==="number"||typeof v==="boolean")w[0]=v;else if(v.isMatrix3)w[0]=v.elements[0],w[1]=v.elements[1],w[2]=v.elements[2],w[3]=0,w[4]=v.elements[3],w[5]=v.elements[4],w[6]=v.elements[5],w[7]=0,w[8]=v.elements[6],w[9]=v.elements[7],w[10]=v.elements[8],w[11]=0;else if(ArrayBuffer.isView(v))w.set(new v.constructor(v.buffer,v.byteOffset,w.length));else v.toArray(w,E)}function b(v,w,E,R){let _=v.value,S=w+"_"+E;if(R[S]===void 0){if(typeof _==="number"||typeof _==="boolean")R[S]=_;else if(ArrayBuffer.isView(_))R[S]=_.slice();else R[S]=_.clone();return!0}else{let F=R[S];if(typeof _==="number"||typeof _==="boolean"){if(F!==_)return R[S]=_,!0}else if(ArrayBuffer.isView(_))return!0;else if(F.equals(_)===!1)return F.copy(_),!0}return!1}function p(v){let w=v.uniforms,E=0,R=16;for(let S=0,F=w.length;S<F;S++){let C=Array.isArray(w[S])?w[S]:[w[S]];for(let z=0,J=C.length;z<J;z++){let O=C[z],H=Array.isArray(O.value)?O.value:[O.value];for(let V=0,U=H.length;V<U;V++){let K=H[V],Q=m(K),se=E%R,me=se%Q.boundary,_e=se+me;if(E+=me,_e!==0&&R-_e<Q.storage)E+=R-_e;O.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=E,E+=Q.storage}}}let _=E%R;if(_>0)E+=R-_;return v.__size=E,v.__cache={},this}function m(v){let w={boundary:0,storage:0};if(typeof v==="number"||typeof v==="boolean")w.boundary=4,w.storage=4;else if(v.isVector2)w.boundary=8,w.storage=8;else if(v.isVector3||v.isColor)w.boundary=16,w.storage=12;else if(v.isVector4)w.boundary=16,w.storage=16;else if(v.isMatrix3)w.boundary=48,w.storage=48;else if(v.isMatrix4)w.boundary=64,w.storage=64;else if(v.isTexture)Me("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(v))w.boundary=16,w.storage=v.byteLength;else Me("WebGLRenderer: Unsupported uniform value type.",v);return w}function A(v){let w=v.target;w.removeEventListener("dispose",A);let E=o.indexOf(w.__bindingPointIndex);o.splice(E,1),e.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function T(){for(let v in r)e.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:c,update:l,dispose:T}}var TM=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Xn=null;function EM(){if(Xn===null)Xn=new Rs(TM,16,16,or,hi),Xn.name="DFG_LUT",Xn.minFilter=kt,Xn.magFilter=kt,Xn.wrapS=Vr,Xn.wrapT=Vr,Xn.generateMipmaps=!1,Xn.needsUpdate=!0;return Xn}class jl{constructor(e={}){let{canvas:t=Gf(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:c=!1,powerPreference:l="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!1,outputBufferType:h=Ln}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=s;let g=h,b=new Set([Oc,Uc,Dc]),p=new Set([Ln,Ci,bs,$r,Lc,Nc]),m=new Uint32Array(4),A=new Int32Array(4),T=new N,v=null,w=null,E=[],R=[],_=null;this.domElement=t,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=Pn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let S=this,F=!1,C=null,z=null,J=null,O=null;this._outputColorSpace=Pi;let H=0,V=0,U=null,K=-1,Q=null,se=new it,me=new it,_e=null,Xe=new Le(0),Be=0,{width:Z,height:ne}=t,fe=1,de=null,Re=null,$e=new it(0,0,Z,ne),Ue=new it(0,0,Z,ne),ze=!1,Je=new Ps,qe=!1,je=!1,Ut=new Fe,pn=new N,pt=new it,Gt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ot=!1;function Ct(){return U===null?fe:1}let L=n;function mn(y,D){return t.getContext(y,D)}try{let y={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${Zh}`);if(t.addEventListener("webglcontextlost",Oe,!1),t.addEventListener("webglcontextrestored",yt,!1),t.addEventListener("webglcontextcreationerror",ht,!1),L===null){if(L=mn("webgl2",y),L===null)if(mn("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(y){throw Ne("WebGLRenderer: "+y.message),y}let tt,mt,M,x,P,W,te,ie,le,X,j,xe,we,ue,re,Ce,Ie,Qe,I,oe,Y,ae,ve;function ee(){if(tt=new Nb(L),tt.init(),Y=new vM(L,tt),mt=new Tb(L,tt,e,Y),M=new _M(L,tt),mt.reversedDepthBuffer&&f)M.buffers.depth.setReversed(!0);z=L.createFramebuffer(),J=L.createFramebuffer(),O=L.createFramebuffer(),x=new Ob(L),P=new iM,W=new xM(L,tt,M,P,mt,Y,x),te=new Lb(S),ie=new Bx(L),ae=new Mb(L,ie),le=new Db(L,ie,x,ae),X=new zb(L,le,ie,ae,x),Qe=new Fb(L,mt,W),re=new Eb(P),j=new nM(S,te,tt,mt,ae,re),xe=new MM(S,P),we=new sM,ue=new hM(tt),Ie=new Sb(S,te,M,X,d,a),Ce=new gM(S,X,mt),ve=new wM(L,x,mt,M),I=new wb(L,tt,x),oe=new Ub(L,tt,x),x.programs=j.programs,S.capabilities=mt,S.extensions=tt,S.properties=P,S.renderLists=we,S.shadowMap=Ce,S.state=M,S.info=x}if(ee(),g!==Ln)_=new Bb(g,t.width,t.height,o,i,r);let ce=new Nd(S,L);this.xr=ce,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let y=tt.get("WEBGL_lose_context");if(y)y.loseContext()},this.forceContextRestore=function(){let y=tt.get("WEBGL_lose_context");if(y)y.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(y){if(y===void 0)return;fe=y,this.setSize(Z,ne,!1)},this.getSize=function(y){return y.set(Z,ne)},this.setSize=function(y,D,G=!0){if(ce.isPresenting){Me("WebGLRenderer: Can't change size while VR device is presenting.");return}if(Z=y,ne=D,t.width=Math.floor(y*fe),t.height=Math.floor(D*fe),G===!0)t.style.width=y+"px",t.style.height=D+"px";if(_!==null)_.setSize(t.width,t.height);this.setViewport(0,0,y,D)},this.getDrawingBufferSize=function(y){return y.set(Z*fe,ne*fe).floor()},this.setDrawingBufferSize=function(y,D,G){Z=y,ne=D,fe=G,t.width=Math.floor(y*G),t.height=Math.floor(D*G),this.setViewport(0,0,y,D)},this.setEffects=function(y){if(g===Ln){Ne("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(y){for(let D=0;D<y.length;D++)if(y[D].isOutputPass===!0){Me("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(y||[])},this.getCurrentViewport=function(y){return y.copy(se)},this.getViewport=function(y){return y.copy($e)},this.setViewport=function(y,D,G,k){if(y.isVector4)$e.set(y.x,y.y,y.z,y.w);else $e.set(y,D,G,k);M.viewport(se.copy($e).multiplyScalar(fe).round())},this.getScissor=function(y){return y.copy(Ue)},this.setScissor=function(y,D,G,k){if(y.isVector4)Ue.set(y.x,y.y,y.z,y.w);else Ue.set(y,D,G,k);M.scissor(me.copy(Ue).multiplyScalar(fe).round())},this.getScissorTest=function(){return ze},this.setScissorTest=function(y){M.setScissorTest(ze=y)},this.setOpaqueSort=function(y){de=y},this.setTransparentSort=function(y){Re=y},this.getClearColor=function(y){return y.copy(Ie.getClearColor())},this.setClearColor=function(){Ie.setClearColor(...arguments)},this.getClearAlpha=function(){return Ie.getClearAlpha()},this.setClearAlpha=function(){Ie.setClearAlpha(...arguments)},this.clear=function(y=!0,D=!0,G=!0){let k=0;if(y){let B=!1;if(U!==null){let ge=U.texture.format;B=b.has(ge)}if(B){let ge=U.texture.type,be=p.has(ge),pe=Ie.getClearColor(),Se=Ie.getClearAlpha(),{r:Ee,g:ke,b:He}=pe;if(be)m[0]=Ee,m[1]=ke,m[2]=He,m[3]=Se,L.clearBufferuiv(L.COLOR,0,m);else A[0]=Ee,A[1]=ke,A[2]=He,A[3]=Se,L.clearBufferiv(L.COLOR,0,A)}else k|=L.COLOR_BUFFER_BIT}if(D)k|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(G)k|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(k!==0)L.clear(k)},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.setNodesHandler=function(y){y.setRenderer(this),C=y},this.dispose=function(){t.removeEventListener("webglcontextlost",Oe,!1),t.removeEventListener("webglcontextrestored",yt,!1),t.removeEventListener("webglcontextcreationerror",ht,!1),Ie.dispose(),we.dispose(),ue.dispose(),P.dispose(),te.dispose(),X.dispose(),ae.dispose(),ve.dispose(),j.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",nh),ce.removeEventListener("sessionend",ih),qi.stop()};function Oe(y){y.preventDefault(),gs("WebGLRenderer: Context Lost."),F=!0}function yt(){gs("WebGLRenderer: Context Restored."),F=!1;let y=x.autoReset,D=Ce.enabled,G=Ce.autoUpdate,k=Ce.needsUpdate,B=Ce.type;ee(),x.autoReset=y,Ce.enabled=D,Ce.autoUpdate=G,Ce.needsUpdate=k,Ce.type=B}function ht(y){Ne("WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function Fn(y){let D=y.target;D.removeEventListener("dispose",Fn),ni(D)}function ni(y){L0(y),P.remove(y)}function L0(y){let D=P.get(y).programs;if(D!==void 0){if(D.forEach(function(G){j.releaseProgram(G)}),y.isShaderMaterial)j.releaseShaderCache(y)}}this.renderBufferDirect=function(y,D,G,k,B,ge){if(D===null)D=Gt;let be=B.isMesh&&B.matrixWorld.determinantAffine()<0,pe=U0(y,D,G,k,B);M.setMaterial(k,be);let Se=G.index,Ee=1;if(k.wireframe===!0){if(Se=le.getWireframeAttribute(G),Se===void 0)return;Ee=2}let ke=G.drawRange,He=G.attributes.position,Ae=ke.start*Ee,st=(ke.start+ke.count)*Ee;if(ge!==null)Ae=Math.max(Ae,ge.start*Ee),st=Math.min(st,(ge.start+ge.count)*Ee);if(Se!==null)Ae=Math.max(Ae,0),st=Math.min(st,Se.count);else if(He!==void 0&&He!==null)Ae=Math.max(Ae,0),st=Math.min(st,He.count);let wt=st-Ae;if(wt<0||wt===1/0)return;ae.setup(B,k,pe,G,Se);let bt,ct=I;if(Se!==null)bt=ie.get(Se),ct=oe,ct.setIndex(bt);if(B.isMesh)if(k.wireframe===!0)M.setLineWidth(k.wireframeLinewidth*Ct()),ct.setMode(L.LINES);else ct.setMode(L.TRIANGLES);else if(B.isLine){let Wt=k.linewidth;if(Wt===void 0)Wt=1;if(M.setLineWidth(Wt*Ct()),B.isLineSegments)ct.setMode(L.LINES);else if(B.isLineLoop)ct.setMode(L.LINE_LOOP);else ct.setMode(L.LINE_STRIP)}else if(B.isPoints)ct.setMode(L.POINTS);else if(B.isSprite)ct.setMode(L.TRIANGLES);if(B.isBatchedMesh)if(!tt.get("WEBGL_multi_draw")){let{_multiDrawStarts:Wt,_multiDrawCounts:ye,_multiDrawCount:sn}=B,Ke=Se?ie.get(Se).bytesPerElement:1,gn=P.get(k).currentProgram.getUniforms();for(let zn=0;zn<sn;zn++)gn.setValue(L,"_gl_DrawID",zn),ct.render(Wt[zn]/Ke,ye[zn])}else ct.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else if(B.isInstancedMesh)ct.renderInstances(Ae,wt,B.count);else if(G.isInstancedBufferGeometry){let Wt=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,ye=Math.min(G.instanceCount,Wt);ct.renderInstances(Ae,wt,ye)}else ct.render(Ae,wt)};function th(y,D,G){if(y.transparent===!0&&y.side===vn&&y.forceSinglePass===!1)y.side=Xt,y.needsUpdate=!0,oo(y,D,G),y.side=Ri,y.needsUpdate=!0,oo(y,D,G),y.side=vn;else oo(y,D,G)}this.compile=function(y,D,G=null){if(G===null)G=y;if(w=ue.get(G),w.init(D),R.push(w),G.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}}),y!==G)y.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}});w.setupLights();let k=new Set;return y.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;let ge=B.material;if(ge)if(Array.isArray(ge))for(let be=0;be<ge.length;be++){let pe=ge[be];th(pe,G,B),k.add(pe)}else th(ge,G,B),k.add(ge)}),w=R.pop(),k},this.compileAsync=function(y,D,G=null){let k=this.compile(y,D,G);return new Promise((B)=>{function ge(){if(k.forEach(function(be){if(P.get(be).currentProgram.isReady())k.delete(be)}),k.size===0){B(y);return}setTimeout(ge,10)}if(tt.get("KHR_parallel_shader_compile")!==null)ge();else setTimeout(ge,10)})};let $a=null;function N0(y){if($a)$a(y)}function nh(){qi.stop()}function ih(){qi.start()}let qi=new bd;if(qi.setAnimationLoop(N0),typeof self<"u")qi.setContext(self);this.setAnimationLoop=function(y){$a=y,ce.setAnimationLoop(y),y===null?qi.stop():qi.start()},ce.addEventListener("sessionstart",nh),ce.addEventListener("sessionend",ih),this.render=function(y,D){if(D!==void 0&&D.isCamera!==!0){Ne("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;if(C!==null)C.renderStart(y,D);let G=ce.enabled===!0&&ce.isPresenting===!0,k=_!==null&&(U===null||G)&&_.begin(S,U);if(y.matrixWorldAutoUpdate===!0)y.updateMatrixWorld();if(D.parent===null&&D.matrixWorldAutoUpdate===!0)D.updateMatrixWorld();if(ce.enabled===!0&&ce.isPresenting===!0&&(_===null||_.isCompositing()===!1)){if(ce.cameraAutoUpdate===!0)ce.updateCamera(D);D=ce.getCamera()}if(y.isScene===!0)y.onBeforeRender(S,y,D,U);if(w=ue.get(y,R.length),w.init(D),w.state.textureUnits=W.getTextureUnits(),R.push(w),Ut.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Je.setFromProjectionMatrix(Ut,xl,D.reversedDepth),je=this.localClippingEnabled,qe=re.init(this.clippingPlanes,je),v=we.get(y,E.length),v.init(),E.push(v),ce.enabled===!0&&ce.isPresenting===!0){let be=S.xr.getDepthSensingMesh();if(be!==null)Za(be,D,-1/0,S.sortObjects)}if(Za(y,D,0,S.sortObjects),v.finish(),S.sortObjects===!0)v.sort(de,Re,D.reversedDepth);if(Ot=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Ot)Ie.addToRenderList(v,y);if(this.info.render.frame++,this.info.autoReset===!0)this.info.reset();if(qe===!0)re.beginShadows();let B=w.state.shadowsArray;if(Ce.render(B,y,D),qe===!0)re.endShadows();if((k&&_.hasRenderPass())===!1){let be=v.opaque,pe=v.transmissive;if(w.setupLights(),D.isArrayCamera){let Se=D.cameras;if(pe.length>0)for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee];sh(be,pe,y,He)}if(Ot)Ie.render(y);for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee];rh(v,y,He,He.viewport)}}else{if(pe.length>0)sh(be,pe,y,D);if(Ot)Ie.render(y);rh(v,y,D)}}if(U!==null&&V===0)W.updateMultisampleRenderTarget(U),W.updateRenderTargetMipmap(U);if(k)_.end(S);if(y.isScene===!0)y.onAfterRender(S,y,D);if(ae.resetDefaultState(),K=-1,Q=null,R.pop(),R.length>0){if(w=R[R.length-1],W.setTextureUnits(w.state.textureUnits),qe===!0)re.setGlobalState(S.clippingPlanes,w.state.camera)}else w=null;if(E.pop(),E.length>0)v=E[E.length-1];else v=null;if(C!==null)C.renderEnd()};function Za(y,D,G,k){if(y.visible===!1)return;if(y.layers.test(D.layers)){if(y.isGroup)G=y.renderOrder;else if(y.isLOD){if(y.autoUpdate===!0)y.update(D)}else if(y.isLightProbeGrid)w.pushLightProbeGrid(y);else if(y.isLight){if(w.pushLight(y),y.castShadow)w.pushShadow(y)}else if(y.isSprite){if(!y.frustumCulled||Je.intersectsSprite(y)){if(k)pt.setFromMatrixPosition(y.matrixWorld).applyMatrix4(Ut);let be=X.update(y),pe=y.material;if(pe.visible)v.push(y,be,pe,G,pt.z,null)}}else if(y.isMesh||y.isLine||y.isPoints){if(!y.frustumCulled||Je.intersectsObject(y)){let be=X.update(y),pe=y.material;if(k){if(y.boundingSphere!==void 0){if(y.boundingSphere===null)y.computeBoundingSphere();pt.copy(y.boundingSphere.center)}else{if(be.boundingSphere===null)be.computeBoundingSphere();pt.copy(be.boundingSphere.center)}pt.applyMatrix4(y.matrixWorld).applyMatrix4(Ut)}if(Array.isArray(pe)){let Se=be.groups;for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee],Ae=pe[He.materialIndex];if(Ae&&Ae.visible)v.push(y,be,Ae,G,pt.z,He)}}else if(pe.visible)v.push(y,be,pe,G,pt.z,null)}}}let ge=y.children;for(let be=0,pe=ge.length;be<pe;be++)Za(ge[be],D,G,k)}function rh(y,D,G,k){let{opaque:B,transmissive:ge,transparent:be}=y;if(w.setupLightsView(G),qe===!0)re.setGlobalState(S.clippingPlanes,G);if(k)M.viewport(se.copy(k));if(B.length>0)so(B,D,G);if(ge.length>0)so(ge,D,G);if(be.length>0)so(be,D,G);M.buffers.depth.setTest(!0),M.buffers.depth.setMask(!0),M.buffers.color.setMask(!0),M.setPolygonOffset(!1)}function sh(y,D,G,k){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(w.state.transmissionRenderTarget[k.id]===void 0){let Ae=tt.has("EXT_color_buffer_half_float")||tt.has("EXT_color_buffer_float");w.state.transmissionRenderTarget[k.id]=new yn(1,1,{generateMipmaps:!0,type:Ae?hi:Ln,minFilter:Wn,samples:Math.max(4,mt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace})}let ge=w.state.transmissionRenderTarget[k.id],be=k.viewport||se;ge.setSize(be.z*S.transmissionResolutionScale,be.w*S.transmissionResolutionScale);let pe=S.getRenderTarget(),Se=S.getActiveCubeFace(),Ee=S.getActiveMipmapLevel();if(S.setRenderTarget(ge),S.getClearColor(Xe),Be=S.getClearAlpha(),Be<1)S.setClearColor(16777215,0.5);if(S.clear(),Ot)Ie.render(G);let ke=S.toneMapping;S.toneMapping=Pn;let He=k.viewport;if(k.viewport!==void 0)k.viewport=void 0;if(w.setupLightsView(k),qe===!0)re.setGlobalState(S.clippingPlanes,k);if(so(y,G,k),W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge),tt.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let st=0,wt=D.length;st<wt;st++){let bt=D[st],{object:ct,geometry:Wt,material:ye,group:sn}=bt;if(ye.side===vn&&ct.layers.test(k.layers)){let Ke=ye.side;ye.side=Xt,ye.needsUpdate=!0,oh(ct,G,k,Wt,ye,sn),ye.side=Ke,ye.needsUpdate=!0,Ae=!0}}if(Ae===!0)W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge)}if(S.setRenderTarget(pe,Se,Ee),S.setClearColor(Xe,Be),He!==void 0)k.viewport=He;S.toneMapping=ke}function so(y,D,G){let k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,ge=y.length;B<ge;B++){let be=y[B],{object:pe,geometry:Se,group:Ee}=be,ke=be.material;if(ke.allowOverride===!0&&k!==null)ke=k;if(pe.layers.test(G.layers))oh(pe,D,G,Se,ke,Ee)}}function oh(y,D,G,k,B,ge){if(y.onBeforeRender(S,D,G,k,B,ge),y.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),B.onBeforeRender(S,D,G,k,y,ge),B.transparent===!0&&B.side===vn&&B.forceSinglePass===!1)B.side=Xt,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,y,ge),B.side=Ri,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,y,ge),B.side=vn;else S.renderBufferDirect(G,D,k,B,y,ge);y.onAfterRender(S,D,G,k,B,ge)}function oo(y,D,G){if(D.isScene!==!0)D=Gt;let k=P.get(y),B=w.state.lights,ge=w.state.shadowsArray,be=B.state.version,pe=j.getParameters(y,B.state,ge,D,G,w.state.lightProbeGridArray),Se=j.getProgramCacheKey(pe),Ee=k.programs;k.environment=y.isMeshStandardMaterial||y.isMeshLambertMaterial||y.isMeshPhongMaterial?D.environment:null,k.fog=D.fog;let ke=y.isMeshStandardMaterial||y.isMeshLambertMaterial&&!y.envMap||y.isMeshPhongMaterial&&!y.envMap;if(k.envMap=te.get(y.envMap||k.environment,ke),k.envMapRotation=k.environment!==null&&y.envMap===null?D.environmentRotation:y.envMapRotation,Ee===void 0)y.addEventListener("dispose",Fn),Ee=new Map,k.programs=Ee;let He=Ee.get(Se);if(He!==void 0){if(k.currentProgram===He&&k.lightsStateVersion===be)return ch(y,pe),He}else{if(pe.uniforms=j.getUniforms(y),C!==null&&y.isNodeMaterial)C.build(y,G,pe);y.onBeforeCompile(pe,S),He=j.acquireProgram(pe,Se),Ee.set(Se,He),k.uniforms=pe.uniforms}let Ae=k.uniforms;if(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)Ae.clippingPlanes=re.uniform;if(ch(y,pe),k.needsLights=F0(y),k.lightsStateVersion=be,k.needsLights)Ae.ambientLightColor.value=B.state.ambient,Ae.lightProbe.value=B.state.probe,Ae.directionalLights.value=B.state.directional,Ae.directionalLightShadows.value=B.state.directionalShadow,Ae.spotLights.value=B.state.spot,Ae.spotLightShadows.value=B.state.spotShadow,Ae.rectAreaLights.value=B.state.rectArea,Ae.ltc_1.value=B.state.rectAreaLTC1,Ae.ltc_2.value=B.state.rectAreaLTC2,Ae.pointLights.value=B.state.point,Ae.pointLightShadows.value=B.state.pointShadow,Ae.hemisphereLights.value=B.state.hemi,Ae.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Ae.spotLightMatrix.value=B.state.spotLightMatrix,Ae.spotLightMap.value=B.state.spotLightMap,Ae.pointShadowMatrix.value=B.state.pointShadowMatrix;return k.lightProbeGrid=w.state.lightProbeGridArray.length>0,k.currentProgram=He,k.uniformsList=null,He}function ah(y){if(y.uniformsList===null){let D=y.currentProgram.getUniforms();y.uniformsList=Bs.seqWithValue(D.seq,y.uniforms)}return y.uniformsList}function ch(y,D){let G=P.get(y);G.outputColorSpace=D.outputColorSpace,G.batching=D.batching,G.batchingColor=D.batchingColor,G.instancing=D.instancing,G.instancingColor=D.instancingColor,G.instancingMorph=D.instancingMorph,G.skinning=D.skinning,G.morphTargets=D.morphTargets,G.morphNormals=D.morphNormals,G.morphColors=D.morphColors,G.morphTargetsCount=D.morphTargetsCount,G.numClippingPlanes=D.numClippingPlanes,G.numIntersection=D.numClipIntersection,G.vertexAlphas=D.vertexAlphas,G.vertexTangents=D.vertexTangents,G.toneMapping=D.toneMapping}function D0(y,D){if(y.length===0)return null;if(y.length===1)return y[0].texture!==null?y[0]:null;T.setFromMatrixPosition(D.matrixWorld);for(let G=0,k=y.length;G<k;G++){let B=y[G];if(B.texture!==null&&B.boundingBox.containsPoint(T))return B}return null}function U0(y,D,G,k,B){if(D.isScene!==!0)D=Gt;W.resetTextureUnits();let ge=D.fog,be=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?D.environment:null,pe=U===null?S.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:Ve.workingColorSpace,Se=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ee=te.get(k.envMap||be,Se),ke=k.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,He=!!G.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ae=!!G.morphAttributes.position,st=!!G.morphAttributes.normal,wt=!!G.morphAttributes.color,bt=Pn;if(k.toneMapped){if(U===null||U.isXRRenderTarget===!0)bt=S.toneMapping}let ct=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Wt=ct!==void 0?ct.length:0,ye=P.get(k),sn=w.state.lights;if(qe===!0){if(je===!0||y!==Q){let ft=y===Q&&k.id===K;re.setState(k,y,ft)}}let Ke=!1;if(k.version===ye.__version){if(ye.needsLights&&ye.lightsStateVersion!==sn.state.version)Ke=!0;else if(ye.outputColorSpace!==pe)Ke=!0;else if(B.isBatchedMesh&&ye.batching===!1)Ke=!0;else if(!B.isBatchedMesh&&ye.batching===!0)Ke=!0;else if(B.isBatchedMesh&&ye.batchingColor===!0&&B.colorTexture===null)Ke=!0;else if(B.isBatchedMesh&&ye.batchingColor===!1&&B.colorTexture!==null)Ke=!0;else if(B.isInstancedMesh&&ye.instancing===!1)Ke=!0;else if(!B.isInstancedMesh&&ye.instancing===!0)Ke=!0;else if(B.isSkinnedMesh&&ye.skinning===!1)Ke=!0;else if(!B.isSkinnedMesh&&ye.skinning===!0)Ke=!0;else if(B.isInstancedMesh&&ye.instancingColor===!0&&B.instanceColor===null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingColor===!1&&B.instanceColor!==null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!0&&B.morphTexture===null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!1&&B.morphTexture!==null)Ke=!0;else if(ye.envMap!==Ee)Ke=!0;else if(k.fog===!0&&ye.fog!==ge)Ke=!0;else if(ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==re.numPlanes||ye.numIntersection!==re.numIntersection))Ke=!0;else if(ye.vertexAlphas!==ke)Ke=!0;else if(ye.vertexTangents!==He)Ke=!0;else if(ye.morphTargets!==Ae)Ke=!0;else if(ye.morphNormals!==st)Ke=!0;else if(ye.morphColors!==wt)Ke=!0;else if(ye.toneMapping!==bt)Ke=!0;else if(ye.morphTargetsCount!==Wt)Ke=!0;else if(!!ye.lightProbeGrid!==w.state.lightProbeGridArray.length>0)Ke=!0}else Ke=!0,ye.__version=k.version;let gn=ye.currentProgram;if(Ke===!0){if(gn=oo(k,D,B),C&&k.isNodeMaterial)C.onUpdateProgram(k,gn,ye)}let zn=!1,_i=!1,vr=!1,lt=gn.getUniforms(),Tt=ye.uniforms;if(M.useProgram(gn.program))zn=!0,_i=!0,vr=!0;if(k.id!==K)K=k.id,_i=!0;if(ye.needsLights){let ft=D0(w.state.lightProbeGridArray,B);if(ye.lightProbeGrid!==ft)ye.lightProbeGrid=ft,_i=!0}if(zn||Q!==y){if(M.buffers.depth.getReversed()&&y.reversedDepth!==!0)y._reversedDepth=!0,y.updateProjectionMatrix();lt.setValue(L,"projectionMatrix",y.projectionMatrix),lt.setValue(L,"viewMatrix",y.matrixWorldInverse);let vi=lt.map.cameraPosition;if(vi!==void 0)vi.setValue(L,pn.setFromMatrixPosition(y.matrixWorld));if(mt.logarithmicDepthBuffer)lt.setValue(L,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2));if(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)lt.setValue(L,"isOrthographic",y.isOrthographicCamera===!0);if(Q!==y)Q=y,_i=!0,vr=!0}if(ye.needsLights){if(sn.state.directionalShadowMap.length>0)lt.setValue(L,"directionalShadowMap",sn.state.directionalShadowMap,W);if(sn.state.spotShadowMap.length>0)lt.setValue(L,"spotShadowMap",sn.state.spotShadowMap,W);if(sn.state.pointShadowMap.length>0)lt.setValue(L,"pointShadowMap",sn.state.pointShadowMap,W)}if(B.isSkinnedMesh){lt.setOptional(L,B,"bindMatrix"),lt.setOptional(L,B,"bindMatrixInverse");let ft=B.skeleton;if(ft){if(ft.boneTexture===null)ft.computeBoneTexture();lt.setValue(L,"boneTexture",ft.boneTexture,W)}}if(B.isBatchedMesh){if(lt.setOptional(L,B,"batchingTexture"),lt.setValue(L,"batchingTexture",B._matricesTexture,W),lt.setOptional(L,B,"batchingIdTexture"),lt.setValue(L,"batchingIdTexture",B._indirectTexture,W),lt.setOptional(L,B,"batchingColorTexture"),B._colorsTexture!==null)lt.setValue(L,"batchingColorTexture",B._colorsTexture,W)}let xi=G.morphAttributes;if(xi.position!==void 0||xi.normal!==void 0||xi.color!==void 0)Qe.update(B,G,gn);if(_i||ye.receiveShadow!==B.receiveShadow)ye.receiveShadow=B.receiveShadow,lt.setValue(L,"receiveShadow",B.receiveShadow);if((k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&D.environment!==null)Tt.envMapIntensity.value=D.environmentIntensity;if(Tt.dfgLUT!==void 0)Tt.dfgLUT.value=EM();if(_i){if(lt.setValue(L,"toneMappingExposure",S.toneMappingExposure),ye.needsLights)O0(Tt,vr);if(ge&&k.fog===!0)xe.refreshFogUniforms(Tt,ge);if(xe.refreshMaterialUniforms(Tt,k,fe,ne,w.state.transmissionRenderTarget[y.id]),ye.needsLights&&ye.lightProbeGrid){let ft=ye.lightProbeGrid;Tt.probesSH.value=ft.texture,Tt.probesMin.value.copy(ft.boundingBox.min),Tt.probesMax.value.copy(ft.boundingBox.max),Tt.probesResolution.value.copy(ft.resolution)}Bs.upload(L,ah(ye),Tt,W)}if(k.isShaderMaterial&&k.uniformsNeedUpdate===!0)Bs.upload(L,ah(ye),Tt,W),k.uniformsNeedUpdate=!1;if(k.isSpriteMaterial)lt.setValue(L,"center",B.center);if(lt.setValue(L,"modelViewMatrix",B.modelViewMatrix),lt.setValue(L,"normalMatrix",B.normalMatrix),lt.setValue(L,"modelMatrix",B.matrixWorld),k.uniformsGroups!==void 0){let ft=k.uniformsGroups;for(let vi=0,yr=ft.length;vi<yr;vi++){let lh=ft[vi];ve.update(lh,gn),ve.bind(lh,gn)}}return gn}function O0(y,D){y.ambientLightColor.needsUpdate=D,y.lightProbe.needsUpdate=D,y.directionalLights.needsUpdate=D,y.directionalLightShadows.needsUpdate=D,y.pointLights.needsUpdate=D,y.pointLightShadows.needsUpdate=D,y.spotLights.needsUpdate=D,y.spotLightShadows.needsUpdate=D,y.rectAreaLights.needsUpdate=D,y.hemisphereLights.needsUpdate=D}function F0(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}if(this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(y,D,G){let k=P.get(y);if(k.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1)k.__useRenderToTexture=!1;P.get(y.texture).__webglTexture=D,P.get(y.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:G,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,D){let G=P.get(y);G.__webglFramebuffer=D,G.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(y,D=0,G=0){U=y,H=D,V=G;let k=null,B=!1,ge=!1;if(y){let pe=P.get(y);if(pe.__useDefaultFramebuffer!==void 0){M.bindFramebuffer(L.FRAMEBUFFER,pe.__webglFramebuffer),se.copy(y.viewport),me.copy(y.scissor),_e=y.scissorTest,M.viewport(se),M.scissor(me),M.setScissorTest(_e),K=-1;return}else if(pe.__webglFramebuffer===void 0)W.setupRenderTarget(y);else if(pe.__hasExternalTextures)W.rebindTextures(y,P.get(y.texture).__webglTexture,P.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){let ke=y.depthTexture;if(pe.__boundDepthTexture!==ke){if(ke!==null&&P.has(ke)&&(y.width!==ke.image.width||y.height!==ke.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");W.setupDepthRenderbuffer(y)}}let Se=y.texture;if(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)ge=!0;let Ee=P.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget){if(Array.isArray(Ee[D]))k=Ee[D][G];else k=Ee[D];B=!0}else if(y.samples>0&&W.useMultisampledRTT(y)===!1)k=P.get(y).__webglMultisampledFramebuffer;else if(Array.isArray(Ee))k=Ee[G];else k=Ee;se.copy(y.viewport),me.copy(y.scissor),_e=y.scissorTest}else se.copy($e).multiplyScalar(fe).floor(),me.copy(Ue).multiplyScalar(fe).floor(),_e=ze;if(G!==0)k=z;if(M.bindFramebuffer(L.FRAMEBUFFER,k))M.drawBuffers(y,k);if(M.viewport(se),M.scissor(me),M.setScissorTest(_e),B){let pe=P.get(y.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+D,pe.__webglTexture,G)}else if(ge){let pe=D;for(let Se=0;Se<y.textures.length;Se++){let Ee=P.get(y.textures[Se]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Se,Ee.__webglTexture,G,pe)}}else if(y!==null&&G!==0){let pe=P.get(y.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,pe.__webglTexture,G)}K=-1},this.readRenderTargetPixels=function(y,D,G,k,B,ge,be,pe=0){if(!(y&&y.isWebGLRenderTarget)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=P.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se){M.bindFramebuffer(L.FRAMEBUFFER,Se);try{let Ee=y.textures[pe],{format:ke,type:He}=Ee;if(y.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!mt.textureFormatReadable(ke)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!mt.textureTypeReadable(He)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(D>=0&&D<=y.width-k&&(G>=0&&G<=y.height-B))L.readPixels(D,G,k,B,Y.convert(ke),Y.convert(He),ge)}finally{let Ee=U!==null?P.get(U).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(y,D,G,k,B,ge,be,pe=0){if(!(y&&y.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=P.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se)if(D>=0&&D<=y.width-k&&(G>=0&&G<=y.height-B)){M.bindFramebuffer(L.FRAMEBUFFER,Se);let Ee=y.textures[pe],{format:ke,type:He}=Ee;if(y.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!mt.textureFormatReadable(ke))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!mt.textureTypeReadable(He))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,ge.byteLength,L.STREAM_READ),L.readPixels(D,G,k,B,Y.convert(ke),Y.convert(He),0);let st=U!==null?P.get(U).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,st);let wt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await Vf(L,wt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,ge),L.deleteBuffer(Ae),L.deleteSync(wt),ge}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,D=null,G=0){let k=Math.pow(2,-G),B=Math.floor(y.image.width*k),ge=Math.floor(y.image.height*k),be=D!==null?D.x:0,pe=D!==null?D.y:0;W.setTexture2D(y,0),L.copyTexSubImage2D(L.TEXTURE_2D,G,0,0,be,pe,B,ge),M.unbindTexture()},this.copyTextureToTexture=function(y,D,G=null,k=null,B=0,ge=0){let be,pe,Se,Ee,ke,He,Ae,st,wt,bt=y.isCompressedTexture?y.mipmaps[ge]:y.image;if(G!==null)be=G.max.x-G.min.x,pe=G.max.y-G.min.y,Se=G.isBox3?G.max.z-G.min.z:1,Ee=G.min.x,ke=G.min.y,He=G.isBox3?G.min.z:0;else{let Tt=Math.pow(2,-B);if(be=Math.floor(bt.width*Tt),pe=Math.floor(bt.height*Tt),y.isDataArrayTexture)Se=bt.depth;else if(y.isData3DTexture)Se=Math.floor(bt.depth*Tt);else Se=1;Ee=0,ke=0,He=0}if(k!==null)Ae=k.x,st=k.y,wt=k.z;else Ae=0,st=0,wt=0;let ct=Y.convert(D.format),Wt=Y.convert(D.type),ye;if(D.isData3DTexture)W.setTexture3D(D,0),ye=L.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)W.setTexture2DArray(D,0),ye=L.TEXTURE_2D_ARRAY;else W.setTexture2D(D,0),ye=L.TEXTURE_2D;M.activeTexture(L.TEXTURE0),M.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,D.flipY),M.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),M.pixelStorei(L.UNPACK_ALIGNMENT,D.unpackAlignment);let sn=M.getParameter(L.UNPACK_ROW_LENGTH),Ke=M.getParameter(L.UNPACK_IMAGE_HEIGHT),gn=M.getParameter(L.UNPACK_SKIP_PIXELS),zn=M.getParameter(L.UNPACK_SKIP_ROWS),_i=M.getParameter(L.UNPACK_SKIP_IMAGES);M.pixelStorei(L.UNPACK_ROW_LENGTH,bt.width),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,bt.height),M.pixelStorei(L.UNPACK_SKIP_PIXELS,Ee),M.pixelStorei(L.UNPACK_SKIP_ROWS,ke),M.pixelStorei(L.UNPACK_SKIP_IMAGES,He);let vr=y.isDataArrayTexture||y.isData3DTexture,lt=D.isDataArrayTexture||D.isData3DTexture;if(y.isDepthTexture){let Tt=P.get(y),xi=P.get(D),ft=P.get(Tt.__renderTarget),vi=P.get(xi.__renderTarget);M.bindFramebuffer(L.READ_FRAMEBUFFER,ft.__webglFramebuffer),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,vi.__webglFramebuffer);for(let yr=0;yr<Se;yr++){if(vr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,P.get(y).__webglTexture,B,He+yr),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,P.get(D).__webglTexture,ge,wt+yr);L.blitFramebuffer(Ee,ke,be,pe,Ae,st,be,pe,L.DEPTH_BUFFER_BIT,L.NEAREST)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(B!==0||y.isRenderTargetTexture||P.has(y)){let Tt=P.get(y),xi=P.get(D);M.bindFramebuffer(L.READ_FRAMEBUFFER,J),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,O);for(let ft=0;ft<Se;ft++){if(vr)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Tt.__webglTexture,B,He+ft);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Tt.__webglTexture,B);if(lt)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,xi.__webglTexture,ge,wt+ft);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,xi.__webglTexture,ge);if(B!==0)L.blitFramebuffer(Ee,ke,be,pe,Ae,st,be,pe,L.COLOR_BUFFER_BIT,L.NEAREST);else if(lt)L.copyTexSubImage3D(ye,ge,Ae,st,wt+ft,Ee,ke,be,pe);else L.copyTexSubImage2D(ye,ge,Ae,st,Ee,ke,be,pe)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(lt)if(y.isDataTexture||y.isData3DTexture)L.texSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,Wt,bt.data);else if(D.isCompressedArrayTexture)L.compressedTexSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,bt.data);else L.texSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,Wt,bt);else if(y.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,ge,Ae,st,be,pe,ct,Wt,bt.data);else if(y.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,ge,Ae,st,bt.width,bt.height,ct,bt.data);else L.texSubImage2D(L.TEXTURE_2D,ge,Ae,st,be,pe,ct,Wt,bt);if(M.pixelStorei(L.UNPACK_ROW_LENGTH,sn),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ke),M.pixelStorei(L.UNPACK_SKIP_PIXELS,gn),M.pixelStorei(L.UNPACK_SKIP_ROWS,zn),M.pixelStorei(L.UNPACK_SKIP_IMAGES,_i),ge===0&&D.generateMipmaps)L.generateMipmap(ye);M.unbindTexture()},this.initRenderTarget=function(y){if(P.get(y).__webglFramebuffer===void 0)W.setupRenderTarget(y)},this.initTexture=function(y){if(y.isCubeTexture)W.setTextureCube(y,0);else if(y.isData3DTexture)W.setTexture3D(y,0);else if(y.isDataArrayTexture||y.isCompressedArrayTexture)W.setTexture2DArray(y,0);else W.setTexture2D(y,0);M.unbindTexture()},this.resetState=function(){H=0,V=0,U=null,M.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return xl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}function Jl(e,t){if(t===pl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Zr||t===Ss){let n=e.getIndex();if(n===null){let o=[],a=e.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);e.setIndex(o),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,r=[];if(t===Zr)for(let o=1;o<=i;o++)r.push(n.getX(0)),r.push(n.getX(o)),r.push(n.getX(o+1));else for(let o=0;o<i;o++)if(o%2===0)r.push(n.getX(o)),r.push(n.getX(o+1)),r.push(n.getX(o+2));else r.push(n.getX(o+2)),r.push(n.getX(o+1)),r.push(n.getX(o));if(r.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=e.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function Ud(e){let t=new Map,n=new Map,i=e.clone();return Od(e,i,function(r,s){t.set(s,r),n.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=t.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return n.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function Od(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)Od(e.children[i],t.children[i],n)}class ru extends pi{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Wd(t)}),this.register(function(t){return new $d(t)}),this.register(function(t){return new ep(t)}),this.register(function(t){return new tp(t)}),this.register(function(t){return new np(t)}),this.register(function(t){return new Xd(t)}),this.register(function(t){return new qd(t)}),this.register(function(t){return new Yd(t)}),this.register(function(t){return new jd(t)}),this.register(function(t){return new Vd(t)}),this.register(function(t){return new Jd(t)}),this.register(function(t){return new Zd(t)}),this.register(function(t){return new Qd(t)}),this.register(function(t){return new Kd(t)}),this.register(function(t){return new Gd(t)}),this.register(function(t){return new tu(t,Ze.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new tu(t,Ze.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new ip(t)})}load(e,t,n,i){let r=this,s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){let c=ki.extractUrlBase(e);s=ki.resolveURL(c,this.path)}else s=ki.extractUrlBase(e);this.manager.itemStart(e);let o=function(c){if(i)i(c);else console.error(c);r.manager.itemError(e),r.manager.itemEnd(e)},a=new Us(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{r.parse(c,s,function(l){t(l),r.manager.itemEnd(e)},o)}catch(l){o(l)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let r,s={},o={},a=new TextDecoder;if(typeof e==="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===rp){try{s[Ze.KHR_BINARY_GLTF]=new sp(e)}catch(u){if(i)i(u);return}r=JSON.parse(s[Ze.KHR_BINARY_GLTF].content)}else r=JSON.parse(a.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new up(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){let u=this.pluginCallbacks[l](c);if(!u.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");o[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let l=0;l<r.extensionsUsed.length;++l){let u=r.extensionsUsed[l],f=r.extensionsRequired||[];switch(u){case Ze.KHR_MATERIALS_UNLIT:s[u]=new Hd;break;case Ze.KHR_DRACO_MESH_COMPRESSION:s[u]=new op(r,this.dracoLoader);break;case Ze.KHR_TEXTURE_TRANSFORM:s[u]=new ap;break;case Ze.KHR_MESH_QUANTIZATION:s[u]=new cp;break;default:if(f.indexOf(u)>=0&&o[u]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function RM(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function Et(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}var Ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Gd{constructor(e){this.parser=e,this.name=Ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];if(r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],c,l=new Le(16777215);if(a.color!==void 0)l.setRGB(a.color[0],a.color[1],a.color[2],cn);let u=a.range!==void 0?a.range:0;switch(a.type){case"directional":c=new Qr(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Kr(l),c.distance=u;break;case"spot":c=new ha(l),c.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,c.angle=a.spot.outerConeAngle,c.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}if(c.position.set(0,0,0),Yn(c,a),a.intensity!==void 0)c.intensity=a.intensity;return c.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(c),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;if(o===void 0)return null;return this._loadLight(o).then(function(a){return n._getNodeRef(t.cache,o,a)})}}class Hd{constructor(){this.name=Ze.KHR_MATERIALS_UNLIT}getMaterialType(){return Zn}extendParams(e,t,n){let i=[];e.color=new Le(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],cn),e.opacity=s[3]}if(r.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",r.baseColorTexture,Pi))}return Promise.all(i)}}class Vd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class Wd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Pe(r,r)}}return Promise.all(i)}}class $d{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class Zd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(t.iridescenceThicknessRange===void 0)t.iridescenceThicknessRange=[100,400];if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class Xd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_SHEEN}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Le(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],cn)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,Pi));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class qd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class Yd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_VOLUME}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Le().setRGB(r[0],r[1],r[2],cn),Promise.all(i)}}class jd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_IOR}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class Jd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];if(t.specularColor=new Le().setRGB(r[0],r[1],r[2],cn),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,Pi));return Promise.all(i)}}class Kd{constructor(e){this.parser=e,this.name=Ze.EXT_MATERIALS_BUMP}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class Qd{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Et(this.parser,e,this.name)!==null?un:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class ep{constructor(e){this.parser=e,this.name=Ze.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,r.source,s)}}class tp{constructor(e){this.parser=e,this.name=Ze.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class np{constructor(e){this.parser=e,this.name=Ze.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class tu{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return r.then(function(o){let a=i.byteOffset||0,c=i.byteLength||0,{count:l,byteStride:u}=i,f=new Uint8Array(o,a,c);if(s.decodeGltfBufferAsync)return s.decodeGltfBufferAsync(l,u,f,i.mode,i.filter).then(function(h){return h.buffer});else return s.ready.then(function(){let h=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(h),l,u,f,i.mode,i.filter),h})})}else return null}}class ip{constructor(e){this.name=Ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let c of i.primitives)if(c.mode!==Sn.TRIANGLES&&c.mode!==Sn.TRIANGLE_STRIP&&c.mode!==Sn.TRIANGLE_FAN&&c.mode!==void 0)return null;let s=n.extensions[this.name].attributes,o=[],a={};for(let c in s)o.push(this.parser.getDependency("accessor",s[c]).then((l)=>(a[c]=l,a[c])));if(o.length<1)return null;return o.push(this.parser.createNodeMesh(e)),Promise.all(o).then((c)=>{let l=c.pop(),u=l.isGroup?l.children:[l],f=c[0].count,h=[];for(let d of u){let g=new Fe,b=new N,p=new zt,m=new N(1,1,1),A=new Yr(d.geometry,d.material,f);for(let T=0;T<f;T++){if(a.TRANSLATION)b.fromBufferAttribute(a.TRANSLATION,T);if(a.ROTATION)p.fromBufferAttribute(a.ROTATION,T);if(a.SCALE)m.fromBufferAttribute(a.SCALE,T);A.setMatrixAt(T,g.compose(b,p,m))}for(let T in a)if(T==="_COLOR_0"){let v=a[T];A.instanceColor=new tr(v.array,v.itemSize,v.normalized)}else if(T!=="TRANSLATION"&&T!=="ROTATION"&&T!=="SCALE")d.geometry.setAttribute(T,a[T]);ot.prototype.copy.call(A,d),this.parser.assignFinalMaterial(A),h.push(A)}if(l.isGroup)return l.clear(),l.add(...h),l;return h[0]})}}var rp="glTF",Hs=12,Fd={JSON:1313821514,BIN:5130562};class sp{constructor(e){this.name=Ze.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Hs),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==rp)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-Hs,r=new DataView(e,Hs),s=0;while(s<i){let o=r.getUint32(s,!0);s+=4;let a=r.getUint32(s,!0);if(s+=4,a===Fd.JSON){let c=new Uint8Array(e,Hs+s,o);this.content=n.decode(c)}else if(a===Fd.BIN){let c=Hs+s;this.body=e.slice(c,c+o)}s+=o}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class op{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ze.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},c={};for(let l in s){let u=nu[l]||l.toLowerCase();o[u]=s[l]}for(let l in e.attributes){let u=nu[l]||l.toLowerCase();if(s[l]!==void 0){let f=n.accessors[e.attributes[l]],h=ns[f.componentType];c[u]=h.name,a[u]=f.normalized===!0}}return t.getDependency("bufferView",r).then(function(l){return new Promise(function(u,f){i.decodeDracoFile(l,function(h){for(let d in h.attributes){let g=h.attributes[d],b=a[d];if(b!==void 0)g.normalized=b}u(h)},o,c,cn,f)})})}}class ap{constructor(){this.name=Ze.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);return e.needsUpdate=!0,e}}class cp{constructor(){this.name=Ze.KHR_MESH_QUANTIZATION}}class su extends di{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=o*2,c=o*3,l=i-t,u=(n-t)/l,f=u*u,h=f*u,d=e*c,g=d-c,b=-2*h+3*f,p=h-f,m=1-b,A=p-f+u;for(let T=0;T!==o;T++){let v=s[g+T+o],w=s[g+T+a]*l,E=s[d+T+o],R=s[d+T]*l;r[T]=m*v+A*w+b*E+p*R}return r}}var CM=new zt;class lp extends su{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return CM.fromArray(r).normalize().toArray(r),r}}var Sn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ns={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zd={9728:In,9729:kt,9984:ko,9985:Wr,9986:ir,9987:Wn},kd={33071:Vr,33648:zo,10497:Hr},Kl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},nu={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Gi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},PM={CUBICSPLINE:void 0,LINEAR:Zo,STEP:dl},Ql={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function IM(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new fi({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ri});return e.DefaultMaterial}function fr(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function Yn(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function LM(e,t,n){let i=!1,r=!1,s=!1;for(let l=0,u=t.length;l<u;l++){let f=t[l];if(f.POSITION!==void 0)i=!0;if(f.NORMAL!==void 0)r=!0;if(f.COLOR_0!==void 0)s=!0;if(i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);let o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){let f=t[l];if(i){let h=f.POSITION!==void 0?n.getDependency("accessor",f.POSITION):e.attributes.position;o.push(h)}if(r){let h=f.NORMAL!==void 0?n.getDependency("accessor",f.NORMAL):e.attributes.normal;a.push(h)}if(s){let h=f.COLOR_0!==void 0?n.getDependency("accessor",f.COLOR_0):e.attributes.color;c.push(h)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let u=l[0],f=l[1],h=l[2];if(i)e.morphAttributes.position=u;if(r)e.morphAttributes.normal=f;if(s)e.morphAttributes.color=h;return e.morphTargetsRelative=!0,e})}function NM(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function DM(e){let t,n=e.extensions&&e.extensions[Ze.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+eu(n.attributes);else t=e.indices+":"+eu(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+eu(e.targets[i]);return t}function eu(e){let t="",n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function iu(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function UM(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var OM=new Fe;class up{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new RM,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let a=o.match(/Version\/(\d+)/);i=n&&a?parseInt(a[1],10):-1,r=o.indexOf("Firefox")>-1,s=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||r&&s<98)this.textureLoader=new aa(this.options.manager);else this.textureLoader=new fa(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Us(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){let o={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};return fr(r,o,i),Yn(o,i),Promise.all(n._invokeAll(function(a){return a.afterRoot&&a.afterRoot(o)})).then(function(){for(let a of o.scenes)a.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let s=t[i].joints;for(let o=0,a=s.length;o<a;o++)e[s[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let s=e[i];if(s.mesh!==void 0){if(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0)n[s.mesh].isSkinnedMesh=!0}if(s.camera!==void 0)this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(s,o)=>{let a=this.associations.get(s);if(a!=null)this.associations.set(o,a);for(let[c,l]of s.children.entries())r(l,o.children[c])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,s){return n.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ze.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,s){n.load(ki.resolveURL(t.uri,i.path),r,void 0,function(){s(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let s=Kl[i.type],o=ns[i.componentType],a=i.normalized===!0,c=new o(i.count*s);return Promise.resolve(new It(c,s,a))}let r=[];if(i.bufferView!==void 0)r.push(this.getDependency("bufferView",i.bufferView));else r.push(null);if(i.sparse!==void 0)r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(r).then(function(s){let o=s[0],a=Kl[i.type],c=ns[i.componentType],l=c.BYTES_PER_ELEMENT,u=l*a,f=i.byteOffset||0,h=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,d=i.normalized===!0,g,b;if(h&&h!==u){let p=Math.floor(f/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,A=t.cache.get(m);if(!A)g=new c(o,p*h,i.count*h/l),A=new Es(g,h/l),t.cache.add(m,A);b=new qr(A,a,f%h/l,d)}else{if(o===null)g=new c(i.count*a);else g=new c(o,f,i.count*a);b=new It(g,a,d)}if(i.sparse!==void 0){let p=Kl.SCALAR,m=ns[i.sparse.indices.componentType],A=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,v=new m(s[1],A,i.sparse.count*p),w=new c(s[2],T,i.sparse.count*a);if(o!==null)b=new It(b.array.slice(),b.itemSize,b.normalized);b.normalized=!1;for(let E=0,R=v.length;E<R;E++){let _=v[E];if(b.setX(_,w[E*a]),a>=2)b.setY(_,w[E*a+1]);if(a>=3)b.setZ(_,w[E*a+2]);if(a>=4)b.setW(_,w[E*a+3]);if(a>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=d}return b})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,s=t.images[r],o=this.textureLoader;if(s.uri){let a=n.manager.getHandler(s.uri);if(a!==null)o=a}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];let c=this.loadImageSource(t,n).then(function(l){if(l.flipY=!1,l.name=s.name||o.name||"",l.name===""&&typeof o.uri==="string"&&o.uri.startsWith("data:image/")===!1)l.name=o.uri;let f=(r.samplers||{})[s.sampler]||{};return l.magFilter=zd[f.magFilter]||kt,l.minFilter=zd[f.minFilter]||Wn,l.wrapS=kd[f.wrapS]||Hr,l.wrapT=kd[f.wrapT]||Hr,l.generateMipmaps=!l.isCompressedTexture&&l.minFilter!==In&&l.minFilter!==kt,i.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[a]=c,c}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let s=i.images[e],o=self.URL||self.webkitURL,a=s.uri||"",c=!1;if(s.bufferView!==void 0)a=n.getDependency("bufferView",s.bufferView).then(function(u){c=!0;let f=new Blob([u],{type:s.mimeType});return a=o.createObjectURL(f),a});else if(s.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(a).then(function(u){return new Promise(function(f,h){let d=f;if(t.isImageBitmapLoader===!0)d=function(g){let b=new St(g);b.needsUpdate=!0,f(b)};t.load(ki.resolveURL(u,r.path),d,void 0,h)})}).then(function(u){if(c===!0)o.revokeObjectURL(a);return Yn(u,s),u.userData.mimeType=s.mimeType||UM(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),u});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0)s=s.clone(),s.channel=n.texCoord;if(r.extensions[Ze.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Ze.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let a=r.associations.get(s);s=r.extensions[Ze.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),r.associations.set(s,a)}}if(i!==void 0)s.colorSpace=i;return e[t]=s,s})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new Ls,nn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,a.sizeAttenuation=!1,this.cache.add(o,a);n=a}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new Is,nn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,this.cache.add(o,a);n=a}if(i||r||s){let o="ClonedMaterial:"+n.uuid+":";if(i)o+="derivative-tangents:";if(r)o+="vertex-colors:";if(s)o+="flat-shading:";let a=this.cache.get(o);if(!a){if(a=n.clone(),r)a.vertexColors=!0;if(s)a.flatShading=!0;if(i){if(a.normalScale)a.normalScale.y*=-1;if(a.clearcoatNormalScale)a.clearcoatNormalScale.y*=-1}this.cache.add(o,a),this.associations.set(a,this.associations.get(n))}n=a}e.material=n}getMaterialType(){return fi}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],s,o={},a=r.extensions||{},c=[];if(a[Ze.KHR_MATERIALS_UNLIT]){let u=i[Ze.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Le(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let f=u.baseColorFactor;o.color.setRGB(f[0],f[1],f[2],cn),o.opacity=f[3]}if(u.baseColorTexture!==void 0)c.push(t.assignTexture(o,"map",u.baseColorTexture,Pi));if(o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0)c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture));s=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}if(r.doubleSided===!0)o.side=vn;let l=r.alphaMode||Ql.OPAQUE;if(l===Ql.BLEND)o.transparent=!0,o.depthWrite=!1;else if(o.transparent=!1,l===Ql.MASK)o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:0.5;if(r.normalTexture!==void 0&&s!==Zn){if(c.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Pe(1,1),r.normalTexture.scale!==void 0){let u=r.normalTexture.scale;o.normalScale.set(u,u)}}if(r.occlusionTexture!==void 0&&s!==Zn){if(c.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0)o.aoMapIntensity=r.occlusionTexture.strength}if(r.emissiveFactor!==void 0&&s!==Zn){let u=r.emissiveFactor;o.emissive=new Le().setRGB(u[0],u[1],u[2],cn)}if(r.emissiveTexture!==void 0&&s!==Zn)c.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Pi));return Promise.all(c).then(function(){let u=new s(o);if(r.name)u.name=r.name;if(Yn(u,r),t.associations.set(u,{materials:e}),r.extensions)fr(i,u,r);return u})}createUniqueName(e){let t=et.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(a){return Bd(a,o,t)})}let s=[];for(let o=0,a=e.length;o<a;o++){let c=e[o],l=DM(c),u=i[l];if(u)s.push(u.promise);else{let f;if(c.extensions&&c.extensions[Ze.KHR_DRACO_MESH_COMPRESSION])f=r(c);else f=Bd(new Kt,c,t);i[l]={primitive:c,promise:f},s.push(f)}}return Promise.all(s)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let a=0,c=s.length;a<c;a++){let l=s[a].material===void 0?IM(this.cache):this.getDependency("material",s[a].material);o.push(l)}return o.push(t.loadGeometries(s)),Promise.all(o).then(function(a){let c=a.slice(0,a.length-1),l=a[a.length-1],u=[];for(let h=0,d=l.length;h<d;h++){let g=l[h],b=s[h],p,m=c[h];if(b.mode===Sn.TRIANGLES||b.mode===Sn.TRIANGLE_STRIP||b.mode===Sn.TRIANGLE_FAN||b.mode===void 0){if(p=r.isSkinnedMesh===!0?new Qo(g,m):new dt(g,m),p.isSkinnedMesh===!0)p.normalizeSkinWeights();if(b.mode===Sn.TRIANGLE_STRIP)p.geometry=Jl(p.geometry,Ss);else if(b.mode===Sn.TRIANGLE_FAN)p.geometry=Jl(p.geometry,Zr)}else if(b.mode===Sn.LINES)p=new ea(g,m);else if(b.mode===Sn.LINE_STRIP)p=new Li(g,m);else if(b.mode===Sn.LINE_LOOP)p=new ta(g,m);else if(b.mode===Sn.POINTS)p=new jr(g,m);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);if(Object.keys(p.geometry.morphAttributes).length>0)NM(p,r);if(p.name=t.createUniqueName(r.name||"mesh_"+e),Yn(p,r),b.extensions)fr(i,p,b);t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h<d;h++)t.associations.set(u[h],{meshes:e,primitives:h});if(u.length===1){if(r.extensions)fr(i,u[0],r);return u[0]}let f=new Bn;if(r.extensions)fr(i,f,r);t.associations.set(f,{meshes:e});for(let h=0,d=u.length;h<d;h++)f.add(u[h]);return f})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Pt(Ms.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new ur(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return Yn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let r=i.pop(),s=i,o=[],a=[];for(let c=0,l=s.length;c<l;c++){let u=s[c];if(u){o.push(u);let f=new Fe;if(r!==null)f.fromArray(r.array,c*16);a.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Cs(o,a)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],c=[],l=[];for(let u=0,f=i.channels.length;u<f;u++){let h=i.channels[u],d=i.samplers[h.sampler],g=h.target,b=g.node,p=i.parameters!==void 0?i.parameters[d.input]:d.input,m=i.parameters!==void 0?i.parameters[d.output]:d.output;if(g.node===void 0)continue;s.push(this.getDependency("node",b)),o.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",m)),c.push(d),l.push(g)}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l)]).then(function(u){let f=u[0],h=u[1],d=u[2],g=u[3],b=u[4],p=[];for(let A=0,T=f.length;A<T;A++){let v=f[A],w=h[A],E=d[A],R=g[A],_=b[A];if(v===void 0)continue;if(v.updateMatrix)v.updateMatrix();let S=n._createAnimationTracks(v,w,E,R,_);if(S)for(let F=0;F<S.length;F++)p.push(S[F])}let m=new zr(r,void 0,p);return Yn(m,i),m})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(r){let s=n._getNodeRef(n.meshCache,i.mesh,r);if(i.weights!==void 0)s.traverse(function(o){if(!o.isMesh)return;for(let a=0,c=i.weights.length;a<c;a++)o.morphTargetInfluences[a]=i.weights[a]});return s})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),s=[],o=i.children||[];for(let c=0,l=o.length;c<l;c++)s.push(n.getDependency("node",o[c]));let a=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),a]).then(function(c){let l=c[0],u=c[1],f=c[2];if(f!==null)l.traverse(function(h){if(!h.isSkinnedMesh)return;h.bind(f,OM)});for(let h=0,d=u.length;h<d;h++)l.add(u[h]);if(l.userData.pivot!==void 0&&u.length>0){let h=l.userData.pivot,d=u[0];l.pivot=new N().fromArray(h),l.position.x-=h[0],l.position.y-=h[1],l.position.z-=h[2],d.position.set(0,0,0),delete l.userData.pivot}return l})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});if(a)o.push(a);if(r.camera!==void 0)o.push(i.getDependency("camera",r.camera).then(function(c){return i._getNodeRef(i.cameraCache,r.camera,c)}));return i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let l;if(r.isBone===!0)l=new As;else if(c.length>1)l=new Bn;else if(c.length===1)l=c[0];else l=new ot;if(l!==c[0])for(let u=0,f=c.length;u<f;u++)l.add(c[u]);if(r.name)l.userData.name=r.name,l.name=s;if(Yn(l,r),r.extensions)fr(n,l,r);if(r.matrix!==void 0){let u=new Fe;u.fromArray(r.matrix),l.applyMatrix4(u)}else{if(r.translation!==void 0)l.position.fromArray(r.translation);if(r.rotation!==void 0)l.quaternion.fromArray(r.rotation);if(r.scale!==void 0)l.scale.fromArray(r.scale)}if(!i.associations.has(l))i.associations.set(l,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(l);i.associations.set(l,{...u})}return i.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new Bn;if(n.name)r.name=i.createUniqueName(n.name);if(Yn(r,n),n.extensions)fr(t,r,n);let s=n.nodes||[],o=[];for(let a=0,c=s.length;a<c;a++)o.push(i.getDependency("node",s[a]));return Promise.all(o).then(function(a){for(let l=0,u=a.length;l<u;l++){let f=a[l];if(f.parent!==null)r.add(Ud(f));else r.add(f)}let c=(l)=>{let u=new Map;for(let[f,h]of i.associations)if(f instanceof nn||f instanceof St)u.set(f,h);return l.traverse((f)=>{let h=i.associations.get(f);if(h!=null)u.set(f,h)}),u};return i.associations=c(r),r})}_createAnimationTracks(e,t,n,i,r){let s=[],o=e.name?e.name:e.uuid,a=[];function c(h){if(h.morphTargetInfluences)a.push(h.name?h.name:h.uuid)}if(Gi[r.path]===Gi.weights){if(c(e),e.isGroup)e.children.forEach(c)}else a.push(o);let l;switch(Gi[r.path]){case Gi.weights:l=Oi;break;case Gi.rotation:l=Fi;break;case Gi.translation:case Gi.scale:l=lr;break;default:switch(n.itemSize){case 1:l=Oi;break;case 2:case 3:default:l=lr;break}break}let u=i.interpolation!==void 0?PM[i.interpolation]:Zo,f=this._getArrayFromAccessor(n);for(let h=0,d=a.length;h<d;h++){let g=new l(a[h]+"."+Gi[r.path],t.array,f,u);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(g);s.push(g)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=iu(t.constructor),i=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof Fi?lp:su)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function FM(e,t,n){let i=t.attributes,r=new Jt;if(i.POSITION!==void 0){let a=n.json.accessors[i.POSITION],{min:c,max:l}=a;if(c!==void 0&&l!==void 0){if(r.set(new N(c[0],c[1],c[2]),new N(l[0],l[1],l[2])),a.normalized){let u=iu(ns[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=t.targets;if(s!==void 0){let a=new N,c=new N;for(let l=0,u=s.length;l<u;l++){let f=s[l];if(f.POSITION!==void 0){let h=n.json.accessors[f.POSITION],{min:d,max:g}=h;if(d!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),h.normalized){let b=iu(ns[h.componentType]);c.multiplyScalar(b)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}e.boundingBox=r;let o=new ln;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}function Bd(e,t,n){let i=t.attributes,r=[];function s(o,a){return n.getDependency("accessor",o).then(function(c){e.setAttribute(a,c)})}for(let o in i){let a=nu[o]||o.toLowerCase();if(a in e.attributes)continue;r.push(s(i[o],a))}if(t.indices!==void 0&&!e.index){let o=n.getDependency("accessor",t.indices).then(function(a){e.setIndex(a)});r.push(o)}if(Ve.workingColorSpace!==cn&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ve.workingColorSpace}" not supported.`);return Yn(e,t),FM(e,t,n),Promise.all(r).then(function(){return t.targets!==void 0?LM(e,t.targets,n):e})}var hp={type:"change"},au={type:"start"},dp={type:"end"},va=new Ii,fp=new An,zM=Math.cos(70*Ms.DEG2RAD),Dt=new N,rn=2*Math.PI,at={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ou=0.000001;class cu extends pa{constructor(e,t=null){super(e,t);if(this.state=at.NONE,this.target=new N,this.cursor=new N,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=0.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:Ei.ROTATE,MIDDLE:Ei.DOLLY,RIGHT:Ei.PAN},this.touches={ONE:Ai.ROTATE,TWO:Ai.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new zt,this._lastTargetPosition=new N,this._quat=new zt().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Os,this._sphericalDelta=new Os,this._scale=1,this._panOffset=new N,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 N,this._mouse=new Pe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=BM.bind(this),this._onPointerDown=kM.bind(this),this._onPointerUp=GM.bind(this),this._onContextMenu=qM.bind(this),this._onMouseWheel=WM.bind(this),this._onKeyDown=$M.bind(this),this._onTouchStart=ZM.bind(this),this._onTouchMove=XM.bind(this),this._onMouseDown=HM.bind(this),this._onMouseMove=VM.bind(this),this._interceptControlDown=YM.bind(this),this._interceptControlUp=jM.bind(this),this.domElement!==null)this.connect(this.domElement);this.update()}set cursorStyle(e){if(this._cursorStyle=e,e==="grab")this.domElement.style.cursor="grab";else this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),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.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.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=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){if(this._domElementKeyEvents!==null)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(hp),this.update(),this.state=at.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;if(Dt.copy(t).sub(this.target),Dt.applyQuaternion(this._quat),this._spherical.setFromVector3(Dt),this.autoRotate&&this.state===at.NONE)this._rotateLeft(this._getAutoRotationAngle(e));if(this.enableDamping)this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor;else this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi;let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;if(isFinite(n)&&isFinite(i)){if(n<-Math.PI)n+=rn;else if(n>Math.PI)n-=rn;if(i<-Math.PI)i+=rn;else if(i>Math.PI)i-=rn;if(n<=i)this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta));else this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)}if(this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0)this.target.addScaledVector(this._panOffset,this.dampingFactor);else 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{let s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=s!=this._spherical.radius}if(Dt.setFromSpherical(this._spherical),Dt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Dt),this.object.lookAt(this.target),this.enableDamping===!0)this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor);else this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0);if(this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){let o=Dt.length();s=this._clampDistance(o*this._scale);let a=o-s;this.object.position.addScaledVector(this._dollyDirection,a),this.object.updateMatrixWorld(),r=!!a}else if(this.object.isOrthographicCamera){let o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=a!==this.object.zoom;let c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=Dt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;if(s!==null)if(this.screenSpacePanning)this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position);else if(va.origin.copy(this.object.position),va.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(va.direction))<zM)this.object.lookAt(this.target);else fp.setFromNormalAndCoplanarPoint(this.object.up,this.target),va.intersectPlane(fp,this.target)}else if(this.object.isOrthographicCamera){let s=this.object.zoom;if(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom)this.object.updateProjectionMatrix(),r=!0}if(this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>ou||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ou||this._lastTargetPosition.distanceToSquared(this.target)>ou)return this.dispatchEvent(hp),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0;return!1}_getAutoRotationAngle(e){if(e!==null)return rn/60*this.autoRotateSpeed*e;else return rn/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*0.01);return Math.pow(0.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Dt.setFromMatrixColumn(t,0),Dt.multiplyScalar(-e),this._panOffset.add(Dt)}_panUp(e,t){if(this.screenSpacePanning===!0)Dt.setFromMatrixColumn(t,1);else Dt.setFromMatrixColumn(t,0),Dt.crossVectors(this.object.up,Dt);Dt.multiplyScalar(e),this._panOffset.add(Dt)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Dt.copy(i).sub(this.target);let r=Dt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else if(this.object.isOrthographicCamera)this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix);else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1}_dollyOut(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale/=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_dollyIn(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale*=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,{width:s,height:o}=n;this._mouse.x=i/s*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(rn*this._rotateDelta.x/t.clientHeight),this._rotateUp(rn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){if(this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0)this._dollyOut(this._getZoomScale(this._dollyDelta.y));else if(this._dollyDelta.y<0)this._dollyIn(this._getZoomScale(this._dollyDelta.y));this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.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(e){if(this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0)this._dollyIn(this._getZoomScale(e.deltaY));else if(e.deltaY>0)this._dollyOut(this._getZoomScale(e.deltaY));this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(rn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,this.keyPanSpeed);t=!0;break;case this.keys.BOTTOM:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(-rn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,-this.keyPanSpeed);t=!0;break;case this.keys.LEFT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(rn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(this.keyPanSpeed,0);t=!0;break;case this.keys.RIGHT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(-rn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(-this.keyPanSpeed,0);t=!0;break}if(t)e.preventDefault(),this.update()}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enablePan)this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enableRotate)this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=0.5*(e.pageX+n.x),r=0.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(rn*this._rotateDelta.x/t.clientHeight),this._rotateUp(rn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.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(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.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);let s=(e.pageX+t.x)*0.5,o=(e.pageY+t.y)*0.5;this._updateZoomParameters(s,o)}_handleTouchMoveDollyPan(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enablePan)this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enableRotate)this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];if(t===void 0)t=new Pe,this._pointerPositions[e.pointerId]=t;t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}if(e.ctrlKey&&!this._controlActive)n.deltaY*=10;return n}}function kM(e){if(this.enabled===!1)return;if(this._pointers.length===0)this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp);if(this._isTrackingPointer(e))return;if(this._addPointer(e),e.pointerType==="touch")this._onTouchStart(e);else this._onMouseDown(e);if(this._cursorStyle==="grab")this.domElement.style.cursor="grabbing"}function BM(e){if(this.enabled===!1)return;if(e.pointerType==="touch")this._onTouchMove(e);else this._onMouseMove(e)}function GM(e){switch(this._removePointer(e),this._pointers.length){case 0:if(this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(dp),this.state=at.NONE,this._cursorStyle==="grab")this.domElement.style.cursor="grab";break;case 1:let t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y});break}}function HM(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Ei.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(e),this.state=at.DOLLY;break;case Ei.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=at.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=at.ROTATE}break;case Ei.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=at.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=at.PAN}break;default:this.state=at.NONE}if(this.state!==at.NONE)this.dispatchEvent(au)}function VM(e){switch(this.state){case at.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(e);break;case at.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(e);break;case at.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(e);break}}function WM(e){if(this.enabled===!1||this.enableZoom===!1||this.state!==at.NONE)return;e.preventDefault(),this.dispatchEvent(au),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(dp)}function $M(e){if(this.enabled===!1)return;this._handleKeyDown(e)}function ZM(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case Ai.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(e),this.state=at.TOUCH_ROTATE;break;case Ai.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(e),this.state=at.TOUCH_PAN;break;default:this.state=at.NONE}break;case 2:switch(this.touches.TWO){case Ai.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(e),this.state=at.TOUCH_DOLLY_PAN;break;case Ai.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(e),this.state=at.TOUCH_DOLLY_ROTATE;break;default:this.state=at.NONE}break;default:this.state=at.NONE}if(this.state!==at.NONE)this.dispatchEvent(au)}function XM(e){switch(this._trackPointer(e),this.state){case at.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(e),this.update();break;case at.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(e),this.update();break;case at.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(e),this.update();break;case at.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=at.NONE}}function qM(e){if(this.enabled===!1)return;e.preventDefault()}function YM(e){if(e.key==="Control")this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}function jM(e){if(e.key==="Control")this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}class lu extends Xr{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let e=new Di;e.deleteAttribute("uv");let t=new fi({side:Xt}),n=new fi,i=new Kr(16777215,900,28,2);i.position.set(0.418,16.199,0.3),this.add(i);let r=new dt(e,t);r.position.set(-0.757,13.219,0.717),r.scale.set(31.713,28.305,28.591),this.add(r);let s=new Yr(e,n,6),o=new ot;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-0.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),s.setMatrixAt(0,o.matrix),o.position.set(-5.607,-0.754,-0.758),o.rotation.set(0,0.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),s.setMatrixAt(1,o.matrix),o.position.set(6.167,0.857,7.803),o.rotation.set(0,0.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),s.setMatrixAt(2,o.matrix),o.position.set(-2.017,0.018,6.124),o.rotation.set(0,0.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),s.setMatrixAt(3,o.matrix),o.position.set(2.291,-0.756,-2.621),o.rotation.set(0,-0.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),s.setMatrixAt(4,o.matrix),o.position.set(-2.193,-0.369,-5.547),o.rotation.set(0,0.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),s.setMatrixAt(5,o.matrix),this.add(s);let a=new dt(e,is(50));a.position.set(-16.116,14.37,8.208),a.scale.set(0.1,2.428,2.739),this.add(a);let c=new dt(e,is(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(0.1,2.425,2.751),this.add(c);let l=new dt(e,is(17));l.position.set(14.904,12.198,-1.832),l.scale.set(0.15,4.265,6.331),this.add(l);let u=new dt(e,is(43));u.position.set(-0.462,8.89,14.52),u.scale.set(4.38,5.441,0.088),this.add(u);let f=new dt(e,is(20));f.position.set(3.235,11.486,-12.541),f.scale.set(2.5,2,0.1),this.add(f);let h=new dt(e,is(100));h.position.set(0,20,0),h.scale.set(1,0.1,1),this.add(h)}dispose(){let e=new Set;this.traverse((t)=>{if(t.isMesh)e.add(t.geometry),e.add(t.material)});for(let t of e)t.dispose()}}function is(e){return new ra({color:0,emissive:16777215,emissiveIntensity:e})}var pp;function q(e,t,n){function i(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=o.prototype,u=Object.keys(l);for(let f=0;f<u.length;f++){let h=u[f];if(!(h in a))a[h]=l[h].bind(a)}}let r=n?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function o(a){var c;let l=n?.Parent?new s:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}var _R=Symbol("zod_brand");class mi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vs extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(pp=globalThis).__zod_globalConfig??(pp.__zod_globalConfig={});var rs=globalThis.__zod_globalConfig;function Dn(e){if(e)Object.assign(rs,e);return rs}function ba(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function $s(e,t){if(typeof t==="bigint")return t.toString();return t}function Sa(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function Ma(e){return e===null||e===void 0}function wa(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function gp(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-i)<r)return 0;return n-i}var mp=Symbol("evaluating");function rt(e,t,n){let i=void 0;Object.defineProperty(e,t,{get(){if(i===mp)return;if(i===void 0)i=mp,i=n();return i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function dr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hi(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function hu(e){return JSON.stringify(e)}function _p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var fu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ws(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var xp=Sa(()=>{if(rs.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function pr(e){if(Ws(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(Ws(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function du(e){if(pr(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var vp=new Set(["string","number","symbol"]);function Vi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jn(e,t,n){let i=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)i._zod.parent=e;return i}function Te(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function yp(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var bp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function JM(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=Hi(e._zod.def,{get shape(){let o={};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;o[a]=n.shape[a]}return dr(this,"shape",o),o},checks:[]});return jn(e,s)}function KM(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=Hi(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete o[a]}return dr(this,"shape",o),o},checks:[]});return jn(e,s)}function QM(e,t){if(!pr(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let s=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Hi(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return dr(this,"shape",s),s}});return jn(e,r)}function ew(e,t){if(!pr(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=Hi(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return dr(this,"shape",i),i}});return jn(e,n)}function tw(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Hi(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return dr(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return jn(e,n)}function nw(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let o=Hi(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!n[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return dr(this,"shape",c),c},checks:[]});return jn(t,o)}function iw(e,t,n){let i=Hi(t._zod.def,{get shape(){let r=t._zod.def.shape,s={...r};if(n)for(let o in n){if(!(o in s))throw Error(`Unrecognized key: "${o}"`);if(!n[o])continue;s[o]=new e({type:"nonoptional",innerType:r[o]})}else for(let o in r)s[o]=new e({type:"nonoptional",innerType:r[o]});return dr(this,"shape",s),s}});return jn(t,i)}function mr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Sp(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Wi(e,t){return t.map((n)=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function ya(e){return typeof e==="string"?e:e?.message}function Un(e,t,n){let i=e.message?e.message:ya(e.inst?._zod.def?.error?.(e))??ya(t?.error?.(e))??ya(n.customError?.(e))??ya(n.localeError?.(e))??"Invalid input",{inst:r,continue:s,input:o,...a}=e;if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=o;return a}function Ta(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function gr(...e){let[t,n,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:i};return{...t}}var Mp=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,$s,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ea=q("$ZodError",Mp),pu=q("$ZodError",Mp,{Parent:Error});function wp(e,t=(n)=>n.message){let n={},i=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else i.push(t(r));return{formErrors:i,fieldErrors:n}}function Tp(e,t=(n)=>n.message){let n={_errors:[]},i=(r,s=[])=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map((a)=>i({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...s,...o.path]);else{let a=[...s,...o.path];if(a.length===0)n._errors.push(t(o));else{let c=n,l=0;while(l<a.length){let u=a[l];if(l!==a.length-1)c[u]=c[u]||{_errors:[]};else c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o));c=c[u],l++}}}};return i(e),n}var Aa=(e)=>(t,n,i,r)=>{let s=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new mi;if(o.issues.length){let a=new(r?.Err??e)(o.issues.map((c)=>Un(c,s,Dn())));throw fu(a,r?.callee),a}return o.value};var Ra=(e)=>async(t,n,i,r)=>{let s=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)o=await o;if(o.issues.length){let a=new(r?.Err??e)(o.issues.map((c)=>Un(c,s,Dn())));throw fu(a,r?.callee),a}return o.value};var Zs=(e)=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new mi;return s.issues.length?{success:!1,error:new(e??Ea)(s.issues.map((o)=>Un(o,r,Dn())))}:{success:!0,data:s.value}},Ep=Zs(pu),Xs=(e)=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((o)=>Un(o,r,Dn())))}:{success:!0,data:s.value}},Ap=Xs(pu),Rp=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Aa(e)(t,n,r)};var Cp=(e)=>(t,n,i)=>Aa(e)(t,n,i);var Pp=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ra(e)(t,n,r)};var Ip=(e)=>async(t,n,i)=>Ra(e)(t,n,i);var Lp=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Zs(e)(t,n,r)};var Np=(e)=>(t,n,i)=>Zs(e)(t,n,i);var Dp=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Xs(e)(t,n,r)};var Up=(e)=>async(t,n,i)=>Xs(e)(t,n,i);var Op=/^[cC][0-9a-z]{6,}$/,Fp=/^[0-9a-z]+$/,zp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kp=/^[0-9a-vA-V]{20}$/,Bp=/^[A-Za-z0-9]{27}$/,Gp=/^[a-zA-Z0-9_-]{21}$/,Hp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Vp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mu=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Wp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var sw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $p(){return new RegExp(sw,"u")}var Zp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var qp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Yp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gu=/^[A-Za-z0-9_-]*$/;var Jp=/^https?$/,Kp=/^\+[1-9]\d{6,14}$/,Qp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",em=new RegExp(`^${Qp}$`);function tm(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function nm(e){return new RegExp(`^${tm(e)}$`)}function im(e){let t=tm({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${Qp}T(?:${i})$`)}var rm=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var sm=/^-?\d+$/,_u=/^-?\d+(?:\.\d+)?$/,om=/^(?:true|false)$/i;var am=/^[^A-Z]*$/,cm=/^[^a-z]*$/;var Ht=q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lm={number:"number",bigint:"bigint",object:"date"},xu=q("$ZodCheckLessThan",(e,t)=>{Ht.init(e,t);let n=lm[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vu=q("$ZodCheckGreaterThan",(e,t)=>{Ht.init(e,t);let n=lm[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),um=q("$ZodCheckMultipleOf",(e,t)=>{Ht.init(e,t),e._zod.onattach.push((n)=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):gp(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),hm=q("$ZodCheckNumberFormat",(e,t)=>{Ht.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=bp[t.format];e._zod.onattach.push((o)=>{let a=o._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=s,n)a.pattern=sm}),e._zod.check=(o)=>{let a=o.value;if(n){if(!Number.isInteger(a)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});else o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}if(a<r)o.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>s)o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var fm=q("$ZodCheckMaxLength",(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!Ma(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)i._zod.bag.maximum=t.maximum}),e._zod.check=(i)=>{let r=i.value;if(r.length<=t.maximum)return;let o=Ta(r);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dm=q("$ZodCheckMinLength",(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!Ma(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)i._zod.bag.minimum=t.minimum}),e._zod.check=(i)=>{let r=i.value;if(r.length>=t.minimum)return;let o=Ta(r);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pm=q("$ZodCheckLengthEquals",(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!Ma(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(i)=>{let r=i.value,s=r.length;if(s===t.length)return;let o=Ta(r),a=s>t.length;i.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),qs=q("$ZodCheckStringFormat",(e,t)=>{var n,i;if(Ht.init(e,t),e._zod.onattach.push((r)=>{let s=r._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),mm=q("$ZodCheckRegex",(e,t)=>{qs.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gm=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=am),qs.init(e,t)}),_m=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cm),qs.init(e,t)}),xm=q("$ZodCheckIncludes",(e,t)=>{Ht.init(e,t);let n=Vi(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((r)=>{let s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),vm=q("$ZodCheckStartsWith",(e,t)=>{Ht.init(e,t);let n=new RegExp(`^${Vi(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),ym=q("$ZodCheckEndsWith",(e,t)=>{Ht.init(e,t);let n=new RegExp(`.*${Vi(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});var bm=q("$ZodCheckOverwrite",(e,t)=>{Ht.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class yu{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
-`).filter((s)=>s),i=Math.min(...n.map((s)=>s.length-s.trimStart().length)),r=n.map((s)=>s.slice(i)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of r)this.content.push(s)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map((r)=>` ${r}`)];return new e(...t,i.join(`
-`))}}var Mm={major:4,minor:4,patch:3};var _t=q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mm;let i=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))i.unshift(e);for(let r of i)for(let s of r._zod.onattach)s(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(o,a,c)=>{let l=mr(o),u;for(let f of a){if(f._zod.def.when){if(Sp(o))continue;if(!f._zod.def.when(o))continue}else if(l)continue;let h=o.issues.length,d=f._zod.check(o);if(d instanceof Promise&&c?.async===!1)throw new mi;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await d,o.issues.length===h)return;if(!l)l=mr(o,h)});else{if(o.issues.length===h)continue;if(!l)l=mr(o,h)}}if(u)return u.then(()=>o);return o},s=(o,a,c)=>{if(mr(o))return o.aborted=!0,o;let l=r(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new mi;return l.then((u)=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if(a.direction==="backward"){let l=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((u)=>s(u,o,a));return s(l,o,a)}let c=e._zod.parse(o,a);if(c instanceof Promise){if(a.async===!1)throw new mi;return c.then((l)=>r(l,i,a))}return r(c,i,a)}}rt(e,"~standard",()=>({validate:(r)=>{try{let s=Ep(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Ap(e,r).then((o)=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),La=q("$ZodString",(e,t)=>{_t.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rm(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),gt=q("$ZodStringFormat",(e,t)=>{qs.init(e,t),La.init(e,t)}),Lm=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vp),gt.init(e,t)}),Nm=q("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mu(i))}else t.pattern??(t.pattern=mu());gt.init(e,t)}),Dm=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Wp),gt.init(e,t)}),Um=q("$ZodURL",(e,t)=>{gt.init(e,t),e._zod.check=(n)=>{try{let i=n.value.trim();if(!t.normalize&&t.protocol?.source===Jp.source){if(!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}}let r=new URL(i);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(r.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=r.href;else n.value=i;return}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Om=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$p()),gt.init(e,t)}),Fm=q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Gp),gt.init(e,t)}),zm=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Op),gt.init(e,t)}),km=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Fp),gt.init(e,t)}),Bm=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zp),gt.init(e,t)}),Gm=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=kp),gt.init(e,t)}),Hm=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Bp),gt.init(e,t)}),Vm=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=im(t)),gt.init(e,t)}),Wm=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=em),gt.init(e,t)}),$m=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nm(t)),gt.init(e,t)}),Zm=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hp),gt.init(e,t)}),Xm=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zp),gt.init(e,t),e._zod.bag.format="ipv4"}),qm=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xp),gt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}});var Ym=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qp),gt.init(e,t)}),jm=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yp),gt.init(e,t),e._zod.check=(n)=>{let i=n.value.split("/");try{if(i.length!==2)throw Error();let[r,s]=i;if(!s)throw Error();let o=Number(s);if(`${o}`!==s)throw Error();if(o<0||o>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Jm(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Km=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jp),gt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(n)=>{if(Jm(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function ow(e){if(!gu.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jm(n)}var Qm=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gu),gt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(n)=>{if(ow(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),eg=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Kp),gt.init(e,t)});function aw(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var tg=q("$ZodJWT",(e,t)=>{gt.init(e,t),e._zod.check=(n)=>{if(aw(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var Su=q("$ZodNumber",(e,t)=>{_t.init(e,t),e._zod.pattern=e._zod.bag.pattern??_u,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let s=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),ng=q("$ZodNumberFormat",(e,t)=>{hm.init(e,t),Su.init(e,t)}),ig=q("$ZodBoolean",(e,t)=>{_t.init(e,t),e._zod.pattern=om,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var rg=q("$ZodUnknown",(e,t)=>{_t.init(e,t),e._zod.parse=(n)=>n}),sg=q("$ZodNever",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function wm(e,t,n){if(e.issues.length)t.issues.push(...Wi(n,e.issues));t.value[n]=e.value}var og=q("$ZodArray",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let s=[];for(let o=0;o<r.length;o++){let a=r[o],c=t.element._zod.run({value:a,issues:[]},i);if(c instanceof Promise)s.push(c.then((l)=>wm(l,n,o)));else wm(c,n,o)}if(s.length)return Promise.all(s).then(()=>n);return n}});function Ia(e,t,n,i,r,s){let o=n in i;if(e.issues.length){if(r&&s&&!o)return;t.issues.push(...Wi(n,e.issues))}if(!o&&!r){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(o)t.value[n]=void 0}else t.value[n]=e.value}function ag(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${i}": expected a Zod schema`);let n=yp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function cg(e,t,n,i,r,s){let o=[],a=r.keySet,c=r.catchall._zod,l=c.def.type,u=c.optin==="optional",f=c.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(a.has(h))continue;if(l==="never"){o.push(h);continue}let d=c.run({value:t[h],issues:[]},i);if(d instanceof Promise)e.push(d.then((g)=>Ia(g,n,h,t,u,f)));else Ia(d,n,h,t,u,f)}if(o.length)n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s});if(!e.length)return n;return Promise.all(e).then(()=>n)}var cw=q("$ZodObject",(e,t)=>{if(_t.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let i=Sa(()=>ag(t));rt(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let f of u.values)c[l].add(f)}}return c});let r=Ws,s=t.catchall,o;e._zod.parse=(a,c)=>{o??(o=i.value);let l=a.value;if(!r(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],f=o.shape;for(let h of o.keys){let d=f[h],g=d._zod.optin==="optional",b=d._zod.optout==="optional",p=d._zod.run({value:l[h],issues:[]},c);if(p instanceof Promise)u.push(p.then((m)=>Ia(m,a,h,l,g,b)));else Ia(p,a,h,l,g,b)}if(!s)return u.length?Promise.all(u).then(()=>a):a;return cg(u,l,a,c,i.value,e)}}),lg=q("$ZodObjectJIT",(e,t)=>{cw.init(e,t);let n=e._zod.parse,i=Sa(()=>ag(t)),r=(h)=>{let d=new yu(["shape","payload","ctx"]),g=i.value,b=(T)=>{let v=hu(T);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");let p=Object.create(null),m=0;for(let T of g.keys)p[T]=`key_${m++}`;d.write("const newResult = {};");for(let T of g.keys){let v=p[T],w=hu(T),E=h[T],R=E?._zod?.optin==="optional",_=E?._zod?.optout==="optional";if(d.write(`const ${v} = ${b(T)};`),R&&_)d.write(`
- if (${v}.issues.length) {
- if (${w} in input) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+}`;class xp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new ma(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new wn({vertexShader:Bw,fragmentShader:Gw,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new dt(new Gs(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class vp extends Fn{constructor(e,t){super();let n=this,i=null,r=1,s=null,o="local-floor",a=1,c=null,l=null,u=null,h=null,f=null,d=null,m=typeof XRWebGLBinding<"u",x=new xp,p={},g=t.getContextAttributes(),A=null,E=null,y=[],w=[],T=new Pe,R=null,_=new Pt;_.viewport=new rt;let S=new Pt;S.viewport=new rt;let U=[_,S],C=new nu,z=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=y[Z];if(ne===void 0)ne=new Ns,y[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=y[Z];if(ne===void 0)ne=new Ns,y[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=y[Z];if(ne===void 0)ne=new Ns,y[Z]=ne;return ne.getHandSpace()};function F(Z){let ne=w.indexOf(Z.inputSource);if(ne===-1)return;let fe=y[ne];if(fe!==void 0)fe.update(Z.inputSource,Z.frame,c||s),fe.dispatchEvent({type:Z.type,data:Z.inputSource})}function H(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",V);for(let Z=0;Z<y.length;Z++){let ne=w[Z];if(ne===null)continue;w[Z]=null,y[Z].disconnect(ne)}z=null,j=null,x.reset();for(let Z in p)delete p[Z];e.setRenderTarget(A),f=null,h=null,u=null,i=null,E=null,Be.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(r=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(o=Z,n.isPresenting===!0)Me("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){if(u===null&&m)u=new XRWebGLBinding(i,t);return u},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",H),i.addEventListener("inputsourceschange",V),g.xrCompatible!==!0)await t.makeXRCompatible();if(R=e.getPixelRatio(),e.getSize(T),!(m&&("createProjectionLayer"in XRWebGLBinding.prototype))){let fe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Mn(f.framebufferWidth,f.framebufferHeight,{format:Yn,type:Un,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{let fe=null,de=null,Re=null;if(g.depth)Re=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=g.stencil?dr:fr,de=g.stencil?Kr:ki;let $e={colorFormat:t.RGBA8,depthFormat:Re,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer($e),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Mn(h.textureWidth,h.textureHeight,{format:Yn,type:Un,depthTexture:new Vi(h.textureWidth,h.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(a),c=null,s=await i.requestReferenceSpace(o),Be.setContext(i),Be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function V(Z){for(let ne=0;ne<Z.removed.length;ne++){let fe=Z.removed[ne],de=w.indexOf(fe);if(de>=0)w[de]=null,y[de].disconnect(fe)}for(let ne=0;ne<Z.added.length;ne++){let fe=Z.added[ne],de=w.indexOf(fe);if(de===-1){for(let $e=0;$e<y.length;$e++)if($e>=w.length){w.push(fe),de=$e;break}else if(w[$e]===null){w[$e]=fe,de=$e;break}if(de===-1)break}let Re=y[de];if(Re)Re.connect(fe)}}let O=new N,K=new N;function Q(Z,ne,fe){O.setFromMatrixPosition(ne.matrixWorld),K.setFromMatrixPosition(fe.matrixWorld);let de=O.distanceTo(K),Re=ne.projectionMatrix.elements,$e=fe.projectionMatrix.elements,Oe=Re[14]/(Re[10]-1),ze=Re[14]/(Re[10]+1),Je=(Re[9]+1)/Re[5],qe=(Re[9]-1)/Re[5],je=(Re[8]-1)/Re[0],Ot=($e[8]+1)/$e[0],_n=Oe*je,pt=Oe*Ot,Ht=de/(-je+Ot),Ut=Ht*-je;if(ne.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(Ut),Z.translateZ(Ht),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Re[10]===-1)Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{let Ct=Oe+Ht,L=ze+Ht,xn=_n-Ut,nt=pt+(de-Ut),mt=Je*ze/L*Ct,M=qe*ze/L*Ct;Z.projectionMatrix.makePerspective(xn,nt,mt,M,Ct,L),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function se(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:fe}=Z;if(x.texture!==null){if(x.depthNear>0)ne=x.depthNear;if(x.depthFar>0)fe=x.depthFar}if(C.near=S.near=_.near=ne,C.far=S.far=_.far=fe,z!==C.near||j!==C.far)i.updateRenderState({depthNear:C.near,depthFar:C.far}),z=C.near,j=C.far;C.layers.mask=Z.layers.mask|6,_.layers.mask=C.layers.mask&-5,S.layers.mask=C.layers.mask&-3;let de=Z.parent,Re=C.cameras;se(C,de);for(let $e=0;$e<Re.length;$e++)se(Re[$e],de);if(Re.length===2)Q(C,_,S);else C.projectionMatrix.copy(_.projectionMatrix);me(Z,C,de)};function me(Z,ne,fe){if(fe===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(fe.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=cr*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return C},this.getFoveation=function(){if(h===null&&f===null)return;return a},this.setFoveation=function(Z){if(a=Z,h!==null)h.fixedFoveation=Z;if(f!==null&&f.fixedFoveation!==void 0)f.fixedFoveation=Z},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(C)},this.getCameraTexture=function(Z){return p[Z]};let _e=null;function Xe(Z,ne){if(l=ne.getViewerPose(c||s),d=ne,l!==null){let fe=l.views;if(f!==null)e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E);let de=!1;if(fe.length!==C.cameras.length)C.cameras.length=0,de=!0;for(let ze=0;ze<fe.length;ze++){let Je=fe[ze],qe=null;if(f!==null)qe=f.getViewport(Je);else{let Ot=u.getViewSubImage(h,Je);if(qe=Ot.viewport,ze===0)e.setRenderTargetTextures(E,Ot.colorTexture,Ot.depthStencilTexture),e.setRenderTarget(E)}let je=U[ze];if(je===void 0)je=new Pt,je.layers.enable(ze),je.viewport=new rt,U[ze]=je;if(je.matrix.fromArray(Je.transform.matrix),je.matrix.decompose(je.position,je.quaternion,je.scale),je.projectionMatrix.fromArray(Je.projectionMatrix),je.projectionMatrixInverse.copy(je.projectionMatrix).invert(),je.viewport.set(qe.x,qe.y,qe.width,qe.height),ze===0)C.matrix.copy(je.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale);if(de===!0)C.cameras.push(je)}let Re=i.enabledFeatures;if(Re&&Re.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&m){u=n.getBinding();let ze=u.getDepthInformation(fe[0]);if(ze&&ze.isValid&&ze.texture)x.init(ze,i.renderState)}if(Re&&Re.includes("camera-access")&&m){e.state.unbindTexture(),u=n.getBinding();for(let ze=0;ze<fe.length;ze++){let Je=fe[ze].camera;if(Je){let qe=p[Je];if(!qe)qe=new ma,p[Je]=qe;let je=u.getCameraImage(Je);qe.sourceTexture=je}}}}for(let fe=0;fe<y.length;fe++){let de=w[fe],Re=y[fe];if(de!==null&&Re!==void 0)Re.update(de,ne,c||s)}if(_e)_e(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});d=null}let Be=new ap;Be.setAnimationLoop(Xe),this.setAnimationLoop=function(Z){_e=Z},this.dispose=function(){}}}var Hw=new Fe,yp=new De;yp.set(-1,0,0,0,1,0,0,0,1);function Vw(e,t){function n(p,g){if(p.matrixAutoUpdate===!0)p.updateMatrix();g.value.copy(p.matrix)}function i(p,g){if(g.color.getRGB(p.fogColor.value,Zl(e)),g.isFog)p.fogNear.value=g.near,p.fogFar.value=g.far;else if(g.isFogExp2)p.fogDensity.value=g.density}function r(p,g,A,E,y){if(g.isNodeMaterial)g.uniformsNeedUpdate=!1;else if(g.isMeshBasicMaterial)s(p,g);else if(g.isMeshLambertMaterial){if(s(p,g),g.envMap)p.envMapIntensity.value=g.envMapIntensity}else if(g.isMeshToonMaterial)s(p,g),h(p,g);else if(g.isMeshPhongMaterial){if(s(p,g),u(p,g),g.envMap)p.envMapIntensity.value=g.envMapIntensity}else if(g.isMeshStandardMaterial){if(s(p,g),f(p,g),g.isMeshPhysicalMaterial)d(p,g,y)}else if(g.isMeshMatcapMaterial)s(p,g),m(p,g);else if(g.isMeshDepthMaterial)s(p,g);else if(g.isMeshDistanceMaterial)s(p,g),x(p,g);else if(g.isMeshNormalMaterial)s(p,g);else if(g.isLineBasicMaterial){if(o(p,g),g.isLineDashedMaterial)a(p,g)}else if(g.isPointsMaterial)c(p,g,A,E);else if(g.isSpriteMaterial)l(p,g);else if(g.isShadowMaterial)p.color.value.copy(g.color),p.opacity.value=g.opacity;else if(g.isShaderMaterial)g.uniformsNeedUpdate=!1}function s(p,g){if(p.opacity.value=g.opacity,g.color)p.diffuse.value.copy(g.color);if(g.emissive)p.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity);if(g.map)p.map.value=g.map,n(g.map,p.mapTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.bumpMap){if(p.bumpMap.value=g.bumpMap,n(g.bumpMap,p.bumpMapTransform),p.bumpScale.value=g.bumpScale,g.side===Xt)p.bumpScale.value*=-1}if(g.normalMap){if(p.normalMap.value=g.normalMap,n(g.normalMap,p.normalMapTransform),p.normalScale.value.copy(g.normalScale),g.side===Xt)p.normalScale.value.negate()}if(g.displacementMap)p.displacementMap.value=g.displacementMap,n(g.displacementMap,p.displacementMapTransform),p.displacementScale.value=g.displacementScale,p.displacementBias.value=g.displacementBias;if(g.emissiveMap)p.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,p.emissiveMapTransform);if(g.specularMap)p.specularMap.value=g.specularMap,n(g.specularMap,p.specularMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest;let A=t.get(g),{envMap:E,envMapRotation:y}=A;if(E){if(p.envMap.value=E,p.envMapRotation.value.setFromMatrix4(Hw.makeRotationFromEuler(y)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(yp);p.reflectivity.value=g.reflectivity,p.ior.value=g.ior,p.refractionRatio.value=g.refractionRatio}if(g.lightMap)p.lightMap.value=g.lightMap,p.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,p.lightMapTransform);if(g.aoMap)p.aoMap.value=g.aoMap,p.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,p.aoMapTransform)}function o(p,g){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,g.map)p.map.value=g.map,n(g.map,p.mapTransform)}function a(p,g){p.dashSize.value=g.dashSize,p.totalSize.value=g.dashSize+g.gapSize,p.scale.value=g.scale}function c(p,g,A,E){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.size.value=g.size*A,p.scale.value=E*0.5,g.map)p.map.value=g.map,n(g.map,p.uvTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest}function l(p,g){if(p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.rotation.value=g.rotation,g.map)p.map.value=g.map,n(g.map,p.mapTransform);if(g.alphaMap)p.alphaMap.value=g.alphaMap,n(g.alphaMap,p.alphaMapTransform);if(g.alphaTest>0)p.alphaTest.value=g.alphaTest}function u(p,g){p.specular.value.copy(g.specular),p.shininess.value=Math.max(g.shininess,0.0001)}function h(p,g){if(g.gradientMap)p.gradientMap.value=g.gradientMap}function f(p,g){if(p.metalness.value=g.metalness,g.metalnessMap)p.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=g.roughness,g.roughnessMap)p.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,p.roughnessMapTransform);if(g.envMap)p.envMapIntensity.value=g.envMapIntensity}function d(p,g,A){if(p.ior.value=g.ior,g.sheen>0){if(p.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),p.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap)p.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,p.sheenColorMapTransform);if(g.sheenRoughnessMap)p.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(g.clearcoat>0){if(p.clearcoat.value=g.clearcoat,p.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap)p.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,p.clearcoatMapTransform);if(g.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(g.clearcoatNormalMap){if(p.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Xt)p.clearcoatNormalScale.value.negate()}}if(g.dispersion>0)p.dispersion.value=g.dispersion;if(g.iridescence>0){if(p.iridescence.value=g.iridescence,p.iridescenceIOR.value=g.iridescenceIOR,p.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap)p.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,p.iridescenceMapTransform);if(g.iridescenceThicknessMap)p.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(g.transmission>0){if(p.transmission.value=g.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),g.transmissionMap)p.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=g.thickness,g.thicknessMap)p.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=g.attenuationDistance,p.attenuationColor.value.copy(g.attenuationColor)}if(g.anisotropy>0){if(p.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap)p.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=g.specularIntensity,p.specularColor.value.copy(g.specularColor),g.specularColorMap)p.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,p.specularColorMapTransform);if(g.specularIntensityMap)p.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,p.specularIntensityMapTransform)}function m(p,g){if(g.matcap)p.matcap.value=g.matcap}function x(p,g){let A=t.get(g).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Ww(e,t,n,i){let r={},s={},o=[],a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,w){let T=w.program;i.uniformBlockBinding(y,T)}function l(y,w){let T=r[y.id];if(T===void 0)p(y),T=u(y),r[y.id]=T,y.addEventListener("dispose",A);let R=w.program;i.updateUBOMapping(y,R);let _=t.render.frame;if(s[y.id]!==_)f(y),s[y.id]=_}function u(y){let w=h();y.__bindingPointIndex=w;let T=e.createBuffer(),{__size:R,usage:_}=y;return e.bindBuffer(e.UNIFORM_BUFFER,T),e.bufferData(e.UNIFORM_BUFFER,R,_),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,w,T),T}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return Ne("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(y){let w=r[y.id],{uniforms:T,__cache:R}=y;e.bindBuffer(e.UNIFORM_BUFFER,w);for(let _=0,S=T.length;_<S;_++){let U=T[_];if(Array.isArray(U))for(let C=0,z=U.length;C<z;C++)d(U[C],_,C,R);else d(U,_,0,R)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function d(y,w,T,R){if(x(y,w,T,R)===!0){let{__offset:_,value:S}=y;if(Array.isArray(S)){let U=0;for(let C=0;C<S.length;C++){let z=S[C],j=g(z);if(m(z,y.__data,U),typeof z!=="number"&&typeof z!=="boolean"&&!z.isMatrix3&&!ArrayBuffer.isView(z))U+=j.storage/Float32Array.BYTES_PER_ELEMENT}}else m(S,y.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,_,y.__data)}}function m(y,w,T){if(typeof y==="number"||typeof y==="boolean")w[0]=y;else if(y.isMatrix3)w[0]=y.elements[0],w[1]=y.elements[1],w[2]=y.elements[2],w[3]=0,w[4]=y.elements[3],w[5]=y.elements[4],w[6]=y.elements[5],w[7]=0,w[8]=y.elements[6],w[9]=y.elements[7],w[10]=y.elements[8],w[11]=0;else if(ArrayBuffer.isView(y))w.set(new y.constructor(y.buffer,y.byteOffset,w.length));else y.toArray(w,T)}function x(y,w,T,R){let _=y.value,S=w+"_"+T;if(R[S]===void 0){if(typeof _==="number"||typeof _==="boolean")R[S]=_;else if(ArrayBuffer.isView(_))R[S]=_.slice();else R[S]=_.clone();return!0}else{let U=R[S];if(typeof _==="number"||typeof _==="boolean"){if(U!==_)return R[S]=_,!0}else if(ArrayBuffer.isView(_))return!0;else if(U.equals(_)===!1)return U.copy(_),!0}return!1}function p(y){let w=y.uniforms,T=0,R=16;for(let S=0,U=w.length;S<U;S++){let C=Array.isArray(w[S])?w[S]:[w[S]];for(let z=0,j=C.length;z<j;z++){let F=C[z],H=Array.isArray(F.value)?F.value:[F.value];for(let V=0,O=H.length;V<O;V++){let K=H[V],Q=g(K),se=T%R,me=se%Q.boundary,_e=se+me;if(T+=me,_e!==0&&R-_e<Q.storage)T+=R-_e;F.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=T,T+=Q.storage}}}let _=T%R;if(_>0)T+=R-_;return y.__size=T,y.__cache={},this}function g(y){let w={boundary:0,storage:0};if(typeof y==="number"||typeof y==="boolean")w.boundary=4,w.storage=4;else if(y.isVector2)w.boundary=8,w.storage=8;else if(y.isVector3||y.isColor)w.boundary=16,w.storage=12;else if(y.isVector4)w.boundary=16,w.storage=16;else if(y.isMatrix3)w.boundary=48,w.storage=48;else if(y.isMatrix4)w.boundary=64,w.storage=64;else if(y.isTexture)Me("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(y))w.boundary=16,w.storage=y.byteLength;else Me("WebGLRenderer: Unsupported uniform value type.",y);return w}function A(y){let w=y.target;w.removeEventListener("dispose",A);let T=o.indexOf(w.__bindingPointIndex);o.splice(T,1),e.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function E(){for(let y in r)e.deleteBuffer(r[y]);o=[],r={},s={}}return{bind:c,update:l,dispose:E}}var $w=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Jn=null;function Zw(){if(Jn===null)Jn=new Us($w,16,16,pr,xi),Jn.name="DFG_LUT",Jn.minFilter=kt,Jn.magFilter=kt,Jn.wrapS=jr,Jn.wrapT=jr,Jn.generateMipmaps=!1,Jn.needsUpdate=!0;return Jn}class xu{constructor(e={}){let{canvas:t=Ad(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:c=!1,powerPreference:l="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:h=!1,outputBufferType:f=Un}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=s;let m=f,x=new Set([rl,il,nl]),p=new Set([Un,ki,Cs,Kr,el,tl]),g=new Uint32Array(4),A=new Int32Array(4),E=new N,y=null,w=null,T=[],R=[],_=null;this.domElement=t,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=Dn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let S=this,U=!1,C=null,z=null,j=null,F=null;this._outputColorSpace=Bi;let H=0,V=0,O=null,K=-1,Q=null,se=new rt,me=new rt,_e=null,Xe=new Le(0),Be=0,{width:Z,height:ne}=t,fe=1,de=null,Re=null,$e=new rt(0,0,Z,ne),Oe=new rt(0,0,Z,ne),ze=!1,Je=new zs,qe=!1,je=!1,Ot=new Fe,_n=new N,pt=new rt,Ht={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ut=!1;function Ct(){return O===null?fe:1}let L=n;function xn(b,D){return t.getContext(b,D)}try{let b={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${Nf}`);if(t.addEventListener("webglcontextlost",Ue,!1),t.addEventListener("webglcontextrestored",yt,!1),t.addEventListener("webglcontextcreationerror",ht,!1),L===null){if(L=xn("webgl2",b),L===null)if(xn("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(b){throw Ne("WebGLRenderer: "+b.message),b}let nt,mt,M,v,P,W,te,ie,le,X,J,xe,we,ue,re,Ce,Ie,Qe,I,oe,Y,ae,ve;function ee(){if(nt=new QS(L),nt.init(),Y=new kw(L,nt),mt=new $S(L,nt,e,Y),M=new Fw(L,nt),mt.reversedDepthBuffer&&h)M.buffers.depth.setReversed(!0);z=L.createFramebuffer(),j=L.createFramebuffer(),F=L.createFramebuffer(),v=new nM(L),P=new Mw,W=new zw(L,nt,M,P,mt,Y,v),te=new KS(S),ie=new oy(L),ae=new VS(L,ie),le=new eM(L,ie,v,ae),X=new rM(L,le,ie,ae,v),Qe=new iM(L,mt,W),re=new ZS(P),J=new Sw(S,te,nt,mt,ae,re),xe=new Vw(S,P),we=new Tw,ue=new Iw(nt),Ie=new HS(S,te,M,X,d,a),Ce=new Uw(S,X,mt),ve=new Ww(L,v,mt,M),I=new WS(L,nt,v),oe=new tM(L,nt,v),v.programs=J.programs,S.capabilities=mt,S.extensions=nt,S.properties=P,S.renderLists=we,S.shadowMap=Ce,S.state=M,S.info=v}if(ee(),m!==Un)_=new oM(m,t.width,t.height,o,i,r);let ce=new vp(S,L);this.xr=ce,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let b=nt.get("WEBGL_lose_context");if(b)b.loseContext()},this.forceContextRestore=function(){let b=nt.get("WEBGL_lose_context");if(b)b.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(b){if(b===void 0)return;fe=b,this.setSize(Z,ne,!1)},this.getSize=function(b){return b.set(Z,ne)},this.setSize=function(b,D,G=!0){if(ce.isPresenting){Me("WebGLRenderer: Can't change size while VR device is presenting.");return}if(Z=b,ne=D,t.width=Math.floor(b*fe),t.height=Math.floor(D*fe),G===!0)t.style.width=b+"px",t.style.height=D+"px";if(_!==null)_.setSize(t.width,t.height);this.setViewport(0,0,b,D)},this.getDrawingBufferSize=function(b){return b.set(Z*fe,ne*fe).floor()},this.setDrawingBufferSize=function(b,D,G){Z=b,ne=D,fe=G,t.width=Math.floor(b*G),t.height=Math.floor(D*G),this.setViewport(0,0,b,D)},this.setEffects=function(b){if(m===Un){Ne("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(b){for(let D=0;D<b.length;D++)if(b[D].isOutputPass===!0){Me("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(b||[])},this.getCurrentViewport=function(b){return b.copy(se)},this.getViewport=function(b){return b.copy($e)},this.setViewport=function(b,D,G,k){if(b.isVector4)$e.set(b.x,b.y,b.z,b.w);else $e.set(b,D,G,k);M.viewport(se.copy($e).multiplyScalar(fe).round())},this.getScissor=function(b){return b.copy(Oe)},this.setScissor=function(b,D,G,k){if(b.isVector4)Oe.set(b.x,b.y,b.z,b.w);else Oe.set(b,D,G,k);M.scissor(me.copy(Oe).multiplyScalar(fe).round())},this.getScissorTest=function(){return ze},this.setScissorTest=function(b){M.setScissorTest(ze=b)},this.setOpaqueSort=function(b){de=b},this.setTransparentSort=function(b){Re=b},this.getClearColor=function(b){return b.copy(Ie.getClearColor())},this.setClearColor=function(){Ie.setClearColor(...arguments)},this.getClearAlpha=function(){return Ie.getClearAlpha()},this.setClearAlpha=function(){Ie.setClearAlpha(...arguments)},this.clear=function(b=!0,D=!0,G=!0){let k=0;if(b){let B=!1;if(O!==null){let ge=O.texture.format;B=x.has(ge)}if(B){let ge=O.texture.type,be=p.has(ge),pe=Ie.getClearColor(),Se=Ie.getClearAlpha(),{r:Ee,g:ke,b:He}=pe;if(be)g[0]=Ee,g[1]=ke,g[2]=He,g[3]=Se,L.clearBufferuiv(L.COLOR,0,g);else A[0]=Ee,A[1]=ke,A[2]=He,A[3]=Se,L.clearBufferiv(L.COLOR,0,A)}else k|=L.COLOR_BUFFER_BIT}if(D)k|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(G)k|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(k!==0)L.clear(k)},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.setNodesHandler=function(b){b.setRenderer(this),C=b},this.dispose=function(){t.removeEventListener("webglcontextlost",Ue,!1),t.removeEventListener("webglcontextrestored",yt,!1),t.removeEventListener("webglcontextcreationerror",ht,!1),Ie.dispose(),we.dispose(),ue.dispose(),P.dispose(),te.dispose(),X.dispose(),ae.dispose(),ve.dispose(),J.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",Hh),ce.removeEventListener("sessionend",Vh),nr.stop()};function Ue(b){b.preventDefault(),ws("WebGLRenderer: Context Lost."),U=!0}function yt(){ws("WebGLRenderer: Context Restored."),U=!1;let b=v.autoReset,D=Ce.enabled,G=Ce.autoUpdate,k=Ce.needsUpdate,B=Ce.type;ee(),v.autoReset=b,Ce.enabled=D,Ce.autoUpdate=G,Ce.needsUpdate=k,Ce.type=B}function ht(b){Ne("WebGLRenderer: A WebGL context could not be created. Reason: ",b.statusMessage)}function Gn(b){let D=b.target;D.removeEventListener("dispose",Gn),li(D)}function li(b){Kx(b),P.remove(b)}function Kx(b){let D=P.get(b).programs;if(D!==void 0){if(D.forEach(function(G){J.releaseProgram(G)}),b.isShaderMaterial)J.releaseShaderCache(b)}}this.renderBufferDirect=function(b,D,G,k,B,ge){if(D===null)D=Ht;let be=B.isMesh&&B.matrixWorld.determinantAffine()<0,pe=tv(b,D,G,k,B);M.setMaterial(k,be);let Se=G.index,Ee=1;if(k.wireframe===!0){if(Se=le.getWireframeAttribute(G),Se===void 0)return;Ee=2}let ke=G.drawRange,He=G.attributes.position,Ae=ke.start*Ee,st=(ke.start+ke.count)*Ee;if(ge!==null)Ae=Math.max(Ae,ge.start*Ee),st=Math.min(st,(ge.start+ge.count)*Ee);if(Se!==null)Ae=Math.max(Ae,0),st=Math.min(st,Se.count);else if(He!==void 0&&He!==null)Ae=Math.max(Ae,0),st=Math.min(st,He.count);let wt=st-Ae;if(wt<0||wt===1/0)return;ae.setup(B,k,pe,G,Se);let bt,ct=I;if(Se!==null)bt=ie.get(Se),ct=oe,ct.setIndex(bt);if(B.isMesh)if(k.wireframe===!0)M.setLineWidth(k.wireframeLinewidth*Ct()),ct.setMode(L.LINES);else ct.setMode(L.TRIANGLES);else if(B.isLine){let Wt=k.linewidth;if(Wt===void 0)Wt=1;if(M.setLineWidth(Wt*Ct()),B.isLineSegments)ct.setMode(L.LINES);else if(B.isLineLoop)ct.setMode(L.LINE_LOOP);else ct.setMode(L.LINE_STRIP)}else if(B.isPoints)ct.setMode(L.POINTS);else if(B.isSprite)ct.setMode(L.TRIANGLES);if(B.isBatchedMesh)if(!nt.get("WEBGL_multi_draw")){let{_multiDrawStarts:Wt,_multiDrawCounts:ye,_multiDrawCount:on}=B,Ke=Se?ie.get(Se).bytesPerElement:1,vn=P.get(k).currentProgram.getUniforms();for(let Hn=0;Hn<on;Hn++)vn.setValue(L,"_gl_DrawID",Hn),ct.render(Wt[Hn]/Ke,ye[Hn])}else ct.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else if(B.isInstancedMesh)ct.renderInstances(Ae,wt,B.count);else if(G.isInstancedBufferGeometry){let Wt=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,ye=Math.min(G.instanceCount,Wt);ct.renderInstances(Ae,wt,ye)}else ct.render(Ae,wt)};function Gh(b,D,G){if(b.transparent===!0&&b.side===Sn&&b.forceSinglePass===!1)b.side=Xt,b.needsUpdate=!0,vo(b,D,G),b.side=zi,b.needsUpdate=!0,vo(b,D,G),b.side=Sn;else vo(b,D,G)}this.compile=function(b,D,G=null){if(G===null)G=b;if(w=ue.get(G),w.init(D),R.push(w),G.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}}),b!==G)b.traverseVisible(function(B){if(B.isLight&&B.layers.test(D.layers)){if(w.pushLight(B),B.castShadow)w.pushShadow(B)}});w.setupLights();let k=new Set;return b.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;let ge=B.material;if(ge)if(Array.isArray(ge))for(let be=0;be<ge.length;be++){let pe=ge[be];Gh(pe,G,B),k.add(pe)}else Gh(ge,G,B),k.add(ge)}),w=R.pop(),k},this.compileAsync=function(b,D,G=null){let k=this.compile(b,D,G);return new Promise((B)=>{function ge(){if(k.forEach(function(be){if(P.get(be).currentProgram.isReady())k.delete(be)}),k.size===0){B(b);return}setTimeout(ge,10)}if(nt.get("KHR_parallel_shader_compile")!==null)ge();else setTimeout(ge,10)})};let dc=null;function Qx(b){if(dc)dc(b)}function Hh(){nr.stop()}function Vh(){nr.start()}let nr=new ap;if(nr.setAnimationLoop(Qx),typeof self<"u")nr.setContext(self);this.setAnimationLoop=function(b){dc=b,ce.setAnimationLoop(b),b===null?nr.stop():nr.start()},ce.addEventListener("sessionstart",Hh),ce.addEventListener("sessionend",Vh),this.render=function(b,D){if(D!==void 0&&D.isCamera!==!0){Ne("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;if(C!==null)C.renderStart(b,D);let G=ce.enabled===!0&&ce.isPresenting===!0,k=_!==null&&(O===null||G)&&_.begin(S,O);if(b.matrixWorldAutoUpdate===!0)b.updateMatrixWorld();if(D.parent===null&&D.matrixWorldAutoUpdate===!0)D.updateMatrixWorld();if(ce.enabled===!0&&ce.isPresenting===!0&&(_===null||_.isCompositing()===!1)){if(ce.cameraAutoUpdate===!0)ce.updateCamera(D);D=ce.getCamera()}if(b.isScene===!0)b.onBeforeRender(S,b,D,O);if(w=ue.get(b,R.length),w.init(D),w.state.textureUnits=W.getTextureUnits(),R.push(w),Ot.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Je.setFromProjectionMatrix(Ot,Bl,D.reversedDepth),je=this.localClippingEnabled,qe=re.init(this.clippingPlanes,je),y=we.get(b,T.length),y.init(),T.push(y),ce.enabled===!0&&ce.isPresenting===!0){let be=S.xr.getDepthSensingMesh();if(be!==null)pc(be,D,-1/0,S.sortObjects)}if(pc(b,D,0,S.sortObjects),y.finish(),S.sortObjects===!0)y.sort(de,Re,D.reversedDepth);if(Ut=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Ut)Ie.addToRenderList(y,b);if(this.info.render.frame++,this.info.autoReset===!0)this.info.reset();if(qe===!0)re.beginShadows();let B=w.state.shadowsArray;if(Ce.render(B,b,D),qe===!0)re.endShadows();if((k&&_.hasRenderPass())===!1){let be=y.opaque,pe=y.transmissive;if(w.setupLights(),D.isArrayCamera){let Se=D.cameras;if(pe.length>0)for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee];$h(be,pe,b,He)}if(Ut)Ie.render(b);for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee];Wh(y,b,He,He.viewport)}}else{if(pe.length>0)$h(be,pe,b,D);if(Ut)Ie.render(b);Wh(y,b,D)}}if(O!==null&&V===0)W.updateMultisampleRenderTarget(O),W.updateRenderTargetMipmap(O);if(k)_.end(S);if(b.isScene===!0)b.onAfterRender(S,b,D);if(ae.resetDefaultState(),K=-1,Q=null,R.pop(),R.length>0){if(w=R[R.length-1],W.setTextureUnits(w.state.textureUnits),qe===!0)re.setGlobalState(S.clippingPlanes,w.state.camera)}else w=null;if(T.pop(),T.length>0)y=T[T.length-1];else y=null;if(C!==null)C.renderEnd()};function pc(b,D,G,k){if(b.visible===!1)return;if(b.layers.test(D.layers)){if(b.isGroup)G=b.renderOrder;else if(b.isLOD){if(b.autoUpdate===!0)b.update(D)}else if(b.isLightProbeGrid)w.pushLightProbeGrid(b);else if(b.isLight){if(w.pushLight(b),b.castShadow)w.pushShadow(b)}else if(b.isSprite){if(!b.frustumCulled||Je.intersectsSprite(b)){if(k)pt.setFromMatrixPosition(b.matrixWorld).applyMatrix4(Ot);let be=X.update(b),pe=b.material;if(pe.visible)y.push(b,be,pe,G,pt.z,null)}}else if(b.isMesh||b.isLine||b.isPoints){if(!b.frustumCulled||Je.intersectsObject(b)){let be=X.update(b),pe=b.material;if(k){if(b.boundingSphere!==void 0){if(b.boundingSphere===null)b.computeBoundingSphere();pt.copy(b.boundingSphere.center)}else{if(be.boundingSphere===null)be.computeBoundingSphere();pt.copy(be.boundingSphere.center)}pt.applyMatrix4(b.matrixWorld).applyMatrix4(Ot)}if(Array.isArray(pe)){let Se=be.groups;for(let Ee=0,ke=Se.length;Ee<ke;Ee++){let He=Se[Ee],Ae=pe[He.materialIndex];if(Ae&&Ae.visible)y.push(b,be,Ae,G,pt.z,He)}}else if(pe.visible)y.push(b,be,pe,G,pt.z,null)}}}let ge=b.children;for(let be=0,pe=ge.length;be<pe;be++)pc(ge[be],D,G,k)}function Wh(b,D,G,k){let{opaque:B,transmissive:ge,transparent:be}=b;if(w.setupLightsView(G),qe===!0)re.setGlobalState(S.clippingPlanes,G);if(k)M.viewport(se.copy(k));if(B.length>0)xo(B,D,G);if(ge.length>0)xo(ge,D,G);if(be.length>0)xo(be,D,G);M.buffers.depth.setTest(!0),M.buffers.depth.setMask(!0),M.buffers.color.setMask(!0),M.setPolygonOffset(!1)}function $h(b,D,G,k){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(w.state.transmissionRenderTarget[k.id]===void 0){let Ae=nt.has("EXT_color_buffer_half_float")||nt.has("EXT_color_buffer_float");w.state.transmissionRenderTarget[k.id]=new Mn(1,1,{generateMipmaps:!0,type:Ae?xi:Un,minFilter:qn,samples:Math.max(4,mt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace})}let ge=w.state.transmissionRenderTarget[k.id],be=k.viewport||se;ge.setSize(be.z*S.transmissionResolutionScale,be.w*S.transmissionResolutionScale);let pe=S.getRenderTarget(),Se=S.getActiveCubeFace(),Ee=S.getActiveMipmapLevel();if(S.setRenderTarget(ge),S.getClearColor(Xe),Be=S.getClearAlpha(),Be<1)S.setClearColor(16777215,0.5);if(S.clear(),Ut)Ie.render(G);let ke=S.toneMapping;S.toneMapping=Dn;let He=k.viewport;if(k.viewport!==void 0)k.viewport=void 0;if(w.setupLightsView(k),qe===!0)re.setGlobalState(S.clippingPlanes,k);if(xo(b,G,k),W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge),nt.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let st=0,wt=D.length;st<wt;st++){let bt=D[st],{object:ct,geometry:Wt,material:ye,group:on}=bt;if(ye.side===Sn&&ct.layers.test(k.layers)){let Ke=ye.side;ye.side=Xt,ye.needsUpdate=!0,Zh(ct,G,k,Wt,ye,on),ye.side=Ke,ye.needsUpdate=!0,Ae=!0}}if(Ae===!0)W.updateMultisampleRenderTarget(ge),W.updateRenderTargetMipmap(ge)}if(S.setRenderTarget(pe,Se,Ee),S.setClearColor(Xe,Be),He!==void 0)k.viewport=He;S.toneMapping=ke}function xo(b,D,G){let k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,ge=b.length;B<ge;B++){let be=b[B],{object:pe,geometry:Se,group:Ee}=be,ke=be.material;if(ke.allowOverride===!0&&k!==null)ke=k;if(pe.layers.test(G.layers))Zh(pe,D,G,Se,ke,Ee)}}function Zh(b,D,G,k,B,ge){if(b.onBeforeRender(S,D,G,k,B,ge),b.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,b.matrixWorld),b.normalMatrix.getNormalMatrix(b.modelViewMatrix),B.onBeforeRender(S,D,G,k,b,ge),B.transparent===!0&&B.side===Sn&&B.forceSinglePass===!1)B.side=Xt,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=zi,B.needsUpdate=!0,S.renderBufferDirect(G,D,k,B,b,ge),B.side=Sn;else S.renderBufferDirect(G,D,k,B,b,ge);b.onAfterRender(S,D,G,k,B,ge)}function vo(b,D,G){if(D.isScene!==!0)D=Ht;let k=P.get(b),B=w.state.lights,ge=w.state.shadowsArray,be=B.state.version,pe=J.getParameters(b,B.state,ge,D,G,w.state.lightProbeGridArray),Se=J.getProgramCacheKey(pe),Ee=k.programs;k.environment=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?D.environment:null,k.fog=D.fog;let ke=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap;if(k.envMap=te.get(b.envMap||k.environment,ke),k.envMapRotation=k.environment!==null&&b.envMap===null?D.environmentRotation:b.envMapRotation,Ee===void 0)b.addEventListener("dispose",Gn),Ee=new Map,k.programs=Ee;let He=Ee.get(Se);if(He!==void 0){if(k.currentProgram===He&&k.lightsStateVersion===be)return qh(b,pe),He}else{if(pe.uniforms=J.getUniforms(b),C!==null&&b.isNodeMaterial)C.build(b,G,pe);b.onBeforeCompile(pe,S),He=J.acquireProgram(pe,Se),Ee.set(Se,He),k.uniforms=pe.uniforms}let Ae=k.uniforms;if(!b.isShaderMaterial&&!b.isRawShaderMaterial||b.clipping===!0)Ae.clippingPlanes=re.uniform;if(qh(b,pe),k.needsLights=iv(b),k.lightsStateVersion=be,k.needsLights)Ae.ambientLightColor.value=B.state.ambient,Ae.lightProbe.value=B.state.probe,Ae.directionalLights.value=B.state.directional,Ae.directionalLightShadows.value=B.state.directionalShadow,Ae.spotLights.value=B.state.spot,Ae.spotLightShadows.value=B.state.spotShadow,Ae.rectAreaLights.value=B.state.rectArea,Ae.ltc_1.value=B.state.rectAreaLTC1,Ae.ltc_2.value=B.state.rectAreaLTC2,Ae.pointLights.value=B.state.point,Ae.pointLightShadows.value=B.state.pointShadow,Ae.hemisphereLights.value=B.state.hemi,Ae.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Ae.spotLightMatrix.value=B.state.spotLightMatrix,Ae.spotLightMap.value=B.state.spotLightMap,Ae.pointShadowMatrix.value=B.state.pointShadowMatrix;return k.lightProbeGrid=w.state.lightProbeGridArray.length>0,k.currentProgram=He,k.uniformsList=null,He}function Xh(b){if(b.uniformsList===null){let D=b.currentProgram.getUniforms();b.uniformsList=qs.seqWithValue(D.seq,b.uniforms)}return b.uniformsList}function qh(b,D){let G=P.get(b);G.outputColorSpace=D.outputColorSpace,G.batching=D.batching,G.batchingColor=D.batchingColor,G.instancing=D.instancing,G.instancingColor=D.instancingColor,G.instancingMorph=D.instancingMorph,G.skinning=D.skinning,G.morphTargets=D.morphTargets,G.morphNormals=D.morphNormals,G.morphColors=D.morphColors,G.morphTargetsCount=D.morphTargetsCount,G.numClippingPlanes=D.numClippingPlanes,G.numIntersection=D.numClipIntersection,G.vertexAlphas=D.vertexAlphas,G.vertexTangents=D.vertexTangents,G.toneMapping=D.toneMapping}function ev(b,D){if(b.length===0)return null;if(b.length===1)return b[0].texture!==null?b[0]:null;E.setFromMatrixPosition(D.matrixWorld);for(let G=0,k=b.length;G<k;G++){let B=b[G];if(B.texture!==null&&B.boundingBox.containsPoint(E))return B}return null}function tv(b,D,G,k,B){if(D.isScene!==!0)D=Ht;W.resetTextureUnits();let ge=D.fog,be=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?D.environment:null,pe=O===null?S.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:Ve.workingColorSpace,Se=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ee=te.get(k.envMap||be,Se),ke=k.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,He=!!G.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ae=!!G.morphAttributes.position,st=!!G.morphAttributes.normal,wt=!!G.morphAttributes.color,bt=Dn;if(k.toneMapped){if(O===null||O.isXRRenderTarget===!0)bt=S.toneMapping}let ct=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Wt=ct!==void 0?ct.length:0,ye=P.get(k),on=w.state.lights;if(qe===!0){if(je===!0||b!==Q){let ft=b===Q&&k.id===K;re.setState(k,b,ft)}}let Ke=!1;if(k.version===ye.__version){if(ye.needsLights&&ye.lightsStateVersion!==on.state.version)Ke=!0;else if(ye.outputColorSpace!==pe)Ke=!0;else if(B.isBatchedMesh&&ye.batching===!1)Ke=!0;else if(!B.isBatchedMesh&&ye.batching===!0)Ke=!0;else if(B.isBatchedMesh&&ye.batchingColor===!0&&B.colorTexture===null)Ke=!0;else if(B.isBatchedMesh&&ye.batchingColor===!1&&B.colorTexture!==null)Ke=!0;else if(B.isInstancedMesh&&ye.instancing===!1)Ke=!0;else if(!B.isInstancedMesh&&ye.instancing===!0)Ke=!0;else if(B.isSkinnedMesh&&ye.skinning===!1)Ke=!0;else if(!B.isSkinnedMesh&&ye.skinning===!0)Ke=!0;else if(B.isInstancedMesh&&ye.instancingColor===!0&&B.instanceColor===null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingColor===!1&&B.instanceColor!==null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!0&&B.morphTexture===null)Ke=!0;else if(B.isInstancedMesh&&ye.instancingMorph===!1&&B.morphTexture!==null)Ke=!0;else if(ye.envMap!==Ee)Ke=!0;else if(k.fog===!0&&ye.fog!==ge)Ke=!0;else if(ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==re.numPlanes||ye.numIntersection!==re.numIntersection))Ke=!0;else if(ye.vertexAlphas!==ke)Ke=!0;else if(ye.vertexTangents!==He)Ke=!0;else if(ye.morphTargets!==Ae)Ke=!0;else if(ye.morphNormals!==st)Ke=!0;else if(ye.morphColors!==wt)Ke=!0;else if(ye.toneMapping!==bt)Ke=!0;else if(ye.morphTargetsCount!==Wt)Ke=!0;else if(!!ye.lightProbeGrid!==w.state.lightProbeGridArray.length>0)Ke=!0}else Ke=!0,ye.__version=k.version;let vn=ye.currentProgram;if(Ke===!0){if(vn=vo(k,D,B),C&&k.isNodeMaterial)C.onUpdateProgram(k,vn,ye)}let Hn=!1,Ai=!1,Er=!1,lt=vn.getUniforms(),Tt=ye.uniforms;if(M.useProgram(vn.program))Hn=!0,Ai=!0,Er=!0;if(k.id!==K)K=k.id,Ai=!0;if(ye.needsLights){let ft=ev(w.state.lightProbeGridArray,B);if(ye.lightProbeGrid!==ft)ye.lightProbeGrid=ft,Ai=!0}if(Hn||Q!==b){if(M.buffers.depth.getReversed()&&b.reversedDepth!==!0)b._reversedDepth=!0,b.updateProjectionMatrix();lt.setValue(L,"projectionMatrix",b.projectionMatrix),lt.setValue(L,"viewMatrix",b.matrixWorldInverse);let Ci=lt.map.cameraPosition;if(Ci!==void 0)Ci.setValue(L,_n.setFromMatrixPosition(b.matrixWorld));if(mt.logarithmicDepthBuffer)lt.setValue(L,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2));if(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)lt.setValue(L,"isOrthographic",b.isOrthographicCamera===!0);if(Q!==b)Q=b,Ai=!0,Er=!0}if(ye.needsLights){if(on.state.directionalShadowMap.length>0)lt.setValue(L,"directionalShadowMap",on.state.directionalShadowMap,W);if(on.state.spotShadowMap.length>0)lt.setValue(L,"spotShadowMap",on.state.spotShadowMap,W);if(on.state.pointShadowMap.length>0)lt.setValue(L,"pointShadowMap",on.state.pointShadowMap,W)}if(B.isSkinnedMesh){lt.setOptional(L,B,"bindMatrix"),lt.setOptional(L,B,"bindMatrixInverse");let ft=B.skeleton;if(ft){if(ft.boneTexture===null)ft.computeBoneTexture();lt.setValue(L,"boneTexture",ft.boneTexture,W)}}if(B.isBatchedMesh){if(lt.setOptional(L,B,"batchingTexture"),lt.setValue(L,"batchingTexture",B._matricesTexture,W),lt.setOptional(L,B,"batchingIdTexture"),lt.setValue(L,"batchingIdTexture",B._indirectTexture,W),lt.setOptional(L,B,"batchingColorTexture"),B._colorsTexture!==null)lt.setValue(L,"batchingColorTexture",B._colorsTexture,W)}let Ri=G.morphAttributes;if(Ri.position!==void 0||Ri.normal!==void 0||Ri.color!==void 0)Qe.update(B,G,vn);if(Ai||ye.receiveShadow!==B.receiveShadow)ye.receiveShadow=B.receiveShadow,lt.setValue(L,"receiveShadow",B.receiveShadow);if((k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&D.environment!==null)Tt.envMapIntensity.value=D.environmentIntensity;if(Tt.dfgLUT!==void 0)Tt.dfgLUT.value=Zw();if(Ai){if(lt.setValue(L,"toneMappingExposure",S.toneMappingExposure),ye.needsLights)nv(Tt,Er);if(ge&&k.fog===!0)xe.refreshFogUniforms(Tt,ge);if(xe.refreshMaterialUniforms(Tt,k,fe,ne,w.state.transmissionRenderTarget[b.id]),ye.needsLights&&ye.lightProbeGrid){let ft=ye.lightProbeGrid;Tt.probesSH.value=ft.texture,Tt.probesMin.value.copy(ft.boundingBox.min),Tt.probesMax.value.copy(ft.boundingBox.max),Tt.probesResolution.value.copy(ft.resolution)}qs.upload(L,Xh(ye),Tt,W)}if(k.isShaderMaterial&&k.uniformsNeedUpdate===!0)qs.upload(L,Xh(ye),Tt,W),k.uniformsNeedUpdate=!1;if(k.isSpriteMaterial)lt.setValue(L,"center",B.center);if(lt.setValue(L,"modelViewMatrix",B.modelViewMatrix),lt.setValue(L,"normalMatrix",B.normalMatrix),lt.setValue(L,"modelMatrix",B.matrixWorld),k.uniformsGroups!==void 0){let ft=k.uniformsGroups;for(let Ci=0,Ar=ft.length;Ci<Ar;Ci++){let Yh=ft[Ci];ve.update(Yh,vn),ve.bind(Yh,vn)}}return vn}function nv(b,D){b.ambientLightColor.needsUpdate=D,b.lightProbe.needsUpdate=D,b.directionalLights.needsUpdate=D,b.directionalLightShadows.needsUpdate=D,b.pointLights.needsUpdate=D,b.pointLightShadows.needsUpdate=D,b.spotLights.needsUpdate=D,b.spotLightShadows.needsUpdate=D,b.rectAreaLights.needsUpdate=D,b.hemisphereLights.needsUpdate=D}function iv(b){return b.isMeshLambertMaterial||b.isMeshToonMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isShadowMaterial||b.isShaderMaterial&&b.lights===!0}if(this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(b,D,G){let k=P.get(b);if(k.__autoAllocateDepthBuffer=b.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1)k.__useRenderToTexture=!1;P.get(b.texture).__webglTexture=D,P.get(b.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:G,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(b,D){let G=P.get(b);G.__webglFramebuffer=D,G.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(b,D=0,G=0){O=b,H=D,V=G;let k=null,B=!1,ge=!1;if(b){let pe=P.get(b);if(pe.__useDefaultFramebuffer!==void 0){M.bindFramebuffer(L.FRAMEBUFFER,pe.__webglFramebuffer),se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest,M.viewport(se),M.scissor(me),M.setScissorTest(_e),K=-1;return}else if(pe.__webglFramebuffer===void 0)W.setupRenderTarget(b);else if(pe.__hasExternalTextures)W.rebindTextures(b,P.get(b.texture).__webglTexture,P.get(b.depthTexture).__webglTexture);else if(b.depthBuffer){let ke=b.depthTexture;if(pe.__boundDepthTexture!==ke){if(ke!==null&&P.has(ke)&&(b.width!==ke.image.width||b.height!==ke.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");W.setupDepthRenderbuffer(b)}}let Se=b.texture;if(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)ge=!0;let Ee=P.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget){if(Array.isArray(Ee[D]))k=Ee[D][G];else k=Ee[D];B=!0}else if(b.samples>0&&W.useMultisampledRTT(b)===!1)k=P.get(b).__webglMultisampledFramebuffer;else if(Array.isArray(Ee))k=Ee[G];else k=Ee;se.copy(b.viewport),me.copy(b.scissor),_e=b.scissorTest}else se.copy($e).multiplyScalar(fe).floor(),me.copy(Oe).multiplyScalar(fe).floor(),_e=ze;if(G!==0)k=z;if(M.bindFramebuffer(L.FRAMEBUFFER,k))M.drawBuffers(b,k);if(M.viewport(se),M.scissor(me),M.setScissorTest(_e),B){let pe=P.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+D,pe.__webglTexture,G)}else if(ge){let pe=D;for(let Se=0;Se<b.textures.length;Se++){let Ee=P.get(b.textures[Se]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Se,Ee.__webglTexture,G,pe)}}else if(b!==null&&G!==0){let pe=P.get(b.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,pe.__webglTexture,G)}K=-1},this.readRenderTargetPixels=function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=P.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se){M.bindFramebuffer(L.FRAMEBUFFER,Se);try{let Ee=b.textures[pe],{format:ke,type:He}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!mt.textureFormatReadable(ke)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!mt.textureTypeReadable(He)){Ne("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B))L.readPixels(D,G,k,B,Y.convert(ke),Y.convert(He),ge)}finally{let Ee=O!==null?P.get(O).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(b,D,G,k,B,ge,be,pe=0){if(!(b&&b.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=P.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&be!==void 0)Se=Se[be];if(Se)if(D>=0&&D<=b.width-k&&(G>=0&&G<=b.height-B)){M.bindFramebuffer(L.FRAMEBUFFER,Se);let Ee=b.textures[pe],{format:ke,type:He}=Ee;if(b.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+pe);if(!mt.textureFormatReadable(ke))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!mt.textureTypeReadable(He))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,ge.byteLength,L.STREAM_READ),L.readPixels(D,G,k,B,Y.convert(ke),Y.convert(He),0);let st=O!==null?P.get(O).__webglFramebuffer:null;M.bindFramebuffer(L.FRAMEBUFFER,st);let wt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await Cd(L,wt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,ge),L.deleteBuffer(Ae),L.deleteSync(wt),ge}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(b,D=null,G=0){let k=Math.pow(2,-G),B=Math.floor(b.image.width*k),ge=Math.floor(b.image.height*k),be=D!==null?D.x:0,pe=D!==null?D.y:0;W.setTexture2D(b,0),L.copyTexSubImage2D(L.TEXTURE_2D,G,0,0,be,pe,B,ge),M.unbindTexture()},this.copyTextureToTexture=function(b,D,G=null,k=null,B=0,ge=0){let be,pe,Se,Ee,ke,He,Ae,st,wt,bt=b.isCompressedTexture?b.mipmaps[ge]:b.image;if(G!==null)be=G.max.x-G.min.x,pe=G.max.y-G.min.y,Se=G.isBox3?G.max.z-G.min.z:1,Ee=G.min.x,ke=G.min.y,He=G.isBox3?G.min.z:0;else{let Tt=Math.pow(2,-B);if(be=Math.floor(bt.width*Tt),pe=Math.floor(bt.height*Tt),b.isDataArrayTexture)Se=bt.depth;else if(b.isData3DTexture)Se=Math.floor(bt.depth*Tt);else Se=1;Ee=0,ke=0,He=0}if(k!==null)Ae=k.x,st=k.y,wt=k.z;else Ae=0,st=0,wt=0;let ct=Y.convert(D.format),Wt=Y.convert(D.type),ye;if(D.isData3DTexture)W.setTexture3D(D,0),ye=L.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)W.setTexture2DArray(D,0),ye=L.TEXTURE_2D_ARRAY;else W.setTexture2D(D,0),ye=L.TEXTURE_2D;M.activeTexture(L.TEXTURE0),M.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,D.flipY),M.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),M.pixelStorei(L.UNPACK_ALIGNMENT,D.unpackAlignment);let on=M.getParameter(L.UNPACK_ROW_LENGTH),Ke=M.getParameter(L.UNPACK_IMAGE_HEIGHT),vn=M.getParameter(L.UNPACK_SKIP_PIXELS),Hn=M.getParameter(L.UNPACK_SKIP_ROWS),Ai=M.getParameter(L.UNPACK_SKIP_IMAGES);M.pixelStorei(L.UNPACK_ROW_LENGTH,bt.width),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,bt.height),M.pixelStorei(L.UNPACK_SKIP_PIXELS,Ee),M.pixelStorei(L.UNPACK_SKIP_ROWS,ke),M.pixelStorei(L.UNPACK_SKIP_IMAGES,He);let Er=b.isDataArrayTexture||b.isData3DTexture,lt=D.isDataArrayTexture||D.isData3DTexture;if(b.isDepthTexture){let Tt=P.get(b),Ri=P.get(D),ft=P.get(Tt.__renderTarget),Ci=P.get(Ri.__renderTarget);M.bindFramebuffer(L.READ_FRAMEBUFFER,ft.__webglFramebuffer),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,Ci.__webglFramebuffer);for(let Ar=0;Ar<Se;Ar++){if(Er)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,P.get(b).__webglTexture,B,He+Ar),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,P.get(D).__webglTexture,ge,wt+Ar);L.blitFramebuffer(Ee,ke,be,pe,Ae,st,be,pe,L.DEPTH_BUFFER_BIT,L.NEAREST)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(B!==0||b.isRenderTargetTexture||P.has(b)){let Tt=P.get(b),Ri=P.get(D);M.bindFramebuffer(L.READ_FRAMEBUFFER,j),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,F);for(let ft=0;ft<Se;ft++){if(Er)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Tt.__webglTexture,B,He+ft);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Tt.__webglTexture,B);if(lt)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Ri.__webglTexture,ge,wt+ft);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Ri.__webglTexture,ge);if(B!==0)L.blitFramebuffer(Ee,ke,be,pe,Ae,st,be,pe,L.COLOR_BUFFER_BIT,L.NEAREST);else if(lt)L.copyTexSubImage3D(ye,ge,Ae,st,wt+ft,Ee,ke,be,pe);else L.copyTexSubImage2D(ye,ge,Ae,st,Ee,ke,be,pe)}M.bindFramebuffer(L.READ_FRAMEBUFFER,null),M.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(lt)if(b.isDataTexture||b.isData3DTexture)L.texSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,Wt,bt.data);else if(D.isCompressedArrayTexture)L.compressedTexSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,bt.data);else L.texSubImage3D(ye,ge,Ae,st,wt,be,pe,Se,ct,Wt,bt);else if(b.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,ge,Ae,st,be,pe,ct,Wt,bt.data);else if(b.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,ge,Ae,st,bt.width,bt.height,ct,bt.data);else L.texSubImage2D(L.TEXTURE_2D,ge,Ae,st,be,pe,ct,Wt,bt);if(M.pixelStorei(L.UNPACK_ROW_LENGTH,on),M.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ke),M.pixelStorei(L.UNPACK_SKIP_PIXELS,vn),M.pixelStorei(L.UNPACK_SKIP_ROWS,Hn),M.pixelStorei(L.UNPACK_SKIP_IMAGES,Ai),ge===0&&D.generateMipmaps)L.generateMipmap(ye);M.unbindTexture()},this.initRenderTarget=function(b){if(P.get(b).__webglFramebuffer===void 0)W.setupRenderTarget(b)},this.initTexture=function(b){if(b.isCubeTexture)W.setTextureCube(b,0);else if(b.isData3DTexture)W.setTexture3D(b,0);else if(b.isDataArrayTexture||b.isCompressedArrayTexture)W.setTexture2DArray(b,0);else W.setTexture2D(b,0);M.unbindTexture()},this.resetState=function(){H=0,V=0,O=null,M.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Bl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}function vu(e,t){if(t===Ul)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Qr||t===Ps){let n=e.getIndex();if(n===null){let o=[],a=e.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);e.setIndex(o),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,r=[];if(t===Qr)for(let o=1;o<=i;o++)r.push(n.getX(0)),r.push(n.getX(o)),r.push(n.getX(o+1));else for(let o=0;o<i;o++)if(o%2===0)r.push(n.getX(o)),r.push(n.getX(o+1)),r.push(n.getX(o+2));else r.push(n.getX(o+2)),r.push(n.getX(o+1)),r.push(n.getX(o));if(r.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=e.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function bp(e){let t=new Map,n=new Map,i=e.clone();return Sp(e,i,function(r,s){t.set(s,r),n.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=t.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return n.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function Sp(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)Sp(e.children[i],t.children[i],n)}class Eu extends bi{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Pp(t)}),this.register(function(t){return new Ip(t)}),this.register(function(t){return new Bp(t)}),this.register(function(t){return new Gp(t)}),this.register(function(t){return new Hp(t)}),this.register(function(t){return new Np(t)}),this.register(function(t){return new Dp(t)}),this.register(function(t){return new Op(t)}),this.register(function(t){return new Up(t)}),this.register(function(t){return new Cp(t)}),this.register(function(t){return new Fp(t)}),this.register(function(t){return new Lp(t)}),this.register(function(t){return new kp(t)}),this.register(function(t){return new zp(t)}),this.register(function(t){return new Ap(t)}),this.register(function(t){return new Mu(t,Ze.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new Mu(t,Ze.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Vp(t)})}load(e,t,n,i){let r=this,s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){let c=Yi.extractUrlBase(e);s=Yi.resolveURL(c,this.path)}else s=Yi.extractUrlBase(e);this.manager.itemStart(e);let o=function(c){if(i)i(c);else console.error(c);r.manager.itemError(e),r.manager.itemEnd(e)},a=new Vs(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{r.parse(c,s,function(l){t(l),r.manager.itemEnd(e)},o)}catch(l){o(l)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let r,s={},o={},a=new TextDecoder;if(typeof e==="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===Wp){try{s[Ze.KHR_BINARY_GLTF]=new $p(e)}catch(u){if(i)i(u);return}r=JSON.parse(s[Ze.KHR_BINARY_GLTF].content)}else r=JSON.parse(a.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new jp(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){let u=this.pluginCallbacks[l](c);if(!u.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");o[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let l=0;l<r.extensionsUsed.length;++l){let u=r.extensionsUsed[l],h=r.extensionsRequired||[];switch(u){case Ze.KHR_MATERIALS_UNLIT:s[u]=new Rp;break;case Ze.KHR_DRACO_MESH_COMPRESSION:s[u]=new Zp(r,this.dracoLoader);break;case Ze.KHR_TEXTURE_TRANSFORM:s[u]=new Xp;break;case Ze.KHR_MESH_QUANTIZATION:s[u]=new qp;break;default:if(h.indexOf(u)>=0&&o[u]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function qw(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function Et(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}var Ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Ap{constructor(e){this.parser=e,this.name=Ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];if(r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],c,l=new Le(16777215);if(a.color!==void 0)l.setRGB(a.color[0],a.color[1],a.color[2],ln);let u=a.range!==void 0?a.range:0;switch(a.type){case"directional":c=new os(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ss(l),c.distance=u;break;case"spot":c=new Ma(l),c.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,c.angle=a.spot.outerConeAngle,c.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}if(c.position.set(0,0,0),Qn(c,a),a.intensity!==void 0)c.intensity=a.intensity;return c.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(c),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;if(o===void 0)return null;return this._loadLight(o).then(function(a){return n._getNodeRef(t.cache,o,a)})}}class Rp{constructor(){this.name=Ze.KHR_MATERIALS_UNLIT}getMaterialType(){return jn}extendParams(e,t,n){let i=[];e.color=new Le(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],ln),e.opacity=s[3]}if(r.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",r.baseColorTexture,Bi))}return Promise.all(i)}}class Cp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class Pp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Pe(r,r)}}return Promise.all(i)}}class Ip{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class Lp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(t.iridescenceThicknessRange===void 0)t.iridescenceThicknessRange=[100,400];if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class Np{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_SHEEN}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Le(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],ln)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,Bi));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class Dp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class Op{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_VOLUME}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Le().setRGB(r[0],r[1],r[2],ln),Promise.all(i)}}class Up{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_IOR}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class Fp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];if(t.specularColor=new Le().setRGB(r[0],r[1],r[2],ln),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,Bi));return Promise.all(i)}}class zp{constructor(e){this.parser=e,this.name=Ze.EXT_MATERIALS_BUMP}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class kp{constructor(e){this.parser=e,this.name=Ze.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Et(this.parser,e,this.name)!==null?hn:null}extendMaterialParams(e,t){let n=Et(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class Bp{constructor(e){this.parser=e,this.name=Ze.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,r.source,s)}}class Gp{constructor(e){this.parser=e,this.name=Ze.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class Hp{constructor(e){this.parser=e,this.name=Ze.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let s=r.extensions[t],o=i.images[s.source],a=n.textureLoader;if(o.uri){let c=n.options.manager.getHandler(o.uri);if(c!==null)a=c}return n.loadTextureImage(e,s.source,a)}}class Mu{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return r.then(function(o){let a=i.byteOffset||0,c=i.byteLength||0,{count:l,byteStride:u}=i,h=new Uint8Array(o,a,c);if(s.decodeGltfBufferAsync)return s.decodeGltfBufferAsync(l,u,h,i.mode,i.filter).then(function(f){return f.buffer});else return s.ready.then(function(){let f=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(f),l,u,h,i.mode,i.filter),f})})}else return null}}class Vp{constructor(e){this.name=Ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let c of i.primitives)if(c.mode!==Tn.TRIANGLES&&c.mode!==Tn.TRIANGLE_STRIP&&c.mode!==Tn.TRIANGLE_FAN&&c.mode!==void 0)return null;let s=n.extensions[this.name].attributes,o=[],a={};for(let c in s)o.push(this.parser.getDependency("accessor",s[c]).then((l)=>(a[c]=l,a[c])));if(o.length<1)return null;return o.push(this.parser.createNodeMesh(e)),Promise.all(o).then((c)=>{let l=c.pop(),u=l.isGroup?l.children:[l],h=c[0].count,f=[];for(let d of u){let m=new Fe,x=new N,p=new zt,g=new N(1,1,1),A=new ns(d.geometry,d.material,h);for(let E=0;E<h;E++){if(a.TRANSLATION)x.fromBufferAttribute(a.TRANSLATION,E);if(a.ROTATION)p.fromBufferAttribute(a.ROTATION,E);if(a.SCALE)g.fromBufferAttribute(a.SCALE,E);A.setMatrixAt(E,m.compose(x,p,g))}for(let E in a)if(E==="_COLOR_0"){let y=a[E];A.instanceColor=new lr(y.array,y.itemSize,y.normalized)}else if(E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE")d.geometry.setAttribute(E,a[E]);ot.prototype.copy.call(A,d),this.parser.assignFinalMaterial(A),f.push(A)}if(l.isGroup)return l.clear(),l.add(...f),l;return f[0]})}}var Wp="glTF",js=12,Mp={JSON:1313821514,BIN:5130562};class $p{constructor(e){this.name=Ze.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,js),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Wp)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-js,r=new DataView(e,js),s=0;while(s<i){let o=r.getUint32(s,!0);s+=4;let a=r.getUint32(s,!0);if(s+=4,a===Mp.JSON){let c=new Uint8Array(e,js+s,o);this.content=n.decode(c)}else if(a===Mp.BIN){let c=js+s;this.body=e.slice(c,c+o)}s+=o}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class Zp{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ze.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},c={};for(let l in s){let u=wu[l]||l.toLowerCase();o[u]=s[l]}for(let l in e.attributes){let u=wu[l]||l.toLowerCase();if(s[l]!==void 0){let h=n.accessors[e.attributes[l]],f=ls[h.componentType];c[u]=f.name,a[u]=h.normalized===!0}}return t.getDependency("bufferView",r).then(function(l){return new Promise(function(u,h){i.decodeDracoFile(l,function(f){for(let d in f.attributes){let m=f.attributes[d],x=a[d];if(x!==void 0)m.normalized=x}u(f)},o,c,ln,h)})})}}class Xp{constructor(){this.name=Ze.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);return e.needsUpdate=!0,e}}class qp{constructor(){this.name=Ze.KHR_MESH_QUANTIZATION}}class Au extends yi{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=o*2,c=o*3,l=i-t,u=(n-t)/l,h=u*u,f=h*u,d=e*c,m=d-c,x=-2*f+3*h,p=f-h,g=1-x,A=p-h+u;for(let E=0;E!==o;E++){let y=s[m+E+o],w=s[m+E+a]*l,T=s[d+E+o],R=s[d+E]*l;r[E]=g*y+A*w+x*T+p*R}return r}}var Yw=new zt;class Yp extends Au{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return Yw.fromArray(r).normalize().toArray(r),r}}var Tn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ls={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},wp={9728:On,9729:kt,9984:Jo,9985:Jr,9986:hr,9987:qn},Tp={33071:jr,33648:jo,10497:Yr},yu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wu={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ji={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},jw={CUBICSPLINE:void 0,LINEAR:ra,STEP:Ol},bu={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Jw(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new vi({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:zi});return e.DefaultMaterial}function yr(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function Qn(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function Kw(e,t,n){let i=!1,r=!1,s=!1;for(let l=0,u=t.length;l<u;l++){let h=t[l];if(h.POSITION!==void 0)i=!0;if(h.NORMAL!==void 0)r=!0;if(h.COLOR_0!==void 0)s=!0;if(i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);let o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){let h=t[l];if(i){let f=h.POSITION!==void 0?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(f)}if(r){let f=h.NORMAL!==void 0?n.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(f)}if(s){let f=h.COLOR_0!==void 0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;c.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let u=l[0],h=l[1],f=l[2];if(i)e.morphAttributes.position=u;if(r)e.morphAttributes.normal=h;if(s)e.morphAttributes.color=f;return e.morphTargetsRelative=!0,e})}function Qw(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function eT(e){let t,n=e.extensions&&e.extensions[Ze.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+Su(n.attributes);else t=e.indices+":"+Su(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+Su(e.targets[i]);return t}function Su(e){let t="",n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Tu(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function tT(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var nT=new Fe;class jp{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new qw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let a=o.match(/Version\/(\d+)/);i=n&&a?parseInt(a[1],10):-1,r=o.indexOf("Firefox")>-1,s=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||r&&s<98)this.textureLoader=new va(this.options.manager);else this.textureLoader=new wa(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Vs(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){let o={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};return yr(r,o,i),Qn(o,i),Promise.all(n._invokeAll(function(a){return a.afterRoot&&a.afterRoot(o)})).then(function(){for(let a of o.scenes)a.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let s=t[i].joints;for(let o=0,a=s.length;o<a;o++)e[s[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let s=e[i];if(s.mesh!==void 0){if(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0)n[s.mesh].isSkinnedMesh=!0}if(s.camera!==void 0)this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(s,o)=>{let a=this.associations.get(s);if(a!=null)this.associations.set(o,a);for(let[c,l]of s.children.entries())r(l,o.children[c])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,s){return n.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ze.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,s){n.load(Yi.resolveURL(t.uri,i.path),r,void 0,function(){s(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let s=yu[i.type],o=ls[i.componentType],a=i.normalized===!0,c=new o(i.count*s);return Promise.resolve(new It(c,s,a))}let r=[];if(i.bufferView!==void 0)r.push(this.getDependency("bufferView",i.bufferView));else r.push(null);if(i.sparse!==void 0)r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(r).then(function(s){let o=s[0],a=yu[i.type],c=ls[i.componentType],l=c.BYTES_PER_ELEMENT,u=l*a,h=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,d=i.normalized===!0,m,x;if(f&&f!==u){let p=Math.floor(h/f),g="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,A=t.cache.get(g);if(!A)m=new c(o,p*f,i.count*f/l),A=new Ds(m,f/l),t.cache.add(g,A);x=new ts(A,a,h%f/l,d)}else{if(o===null)m=new c(i.count*a);else m=new c(o,h,i.count*a);x=new It(m,a,d)}if(i.sparse!==void 0){let p=yu.SCALAR,g=ls[i.sparse.indices.componentType],A=i.sparse.indices.byteOffset||0,E=i.sparse.values.byteOffset||0,y=new g(s[1],A,i.sparse.count*p),w=new c(s[2],E,i.sparse.count*a);if(o!==null)x=new It(x.array.slice(),x.itemSize,x.normalized);x.normalized=!1;for(let T=0,R=y.length;T<R;T++){let _=y[T];if(x.setX(_,w[T*a]),a>=2)x.setY(_,w[T*a+1]);if(a>=3)x.setZ(_,w[T*a+2]);if(a>=4)x.setW(_,w[T*a+3]);if(a>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}x.normalized=d}return x})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,s=t.images[r],o=this.textureLoader;if(s.uri){let a=n.manager.getHandler(s.uri);if(a!==null)o=a}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];let c=this.loadImageSource(t,n).then(function(l){if(l.flipY=!1,l.name=s.name||o.name||"",l.name===""&&typeof o.uri==="string"&&o.uri.startsWith("data:image/")===!1)l.name=o.uri;let h=(r.samplers||{})[s.sampler]||{};return l.magFilter=wp[h.magFilter]||kt,l.minFilter=wp[h.minFilter]||qn,l.wrapS=Tp[h.wrapS]||Yr,l.wrapT=Tp[h.wrapT]||Yr,l.generateMipmaps=!l.isCompressedTexture&&l.minFilter!==On&&l.minFilter!==kt,i.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[a]=c,c}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let s=i.images[e],o=self.URL||self.webkitURL,a=s.uri||"",c=!1;if(s.bufferView!==void 0)a=n.getDependency("bufferView",s.bufferView).then(function(u){c=!0;let h=new Blob([u],{type:s.mimeType});return a=o.createObjectURL(h),a});else if(s.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(a).then(function(u){return new Promise(function(h,f){let d=h;if(t.isImageBitmapLoader===!0)d=function(m){let x=new St(m);x.needsUpdate=!0,h(x)};t.load(Yi.resolveURL(u,r.path),d,void 0,f)})}).then(function(u){if(c===!0)o.revokeObjectURL(a);return Qn(u,s),u.userData.mimeType=s.mimeType||tT(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),u});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0)s=s.clone(),s.channel=n.texCoord;if(r.extensions[Ze.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Ze.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let a=r.associations.get(s);s=r.extensions[Ze.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),r.associations.set(s,a)}}if(i!==void 0)s.colorSpace=i;return e[t]=s,s})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new Bs,rn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,a.sizeAttenuation=!1,this.cache.add(o,a);n=a}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,a=this.cache.get(o);if(!a)a=new ks,rn.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,this.cache.add(o,a);n=a}if(i||r||s){let o="ClonedMaterial:"+n.uuid+":";if(i)o+="derivative-tangents:";if(r)o+="vertex-colors:";if(s)o+="flat-shading:";let a=this.cache.get(o);if(!a){if(a=n.clone(),r)a.vertexColors=!0;if(s)a.flatShading=!0;if(i){if(a.normalScale)a.normalScale.y*=-1;if(a.clearcoatNormalScale)a.clearcoatNormalScale.y*=-1}this.cache.add(o,a),this.associations.set(a,this.associations.get(n))}n=a}e.material=n}getMaterialType(){return vi}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],s,o={},a=r.extensions||{},c=[];if(a[Ze.KHR_MATERIALS_UNLIT]){let u=i[Ze.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Le(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let h=u.baseColorFactor;o.color.setRGB(h[0],h[1],h[2],ln),o.opacity=h[3]}if(u.baseColorTexture!==void 0)c.push(t.assignTexture(o,"map",u.baseColorTexture,Bi));if(o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0)c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture));s=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,o)})))}if(r.doubleSided===!0)o.side=Sn;let l=r.alphaMode||bu.OPAQUE;if(l===bu.BLEND)o.transparent=!0,o.depthWrite=!1;else if(o.transparent=!1,l===bu.MASK)o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:0.5;if(r.normalTexture!==void 0&&s!==jn){if(c.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Pe(1,1),r.normalTexture.scale!==void 0){let u=r.normalTexture.scale;o.normalScale.set(u,u)}}if(r.occlusionTexture!==void 0&&s!==jn){if(c.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0)o.aoMapIntensity=r.occlusionTexture.strength}if(r.emissiveFactor!==void 0&&s!==jn){let u=r.emissiveFactor;o.emissive=new Le().setRGB(u[0],u[1],u[2],ln)}if(r.emissiveTexture!==void 0&&s!==jn)c.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Bi));return Promise.all(c).then(function(){let u=new s(o);if(r.name)u.name=r.name;if(Qn(u,r),t.associations.set(u,{materials:e}),r.extensions)yr(i,u,r);return u})}createUniqueName(e){let t=et.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(a){return Ep(a,o,t)})}let s=[];for(let o=0,a=e.length;o<a;o++){let c=e[o],l=eT(c),u=i[l];if(u)s.push(u.promise);else{let h;if(c.extensions&&c.extensions[Ze.KHR_DRACO_MESH_COMPRESSION])h=r(c);else h=Ep(new Qt,c,t);i[l]={primitive:c,promise:h},s.push(h)}}return Promise.all(s)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let a=0,c=s.length;a<c;a++){let l=s[a].material===void 0?Jw(this.cache):this.getDependency("material",s[a].material);o.push(l)}return o.push(t.loadGeometries(s)),Promise.all(o).then(function(a){let c=a.slice(0,a.length-1),l=a[a.length-1],u=[];for(let f=0,d=l.length;f<d;f++){let m=l[f],x=s[f],p,g=c[f];if(x.mode===Tn.TRIANGLES||x.mode===Tn.TRIANGLE_STRIP||x.mode===Tn.TRIANGLE_FAN||x.mode===void 0){if(p=r.isSkinnedMesh===!0?new ha(m,g):new dt(m,g),p.isSkinnedMesh===!0)p.normalizeSkinWeights();if(x.mode===Tn.TRIANGLE_STRIP)p.geometry=vu(p.geometry,Ps);else if(x.mode===Tn.TRIANGLE_FAN)p.geometry=vu(p.geometry,Qr)}else if(x.mode===Tn.LINES)p=new fa(m,g);else if(x.mode===Tn.LINE_STRIP)p=new Hi(m,g);else if(x.mode===Tn.LINE_LOOP)p=new da(m,g);else if(x.mode===Tn.POINTS)p=new is(m,g);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);if(Object.keys(p.geometry.morphAttributes).length>0)Qw(p,r);if(p.name=t.createUniqueName(r.name||"mesh_"+e),Qn(p,r),x.extensions)yr(i,p,x);t.assignFinalMaterial(p),u.push(p)}for(let f=0,d=u.length;f<d;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1){if(r.extensions)yr(i,u[0],r);return u[0]}let h=new Wn;if(r.extensions)yr(i,h,r);t.associations.set(h,{meshes:e});for(let f=0,d=u.length;f<d;f++)h.add(u[f]);return h})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Pt(Is.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new xr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return Qn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let r=i.pop(),s=i,o=[],a=[];for(let c=0,l=s.length;c<l;c++){let u=s[c];if(u){o.push(u);let h=new Fe;if(r!==null)h.fromArray(r.array,c*16);a.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Fs(o,a)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],c=[],l=[];for(let u=0,h=i.channels.length;u<h;u++){let f=i.channels[u],d=i.samplers[f.sampler],m=f.target,x=m.node,p=i.parameters!==void 0?i.parameters[d.input]:d.input,g=i.parameters!==void 0?i.parameters[d.output]:d.output;if(m.node===void 0)continue;s.push(this.getDependency("node",x)),o.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",g)),c.push(d),l.push(m)}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l)]).then(function(u){let h=u[0],f=u[1],d=u[2],m=u[3],x=u[4],p=[];for(let A=0,E=h.length;A<E;A++){let y=h[A],w=f[A],T=d[A],R=m[A],_=x[A];if(y===void 0)continue;if(y.updateMatrix)y.updateMatrix();let S=n._createAnimationTracks(y,w,T,R,_);if(S)for(let U=0;U<S.length;U++)p.push(S[U])}let g=new $r(r,void 0,p);return Qn(g,i),g})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(r){let s=n._getNodeRef(n.meshCache,i.mesh,r);if(i.weights!==void 0)s.traverse(function(o){if(!o.isMesh)return;for(let a=0,c=i.weights.length;a<c;a++)o.morphTargetInfluences[a]=i.weights[a]});return s})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),s=[],o=i.children||[];for(let c=0,l=o.length;c<l;c++)s.push(n.getDependency("node",o[c]));let a=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),a]).then(function(c){let l=c[0],u=c[1],h=c[2];if(h!==null)l.traverse(function(f){if(!f.isSkinnedMesh)return;f.bind(h,nT)});for(let f=0,d=u.length;f<d;f++)l.add(u[f]);if(l.userData.pivot!==void 0&&u.length>0){let f=l.userData.pivot,d=u[0];l.pivot=new N().fromArray(f),l.position.x-=f[0],l.position.y-=f[1],l.position.z-=f[2],d.position.set(0,0,0),delete l.userData.pivot}return l})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});if(a)o.push(a);if(r.camera!==void 0)o.push(i.getDependency("camera",r.camera).then(function(c){return i._getNodeRef(i.cameraCache,r.camera,c)}));return i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let l;if(r.isBone===!0)l=new Os;else if(c.length>1)l=new Wn;else if(c.length===1)l=c[0];else l=new ot;if(l!==c[0])for(let u=0,h=c.length;u<h;u++)l.add(c[u]);if(r.name)l.userData.name=r.name,l.name=s;if(Qn(l,r),r.extensions)yr(n,l,r);if(r.matrix!==void 0){let u=new Fe;u.fromArray(r.matrix),l.applyMatrix4(u)}else{if(r.translation!==void 0)l.position.fromArray(r.translation);if(r.rotation!==void 0)l.quaternion.fromArray(r.rotation);if(r.scale!==void 0)l.scale.fromArray(r.scale)}if(!i.associations.has(l))i.associations.set(l,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(l);i.associations.set(l,{...u})}return i.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new Wn;if(n.name)r.name=i.createUniqueName(n.name);if(Qn(r,n),n.extensions)yr(t,r,n);let s=n.nodes||[],o=[];for(let a=0,c=s.length;a<c;a++)o.push(i.getDependency("node",s[a]));return Promise.all(o).then(function(a){for(let l=0,u=a.length;l<u;l++){let h=a[l];if(h.parent!==null)r.add(bp(h));else r.add(h)}let c=(l)=>{let u=new Map;for(let[h,f]of i.associations)if(h instanceof rn||h instanceof St)u.set(h,f);return l.traverse((h)=>{let f=i.associations.get(h);if(f!=null)u.set(h,f)}),u};return i.associations=c(r),r})}_createAnimationTracks(e,t,n,i,r){let s=[],o=e.name?e.name:e.uuid,a=[];function c(f){if(f.morphTargetInfluences)a.push(f.name?f.name:f.uuid)}if(Ji[r.path]===Ji.weights){if(c(e),e.isGroup)e.children.forEach(c)}else a.push(o);let l;switch(Ji[r.path]){case Ji.weights:l=Zi;break;case Ji.rotation:l=Xi;break;case Ji.translation:case Ji.scale:l=_r;break;default:switch(n.itemSize){case 1:l=Zi;break;case 2:case 3:default:l=_r;break}break}let u=i.interpolation!==void 0?jw[i.interpolation]:ra,h=this._getArrayFromAccessor(n);for(let f=0,d=a.length;f<d;f++){let m=new l(a[f]+"."+Ji[r.path],t.array,h,u);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(m);s.push(m)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Tu(t.constructor),i=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof Xi?Yp:Au)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function iT(e,t,n){let i=t.attributes,r=new Kt;if(i.POSITION!==void 0){let a=n.json.accessors[i.POSITION],{min:c,max:l}=a;if(c!==void 0&&l!==void 0){if(r.set(new N(c[0],c[1],c[2]),new N(l[0],l[1],l[2])),a.normalized){let u=Tu(ls[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=t.targets;if(s!==void 0){let a=new N,c=new N;for(let l=0,u=s.length;l<u;l++){let h=s[l];if(h.POSITION!==void 0){let f=n.json.accessors[h.POSITION],{min:d,max:m}=f;if(d!==void 0&&m!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(m[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(m[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(m[2]))),f.normalized){let x=Tu(ls[f.componentType]);c.multiplyScalar(x)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}e.boundingBox=r;let o=new un;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}function Ep(e,t,n){let i=t.attributes,r=[];function s(o,a){return n.getDependency("accessor",o).then(function(c){e.setAttribute(a,c)})}for(let o in i){let a=wu[o]||o.toLowerCase();if(a in e.attributes)continue;r.push(s(i[o],a))}if(t.indices!==void 0&&!e.index){let o=n.getDependency("accessor",t.indices).then(function(a){e.setIndex(a)});r.push(o)}if(Ve.workingColorSpace!==ln&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ve.workingColorSpace}" not supported.`);return Qn(e,t),iT(e,t,n),Promise.all(r).then(function(){return t.targets!==void 0?Kw(e,t.targets,n):e})}var Jp={type:"change"},Cu={type:"start"},Qp={type:"end"},Ia=new Gi,Kp=new In,rT=Math.cos(70*Is.DEG2RAD),Dt=new N,sn=2*Math.PI,at={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ru=0.000001;class Pu extends Ea{constructor(e,t=null){super(e,t);if(this.state=at.NONE,this.target=new N,this.cursor=new N,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=0.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:Ui.ROTATE,MIDDLE:Ui.DOLLY,RIGHT:Ui.PAN},this.touches={ONE:Fi.ROTATE,TWO:Fi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new zt,this._lastTargetPosition=new N,this._quat=new zt().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Ws,this._sphericalDelta=new Ws,this._scale=1,this._panOffset=new N,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 N,this._mouse=new Pe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=oT.bind(this),this._onPointerDown=sT.bind(this),this._onPointerUp=aT.bind(this),this._onContextMenu=pT.bind(this),this._onMouseWheel=uT.bind(this),this._onKeyDown=hT.bind(this),this._onTouchStart=fT.bind(this),this._onTouchMove=dT.bind(this),this._onMouseDown=cT.bind(this),this._onMouseMove=lT.bind(this),this._interceptControlDown=mT.bind(this),this._interceptControlUp=gT.bind(this),this.domElement!==null)this.connect(this.domElement);this.update()}set cursorStyle(e){if(this._cursorStyle=e,e==="grab")this.domElement.style.cursor="grab";else this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),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.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.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=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){if(this._domElementKeyEvents!==null)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(Jp),this.update(),this.state=at.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;if(Dt.copy(t).sub(this.target),Dt.applyQuaternion(this._quat),this._spherical.setFromVector3(Dt),this.autoRotate&&this.state===at.NONE)this._rotateLeft(this._getAutoRotationAngle(e));if(this.enableDamping)this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor;else this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi;let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;if(isFinite(n)&&isFinite(i)){if(n<-Math.PI)n+=sn;else if(n>Math.PI)n-=sn;if(i<-Math.PI)i+=sn;else if(i>Math.PI)i-=sn;if(n<=i)this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta));else this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)}if(this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0)this.target.addScaledVector(this._panOffset,this.dampingFactor);else 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{let s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=s!=this._spherical.radius}if(Dt.setFromSpherical(this._spherical),Dt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Dt),this.object.lookAt(this.target),this.enableDamping===!0)this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor);else this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0);if(this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){let o=Dt.length();s=this._clampDistance(o*this._scale);let a=o-s;this.object.position.addScaledVector(this._dollyDirection,a),this.object.updateMatrixWorld(),r=!!a}else if(this.object.isOrthographicCamera){let o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=a!==this.object.zoom;let c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=Dt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;if(s!==null)if(this.screenSpacePanning)this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position);else if(Ia.origin.copy(this.object.position),Ia.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Ia.direction))<rT)this.object.lookAt(this.target);else Kp.setFromNormalAndCoplanarPoint(this.object.up,this.target),Ia.intersectPlane(Kp,this.target)}else if(this.object.isOrthographicCamera){let s=this.object.zoom;if(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom)this.object.updateProjectionMatrix(),r=!0}if(this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Ru||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ru||this._lastTargetPosition.distanceToSquared(this.target)>Ru)return this.dispatchEvent(Jp),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0;return!1}_getAutoRotationAngle(e){if(e!==null)return sn/60*this.autoRotateSpeed*e;else return sn/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*0.01);return Math.pow(0.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Dt.setFromMatrixColumn(t,0),Dt.multiplyScalar(-e),this._panOffset.add(Dt)}_panUp(e,t){if(this.screenSpacePanning===!0)Dt.setFromMatrixColumn(t,1);else Dt.setFromMatrixColumn(t,0),Dt.crossVectors(this.object.up,Dt);Dt.multiplyScalar(e),this._panOffset.add(Dt)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Dt.copy(i).sub(this.target);let r=Dt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else if(this.object.isOrthographicCamera)this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix);else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1}_dollyOut(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale/=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_dollyIn(e){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale*=e;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,{width:s,height:o}=n;this._mouse.x=i/s*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sn*this._rotateDelta.x/t.clientHeight),this._rotateUp(sn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){if(this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0)this._dollyOut(this._getZoomScale(this._dollyDelta.y));else if(this._dollyDelta.y<0)this._dollyIn(this._getZoomScale(this._dollyDelta.y));this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.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(e){if(this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0)this._dollyIn(this._getZoomScale(e.deltaY));else if(e.deltaY>0)this._dollyOut(this._getZoomScale(e.deltaY));this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,this.keyPanSpeed);t=!0;break;case this.keys.BOTTOM:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateUp(-sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,-this.keyPanSpeed);t=!0;break;case this.keys.LEFT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(this.keyPanSpeed,0);t=!0;break;case this.keys.RIGHT:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate)this._rotateLeft(-sn*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(-this.keyPanSpeed,0);t=!0;break}if(t)e.preventDefault(),this.update()}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enablePan)this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){if(this.enableZoom)this._handleTouchStartDolly(e);if(this.enableRotate)this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=0.5*(e.pageX+n.x),r=0.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sn*this._rotateDelta.x/t.clientHeight),this._rotateUp(sn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=0.5*(e.pageX+t.x),i=0.5*(e.pageY+t.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(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.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);let s=(e.pageX+t.x)*0.5,o=(e.pageY+t.y)*0.5;this._updateZoomParameters(s,o)}_handleTouchMoveDollyPan(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enablePan)this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){if(this.enableZoom)this._handleTouchMoveDolly(e);if(this.enableRotate)this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];if(t===void 0)t=new Pe,this._pointerPositions[e.pointerId]=t;t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}if(e.ctrlKey&&!this._controlActive)n.deltaY*=10;return n}}function sT(e){if(this.enabled===!1)return;if(this._pointers.length===0)this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp);if(this._isTrackingPointer(e))return;if(this._addPointer(e),e.pointerType==="touch")this._onTouchStart(e);else this._onMouseDown(e);if(this._cursorStyle==="grab")this.domElement.style.cursor="grabbing"}function oT(e){if(this.enabled===!1)return;if(e.pointerType==="touch")this._onTouchMove(e);else this._onMouseMove(e)}function aT(e){switch(this._removePointer(e),this._pointers.length){case 0:if(this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Qp),this.state=at.NONE,this._cursorStyle==="grab")this.domElement.style.cursor="grab";break;case 1:let t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y});break}}function cT(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Ui.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(e),this.state=at.DOLLY;break;case Ui.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=at.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=at.ROTATE}break;case Ui.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=at.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=at.PAN}break;default:this.state=at.NONE}if(this.state!==at.NONE)this.dispatchEvent(Cu)}function lT(e){switch(this.state){case at.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(e);break;case at.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(e);break;case at.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(e);break}}function uT(e){if(this.enabled===!1||this.enableZoom===!1||this.state!==at.NONE)return;e.preventDefault(),this.dispatchEvent(Cu),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(Qp)}function hT(e){if(this.enabled===!1)return;this._handleKeyDown(e)}function fT(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case Fi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(e),this.state=at.TOUCH_ROTATE;break;case Fi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(e),this.state=at.TOUCH_PAN;break;default:this.state=at.NONE}break;case 2:switch(this.touches.TWO){case Fi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(e),this.state=at.TOUCH_DOLLY_PAN;break;case Fi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(e),this.state=at.TOUCH_DOLLY_ROTATE;break;default:this.state=at.NONE}break;default:this.state=at.NONE}if(this.state!==at.NONE)this.dispatchEvent(Cu)}function dT(e){switch(this._trackPointer(e),this.state){case at.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(e),this.update();break;case at.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(e),this.update();break;case at.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(e),this.update();break;case at.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=at.NONE}}function pT(e){if(this.enabled===!1)return;e.preventDefault()}function mT(e){if(e.key==="Control")this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}function gT(e){if(e.key==="Control")this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}class Iu extends es{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let e=new Wi;e.deleteAttribute("uv");let t=new vi({side:Xt}),n=new vi,i=new ss(16777215,900,28,2);i.position.set(0.418,16.199,0.3),this.add(i);let r=new dt(e,t);r.position.set(-0.757,13.219,0.717),r.scale.set(31.713,28.305,28.591),this.add(r);let s=new ns(e,n,6),o=new ot;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-0.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),s.setMatrixAt(0,o.matrix),o.position.set(-5.607,-0.754,-0.758),o.rotation.set(0,0.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),s.setMatrixAt(1,o.matrix),o.position.set(6.167,0.857,7.803),o.rotation.set(0,0.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),s.setMatrixAt(2,o.matrix),o.position.set(-2.017,0.018,6.124),o.rotation.set(0,0.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),s.setMatrixAt(3,o.matrix),o.position.set(2.291,-0.756,-2.621),o.rotation.set(0,-0.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),s.setMatrixAt(4,o.matrix),o.position.set(-2.193,-0.369,-5.547),o.rotation.set(0,0.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),s.setMatrixAt(5,o.matrix),this.add(s);let a=new dt(e,us(50));a.position.set(-16.116,14.37,8.208),a.scale.set(0.1,2.428,2.739),this.add(a);let c=new dt(e,us(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(0.1,2.425,2.751),this.add(c);let l=new dt(e,us(17));l.position.set(14.904,12.198,-1.832),l.scale.set(0.15,4.265,6.331),this.add(l);let u=new dt(e,us(43));u.position.set(-0.462,8.89,14.52),u.scale.set(4.38,5.441,0.088),this.add(u);let h=new dt(e,us(20));h.position.set(3.235,11.486,-12.541),h.scale.set(2.5,2,0.1),this.add(h);let f=new dt(e,us(100));f.position.set(0,20,0),f.scale.set(1,0.1,1),this.add(f)}dispose(){let e=new Set;this.traverse((t)=>{if(t.isMesh)e.add(t.geometry),e.add(t.material)});for(let t of e)t.dispose()}}function us(e){return new ga({color:0,emissive:16777215,emissiveIntensity:e})}function Qs(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function Nu(e,t="|"){return e.map((n)=>Uu(n)).join(t)}function eo(e,t){if(typeof t==="bigint")return t.toString();return t}class tm{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function La(e){return new tm(e)}function nm(e){return e===null||e===void 0}function Na(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function im(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-i)<r)return 0;return n-i}function zn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Da(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Si(e){return Da(e._zod.def)??e._zod.def.shape}function rm(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return zn(this,t,i),i},enumerable:!0,configurable:!0})}function sm(e,t,n){if(t in e)zn(e,t,n);else e[t]=n}function br(e,t,n,i){let r=Si(t);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);if(!o.enumerable)continue;if(o.get)rm(e,s,()=>{let a=t._zod.def.shape[s];return i?i(a,s):a});else sm(e,s,i?i(o.value,s):o.value)}}function _T(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);if(!i.enumerable)continue;if(i.get)rm(e,n,()=>t[n]);else sm(e,n,i.value)}}function dn(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function om(e){return JSON.stringify(e)}function am(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Du="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ks(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var cm=La(()=>{if(en.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Sr(e){if(Ks(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(Ks(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Ou(e){if(Sr(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var lm=new Set(["string","number","symbol"]);function Qi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(e,t,n){let i=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)i._zod.parent=e;return i}function Te(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Uu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function um(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Oa=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Fu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xT(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return br(s,e,Ua(e,t)),ei(e,dn(n,{shape:s,checks:[]}))}function Ua(e,t){let n=Si(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw Error(`Unrecognized key: "${String(r)}"`);if(t[r])i.push(r)}return i}function vT(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Ua(e,t)),o={};return br(o,e,Reflect.ownKeys(Si(e)).filter((a)=>!s.has(a))),ei(e,dn(n,{shape:o,checks:[]}))}function yT(e,t){if(!Sr(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=Si(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ei(e,dn(e._zod.def,{shape:hm(e,t)}))}function hm(e,t){let n={};return br(n,e,Reflect.ownKeys(Si(e))),_T(n,t),n}function bT(e,t){if(!Sr(t))throw Error("Invalid input to safeExtend: expected a plain object");return ei(e,dn(e._zod.def,{shape:hm(e,t)}))}function ST(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};br(n,e,Reflect.ownKeys(Si(e))),br(n,t,Reflect.ownKeys(Si(t)));let i=dn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ei(e,i)}function fm(e,t,n,i="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ua(t,n)):void 0,c={};return br(c,t,Reflect.ownKeys(Si(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),ei(t,dn(t._zod.def,{shape:c,checks:[]}))}function MT(e,t,n){let i=n?new Set(Ua(t,n)):void 0,r={};return br(r,t,Reflect.ownKeys(Si(t)),(s,o)=>i&&!i.has(o)?s:new e({type:"nonoptional",innerType:s})),ei(t,dn(t._zod.def,{shape:r}))}function ti(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function dm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function wi(e,t){return t.map((n)=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Js(e){return typeof e==="string"?e:e?.message}function zu(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function ni(e,t,n){var i;let r=e.inst?._zod?.traits;if(r?.has("$ZodType"))if(r.has("$ZodCheck"))(i=e).schema??(i.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:Js(e.inst?._zod.def?.error?.(e))??Js(s?.(e))??Js(t?.error?.(e))??Js(n.customError?.(e))??Js(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=e.input;return a}var wT=/[\uD800-\uDBFF]/;function Fa(e){let t=e.length;if(!wT.test(e))return t;let n=t;for(let i=0;i<t-1;i++)if((e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320)n--,i++;return n}function za(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function pm(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Mr(...e){let[t,n,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:i};return{...t}}function mm(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);if(i.get)Object.defineProperty(e,n,{...i,enumerable:!1});else em(e,n,i.value)}for(let n of Object.getOwnPropertySymbols(t))em(e,n,t[n])}function Mi(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function ku(e,t,n){return Mi(e,t,n,!1)}function gm(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Mi(this,n,i(this))},set(r){Mi(this,n,r)}})}return t}function em(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mi(this,t,n.bind(this))},set(i){Mi(this,t,i)}})}function TT(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Lu,Ki=!1,ET={configurable:!0,get(){Ki=!0;return}};function tt(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&Lu!==e._zod){Lu=void 0;return}Lu=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,ET);let r=Ki;Ki=!1;try{let s=n(this);if(Ki)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Ki=Ki||r,s}catch(s){throw delete this[t],Ki=Ki||r,s}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function AT(e,t,n,i){let r=TT(e,t);if(!r)return;Object.defineProperty(r,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:s})}})}var RT="~constantCatch";function _m(e){let t=()=>e;return t[RT]=!0,t}var xm;var Bu={value:void 0,enumerable:!1},vm="captureStackTrace"in Error?Error:null;function CT(e){let t=vm;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return vm=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,i){let r={};function s(f){this.def=f,this.constr=h,this.traits=new Set}s.prototype=r;let o=n,a=o&&new WeakSet;function c(f,d){if(!f._zod){Bu.value=new s(d);try{Object.defineProperty(f,"_zod",Bu)}finally{Bu.value=void 0}}if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,d),a){let x=Object.getPrototypeOf(f),p=f._zod.constr.prototype,g=x;while(g&&g!==p)g=Object.getPrototypeOf(g);let A=g??x;if(!a.has(A))a.add(A),mm(A,o)}let m=h.prototype;for(let x in m){if(!Object.prototype.hasOwnProperty.call(m,x))continue;if(!(x in f))f[x]=m[x].bind(f)}}let l=i?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function h(f){let d=i?.Parent?CT(u):this;c(d,f);let m=d._zod.deferred;if(m){for(let p of m)p();d._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;if(x)x(d);return d}return Object.defineProperty(h,"init",{value:c}),Object.defineProperty(h,Symbol.hasInstance,{value:(f)=>{if(i?.Parent&&f instanceof i.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(h,"name",{value:e}),h}class ii extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class to extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(xm=globalThis).__zod_globalConfig??(xm.__zod_globalConfig={});var en=globalThis.__zod_globalConfig;function pn(e){if(e)Object.assign(en,e);return en}function PT(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,eo,2)),e.message}function IT(e){this._zod.message=e}var LT={get:PT,set:IT,enumerable:!0,configurable:!0},Hu={value:void 0,enumerable:!1},ym=new WeakSet([Object.prototype,Error.prototype]),bm=(e,t)=>{e.name="$ZodError",Hu.value=t,Object.defineProperty(e,"issues",Hu),Hu.value=void 0,Object.defineProperty(e,"message",LT);let n=Object.getPrototypeOf(e);if(!ym.has(n))ym.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}})},Sm=q("$ZodError",bm),_P=q("$ZodError",bm,void 0,{Parent:Error});function NT(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function Mm(e,t=(n)=>n.message){let n={},i=[];for(let r of e.issues)if(r.path.length>0)NT(n,r.path[0],()=>[]).push(t(r));else i.push(t(r));return{formErrors:i,fieldErrors:n}}function wm(e,t=(n)=>n.message){let n={_errors:[]},i=(r,s=[])=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map((a)=>i({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...s,...o.path]);else{let a=[...s,...o.path];if(a.length===0)n._errors.push(t(o));else{let c=n,l=0;while(l<a.length){let u=a[l],h=l===a.length-1;if(u==="_errors"){if(h)c._errors.push(t(o));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[u];if(h)f._errors.push(t(o));c=f,l++}}}};return i(e),n}function ka(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ba=(e)=>{let t=(n,i,r,s)=>{let o=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new ii;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((l)=>ni(l,o,pn())));throw Du(c,s?.callee??t),c}return a.value};return t};var Ga=(e)=>{let t=async(n,i,r,s)=>{let o=r?{...r,async:!0}:{async:!0},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((l)=>ni(l,o,pn())));throw Du(c,s?.callee??t),c}return a.value};return t};var Ha=(e)=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new ii;return s.issues.length?Tm(e,s.issues,r):{success:!0,data:s.value}};function Tm(e,t,n){let i;return{success:!1,get error(){if(!i)i=new e(t.map((r)=>ni(r,n,pn()))),t=void 0,n=void 0;return i},set error(r){i=r,t=void 0,n=void 0}}}var Va=(e)=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)s=await s;return s.issues.length?Tm(e,s.issues,r):{success:!0,data:s.value}};var DT=Symbol.for("zod.compile.invalid"),OT=Symbol.for("zod.compile.fallback"),Vu=(e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==DT)return!0;if(i.definite===!0&&n===void 0)return!1}return UT(e,t,n)};function UT(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,s;if(r)i[OT]=!0,s=r({value:t,issues:[]},i);else s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new ii;return s.issues.length===0}var Wu=async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);if(r instanceof Promise)r=await r;return r.issues.length===0},Em=(e)=>{let t=Ba(e),n=(i,r,s,o)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(i,r,a,ka(n,o))};return n};var Am=(e)=>{let t=Ba(e),n=(i,r,s,o)=>t(i,r,s,ka(n,o));return n};var Rm=(e)=>{let t=Ga(e),n=async(i,r,s,o)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(i,r,a,ka(n,o))};return n};var Cm=(e)=>{let t=Ga(e),n=async(i,r,s,o)=>await t(i,r,s,ka(n,o));return n};var Pm=(e)=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ha(e)(t,n,r)};var Im=(e)=>(t,n,i)=>Ha(e)(t,n,i);var Lm=(e)=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Va(e)(t,n,r)};var Nm=(e)=>async(t,n,i)=>Va(e)(t,n,i);var Dm=/^[cC][0-9a-z]{6,}$/,Om=/^[0-9a-z]+$/,Um=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Fm=/^[0-9a-vA-V]{20}$/,zm=/^[A-Za-z0-9]{27}$/,km=/^[a-zA-Z0-9_-]{21}$/;function Bm(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Gm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Hm=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zu=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Vm=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var FT="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Wm(){return new RegExp(FT,"u")}var $m=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Xm=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ym=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jm=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Jm=/^https?$/,Km=/^\+[1-9]\d{6,14}$/;var Qm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function zT(e){return new RegExp(`^${e}$`)}var eg=zT(Qm);function $u(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function tg(e){return new RegExp(`^${$u(e)}$`)}function ng(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${$u({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${$u({precision:e.precision})}`:n;return new RegExp(`^${Qm}T(?:${i})$`)}var ig=/^[\s\S]{0,}$/;var Xu=/^-?\d+$/,no=/^-?\d+(?:\.\d+)?$/,rg=/^(?:true|false)$/i;var sg=/^[^A-Z]*$/,og=/^[^a-z]*$/;var Bt=q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var qu=(e)=>{let t=e.value;return!nm(t)&&t.length!==void 0},Wa={number:"number",bigint:"bigint",object:"date"},Yu=q("$ZodCheckLessThan",(e,t)=>{Bt.init(e,t);let n=Wa[typeof t.value];e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:Wa[typeof i.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ju=q("$ZodCheckGreaterThan",(e,t)=>{Bt.init(e,t);let n=Wa[typeof t.value];e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:Wa[typeof i.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ag=q("$ZodCheckMultipleOf",(e,t)=>{Bt.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):im(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cg=q("$ZodCheckNumberFormat",(e,t)=>{Bt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=Oa[t.format];e._zod.check=(o)=>{let a=o.value;if(n){if(!Number.isInteger(a)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});else o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}if(a<r)o.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>s)o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var lg=q("$ZodCheckMaxLength",(e,t)=>{var n;Bt.init(e,t),(n=e._zod.def).when??(n.when=qu),e._zod.check=(i)=>{let r=i.value,s=r.length;if((typeof r==="string"&&s>t.maximum?Fa(r):s)<=t.maximum)return;let a=za(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ug=q("$ZodCheckMinLength",(e,t)=>{var n;Bt.init(e,t),(n=e._zod.def).when??(n.when=qu),e._zod.check=(i)=>{let r=i.value,s=r.length;if((typeof r==="string"&&s>=t.minimum&&s<t.minimum*2?Fa(r):s)>=t.minimum)return;let a=za(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hg=q("$ZodCheckLengthEquals",(e,t)=>{var n;Bt.init(e,t),(n=e._zod.def).when??(n.when=qu),e._zod.check=(i)=>{let r=i.value,s=r.length,o=typeof r==="string"&&s>=t.length&&s<=t.length*2?Fa(r):s;if(o===t.length)return;let a=za(r),c=o>t.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),ro=q("$ZodCheckStringFormat",(e,t)=>{var n,i;if(Bt.init(e,t),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),fg=q("$ZodCheckRegex",(e,t)=>{ro.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dg=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sg),ro.init(e,t)}),pg=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=og),ro.init(e,t)}),mg=q("$ZodCheckIncludes",(e,t)=>{Bt.init(e,t);let n=Qi(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),gg=q("$ZodCheckStartsWith",(e,t)=>{Bt.init(e,t);let n=new RegExp(`^${Qi(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),_g=q("$ZodCheckEndsWith",(e,t)=>{Bt.init(e,t);let n=new RegExp(`.*${Qi(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});var xg=q("$ZodCheckOverwrite",(e,t)=>{Bt.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class Ju{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
+`).filter((s)=>s),i=Math.min(...n.map((s)=>s.length-s.trimStart().length)),r=n.map((s)=>s.slice(i)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of r)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
+${t.join(`
+`)}
+};`)(...Object.values(this.closed))}}var yg={major:4,minor:6,patch:2};var gt=q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yg;let i=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(let s of r)for(let o of s._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,l)=>{if(a.memo)return a;let u=ti(a),h;for(let f of c){if(f._zod.def.when){if(dm(a))continue;if(!f._zod.def.when(a))continue}else if(u)continue;let d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&l?.async===!1)throw new ii;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await m,a.issues.length===d)return;if(zu(a.issues,d,e),!u)u=ti(a,d)});else{if(a.issues.length===d)continue;if(zu(a.issues,d,e),!u)u=ti(a,d)}}if(h)return h.then(()=>a);return a},o=(a,c,l)=>{if(ti(a))return a.aborted=!0,a;let u=s(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new ii;return u.then((h)=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((h)=>o(h,a,c));return o(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new ii;return l.then((u)=>s(u,r,c))}return s(l,r,c)}}},{get "~standard"(){return ku(this,"~standard",Qu(this))},set "~standard"(e){Mi(this,"~standard",e)}}),Ig=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>ni(n,t,pn()))}:{value:e.value};async function kT(e,t){let n={async:!0};return Ig(await e._zod.run({value:t,issues:[]},n),n)}function Qu(e){return{validate:(t)=>{let n={async:!1};try{let i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return Ig(i,n)}catch(i){}return kT(e,t)},vendor:"zod",version:1}}var Xa=q("$ZodString",(e,t)=>{gt.init(e,t),e._zod.pattern=t.pattern??ig,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),_t=q("$ZodStringFormat",(e,t)=>{ro.init(e,t),Xa.init(e,t)}),Lg=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hm),_t.init(e,t)}),Ng=q("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zu(i))}else t.pattern??(t.pattern=Zu());_t.init(e,t)}),Dg=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Vm),_t.init(e,t)}),Og=1,Ug=2;function BT(e,t){if(!t.normalize&&t.protocol?.source===Jm.source&&!/^https?:\/\//i.test(e))return Og;try{return new URL(e)}catch{return Ug}}var GT=/[\t\n\r]/g;function HT(e){return e.replace(GT,"")}function VT(e,t){return t.lastIndex=0,t.test(e.hostname)}function WT(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Fg=q("$ZodURL",(e,t)=>{_t.init(e,t),e._zod.check=(n)=>{try{let i=n.value.trim(),r=BT(i,t);if(r===Og){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(r===Ug){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(t.hostname&&!VT(r,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!WT(r,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?r.href:HT(i);return}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),zg=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Wm()),_t.init(e,t)}),kg=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?km:Bm(t.length)),_t.init(e,t)}),Bg=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Dm),_t.init(e,t)}),Gg=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Om),_t.init(e,t)}),Hg=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Um),_t.init(e,t)}),Vg=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fm),_t.init(e,t)}),Wg=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zm),_t.init(e,t)}),$g=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ng(t)),_t.init(e,t)}),Zg=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eg),_t.init(e,t)}),Xg=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tg(t)),_t.init(e,t)}),qg=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gm),_t.init(e,t)}),Yg=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$m),_t.init(e,t)}),$T=/^[0-9a-fA-F:.]+$/;function jg(e){if(!$T.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Jg=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zm),_t.init(e,t),e._zod.check=(n)=>{if(!jg(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Kg=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xm),_t.init(e,t)});function ZT(e){let t=e.split("/");if(t.length!==2)return!1;let[n,i]=t;if(!i)return!1;let r=Number(i);if(`${r}`!==i)return!1;if(r<0||r>128)return!1;return jg(n)}var Qg=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qm),_t.init(e,t),e._zod.check=(n)=>{if(!ZT(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function e_(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var eh=/^[0-9a-zA-Z+/]*={0,2}$/,t_=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eh),_t.init(e,t),e._zod.check=(n)=>{if(e_(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),qa=/^[A-Za-z0-9_-]*$/;function XT(e){if(!qa.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return e_(n)}var n_=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qa),_t.init(e,t),e._zod.check=(n)=>{if(XT(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),i_=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Km),_t.init(e,t)});function qT(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var r_=q("$ZodJWT",(e,t)=>{_t.init(e,t),e._zod.check=(n)=>{if(qT(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var th=q("$ZodNumber",(e,t)=>{gt.init(e,t),e._zod.pattern=no,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let s=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?String(r):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),s_=q("$ZodNumberFormat",(e,t)=>{cg.init(e,t),th.init(e,t)}),o_=q("$ZodBoolean",(e,t)=>{gt.init(e,t),e._zod.pattern=rg,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var a_=q("$ZodUnknown",(e,t)=>{gt.init(e,t),e._zod.parse=(n)=>n}),c_=q("$ZodNever",(e,t)=>{gt.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function bg(e,t,n){if(e.issues.length)t.issues.push(...wi(n,e.issues));t.value[n]=e.value}var l_=q("$ZodArray",(e,t)=>{gt.init(e,t);let n=en.memoizer;n?.attach(e),e._zod.parse=(i,r)=>{let s=i.value;if(!Array.isArray(s))return i.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),i;i.value=n?n.alloc(e,i,Array(s.length),r):Array(s.length);let o=[],a=r?.abortEarly;for(let c=0;c<s.length;c++){let l=s[c],u=t.element._zod.run({value:l,issues:[]},r);if(u instanceof Promise)o.push(u.then((h)=>bg(h,i,c)));else if(bg(u,i,c),a&&u.issues.length!==0&&ti(u))break}if(o.length)return Promise.all(o).then(()=>i);return i}});function Za(e,t,n,i,r,s){let o=n in i,a=s==="optional";if(!o&&a&&r==="optional")return;if(e.issues.length){if(r!==void 0&&a&&!o)return;t.issues.push(...wi(n,e.issues))}if(!o&&r===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(o||r==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var YT=[];function u_(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:YT,r=i.length?[...t,...i]:t;for(let o of r)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(o)}": expected a Zod schema`);let s=um(e.shape);return{...e,allKeys:r,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function h_(e,t,n,i,r,s,o){let a=[],c=r.keySet,l=r.catchall._zod,u=l.def.type,{optin:h,optout:f}=l,d=0;for(let m in t){if(o&&n.issues.length!==d){if(ti(n,d))break;d=n.issues.length}if(c.has(m))continue;if(m==="__proto__"){if(u==="never")a.push(m);continue}if(u==="never"){a.push(m);continue}let x=l.run({value:t[m],issues:[]},i);if(x instanceof Promise)e.push(x.then((p)=>Za(p,n,m,t,h,f)));else Za(x,n,m,t,h,f)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var jT=q("$ZodObject",(e,t)=>{gt.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){let l=()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(t,"shape",{get:l})}let r=La(()=>u_(t));tt(e,"propValues",(l)=>{let u=l.def.shape,h={};for(let f in u){let d=u[f]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(h,f))zn(h,f,new Set);for(let m of d.values)h[f].add(m);if(d.optin!==void 0)h[f].add(void 0)}}return h});let s=Ks,o=t.catchall,a,c=en.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=r.value);let h=l.value;if(!s(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let f=[],d=a.shape,m=u?.abortEarly,x=l.issues.length;for(let p of a.allKeys){if(m&&l.issues.length!==x){if(ti(l,x))break;x=l.issues.length}if(p==="__proto__")continue;let g=d[p],A=g._zod.optin,E=g._zod.optout,y=g._zod.run({value:h[p],issues:[]},u);if(y instanceof Promise)f.push(y.then((w)=>Za(w,l,p,h,A,E)));else Za(y,l,p,h,A,E)}if(!o)return f.length?Promise.all(f).then(()=>l):l;return h_(f,h,l,u,r.value,e,m===!0)}}),f_=q("$ZodObjectJIT",(e,t)=>{jT.init(e,t);let n=e._zod.parse,i=La(()=>u_(t)),r=en.memoizer,s=(d)=>{let m=i.value,x=m.symbolKeys,p=new Ju(["payload","ctx"],{shape:d,inst:e,memo:r,syms:x}),g=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,A=(w,T)=>`
+ let ${w}_ab = false;
+ for (let i = 0; i < ${w}.issues.length; i++) {
+ const iss = ${w}.issues[i];
+ iss.path = iss.path ? [${T}, ...iss.path] : [${T}];
+ payload.issues.push(iss);
+ if (iss.continue !== true) ${w}_ab = true;
}
- }
-
- if (${v}.value === undefined) {
- if (${w} in input) {
- newResult[${w}] = undefined;
+ if (${w}_ab && ctx && ctx.abortEarly) {
+ payload.value = newResult;
+ return payload;
+ }`;p.write("const input = payload.value;");let E=Object.create(null),y=0;for(let w of m.allKeys)E[w]=`key_${y++}`;p.write(r?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of m.allKeys){if(w==="__proto__")continue;let T=E[w],R=typeof w==="symbol"?`syms[${x.indexOf(w)}]`:om(w),_=`${R} in input`,S=d[w],U=S?._zod?.optin,C=U!==void 0,z=S?._zod?.optout==="optional";if(p.write(`const ${T} = ${g(R)};`),C&&z){let j=U==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;p.write(`
+ const ${T}_present = ${_};
+ if (!${T}.issues.length || ${T}_present) {
+ if (${T}.issues.length) {${A(T,R)}
+ }
+
+ if (${j}) {
+ newResult[${R}] = ${T}.value;
}
- } else {
- newResult[${w}] = ${v}.value;
}
-
- `);else if(!R)d.write(`
- const ${v}_present = ${w} in input;
- if (${v}.issues.length) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+
+ `)}else if(!C)p.write(`
+ const ${T}_present = ${_};
+ if (${T}.issues.length) {${A(T,R)}
}
- if (!${v}_present && !${v}.issues.length) {
+ if (!${T}_present && !${T}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
- path: [${w}]
+ path: [${R}]
});
+ if (ctx && ctx.abortEarly) {
+ payload.value = newResult;
+ return payload;
+ }
}
- if (${v}_present) {
- if (${v}.value === undefined) {
- newResult[${w}] = undefined;
- } else {
- newResult[${w}] = ${v}.value;
- }
+ if (${T}_present) {
+ newResult[${R}] = ${T}.value;
}
- `);else d.write(`
- if (${v}.issues.length) {
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
- ...iss,
- path: iss.path ? [${w}, ...iss.path] : [${w}]
- })));
+ `);else if(p.write(`
+ if (${T}.issues.length) {${A(T,R)}
}
-
- if (${v}.value === undefined) {
- if (${w} in input) {
- newResult[${w}] = undefined;
- }
- } else {
- newResult[${w}] = ${v}.value;
+ `),U==="defaulted")p.write(`newResult[${R}] = ${T}.value;`);else p.write(`
+ if (${T}.value !== undefined || ${_}) {
+ newResult[${R}] = ${T}.value;
}
-
- `)}d.write("payload.value = newResult;"),d.write("return payload;");let A=d.compile();return(T,v)=>A(h,T,v)},s,o=Ws,a=!rs.jitless,l=a&&xp.value,u=t.catchall,f;e._zod.parse=(h,d)=>{f??(f=i.value);let g=h.value;if(!o(g))return h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h;if(a&&l&&d?.async===!1&&d.jitless!==!0){if(!s)s=r(t.shape);if(h=s(h,d),!u)return h;return cg([],g,h,d,f,e)}return n(h,d)}});function Tm(e,t,n,i){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let r=e.filter((s)=>!mr(s));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((o)=>Un(o,i,Dn())))}),t}var ug=q("$ZodUnion",(e,t)=>{_t.init(e,t),rt(e._zod,"optin",()=>t.options.some((i)=>i._zod.optin==="optional")?"optional":void 0),rt(e._zod,"optout",()=>t.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),rt(e._zod,"values",()=>{if(t.options.every((i)=>i._zod.values))return new Set(t.options.flatMap((i)=>Array.from(i._zod.values)));return}),rt(e._zod,"pattern",()=>{if(t.options.every((i)=>i._zod.pattern)){let i=t.options.map((r)=>r._zod.pattern);return new RegExp(`^(${i.map((r)=>wa(r.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let s=!1,o=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},r);if(c instanceof Promise)o.push(c),s=!0;else{if(c.issues.length===0)return c;o.push(c)}}if(!s)return Tm(o,i,e,r);return Promise.all(o).then((a)=>Tm(a,i,e,r))}});var hg=q("$ZodIntersection",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,s=t.left._zod.run({value:r,issues:[]},i),o=t.right._zod.run({value:r,issues:[]},i);if(s instanceof Promise||o instanceof Promise)return Promise.all([s,o]).then(([c,l])=>Em(n,c,l));return Em(n,s,o)}});function bu(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(pr(e)&&pr(t)){let n=Object.keys(t),i=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),r={...e,...t};for(let s of i){let o=bu(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};r[s]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],s=t[i],o=bu(r,s);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Em(e,t,n){let i=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let c of a.keys){if(!i.has(c))i.set(c,{});i.get(c).l=!0}}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!i.has(c))i.set(c,{});i.get(c).r=!0}else e.issues.push(a);let s=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r)e.issues.push({...r,keys:s});if(mr(e))return e;let o=bu(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var fg=q("$ZodRecord",(e,t)=>{_t.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!pr(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let s=[],o=t.keyType._zod.values;if(o){n.value={};let a=new Set;for(let l of o)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){a.add(typeof l==="number"?l.toString():l);let u=t.keyType._zod.run({value:l,issues:[]},i);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((d)=>Un(d,i,Dn())),input:l,path:[l],inst:e});continue}let f=u.value,h=t.valueType._zod.run({value:r[l],issues:[]},i);if(h instanceof Promise)s.push(h.then((d)=>{if(d.issues.length)n.issues.push(...Wi(l,d.issues));n.value[f]=d.value}));else{if(h.issues.length)n.issues.push(...Wi(l,h.issues));n.value[f]=h.value}}let c;for(let l in r)if(!a.has(l))c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(let a of Reflect.ownKeys(r)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(r,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},i);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&_u.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},i);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")n.value[a]=r[a];else n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>Un(f,i,Dn())),input:a,path:[a],inst:e});continue}let u=t.valueType._zod.run({value:r[a],issues:[]},i);if(u instanceof Promise)s.push(u.then((f)=>{if(f.issues.length)n.issues.push(...Wi(a,f.issues));n.value[c.value]=f.value}));else{if(u.issues.length)n.issues.push(...Wi(a,u.issues));n.value[c.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>n);return n}});var dg=q("$ZodEnum",(e,t)=>{_t.init(e,t);let n=ba(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((r)=>vp.has(typeof r)).map((r)=>typeof r==="string"?Vi(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{let o=r.value;if(i.has(o))return r;return r.issues.push({code:"invalid_value",values:n,input:o,inst:e}),r}}),pg=q("$ZodLiteral",(e,t)=>{if(_t.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((i)=>typeof i==="string"?Vi(i):i?Vi(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,r)=>{let s=i.value;if(n.has(s))return i;return i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});var mg=q("$ZodTransform",(e,t)=>{_t.init(e,t),e._zod.optin="optional",e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Vs(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then((o)=>(n.value=o,n.fallback=!0,n));if(r instanceof Promise)throw new mi;return n.value=r,n.fallback=!0,n}});function Am(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Mu=q("$ZodOptional",(e,t)=>{_t.init(e,t),e._zod.optin="optional",e._zod.optout="optional",rt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),rt(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${wa(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){let r=n.value,s=t.innerType._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>Am(o,r));return Am(s,r)}if(n.value===void 0)return n;return t.innerType._zod.run(n,i)}}),gg=q("$ZodExactOptional",(e,t)=>{Mu.init(e,t),rt(e._zod,"values",()=>t.innerType._zod.values),rt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),_g=q("$ZodNullable",(e,t)=>{_t.init(e,t),rt(e._zod,"optin",()=>t.innerType._zod.optin),rt(e._zod,"optout",()=>t.innerType._zod.optout),rt(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${wa(n.source)}|null)$`):void 0}),rt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>{if(n.value===null)return n;return t.innerType._zod.run(n,i)}}),xg=q("$ZodDefault",(e,t)=>{_t.init(e,t),e._zod.optin="optional",rt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Rm(s,t));return Rm(r,t)}});function Rm(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var vg=q("$ZodPrefault",(e,t)=>{_t.init(e,t),e._zod.optin="optional",rt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,i)}}),yg=q("$ZodNonOptional",(e,t)=>{_t.init(e,t),rt(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Cm(s,e));return Cm(r,e)}});function Cm(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var bg=q("$ZodCatch",(e,t)=>{_t.init(e,t),e._zod.optin="optional",rt(e._zod,"optout",()=>t.innerType._zod.optout),rt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>{if(n.value=s.value,s.issues.length)n.value=t.catchValue({...n,error:{issues:s.issues.map((o)=>Un(o,i,Dn()))},input:n.value}),n.issues=[],n.fallback=!0;return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((s)=>Un(s,i,Dn()))},input:n.value}),n.issues=[],n.fallback=!0;return n}});var Sg=q("$ZodPipe",(e,t)=>{_t.init(e,t),rt(e._zod,"values",()=>t.in._zod.values),rt(e._zod,"optin",()=>t.in._zod.optin),rt(e._zod,"optout",()=>t.out._zod.optout),rt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let s=t.out._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>Pa(o,t.in,i));return Pa(s,t.in,i)}let r=t.in._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Pa(s,t.out,i));return Pa(r,t.out,i)}});function Pa(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Mg=q("$ZodReadonly",(e,t)=>{_t.init(e,t),rt(e._zod,"propValues",()=>t.innerType._zod.propValues),rt(e._zod,"values",()=>t.innerType._zod.values),rt(e._zod,"optin",()=>t.innerType?._zod?.optin),rt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then(Pm);return Pm(r)}});function Pm(e){return e.value=Object.freeze(e.value),e}var wg=q("$ZodCustom",(e,t)=>{Ht.init(e,t),_t.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=(n)=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then((s)=>Im(s,n,i,e));Im(r,n,i,e);return}});function Im(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)r.params=i._zod.def.params;t.issues.push(gr(r))}}var Tg,zR=Symbol("ZodOutput"),kR=Symbol("ZodInput");class Eg{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function lw(){return new Eg}(Tg=globalThis).__zod_globalRegistry??(Tg.__zod_globalRegistry=lw());var _r=globalThis.__zod_globalRegistry;function Ag(e,t){return new e({type:"string",...Te(t)})}function Rg(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function wu(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function Cg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function Pg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function Ig(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function Lg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function Ng(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function Dg(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function Ug(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function Og(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function Fg(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function zg(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function kg(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function Bg(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function Gg(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function Hg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function Vg(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function Wg(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function $g(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function Zg(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function Xg(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function qg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function Yg(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function jg(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function Jg(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function Kg(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function Qg(e,t){return new e({type:"number",checks:[],...Te(t)})}function e_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function t_(e,t){return new e({type:"boolean",...Te(t)})}function n_(e){return new e({type:"unknown"})}function i_(e,t){return new e({type:"never",...Te(t)})}function Na(e,t){return new xu({check:"less_than",...Te(t),value:e,inclusive:!1})}function Ys(e,t){return new xu({check:"less_than",...Te(t),value:e,inclusive:!0})}function Da(e,t){return new vu({check:"greater_than",...Te(t),value:e,inclusive:!1})}function js(e,t){return new vu({check:"greater_than",...Te(t),value:e,inclusive:!0})}function Ua(e,t){return new um({check:"multiple_of",...Te(t),value:e})}function Oa(e,t){return new fm({check:"max_length",...Te(t),maximum:e})}function ss(e,t){return new dm({check:"min_length",...Te(t),minimum:e})}function Fa(e,t){return new pm({check:"length_equals",...Te(t),length:e})}function Tu(e,t){return new mm({check:"string_format",format:"regex",...Te(t),pattern:e})}function Eu(e){return new gm({check:"string_format",format:"lowercase",...Te(e)})}function Au(e){return new _m({check:"string_format",format:"uppercase",...Te(e)})}function Ru(e,t){return new xm({check:"string_format",format:"includes",...Te(t),includes:e})}function Cu(e,t){return new vm({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function Pu(e,t){return new ym({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Zi(e){return new bm({check:"overwrite",tx:e})}function Iu(e){return Zi((t)=>t.normalize(e))}function Lu(){return Zi((e)=>e.trim())}function Nu(){return Zi((e)=>e.toLowerCase())}function Du(){return Zi((e)=>e.toUpperCase())}function Uu(){return Zi((e)=>_p(e))}function r_(e,t,n){return new e({type:"array",element:t,...Te(n)})}function s_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Te(n)})}function o_(e,t){let n=uw((i)=>(i.addIssue=(r)=>{if(typeof r==="string")i.issues.push(gr(r,i.value,n._zod.def));else{let s=r;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),i.issues.push(gr(s))}},e(i.value,i)),t);return n}function uw(e,t){let n=new Ht({check:"custom",...Te(t)});return n._zod.check=e,n}function Ou(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??_r,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function At(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let h=o.schema,d=t.processors[r.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);d(e,t,h,u)}let f=e._zod.parent;if(f){if(!o.ref)o.ref=f;At(f,t,u),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(o.schema,c);if(t.io==="input"&&Qt(e))delete o.schema.examples,delete o.schema.default;if(t.io==="input"&&"_prefault"in o.schema)(i=o.schema).default??(i.default=o.schema._prefault);return delete o.schema._prefault,t.seen.get(e).schema}function Fu(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let o of e.seen.entries()){let a=e.metadataRegistry.get(o[0])?.id;if(a){let c=i.get(a);if(c&&c!==o[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=(o)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(o[0])?.id,h=e.external.uri??((g)=>g);if(f)return{ref:h(f)};let d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${h("__shared")}#/${a}/${d}`}}if(o[1]===n)return{ref:"#"};let l=`${"#"}/${a}/`,u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},s=(o)=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=r(o);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let f in u)delete u[f];u.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let a=o[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
+ `)}return p.write("payload.value = newResult;"),p.write("return payload;"),p.compile()},o,a=Ks,c=!en.jitless,u=c&&cm.value,h=t.catchall,f;e._zod.parse=(d,m)=>{f??(f=i.value);let x=d.value;if(!a(x))return d.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),d;if(c&&u&&m?.async===!1&&m.jitless!==!0){if(!o)o=s(t.shape);if(d=o(d,m),!h)return d;return h_([],x,d,m,f,e,m?.abortEarly===!0)}return n(d,m)}});function Sg(e,t,n,i){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let r=e.filter((s)=>!ti(s));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((o)=>ni(o,i,pn())))}),t}var d_=q("$ZodUnion",(e,t)=>{gt.init(e,t),tt(e,"optin",(i)=>i.def.options.some((r)=>r._zod.optin==="defaulted")?"defaulted":i.def.options.some((r)=>r._zod.optin!==void 0)?"optional":void 0),tt(e,"optout",(i)=>i.def.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),tt(e,"values",(i)=>{if(i.def.options.every((r)=>r._zod.values))return new Set(i.def.options.flatMap((r)=>Array.from(r._zod.values)));return}),tt(e,"pattern",(i)=>{if(i.def.options.every((r)=>r._zod.pattern)){let r=i.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${r.map((s)=>Na(s.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let s=!1,o=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},r);if(c instanceof Promise)o.push(c),s=!0;else{if(c.issues.length===0)return c;o.push(c)}}if(!s)return Sg(o,i,e,r);return Promise.all(o).then((a)=>Sg(a,i,e,r))}});var p_=q("$ZodIntersection",(e,t)=>{gt.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,s=t.left._zod.run({value:r,issues:[]},i),o=t.right._zod.run({value:r,issues:[]},i);if(s instanceof Promise||o instanceof Promise)return Promise.all([s,o]).then(([c,l])=>Mg(n,c,l));return Mg(n,s,o)}});function Ku(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Sr(e)&&Sr(t)){let n=Object.keys(t),i=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),r={...e,...t};if(Object.prototype.hasOwnProperty.call(r,"__proto__"))delete r.__proto__;for(let s of i){if(s==="__proto__")continue;let o=Ku(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};r[s]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],s=t[i],o=Ku(r,s);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mg(e,t,n){let i=new Map,r,s=new Map,o=(l,u)=>{let h;if(l.code==="unrecognized_keys"&&!l.path?.length)r??(r=l),h=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let f=String(l.path[0]);if(!s.has(f))s.set(f,l);h=[f]}else return!1;for(let f of h){if(!i.has(f))i.set(f,{});i.get(f)[u]=!0}return!0};for(let l of t.issues)if(!o(l,"l"))e.issues.push(l);for(let l of n.issues)if(!o(l,"r"))e.issues.push(l);let a=[...i].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=r?a.filter((u)=>r.keys.includes(u)):[];if(l.length)e.issues.push({...r,keys:l});for(let u of a)if(!l.includes(u)&&s.has(u))e.issues.push(s.get(u))}let c=Ku(t.value,n.value);if(!c.valid){if(ti(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var m_=q("$ZodRecord",(e,t)=>{gt.init(e,t);let n=en.memoizer;n?.attach(e),e._zod.parse=(i,r)=>{let s=i.value;if(!Sr(s))return i.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),i;let o=[],a=t.keyType._zod.values;if(a&&!t.partial){i.value=n?n.alloc(e,i,{},r):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let h=t.keyType._zod.run({value:u,issues:[]},r);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((m)=>ni(m,r,pn())),input:u,path:[u],inst:e});continue}let f=h.value;if(f==="__proto__")continue;let d=t.valueType._zod.run({value:s[u],issues:[]},r);if(d instanceof Promise)o.push(d.then((m)=>{if(m.issues.length)i.issues.push(...wi(u,m.issues));i.value[f]=m.value}));else{if(d.issues.length)i.issues.push(...wi(u,d.issues));i.value[f]=d.value}}let l;for(let u in s)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;i.value[u]=s[u]}else l=l??[],l.push(u);if(l&&l.length>0)i.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l,continue:!0})}else{i.value=n?n.alloc(e,i,{},r):{};let c;for(let l of Reflect.ownKeys(s)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&no.test(l)&&u.issues.length){let m=t.keyType._zod.run({value:Number(l),issues:[]},r);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)u=m}if(u.issues.length){if(t.mode==="loose")i.value[l]=s[l];else if(a)c=c??[],c.push(l);else i.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((m)=>ni(m,r,pn())),input:l,path:[l],inst:e});continue}let f=u.value;if(f==="__proto__")continue;let d=t.valueType._zod.run({value:s[l],issues:[]},r);if(d instanceof Promise)o.push(d.then((m)=>{if(m.issues.length)i.issues.push(...wi(l,m.issues));i.value[f]=m.value}));else{if(d.issues.length)i.issues.push(...wi(l,d.issues));i.value[f]=d.value}}if(c&&c.length>0)i.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(o.length)return Promise.all(o).then(()=>i);return i}});var g_=q("$ZodEnum",(e,t)=>{gt.init(e,t);let n=Qs(t.entries),i=new Set(n);e._zod.values=i,tt(e,"pattern",(r)=>{let s=Qs(r.def.entries).filter((o)=>lm.has(typeof o));return new RegExp(s.length?`^(${s.map((o)=>Qi(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,s)=>{let o=r.value;if(i.has(o))return r;return r.issues.push({code:"invalid_value",values:n,input:o,inst:e}),r}}),__=q("$ZodLiteral",(e,t)=>{gt.init(e,t);let n=new Set(t.values);e._zod.values=n,tt(e,"pattern",(i)=>{let r=i.def.values;return new RegExp(r.length?`^(${r.map((s)=>typeof s==="string"?Qi(s):s?Qi(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,r)=>{let s=i.value;if(n.has(s))return i;return i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});var x_=q("$ZodTransform",(e,t)=>{gt.init(e,t),e._zod.optin="optional",en.memoizer?.guard(e),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new to(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then((o)=>(n.value=o,n));if(r instanceof Promise)throw new ii;return n.value=r,n}});function wg(e,t){return e.value=t.issues.length?void 0:t.value,e}var nh=q("$ZodOptional",(e,t)=>{gt.init(e,t),tt(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",tt(e,"values",(n)=>{let i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),tt(e,"pattern",(n)=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Na(i.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let r=t.innerType._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)return r.then((s)=>wg(n,s));return wg(n,r)}return t.innerType._zod.run(n,i)}}),v_=q("$ZodExactOptional",(e,t)=>{nh.init(e,t),tt(e,"values",(n)=>n.def.innerType._zod.values),tt(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),y_=q("$ZodNullable",(e,t)=>{gt.init(e,t),tt(e,"optin",(n)=>n.def.innerType._zod.optin),tt(e,"optout",(n)=>n.def.innerType._zod.optout),tt(e,"pattern",(n)=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Na(i.source)}|null)$`):void 0}),tt(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>{if(n.value===null)return n;return t.innerType._zod.run(n,i)}}),b_=q("$ZodDefault",(e,t)=>{gt.init(e,t),e._zod.optin="defaulted",tt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Tg(s,t));return Tg(r,t)}});function Tg(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var S_=q("$ZodPrefault",(e,t)=>{gt.init(e,t),e._zod.optin="defaulted",tt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,i)}}),M_=q("$ZodNonOptional",(e,t)=>{gt.init(e,t),tt(e,"values",(n)=>{let i=n.def.innerType._zod.values;return i?new Set([...i].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>Eg(s,e));return Eg(r,e)}});function Eg(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ag(e,t,n,i){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((r)=>ni(r,i,pn()))},input:e.value}),e}var w_=q("$ZodCatch",(e,t)=>{gt.init(e,t),tt(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),tt(e,"optout",(n)=>n.def.innerType._zod.optout),tt(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)return r.then((s)=>Ag(n,s,t,i));return Ag(n,r,t,i)}});var T_=q("$ZodPipe",(e,t)=>{gt.init(e,t),tt(e,"values",(n)=>n.def.in._zod.values),tt(e,"optin",(n)=>n.def.in._zod.optin),tt(e,"optout",(n)=>n.def.out._zod.optout),tt(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let s=t.out._zod.run(n,i);if(s instanceof Promise)return s.then((o)=>$a(o,t.in,i));return $a(s,t.in,i)}let r=t.in._zod.run(n,i);if(r instanceof Promise)return r.then((s)=>$a(s,t.out,i));return $a(r,t.out,i)}});function $a(e,t,n){if(e.issues.some((i)=>i.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var E_=q("$ZodReadonly",(e,t)=>{gt.init(e,t),tt(e,"propValues",(n)=>n.def.innerType._zod.propValues),tt(e,"values",(n)=>n.def.innerType._zod.values),tt(e,"optin",(n)=>n.def.innerType?._zod?.optin),tt(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then(Rg);return Rg(r)}});function Rg(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var A_=q("$ZodCustom",(e,t)=>{Bt.init(e,t),gt.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=(n)=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then((s)=>Cg(s,n,i,e));Cg(r,n,i,e);return}});function Cg(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)r.params=i._zod.def.params;t.issues.push(Mr(r))}}function Pg(e,t,n){if(e.issues.length)t.issues.push(...wi(n,e.issues))}var JT=q("$ZodProperties",(e,t)=>{gt.init(e,t),Bt.init(e,t);let n=en.memoizer;n?.attach(e);let i,r=(s,o)=>{i??(i=Reflect.ownKeys(t.shape).map((l)=>[l,t.shape[l]]));let a=s.value,c;for(let[l,u]of i){let h=u._zod.run({value:a[l],issues:[]},o);if(h instanceof Promise)c??(c=[]),c.push(h.then((f)=>Pg(f,s,l)));else Pg(h,s,l)}if(c)return Promise.all(c).then(()=>{return});return};e._zod.parse=(s,o)=>{let a=s.value;if(a===null||typeof a!=="object"&&typeof a!=="function")return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;if(o.direction==="backward")o={...o,direction:"forward"};if(n)n.alloc(e,s,a,o);let c=r(s,o);return c instanceof Promise?c.then(()=>s):s},e._zod.check=(s)=>{if(s.value==null){s.issues.push({expected:"object",code:"invalid_type",input:s.value,inst:e});return}return r(s,{})}},{*[Symbol.iterator](){yield this}});class C_ extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var rh="~memo",R_=[];function P_(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function ih(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var I_=new WeakMap,so=0,Ja=1,oo=2;function Ka(e,t,n){let i=I_.get(e);if(i!==void 0)return i?oo:so;if(t.has(e))return oo;t.add(e);let r=so,s=(u)=>{if(r!==oo&&u?._zod){let h=Ka(u,t,n);if(h>r)r=h}},o=(u,h)=>{let f=so;for(let d of Reflect.ownKeys(u)){let m=Object.getOwnPropertyDescriptor(u,d);if(h&&!m.enumerable)continue;let x=m.get?Ja:m.value?._zod?Ka(m.value,t,n):so;if(x>f)f=x}return f},a=(u)=>{if(u>r)r=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Da(c);a(u?o(u,!0):Ja),s(c.catchall);break}case"properties":a(o(c.shape,!1));break;case"array":s(c.element);break;case"tuple":for(let u of c.items)s(u);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let u of c.options)s(u);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let u=c._cachedInner??(n?e._zod.innerType:void 0);a(u?Ka(u,t,!1):Ja);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let h=Object.getOwnPropertyDescriptor(c,u);if(!h||h.get)continue;let f=h.value;if(!f||typeof f!=="object")continue;if(f._zod)s(f);else if(Array.isArray(f))for(let d of f)s(d)}}return t.delete(e),KT(e,r)}function KT(e,t){if(t!==Ja)I_.set(e,t===oo);return t}function QT(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Ya,ja=[],eE={alloc(e,t,n){let i=Ya;if(!i)return n;Ya=void 0;let r={value:n,issues:null};return i.set(t.value,r),ja.push(r),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,i=(r,s)=>{if(s.direction!=="backward"&&tE(s,r.value))throw new C_;return n(r,s)};if(e._zod.parse=i,e._zod.run===n)e._zod.run=i})},attach(e){var t;let n,i=!1,r,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let o=e._zod.parse,a=(c,l)=>{if(n===void 0){let g=Ka(e,new Set,!1);if(g===so){if(e._zod.parse=o,e._zod.run===a)e._zod.run=o;return o(c,l)}if(g===oo||i)n=!0;else i=!0}let u=c.value;if(!P_(u))return o(c,l);let h=l[rh];if(!h)h={buckets:new WeakMap,backEdges:void 0},l[rh]=h;let f;if(r===l)f=s;else f=QT(h,e),r=l,s=f;let d=f.get(u);if(d){if(c.value=d.value,d.issues){if(d.issues.length)c.issues.push(...ih(d.issues))}else c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value);return c}Ya=f;let m=ja.length,x=o(c,l);Ya=void 0;let p=ja.length>m?ja.pop():void 0;if(x instanceof Promise)return x.then((g)=>{if(p)p.issues=g.issues.length?ih(g.issues):R_;return g});if(p)p.issues=x.issues.length?ih(x.issues):R_;return x};if(e._zod.parse=a,e._zod.run===o)e._zod.run=a})}};function L_(){return eE}function tE(e,t){let n=e[rh]?.backEdges;return n!==void 0&&P_(t)&&n.has(t)}var nE=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function r(s,o){if(s==="number"&&typeof o==="number"&&!Number.isFinite(o))return String(o);return i[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let o=r(s.expected),a=pm(s.input),c=r(a,s.input);return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Uu(s.values[0])}`;return`Invalid option: expected one of ${Nu(s.values,"|")}`;case"too_big":{let o=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{let o=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{let o=s;if(o.format==="starts_with")return`Invalid string: must start with "${o.prefix}"`;if(o.format==="ends_with")return`Invalid string: must end with "${o.suffix}"`;if(o.format==="includes")return`Invalid string: must include "${o.includes}"`;if(o.format==="regex")return`Invalid string: must match pattern ${o.pattern}`;return`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Nu(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function sh(){return{localeError:nE()}}var N_;class D_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function iE(){return new D_}(N_=globalThis).__zod_globalRegistry??(N_.__zod_globalRegistry=iE());var wr=globalThis.__zod_globalRegistry;function O_(e,t){return new e({type:"string",...Te(t)})}function U_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function F_(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function z_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function k_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function B_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function G_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function H_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function V_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function W_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function $_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function Z_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function X_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function q_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function Y_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function j_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function J_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function K_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function Q_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function e0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function t0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function n0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function i0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function r0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function s0(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function o0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function a0(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function c0(e,t){return new e({type:"number",checks:[],...Te(t)})}function l0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function u0(e,t){return new e({type:"boolean",...Te(t)})}function h0(e){return new e({type:"unknown"})}function f0(e,t){return new e({type:"never",...Te(t)})}function Qa(e,t){return new Yu({check:"less_than",...Te(t),value:e,inclusive:!1})}function ao(e,t){return new Yu({check:"less_than",...Te(t),value:e,inclusive:!0})}function ec(e,t){return new ju({check:"greater_than",...Te(t),value:e,inclusive:!1})}function co(e,t){return new ju({check:"greater_than",...Te(t),value:e,inclusive:!0})}function tc(e,t){return new ag({check:"multiple_of",...Te(t),value:e})}function nc(e,t){return new lg({check:"max_length",...Te(t),maximum:e})}function hs(e,t){return new ug({check:"min_length",...Te(t),minimum:e})}function ic(e,t){return new hg({check:"length_equals",...Te(t),length:e})}function oh(e,t){return new fg({check:"string_format",format:"regex",...Te(t),pattern:e})}function ah(e){return new dg({check:"string_format",format:"lowercase",...Te(e)})}function ch(e){return new pg({check:"string_format",format:"uppercase",...Te(e)})}function lh(e,t){return new mg({check:"string_format",format:"includes",...Te(t),includes:e})}function uh(e,t){return new gg({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function hh(e,t){return new _g({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function er(e){return new xg({check:"overwrite",tx:e})}function fh(e){return er((t)=>t.normalize(e))}function dh(){return er((e)=>e.trim())}function ph(){return er((e)=>e.toLowerCase())}function mh(){return er((e)=>e.toUpperCase())}function gh(){return er((e)=>am(e))}function d0(e,t,n){return new e({type:"array",element:t,...Te(n)})}function p0(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Te(n)})}function m0(e,t){let n=rE((i)=>(i.addIssue=(r)=>{if(typeof r==="string")i.issues.push(Mr(r,i.value,n._zod.def));else{let s=r;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=i.value;s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),i.issues.push(Mr(s))}},e(i.value,i)),t);return n}function rE(e,t){let n=new Bt({check:"custom",...Te(t)});return n._zod.check=e,n}function lo(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,i))zn(e,i,n[i]);return e}function xh(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??wr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ti(e,t,n,i,r){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(r);return Object.assign(n,s),!0}function At(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let f=o.schema,d=t.processors[r.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);d(e,t,f,u)}let h=e._zod.parent;if(h){if(!o.ref)o.ref=h;At(h,t,u),t.seen.get(h).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)lo(o.schema,c);if(t.io==="input"&&Yt(e))delete o.schema.examples,delete o.schema.default;if(t.io==="input"&&"_prefault"in o.schema)(i=o.schema).default??(i.default=o.schema._prefault);return delete o.schema._prefault,t.seen.get(e).schema}function g0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function vh(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let o of e.seen.entries()){let a=e.metadataRegistry.get(o[0])?.id;if(a){let c=i.get(a);if(c&&c!==o[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=(o)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let h=e.external.registry.get(o[0])?.id,f=e.external.uri??((m)=>m);if(h)return{ref:f(h)};let d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${f("__shared")}#/${a}/${g0(d)}`}}let c="#",l=`${c}/${a}/`;if(o[1]===n&&!o[1].schema.id)return{ref:c};let u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+g0(u)}},s=(o)=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=r(o);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let h in u)delete u[h];u.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let a=o[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
-Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1){if(e.reused==="ref"){s(o);continue}}}}function zu(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){i(f);let d=e.seen.get(f),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Object.assign(l,g);if(Object.assign(l,u),a._zod.parent===f)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(!(p in u))delete l[p]}if(g.$ref&&d.def)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(p in d.def&&JSON.stringify(l[p])===JSON.stringify(d.def[p]))delete l[p]}}let h=a._zod.parent;if(h&&h!==f){i(h);let d=e.seen.get(h);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in d.def&&JSON.stringify(l[g])===JSON.stringify(d.def[g]))delete l[g]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())i(a[0]);let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Object.assign(r,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&r.id===s)delete r.id;let o=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;o[c.defId]=c.def}}if(e.external);else if(Object.keys(o).length>0)if(e.target==="draft-2020-12")r.$defs=o;else r.definitions=o;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Js(t,"input",e.processors),output:Js(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Qt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Qt(i.element,n);if(i.type==="set")return Qt(i.valueType,n);if(i.type==="lazy")return Qt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Qt(i.innerType,n);if(i.type==="intersection")return Qt(i.left,n)||Qt(i.right,n);if(i.type==="record"||i.type==="map")return Qt(i.keyType,n)||Qt(i.valueType,n);if(i.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Qt(i.in,n)||Qt(i.out,n)}if(i.type==="object"){for(let r in i.shape)if(Qt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Qt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Qt(r,n))return!0;if(i.rest&&Qt(i.rest,n))return!0;return!1}return!1}var a_=(e,t={})=>(n)=>{let i=Ou({...n,processors:t});return At(e,i),Fu(i,e),zu(i,e)},Js=(e,t,n={})=>(i)=>{let{libraryOptions:r,target:s}=i??{},o=Ou({...r??{},target:s,io:t,processors:n});return At(e,o),Fu(o,e),zu(o,e)};var hw={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c_=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s==="number")r.minLength=s;if(typeof o==="number")r.maxLength=o;if(a){if(r.format=hw[a]??a,r.format==="")delete r.format;if(a==="time")delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let u=[...c];if(u.length===1)r.pattern=u[0].source;else if(u.length>1)r.allOf=[...u.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},l_=(e,t,n,i)=>{let r=n,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))r.type="integer";else r.type="number";let f=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)r.minimum=u,r.exclusiveMinimum=!0;else r.exclusiveMinimum=u;else if(typeof s==="number")r.minimum=s;if(h)if(d)r.maximum=l,r.exclusiveMaximum=!0;else r.exclusiveMaximum=l;else if(typeof o==="number")r.maximum=o;if(typeof c==="number")r.multipleOf=c},u_=(e,t,n,i)=>{n.type="boolean"};var h_=(e,t,n,i)=>{n.not={}};var f_=(e,t,n,i)=>{};var d_=(e,t,n,i)=>{let r=e._zod.def,s=ba(r.entries);if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";n.enum=s},p_=(e,t,n,i)=>{let r=e._zod.def,s=[];for(let o of r.values)if(o===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(o));else s.push(o);if(s.length===0);else if(s.length===1){let o=s[0];if(n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[o];else n.const=o}else{if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";if(s.every((o)=>typeof o==="boolean"))n.type="boolean";if(s.every((o)=>o===null))n.type="null";n.enum=s}};var m_=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var g_=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var __=(e,t,n,i)=>{let r=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;if(typeof o==="number")r.minItems=o;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=At(s.element,t,{...i,path:[...i.path,"items"]})},x_=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object",r.properties={};let o=s.shape;for(let l in o)r.properties[l]=At(o[l],t,{...i,path:[...i.path,"properties",l]});let a=new Set(Object.keys(o)),c=new Set([...a].filter((l)=>{let u=s.shape[l]._zod;if(t.io==="input")return u.optin===void 0;else return u.optout===void 0}));if(c.size>0)r.required=Array.from(c);if(s.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")r.additionalProperties=!1}else if(s.catchall)r.additionalProperties=At(s.catchall,t,{...i,path:[...i.path,"additionalProperties"]})},v_=(e,t,n,i)=>{let r=e._zod.def,s=r.inclusive===!1,o=r.options.map((a,c)=>At(a,t,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));if(s)n.oneOf=o;else n.anyOf=o},y_=(e,t,n,i)=>{let r=e._zod.def,s=At(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=At(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=c};var b_=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object";let o=s.keyType,c=o._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let u=At(s.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let f of c)r.patternProperties[f.source]=u}else{if(t.target==="draft-07"||t.target==="draft-2020-12")r.propertyNames=At(s.keyType,t,{...i,path:[...i.path,"propertyNames"]});r.additionalProperties=At(s.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values;if(l){let u=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(u.length>0)r.required=u}},S_=(e,t,n,i)=>{let r=e._zod.def,s=At(r.innerType,t,i),o=t.seen.get(e);if(t.target==="openapi-3.0")o.ref=r.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},M_=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType},w_=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},T_=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);if(s.ref=r.innerType,t.io==="input")n._prefault=JSON.parse(JSON.stringify(r.defaultValue))},E_=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},A_=(e,t,n,i)=>{let r=e._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?r.out:r.in:r.out;At(o,t,i);let a=t.seen.get(e);a.ref=o},R_=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0};var ku=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType};var xw=q("ZodISODateTime",(e,t)=>{Vm.init(e,t),xt.init(e,t)});function C_(e){return Yg(xw,e)}var vw=q("ZodISODate",(e,t)=>{Wm.init(e,t),xt.init(e,t)});function P_(e){return jg(vw,e)}var yw=q("ZodISOTime",(e,t)=>{$m.init(e,t),xt.init(e,t)});function I_(e){return Jg(yw,e)}var bw=q("ZodISODuration",(e,t)=>{Zm.init(e,t),xt.init(e,t)});function L_(e){return Kg(bw,e)}var ww=(e,t)=>{Ea.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>Tp(e,n)},flatten:{value:(n)=>wp(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,$s,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,$s,2)}},isEmpty:{get(){return e.issues.length===0}}})};var fn=q("ZodError",ww,{Parent:Error});var N_=Aa(fn),D_=Ra(fn),U_=Zs(fn),O_=Xs(fn),F_=Rp(fn),z_=Cp(fn),k_=Pp(fn),B_=Ip(fn),G_=Lp(fn),H_=Np(fn),V_=Dp(fn),W_=Up(fn);var $_=new WeakMap;function Ks(e,t,n){let i=Object.getPrototypeOf(e),r=$_.get(i);if(!r)r=new Set,$_.set(i,r);if(r.has(t))return;r.add(t);for(let s in n){let o=n[s];Object.defineProperty(i,s,{configurable:!0,enumerable:!1,get(){let a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var vt=q("ZodType",(e,t)=>(_t.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Js(e,"input"),output:Js(e,"output")}}),e.toJSONSchema=a_(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>N_(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>U_(e,n,i),e.parseAsync=async(n,i)=>D_(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>O_(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>F_(e,n,i),e.decode=(n,i)=>z_(e,n,i),e.encodeAsync=async(n,i)=>k_(e,n,i),e.decodeAsync=async(n,i)=>B_(e,n,i),e.safeEncode=(n,i)=>G_(e,n,i),e.safeDecode=(n,i)=>H_(e,n,i),e.safeEncodeAsync=async(n,i)=>V_(e,n,i),e.safeDecodeAsync=async(n,i)=>W_(e,n,i),Ks(e,"ZodType",{check(...n){let i=this.def;return this.clone(Hi(i,{checks:[...i.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return jn(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(bT(n,i))},superRefine(n,i){return this.check(ST(n,i))},overwrite(n){return this.check(Zi(n))},optional(){return Y_(this)},exactOptional(){return cT(this)},nullable(){return j_(this)},nullish(){return Y_(j_(this))},nonoptional(n){return pT(this,n)},array(){return Ba(this)},or(n){return eT([this,n])},and(n){return nT(this,n)},transform(n){return J_(this,oT(n))},default(n){return hT(this,n)},prefault(n){return dT(this,n)},catch(n){return gT(this,n)},pipe(n){return J_(this,n)},readonly(){return vT(this)},describe(n){let i=this.clone();return _r.add(i,{description:n}),i},meta(...n){if(n.length===0)return _r.get(this);let i=this.clone();return _r.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return _r.get(e)?.description},configurable:!0}),e)),K_=q("_ZodString",(e,t)=>{La.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>c_(e,i,r,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ks(e,"_ZodString",{regex(...i){return this.check(Tu(...i))},includes(...i){return this.check(Ru(...i))},startsWith(...i){return this.check(Cu(...i))},endsWith(...i){return this.check(Pu(...i))},min(...i){return this.check(ss(...i))},max(...i){return this.check(Oa(...i))},length(...i){return this.check(Fa(...i))},nonempty(...i){return this.check(ss(1,...i))},lowercase(i){return this.check(Eu(i))},uppercase(i){return this.check(Au(i))},trim(){return this.check(Lu())},normalize(...i){return this.check(Iu(...i))},toLowerCase(){return this.check(Nu())},toUpperCase(){return this.check(Du())},slugify(){return this.check(Uu())}})}),Ew=q("ZodString",(e,t)=>{La.init(e,t),K_.init(e,t),e.email=(n)=>e.check(Rg(Aw,n)),e.url=(n)=>e.check(Ng(Rw,n)),e.jwt=(n)=>e.check(qg(Vw,n)),e.emoji=(n)=>e.check(Dg(Cw,n)),e.guid=(n)=>e.check(wu(Z_,n)),e.uuid=(n)=>e.check(Cg(ka,n)),e.uuidv4=(n)=>e.check(Pg(ka,n)),e.uuidv6=(n)=>e.check(Ig(ka,n)),e.uuidv7=(n)=>e.check(Lg(ka,n)),e.nanoid=(n)=>e.check(Ug(Pw,n)),e.guid=(n)=>e.check(wu(Z_,n)),e.cuid=(n)=>e.check(Og(Iw,n)),e.cuid2=(n)=>e.check(Fg(Lw,n)),e.ulid=(n)=>e.check(zg(Nw,n)),e.base64=(n)=>e.check($g(Bw,n)),e.base64url=(n)=>e.check(Zg(Gw,n)),e.xid=(n)=>e.check(kg(Dw,n)),e.ksuid=(n)=>e.check(Bg(Uw,n)),e.ipv4=(n)=>e.check(Gg(Ow,n)),e.ipv6=(n)=>e.check(Hg(Fw,n)),e.cidrv4=(n)=>e.check(Vg(zw,n)),e.cidrv6=(n)=>e.check(Wg(kw,n)),e.e164=(n)=>e.check(Xg(Hw,n)),e.datetime=(n)=>e.check(C_(n)),e.date=(n)=>e.check(P_(n)),e.time=(n)=>e.check(I_(n)),e.duration=(n)=>e.check(L_(n))});function Yt(e){return Ag(Ew,e)}var xt=q("ZodStringFormat",(e,t)=>{gt.init(e,t),K_.init(e,t)}),Aw=q("ZodEmail",(e,t)=>{Dm.init(e,t),xt.init(e,t)});var Z_=q("ZodGUID",(e,t)=>{Lm.init(e,t),xt.init(e,t)});var ka=q("ZodUUID",(e,t)=>{Nm.init(e,t),xt.init(e,t)});var Rw=q("ZodURL",(e,t)=>{Um.init(e,t),xt.init(e,t)});var Cw=q("ZodEmoji",(e,t)=>{Om.init(e,t),xt.init(e,t)});var Pw=q("ZodNanoID",(e,t)=>{Fm.init(e,t),xt.init(e,t)});var Iw=q("ZodCUID",(e,t)=>{zm.init(e,t),xt.init(e,t)});var Lw=q("ZodCUID2",(e,t)=>{km.init(e,t),xt.init(e,t)});var Nw=q("ZodULID",(e,t)=>{Bm.init(e,t),xt.init(e,t)});var Dw=q("ZodXID",(e,t)=>{Gm.init(e,t),xt.init(e,t)});var Uw=q("ZodKSUID",(e,t)=>{Hm.init(e,t),xt.init(e,t)});var Ow=q("ZodIPv4",(e,t)=>{Xm.init(e,t),xt.init(e,t)});var Fw=q("ZodIPv6",(e,t)=>{qm.init(e,t),xt.init(e,t)});var zw=q("ZodCIDRv4",(e,t)=>{Ym.init(e,t),xt.init(e,t)});var kw=q("ZodCIDRv6",(e,t)=>{jm.init(e,t),xt.init(e,t)});var Bw=q("ZodBase64",(e,t)=>{Km.init(e,t),xt.init(e,t)});var Gw=q("ZodBase64URL",(e,t)=>{Qm.init(e,t),xt.init(e,t)});var Hw=q("ZodE164",(e,t)=>{eg.init(e,t),xt.init(e,t)});var Vw=q("ZodJWT",(e,t)=>{tg.init(e,t),xt.init(e,t)});var Q_=q("ZodNumber",(e,t)=>{Su.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>l_(e,i,r,s),Ks(e,"ZodNumber",{gt(i,r){return this.check(Da(i,r))},gte(i,r){return this.check(js(i,r))},min(i,r){return this.check(js(i,r))},lt(i,r){return this.check(Na(i,r))},lte(i,r){return this.check(Ys(i,r))},max(i,r){return this.check(Ys(i,r))},int(i){return this.check(X_(i))},safe(i){return this.check(X_(i))},positive(i){return this.check(Da(0,i))},nonnegative(i){return this.check(js(0,i))},negative(i){return this.check(Na(0,i))},nonpositive(i){return this.check(Ys(0,i))},multipleOf(i,r){return this.check(Ua(i,r))},step(i,r){return this.check(Ua(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Ww(e){return Qg(Q_,e)}var $w=q("ZodNumberFormat",(e,t)=>{ng.init(e,t),Q_.init(e,t)});function X_(e){return e_($w,e)}var Zw=q("ZodBoolean",(e,t)=>{ig.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>u_(e,n,i,r)});function Xw(e){return t_(Zw,e)}var qw=q("ZodUnknown",(e,t)=>{rg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>f_(e,n,i,r)});function xr(){return n_(qw)}var Yw=q("ZodNever",(e,t)=>{sg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>h_(e,n,i,r)});function jw(e){return i_(Yw,e)}var Jw=q("ZodArray",(e,t)=>{og.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>__(e,n,i,r),e.element=t.element,Ks(e,"ZodArray",{min(n,i){return this.check(ss(n,i))},nonempty(n){return this.check(ss(1,n))},max(n,i){return this.check(Oa(n,i))},length(n,i){return this.check(Fa(n,i))},unwrap(){return this.element}})});function Ba(e,t){return r_(Jw,e,t)}var Kw=q("ZodObject",(e,t)=>{lg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>x_(e,n,i,r),rt(e,"shape",()=>t.shape),Ks(e,"ZodObject",{keyof(){return t0(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:xr()})},loose(){return this.clone({...this._zod.def,catchall:xr()})},strict(){return this.clone({...this._zod.def,catchall:jw()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return QM(this,n)},safeExtend(n){return ew(this,n)},merge(n){return tw(this,n)},pick(n){return JM(this,n)},omit(n){return KM(this,n)},partial(...n){return nw(n0,this,n[0])},required(...n){return iw(i0,this,n[0])}})});function Qs(e,t){let n={type:"object",shape:e??{},...Te(t)};return new Kw(n)}var Qw=q("ZodUnion",(e,t)=>{ug.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>v_(e,n,i,r),e.options=t.options});function eT(e,t){return new Qw({type:"union",options:e,...Te(t)})}var tT=q("ZodIntersection",(e,t)=>{hg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>y_(e,n,i,r)});function nT(e,t){return new tT({type:"intersection",left:e,right:t})}var q_=q("ZodRecord",(e,t)=>{fg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>b_(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function e0(e,t,n){if(!t||!t._zod)return new q_({type:"record",keyType:Yt(),valueType:e,...Te(t)});return new q_({type:"record",keyType:e,valueType:t,...Te(n)})}var Bu=q("ZodEnum",(e,t)=>{dg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>d_(e,i,r,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let s={};for(let o of i)if(n.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new Bu({...t,checks:[],...Te(r),entries:s})},e.exclude=(i,r)=>{let s={...t.entries};for(let o of i)if(n.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new Bu({...t,checks:[],...Te(r),entries:s})}});function t0(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((i)=>[i,i])):e;return new Bu({type:"enum",entries:n,...Te(t)})}var iT=q("ZodLiteral",(e,t)=>{pg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>p_(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function rT(e,t){return new iT({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}var sT=q("ZodTransform",(e,t)=>{mg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>g_(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Vs(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(gr(s,n.value,t));else{let o=s;if(o.fatal)o.continue=!1;o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(gr(o))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((s)=>(n.value=s,n.fallback=!0,n));return n.value=r,n.fallback=!0,n}});function oT(e){return new sT({type:"transform",transform:e})}var n0=q("ZodOptional",(e,t)=>{Mu.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ku(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Y_(e){return new n0({type:"optional",innerType:e})}var aT=q("ZodExactOptional",(e,t)=>{gg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ku(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function cT(e){return new aT({type:"optional",innerType:e})}var lT=q("ZodNullable",(e,t)=>{_g.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>S_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function j_(e){return new lT({type:"nullable",innerType:e})}var uT=q("ZodDefault",(e,t)=>{xg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>w_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hT(e,t){return new uT({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():du(t)}})}var fT=q("ZodPrefault",(e,t)=>{vg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>T_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function dT(e,t){return new fT({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():du(t)}})}var i0=q("ZodNonOptional",(e,t)=>{yg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>M_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function pT(e,t){return new i0({type:"nonoptional",innerType:e,...Te(t)})}var mT=q("ZodCatch",(e,t)=>{bg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>E_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gT(e,t){return new mT({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var _T=q("ZodPipe",(e,t)=>{Sg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>A_(e,n,i,r),e.in=t.in,e.out=t.out});function J_(e,t){return new _T({type:"pipe",in:e,out:t})}var xT=q("ZodReadonly",(e,t)=>{Mg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>R_(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function vT(e){return new xT({type:"readonly",innerType:e})}var yT=q("ZodCustom",(e,t)=>{wg.init(e,t),vt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>m_(e,n,i,r)});function bT(e,t={}){return s_(yT,e,t)}function ST(e,t){return o_(e,t)}/*!
+Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1){if(e.reused==="ref")s(o)}}if(e.external)e.sharedDefsExtractedFor=e.external}function v0(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!=="object")return;v0(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let s=i.type;for(let o of Array.isArray(s)?s:[s]){if(typeof o!=="string")return;if(!n.includes(o))n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var y0=new Set(["type","properties","required","additionalProperties"]),_0=["oneOf","anyOf"];function x0(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function _h(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let o in s)if(!y0.has(o))return null;t.push(s)}let n={},i=new Set;for(let s of t){for(let o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let a=[];for(let l of t){let u=l.properties?.[o]??x0(l);if(u===null||u===void 0)continue;if(!a.some((h)=>JSON.stringify(h)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:_h(a)??{allOf:a};zn(n,o,c)}for(let o of s.required??[])i.add(o)}let r={type:"object",properties:n};if(i.size)r.required=[...i];if(t.every((s)=>s.additionalProperties===!1))r.additionalProperties=!1;else{let s=[];for(let o of t){let a=x0(o);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)r.additionalProperties=s[0];else if(s.length>1)r.additionalProperties={allOf:s}}return r}function sE(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of y0)if(r in e)return;let n=t.filter((r)=>_0.some((s)=>Array.isArray(r[s]))),i=null;if(!n.length)i=_h(t);else{let r=n[0],s=_0.find((c)=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let o=t.filter((c)=>c!==r),a=r[s].map((c)=>_h([...o,c]));if(a.some((c)=>!c))return;i={[s]:a}}if(!i)return;delete e.allOf,lo(e,i)}function yh(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let i=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},h=c.ref;if(c.ref=null,h){i(h);let d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(m);else lo(l,m);if(lo(l,u),a._zod.parent===h)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(!(p in u))delete l[p]}if(m.$ref&&d.def)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(p in d.def&&JSON.stringify(l[p])===JSON.stringify(d.def[p]))delete l[p]}}let f=a._zod.parent;if(f&&f!==h){i(f);let d=e.seen.get(f);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let m in l){if(m==="$ref"||m==="allOf")continue;if(m in d.def&&JSON.stringify(l[m])===JSON.stringify(d.def[m]))delete l[m]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())v0(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let h=a.get(u);if(h)h.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])sE(l)}}let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}lo(r,n.defId?n.schema:n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&r.id===s)delete r.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;zn(o,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(o).length>0)if(e.target==="draft-2020-12")r.$defs=o;else r.definitions=o;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:uo(t,"input",e.processors),output:uo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Yt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Yt(i.element,n);if(i.type==="set")return Yt(i.valueType,n);if(i.type==="lazy")return Yt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Yt(i.innerType,n);if(i.type==="intersection")return Yt(i.left,n)||Yt(i.right,n);if(i.type==="record"||i.type==="map")return Yt(i.keyType,n)||Yt(i.valueType,n);if(i.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Yt(i.in,n)||Yt(i.out,n)}if(i.type==="object"){for(let r in i.shape)if(Yt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Yt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Yt(r,n))return!0;if(i.rest&&Yt(i.rest,n))return!0;return!1}return!1}var b0=(e,t={})=>(n)=>{let i=xh({...n,processors:t});return At(e,i),vh(i,e),yh(i,e)},uo=(e,t,n={})=>(i)=>{let{libraryOptions:r,target:s}=i??{},o=xh({...r??{},target:s,io:t,processors:n});return At(e,o),vh(o,e),yh(o,e)};var fs=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},ds=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},S0=(e,t)=>{fs(e,"minimum",t),ds(e,"maximum",t)},E0=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},A0=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},R0=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},C0=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},M0=(e,t)=>fs(e,"minimum",t.minimum),w0=(e,t)=>ds(e,"maximum",t.maximum),T0=(e)=>(t,n)=>{C0(t,n.format);let[i,r]=e[n.format];fs(t,"minimum",i),ds(t,"maximum",r)},oE={greater_than:(e,t)=>fs(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ds(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>E0(e,t.value),number_format:T0(Oa),bigint_format:T0(Fu),min_length:M0,max_length:w0,length_equals:(e,t)=>S0(e,t.length),min_size:M0,max_size:w0,size_equals:(e,t)=>S0(e,t.size),string_format:(e,t)=>{if(C0(e,t.format),t.pattern)A0(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>R0(e,t.mime)};function En(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let s of i)oE[s._zod.def.check]?.(t,s._zod.def);let r=e._zod.bag;if(r.minimum!==void 0)fs(t,"minimum",r.minimum);if(r.exclusiveMinimum!==void 0)fs(t,"exclusiveMinimum",r.exclusiveMinimum);if(r.maximum!==void 0)ds(t,"maximum",r.maximum);if(r.exclusiveMaximum!==void 0)ds(t,"exclusiveMaximum",r.exclusiveMaximum);if(r.multipleOf!==void 0)E0(t,r.multipleOf);if(r.format!==void 0){if(t.format??(t.format=r.format),r.format.includes("int"))t.isInt=!0}if(r.mime)R0(t,r.mime);for(let s of r.patterns??[])A0(t,s);return t}var aE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cE=new Map([[eh,Ym],[qa,jm]]),P0=(e)=>cE.get(e)??e,I0=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l,laxFormat:u}=En(e);if(typeof s==="number")r.minLength=s;if(typeof o==="number")r.maxLength=o;if(a){if(r.format=aE[a]??a,r.format==="")delete r.format;if(a==="time"||u)delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let h=[...c].map(P0);if(h.length===1)r.pattern=h[0].source;else if(h.length>1)r.allOf=[...h.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},L0=(e,t,n,i)=>{let r=n,{minimum:s,maximum:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=En(e);r.type=u?"integer":"number";let h=typeof l==="number"&&l>=(s??Number.NEGATIVE_INFINITY),f=typeof c==="number"&&c<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h)if(d)r.minimum=l,r.exclusiveMinimum=!0;else r.exclusiveMinimum=l;else if(typeof s==="number")r.minimum=s;if(f)if(d)r.maximum=c,r.exclusiveMaximum=!0;else r.exclusiveMaximum=c;else if(typeof o==="number")r.maximum=o;if(a){let m=new Set;for(let g of a)if(Number.isFinite(g)&&g!==0)m.add(Math.abs(g));else Ti(e,t,r,i,`A multipleOf divisor of ${g} cannot be represented in JSON Schema`);let[x,...p]=m;if(x!==void 0)r.multipleOf=x;if(p.length)r.allOf=[...r.allOf??[],...p.map((g)=>({multipleOf:g}))]}},N0=(e,t,n,i)=>{n.type="boolean"};var D0=(e,t,n,i)=>{n.not={}};var O0=(e,t,n,i)=>{};var U0=(e,t,n,i)=>{let r=e._zod.def,s=Qs(r.entries);if(s.length===0){n.not={};return}if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";n.enum=s},F0=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let s=[];for(let o of r.values)if(o===void 0){if(Ti(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==="bigint"){if(Ti(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(o))}else s.push(o);if(s.length===0);else if(s.length===1){let o=s[0];if(n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[o];else n.const=o}else{if(s.every((o)=>typeof o==="number"))n.type="number";if(s.every((o)=>typeof o==="string"))n.type="string";if(s.every((o)=>typeof o==="boolean"))n.type="boolean";if(s.every((o)=>o===null))n.type="null";n.enum=s}};var z0=(e,t,n,i)=>{Ti(e,t,n,i,"Custom types cannot be represented in JSON Schema")};var k0=(e,t,n,i)=>{Ti(e,t,n,i,"Transforms cannot be represented in JSON Schema")};var B0=(e,t,n,i)=>{let r=n,s=e._zod.def,{minimum:o,maximum:a}=En(e);if(typeof o==="number")r.minItems=o;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=At(s.element,t,{...i,path:[...i.path,"items"]})};function rc(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return rc(t.out);if(t.type==="catch")return rc(t.innerType);return e._zod.optin}var G0=(e,t,n,i)=>{let r=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&Ti(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let u in o)zn(r.properties,u,At(o[u],t,{...i,path:[...i.path,"properties",u]}));let c=new Set(Object.keys(o)),l=new Set([...c].filter((u)=>{let h=s.shape[u];if(t.io==="input")return rc(h)===void 0;else return h._zod.optout===void 0}));if(l.size>0)r.required=Array.from(l);if(s.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")r.additionalProperties=!1}else if(s.catchall)r.additionalProperties=At(s.catchall,t,{...i,path:[...i.path,"additionalProperties"]})};var H0=(e,t,n,i)=>{let r=e._zod.def,s=r.inclusive===!1,o=r.options.map((a,c)=>At(a,t,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));if(s)n.oneOf=o;else n.anyOf=o},V0=(e,t,n,i)=>{let r=e._zod.def,s=At(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=At(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function bh(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let m=e.get(t)?.def;if(!m)return t;let x=bh(e,m,n);return x===m?t:x}for(let m of["anyOf","oneOf"]){let x=t[m];if(!Array.isArray(x))continue;let p=x.map((g)=>bh(e,g,n));if(p.some((g,A)=>g!==x[A]))t={...t,[m]:p}}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some((m)=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!s?.some((m)=>typeof m==="number"))return t;let{minimum:o,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:h,id:f,...d}=t;if(d.enum)d.enum=d.enum.map((m)=>typeof m==="number"?String(m):m);else if(typeof d.const==="number")d.const=String(d.const);if(!r)return d;if(d.type="string",!s)d.pattern=(i.includes("number")?no:Xu).source;return d}var Sh=new WeakMap;function lE(e){let t=new Map;for(let i of e.seen.values())if(i.def&&!t.has(i.schema))t.set(i.schema,i);let n=new Map;for(let i of Sh.get(e)??[]){let r=e.seen.get(i),s=(r?.def??r?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;let o=bh(t,s,new Set);if(o!==s)n.set(s,o)}if(!n.size)return;for(let i of e.seen.values())for(let r of[i.schema,i.def]){let s=r&&n.get(r.propertyNames);if(s)r.propertyNames=s}}var W0=(e,t,n,i)=>{let r=n,s=e._zod.def;r.type="object";let o=s.keyType,a=En(o).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=At(s.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let h of a)zn(r.patternProperties,P0(h).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=At(s.keyType,t,{...i,path:[...i.path,"propertyNames"]});let u=Sh.get(t);if(!u)u=[],Sh.set(t,u),t.deferred.push(()=>lE(t));u.push(e)}r.additionalProperties=At(s.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=o._zod.values,l=t.io==="input"&&rc(s.valueType)!==void 0;if(c&&!s.partial&&!l){let u=[...c].filter((h)=>typeof h==="string"||typeof h==="number");if(u.length>0)r.required=u.map(String)}},$0=(e,t,n,i)=>{let r=e._zod.def,s=At(r.innerType,t,i),o=t.seen.get(e);if(t.target==="openapi-3.0")o.ref=r.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},Z0=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType},Mh=Symbol();function X0(e,t,n,i,r){let s=!1,o=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(o);return Ti(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),Mh}var q0=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o=X0(r.defaultValue,e,t,n,i);if(o!==Mh)n.default=o},Y0=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);if(s.ref=r.innerType,t.io!=="input")return;let o=X0(r.defaultValue,e,t,n,i);if(o!==Mh)n._prefault=o},j0=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{Ti(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},J0=(e,t,n,i)=>{let r=e._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?r.out:r.in:r.out;At(o,t,i);let a=t.seen.get(e);a.ref=o},K0=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0};var wh=(e,t,n,i)=>{let r=e._zod.def;At(r.innerType,t,i);let s=t.seen.get(e);s.ref=r.innerType};var Q0=new WeakSet([Object.prototype,Error.prototype]);function sc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var gE=(e,t)=>{Sm.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Q0.has(n))return;Q0.add(n),sc(n,"format",(i)=>(r)=>wm(i,r)),sc(n,"flatten",(i)=>(r)=>Mm(i,r)),sc(n,"addIssue",(i)=>(r)=>{i.issues.push(r),i.message=JSON.stringify(i.issues,eo,2)}),sc(n,"addIssues",(i)=>(r)=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,eo,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var mn=q("ZodError",gE,void 0,{Parent:Error});var ex=Ba(mn),tx=Ga(mn),nx=Ha(mn),ix=Va(mn),rx=Em(mn),sx=Am(mn),ox=Rm(mn),ax=Cm(mn),cx=Pm(mn),lx=Im(mn),ux=Lm(mn),hx=Nm(mn);function xE(){if(!en.localeError)pn(sh())}function ac(){if(!en.memoizer)pn({memoizer:L_()})}var xt=q("ZodType",(e,t)=>(xE(),gt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(dn(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ei(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xA(e,t))},superRefine(e,t){return this.check(vA(e,t))},overwrite(e){return this.check(er(e))},optional(){return px(this)},exactOptional(){return sA(this)},nullable(){return mx(this)},nullish(){return px(mx(this))},nonoptional(e){return hA(this,e)},array(){return cc(this)},or(e){return KE([this,e])},and(e){return eA(this,e)},transform(e){return gx(this,rA(e))},default(e){return cA(this,e)},prefault(e){return uA(this,e)},catch(e){return dA(this,e)},pipe(e){return gx(this,e)},readonly(){return gA(this)},describe(e){let t=this.clone();return wr.add(t,{description:e}),t},meta(...e){if(e.length===0)return wr.get(this);let t=this.clone();return wr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ku(this,"~standard",{...Qu(this),jsonSchema:{input:uo(this,"input"),output:uo(this,"output")}})},set "~standard"(e){Mi(this,"~standard",e)},parse:function e(t,n){return ex(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await tx(this,t,n,{callee:e})},safeParse(e,t){return nx(this,e,t)},async safeParseAsync(e,t){return ix(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Mi(this,"spa",e)},validate(e,t){return Vu(this,e,t)},validateAsync(e,t){return Wu(this,e,t)},encode:function e(t,n){return rx(this,t,n,{callee:e})},decode:function e(t,n){return sx(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ox(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ax(this,t,n,{callee:e})},safeEncode(e,t){return cx(this,e,t)},safeDecode(e,t){return lx(this,e,t)},async safeEncodeAsync(e,t){return ux(this,e,t)},async safeDecodeAsync(e,t){return hx(this,e,t)},toJSONSchema(e){return b0(this,{})(e)},get description(){return wr.get(this)?.description},get _def(){return this._zod.def}}),_x=q("_ZodString",(e,t)=>{Xa.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>I0(e,n,i,r)},gm({format:(e)=>En(e).format??null,minLength:(e)=>En(e).minimum??null,maxLength:(e)=>En(e).maximum??null},{regex(...e){return this.check(oh(...e))},includes(...e){return this.check(lh(...e))},startsWith(...e){return this.check(uh(...e))},endsWith(...e){return this.check(hh(...e))},min(...e){return this.check(hs(...e))},max(...e){return this.check(nc(...e))},length(...e){return this.check(ic(...e))},nonempty(...e){return this.check(hs(1,...e))},lowercase(e){return this.check(ah(e))},uppercase(e){return this.check(ch(e))},trim(){return this.check(dh())},normalize(...e){return this.check(fh(...e))},toLowerCase(){return this.check(ph())},toUpperCase(){return this.check(mh())},slugify(){return this.check(gh())}})),vE=q("ZodString",(e,t)=>{Xa.init(e,t),_x.init(e,t)},{email(e){return this.check(U_(wE,e))},url(e){return this.check(H_(EE,e))},jwt(e){return this.check(i0(GE,e))},emoji(e){return this.check(V_(AE,e))},guid(e){return this.check(F_(TE,e))},uuid(e){return this.check(z_(oc,e))},uuidv4(e){return this.check(k_(oc,e))},uuidv6(e){return this.check(B_(oc,e))},uuidv7(e){return this.check(G_(oc,e))},nanoid(e){return this.check(W_(RE,e))},cuid(e){return this.check($_(CE,e))},cuid2(e){return this.check(Z_(PE,e))},ulid(e){return this.check(X_(IE,e))},base64(e){return this.check(e0(zE,e))},base64url(e){return this.check(t0(kE,e))},xid(e){return this.check(q_(LE,e))},ksuid(e){return this.check(Y_(NE,e))},ipv4(e){return this.check(j_(DE,e))},ipv6(e){return this.check(J_(OE,e))},cidrv4(e){return this.check(K_(UE,e))},cidrv6(e){return this.check(Q_(FE,e))},e164(e){return this.check(n0(BE,e))},datetime(e){return this.check(r0(yE,e))},date(e){return this.check(s0(bE,e))},time(e){return this.check(o0(SE,e))},duration(e){return this.check(a0(ME,e))}});function jt(e){return O_(vE,e)}var vt=q("ZodStringFormat",(e,t)=>{_t.init(e,t),_x.init(e,t)}),yE=q("ZodISODateTime",(e,t)=>{$g.init(e,t),vt.init(e,t)}),bE=q("ZodISODate",(e,t)=>{Zg.init(e,t),vt.init(e,t)}),SE=q("ZodISOTime",(e,t)=>{Xg.init(e,t),vt.init(e,t)}),ME=q("ZodISODuration",(e,t)=>{qg.init(e,t),vt.init(e,t)}),wE=q("ZodEmail",(e,t)=>{Dg.init(e,t),vt.init(e,t)});var TE=q("ZodGUID",(e,t)=>{Lg.init(e,t),vt.init(e,t)});var oc=q("ZodUUID",(e,t)=>{Ng.init(e,t),vt.init(e,t)});var EE=q("ZodURL",(e,t)=>{Fg.init(e,t),vt.init(e,t)});var AE=q("ZodEmoji",(e,t)=>{zg.init(e,t),vt.init(e,t)});var RE=q("ZodNanoID",(e,t)=>{kg.init(e,t),vt.init(e,t)});var CE=q("ZodCUID",(e,t)=>{Bg.init(e,t),vt.init(e,t)});var PE=q("ZodCUID2",(e,t)=>{Gg.init(e,t),vt.init(e,t)});var IE=q("ZodULID",(e,t)=>{Hg.init(e,t),vt.init(e,t)});var LE=q("ZodXID",(e,t)=>{Vg.init(e,t),vt.init(e,t)});var NE=q("ZodKSUID",(e,t)=>{Wg.init(e,t),vt.init(e,t)});var DE=q("ZodIPv4",(e,t)=>{Yg.init(e,t),vt.init(e,t)});var OE=q("ZodIPv6",(e,t)=>{Jg.init(e,t),vt.init(e,t)});var UE=q("ZodCIDRv4",(e,t)=>{Kg.init(e,t),vt.init(e,t)});var FE=q("ZodCIDRv6",(e,t)=>{Qg.init(e,t),vt.init(e,t)});var zE=q("ZodBase64",(e,t)=>{t_.init(e,t),vt.init(e,t)});var kE=q("ZodBase64URL",(e,t)=>{n_.init(e,t),vt.init(e,t)});var BE=q("ZodE164",(e,t)=>{i_.init(e,t),vt.init(e,t)});var GE=q("ZodJWT",(e,t)=>{r_.init(e,t),vt.init(e,t)});var xx=q("ZodNumber",(e,t)=>{th.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>L0(e,n,i,r),e.isFinite=!0},gm({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=En(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=En(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=En(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>En(e).format??null},{gt(e,t){return this.check(ec(e,t))},gte(e,t){return this.check(co(e,t))},min(e,t){return this.check(co(e,t))},lt(e,t){return this.check(Qa(e,t))},lte(e,t){return this.check(ao(e,t))},max(e,t){return this.check(ao(e,t))},int(e){return this.check(fx(e))},safe(e){return this.check(fx(e))},positive(e){return this.check(ec(0,e))},nonnegative(e){return this.check(co(0,e))},negative(e){return this.check(Qa(0,e))},nonpositive(e){return this.check(ao(0,e))},multipleOf(e,t){return this.check(tc(e,t))},step(e,t){return this.check(tc(e,t))},finite(){return this}}));function HE(e){return c0(xx,e)}var VE=q("ZodNumberFormat",(e,t)=>{s_.init(e,t),xx.init(e,t)});function fx(e){return l0(VE,e)}var WE=q("ZodBoolean",(e,t)=>{o_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>N0(e,n,i,r)});function $E(e){return u0(WE,e)}var ZE=q("ZodUnknown",(e,t)=>{a_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>O0(e,n,i,r)});function Tr(){return h0(ZE)}var XE=q("ZodNever",(e,t)=>{c_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>D0(e,n,i,r)});function qE(e){return f0(XE,e)}var YE=q("ZodArray",(e,t)=>{ac(),l_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>B0(e,n,i,r),e.element=t.element},{min(e,t){return this.check(hs(e,t))},nonempty(e){return this.check(hs(1,e))},max(e,t){return this.check(nc(e,t))},length(e,t){return this.check(ic(e,t))},unwrap(){return this.element}});function cc(e,t){return d0(YE,e,t)}var jE=q("ZodObject",(e,t)=>{ac(),f_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>G0(e,n,i,r),AT(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return yx(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(dn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(dn(this._zod.def,{catchall:Tr()}))},loose(){return this.clone(dn(this._zod.def,{catchall:Tr()}))},strict(){return this.clone(dn(this._zod.def,{catchall:qE()}))},strip(){return this.clone(dn(this._zod.def,{catchall:void 0}))},extend(e){return yT(this,e)},safeExtend(e){return bT(this,e)},merge(e){return ST(this,e)},pick(e){return xT(this,e)},omit(e){return vT(this,e)},partial(...e){return fm(bx,this,e[0])},exactPartial(...e){return fm(Sx,this,e[0],"exactPartial")},required(...e){return MT(Mx,this,e[0])}});function ho(e,t){let n={type:"object",shape:e??{},...Te(t)};return new jE(n)}var JE=q("ZodUnion",(e,t)=>{d_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>H0(e,n,i,r),e.options=t.options});function KE(e,t){return new JE({type:"union",options:e,...Te(t)})}var QE=q("ZodIntersection",(e,t)=>{p_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>V0(e,n,i,r)});function eA(e,t){return new QE({type:"intersection",left:e,right:t})}var dx=q("ZodRecord",(e,t)=>{ac(),m_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>W0(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function vx(e,t,n){if(!t||!t._zod)return new dx({type:"record",keyType:jt(),valueType:e,...Te(t)});return new dx({type:"record",keyType:e,valueType:t,...Te(n)})}var Eh=q("ZodEnum",(e,t)=>{g_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(i,r,s)=>U0(e,i,r,s),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let s={};for(let o of i)if(n.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new Eh({...t,checks:[],...Te(r),entries:s})},e.exclude=(i,r)=>{let s={...t.entries};for(let o of i)if(n.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new Eh({...t,checks:[],...Te(r),entries:s})}});function yx(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((i)=>[i,i])):e;return new Eh({type:"enum",entries:n,...Te(t)})}var tA=q("ZodLiteral",(e,t)=>{__.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>F0(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nA(e,t){return new tA({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}var iA=q("ZodTransform",(e,t)=>{ac(),x_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>k0(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new to(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(Mr(s,n.value,t));else{let o=s;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=n.value;o.inst??(o.inst=e),n.issues.push(Mr(o))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((s)=>(n.value=s,n));return n.value=r,n}});function rA(e){return new iA({type:"transform",transform:e})}var bx=q("ZodOptional",(e,t)=>{nh.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wh(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function px(e){return new bx({type:"optional",innerType:e})}var Sx=q("ZodExactOptional",(e,t)=>{v_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wh(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new Sx({type:"optional",innerType:e})}var oA=q("ZodNullable",(e,t)=>{y_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function mx(e){return new oA({type:"nullable",innerType:e})}var aA=q("ZodDefault",(e,t)=>{b_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>q0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cA(e,t){return new aA({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var lA=q("ZodPrefault",(e,t)=>{S_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Y0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function uA(e,t){return new lA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var Mx=q("ZodNonOptional",(e,t)=>{M_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Z0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function hA(e,t){return new Mx({type:"nonoptional",innerType:e,...Te(t)})}var fA=q("ZodCatch",(e,t)=>{w_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>j0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dA(e,t){return new fA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:_m(t)})}var pA=q("ZodPipe",(e,t)=>{T_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>J0(e,n,i,r),e.in=t.in,e.out=t.out});function gx(e,t){return new pA({type:"pipe",in:e,out:t})}var mA=q("ZodReadonly",(e,t)=>{E_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>K0(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function gA(e){return new mA({type:"readonly",innerType:e})}var _A=q("ZodCustom",(e,t)=>{A_.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,i,r)=>z0(e,n,i,r)});function xA(e,t={}){return p0(_A,e,t)}function vA(e,t){return m0(e,t)}/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
-*/var Mt=Uint8Array,dn=Uint16Array,Yu=Int32Array,Ga=new Mt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ha=new Mt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Wu=new Mt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u0=function(e,t){var n=new dn(31);for(var i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Yu(n[30]);for(var i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return{b:n,r}},h0=u0(Ga,2),{b:f0,r:$u}=h0;f0[28]=258,$u[258]=28;var d0=u0(Ha,0),{b:wT,r:r0}=d0,Zu=new dn(32768);for(Ye=0;Ye<32768;++Ye)Jn=(Ye&43690)>>1|(Ye&21845)<<1,Jn=(Jn&52428)>>2|(Jn&13107)<<2,Jn=(Jn&61680)>>4|(Jn&3855)<<4,Zu[Ye]=((Jn&65280)>>8|(Jn&255)<<8)>>1;var Jn,Ye,Kn=function(e,t,n){var i=e.length,r=0,s=new dn(t);for(;r<i;++r)if(e[r])++s[e[r]-1];var o=new dn(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(n){a=new dn(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r]){var l=r<<4|e[r],u=t-e[r],f=o[e[r]-1]++<<u;for(var h=f|(1<<u)-1;f<=h;++f)a[Zu[f]>>c]=l}}else{a=new dn(i);for(r=0;r<i;++r)if(e[r])a[r]=Zu[o[e[r]-1]++]>>15-e[r]}return a},Xi=new Mt(288);for(Ye=0;Ye<144;++Ye)Xi[Ye]=8;var Ye;for(Ye=144;Ye<256;++Ye)Xi[Ye]=9;var Ye;for(Ye=256;Ye<280;++Ye)Xi[Ye]=7;var Ye;for(Ye=280;Ye<288;++Ye)Xi[Ye]=8;var Ye,no=new Mt(32);for(Ye=0;Ye<32;++Ye)no[Ye]=5;var Ye,TT=Kn(Xi,9,0),ET=Kn(Xi,9,1),AT=Kn(no,5,0),RT=Kn(no,5,1),Gu=function(e){var t=e[0];for(var n=1;n<e.length;++n)if(e[n]>t)t=e[n];return t},On=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},Hu=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ju=function(e){return(e+7)/8|0},Ju=function(e,t,n){if(t==null||t<0)t=0;if(n==null||n>e.length)n=e.length;return new Mt(e.subarray(t,n))};var CT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Mn=function(e,t,n){var i=Error(t||CT[e]);if(i.code=e,Error.captureStackTrace)Error.captureStackTrace(i,Mn);if(!n)throw i;return i},PT=function(e,t,n,i){var r=e.length,s=i?i.length:0;if(!r||t.f&&!t.l)return n||new Mt(0);var o=!n,a=o||t.i!=2,c=t.i;if(o)n=new Mt(r*3);var l=function(Ue){var ze=n.length;if(Ue>ze){var Je=new Mt(Math.max(ze*2,Ue));Je.set(n),n=Je}},u=t.f||0,f=t.p||0,h=t.b||0,{l:d,d:g,m:b,n:p}=t,m=r*8;do{if(!d){u=On(e,f,1);var A=On(e,f+1,3);if(f+=3,!A){var T=ju(f)+4,v=e[T-4]|e[T-3]<<8,w=T+v;if(w>r){if(c)Mn(0);break}if(a)l(h+v);n.set(e.subarray(T,w),h),t.b=h+=v,t.p=f=w*8,t.f=u;continue}else if(A==1)d=ET,g=RT,b=9,p=5;else if(A==2){var E=On(e,f,31)+257,R=On(e,f+10,15)+4,_=E+On(e,f+5,31)+1;f+=14;var S=new Mt(_),F=new Mt(19);for(var C=0;C<R;++C)F[Wu[C]]=On(e,f+C*3,7);f+=R*3;var z=Gu(F),J=(1<<z)-1,O=Kn(F,z,1);for(var C=0;C<_;){var H=O[On(e,f,J)];f+=H&15;var T=H>>4;if(T<16)S[C++]=T;else{var V=0,U=0;if(T==16)U=3+On(e,f,3),f+=2,V=S[C-1];else if(T==17)U=3+On(e,f,7),f+=3;else if(T==18)U=11+On(e,f,127),f+=7;while(U--)S[C++]=V}}var K=S.subarray(0,E),Q=S.subarray(E);b=Gu(K),p=Gu(Q),d=Kn(K,b,1),g=Kn(Q,p,1)}else Mn(1);if(f>m){if(c)Mn(0);break}}if(a)l(h+131072);var se=(1<<b)-1,me=(1<<p)-1,_e=f;for(;;_e=f){var V=d[Hu(e,f)&se],Xe=V>>4;if(f+=V&15,f>m){if(c)Mn(0);break}if(!V)Mn(2);if(Xe<256)n[h++]=Xe;else if(Xe==256){_e=f,d=null;break}else{var Be=Xe-254;if(Xe>264){var C=Xe-257,Z=Ga[C];Be=On(e,f,(1<<Z)-1)+f0[C],f+=Z}var ne=g[Hu(e,f)&me],fe=ne>>4;if(!ne)Mn(3);f+=ne&15;var Q=wT[fe];if(fe>3){var Z=Ha[fe];Q+=Hu(e,f)&(1<<Z)-1,f+=Z}if(f>m){if(c)Mn(0);break}if(a)l(h+131072);var de=h+Be;if(h<Q){var Re=s-Q,$e=Math.min(Q,de);if(Re+h<0)Mn(3);for(;h<$e;++h)n[h]=i[Re+h]}for(;h<de;++h)n[h]=n[h-Q]}}if(t.l=d,t.p=_e,t.b=h,t.f=u,d)u=1,t.m=b,t.d=g,t.n=p}while(!u);return h!=n.length&&o?Ju(n,0,h):n.subarray(0,h)},gi=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},eo=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},Vu=function(e,t){var n=[];for(var i=0;i<e.length;++i)if(e[i])n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return{t:m0,l:0};if(r==1){var o=new Mt(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(w,E){return w.f-E.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,f=2;n[0]={s:-1,f:a.f+c.f,l:a,r:c};while(u!=r-1)a=n[n[l].f<n[f].f?l++:f++],c=n[l!=u&&n[l].f<n[f].f?l++:f++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(var i=1;i<r;++i)if(s[i].s>h)h=s[i].s;var d=new dn(h+1),g=Xu(n[u-1],d,0);if(g>t){var i=0,b=0,p=g-t,m=1<<p;s.sort(function(E,R){return d[R.s]-d[E.s]||E.f-R.f});for(;i<r;++i){var A=s[i].s;if(d[A]>t)b+=m-(1<<g-d[A]),d[A]=t;else break}b>>=p;while(b>0){var T=s[i].s;if(d[T]<t)b-=1<<t-d[T]++-1;else++i}for(;i>=0&&b;--i){var v=s[i].s;if(d[v]==t)--d[v],++b}g=t}return{t:new Mt(d),l:g}},Xu=function(e,t,n){return e.s==-1?Math.max(Xu(e.l,t,n+1),Xu(e.r,t,n+1)):t[e.s]=n},s0=function(e){var t=e.length;while(t&&!e[--t]);var n=new dn(++t),i=0,r=e[0],s=1,o=function(c){n[i++]=c};for(var a=1;a<=t;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);if(s>2)o(s>10?s-11<<5|28690:s-3<<5|12305),s=0}else if(s>3){o(r),--s;for(;s>6;s-=6)o(8304);if(s>2)o(s-3<<5|8208),s=0}while(s--)o(r);s=1,r=e[a]}return{c:n.subarray(0,i),n:t}},to=function(e,t){var n=0;for(var i=0;i<t.length;++i)n+=e[i]*t[i];return n},p0=function(e,t,n){var i=n.length,r=ju(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var s=0;s<i;++s)e[r+s+4]=n[s];return(r+4+i)*8},o0=function(e,t,n,i,r,s,o,a,c,l,u){gi(t,u++,n),++r[256];var f=Vu(r,15),{t:h,l:d}=f,g=Vu(s,15),{t:b,l:p}=g,m=s0(h),{c:A,n:T}=m,v=s0(b),{c:w,n:E}=v,R=new dn(19);for(var _=0;_<A.length;++_)++R[A[_]&31];for(var _=0;_<w.length;++_)++R[w[_]&31];var S=Vu(R,7),{t:F,l:C}=S,z=19;for(;z>4&&!F[Wu[z-1]];--z);var J=l+5<<3,O=to(r,Xi)+to(s,no)+o,H=to(r,h)+to(s,b)+o+14+3*z+to(R,F)+2*R[16]+3*R[17]+7*R[18];if(c>=0&&J<=O&&J<=H)return p0(t,u,e.subarray(c,c+l));var V,U,K,Q;if(gi(t,u,1+(H<O)),u+=2,H<O){V=Kn(h,d,0),U=h,K=Kn(b,p,0),Q=b;var se=Kn(F,C,0);gi(t,u,T-257),gi(t,u+5,E-1),gi(t,u+10,z-4),u+=14;for(var _=0;_<z;++_)gi(t,u+3*_,F[Wu[_]]);u+=3*z;var me=[A,w];for(var _e=0;_e<2;++_e){var Xe=me[_e];for(var _=0;_<Xe.length;++_){var Be=Xe[_]&31;if(gi(t,u,se[Be]),u+=F[Be],Be>15)gi(t,u,Xe[_]>>5&127),u+=Xe[_]>>12}}}else V=TT,U=Xi,K=AT,Q=no;for(var _=0;_<a;++_){var Z=i[_];if(Z>255){var Be=Z>>18&31;if(eo(t,u,V[Be+257]),u+=U[Be+257],Be>7)gi(t,u,Z>>23&31),u+=Ga[Be];var ne=Z&31;if(eo(t,u,K[ne]),u+=Q[ne],ne>3)eo(t,u,Z>>5&8191),u+=Ha[ne]}else eo(t,u,V[Z]),u+=U[Z]}return eo(t,u,V[256]),u+U[256]},IT=new Yu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),m0=new Mt(0),LT=function(e,t,n,i,r,s){var o=s.z||e.length,a=new Mt(i+o+5*(1+Math.ceil(o/7000))+r),c=a.subarray(i,a.length-r),l=s.l,u=(s.r||0)&7;if(t){if(u)c[0]=s.r>>3;var f=IT[t-1],h=f>>13,d=f&8191,g=(1<<n)-1,b=s.p||new dn(32768),p=s.h||new dn(g+1),m=Math.ceil(n/3),A=2*m,T=function(qe){return(e[qe]^e[qe+1]<<m^e[qe+2]<<A)&g},v=new Yu(25000),w=new dn(288),E=new dn(32),R=0,_=0,S=s.i||0,F=0,C=s.w||0,z=0;for(;S+2<o;++S){var J=T(S),O=S&32767,H=p[J];if(b[O]=H,p[J]=O,C<=S){var V=o-S;if((R>7000||F>24576)&&(V>423||!l)){u=o0(e,c,0,v,w,E,_,F,z,S-z,u),F=R=_=0,z=S;for(var U=0;U<286;++U)w[U]=0;for(var U=0;U<30;++U)E[U]=0}var K=2,Q=0,se=d,me=O-H&32767;if(V>2&&J==T(S-me)){var _e=Math.min(h,V)-1,Xe=Math.min(32767,S),Be=Math.min(258,V);while(me<=Xe&&--se&&O!=H){if(e[S+K]==e[S+K-me]){var Z=0;for(;Z<Be&&e[S+Z]==e[S+Z-me];++Z);if(Z>K){if(K=Z,Q=me,Z>_e)break;var ne=Math.min(me,Z-2),fe=0;for(var U=0;U<ne;++U){var de=S-me+U&32767,Re=b[de],$e=de-Re&32767;if($e>fe)fe=$e,H=de}}}O=H,H=b[O],me+=O-H&32767}}if(Q){v[F++]=268435456|$u[K]<<18|r0[Q];var Ue=$u[K]&31,ze=r0[Q]&31;_+=Ga[Ue]+Ha[ze],++w[257+Ue],++E[ze],C=S+K,++R}else v[F++]=e[S],++w[e[S]]}}for(S=Math.max(S,C);S<o;++S)v[F++]=e[S],++w[e[S]];if(u=o0(e,c,l,v,w,E,_,F,z,S-z,u),!l)s.r=u&7|c[u/8|0]<<3,u-=7,s.h=p,s.p=b,s.i=S,s.w=C}else{for(var S=s.w||0;S<o+l;S+=65535){var Je=S+65535;if(Je>=o)c[u/8|0]=l,Je=o;u=p0(c,u+1,e.subarray(S,Je))}s.i=o}return Ju(a,0,i+ju(u)+r)},NT=function(){var e=new Int32Array(256);for(var t=0;t<256;++t){var n=t,i=9;while(--i)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),DT=function(){var e=-1;return{p:function(t){var n=e;for(var i=0;i<t.length;++i)n=NT[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var UT=function(e,t,n,i,r){if(!r){if(r={l:1},t.dictionary){var s=t.dictionary.subarray(-32768),o=new Mt(s.length+e.length);o.set(s),o.set(e,s.length),e=o,r.w=s.length}}return LT(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},g0=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var Vt=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function _0(e,t){return UT(e,t||{},0,0)}function x0(e,t){return PT(e,{i:2},t&&t.out,t&&t.dictionary)}var v0=function(e,t,n,i){for(var r in e){var s=e[r],o=t+r,a=i;if(Array.isArray(s))a=g0(i,s[1]),s=s[0];if(s instanceof Mt)n[o]=[s,a];else n[o+="/"]=[new Mt(0),a],v0(s,o,n,i)}},a0=typeof TextEncoder<"u"&&new TextEncoder,OT=typeof TextDecoder<"u"&&new TextDecoder,FT=0;try{OT.decode(m0,{stream:!0}),FT=1}catch(e){}function c0(e,t){if(t){var n=new Mt(e.length);for(var i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(a0)return a0.encode(e);var r=e.length,s=new Mt(e.length+(e.length>>1)),o=0,a=function(u){s[o++]=u};for(var i=0;i<r;++i){if(o+5>s.length){var c=new Mt(o+8+(r-i<<1));c.set(s),s=c}var l=e.charCodeAt(i);if(l<128||t)a(l);else if(l<2048)a(192|l>>6),a(128|l&63);else if(l>55295&&l<57344)l=65536+(l&1047552)|e.charCodeAt(++i)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63);else a(224|l>>12),a(128|l>>6&63),a(128|l&63)}return Ju(s,0,o)}var qu=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;if(i>65535)Mn(9);t+=i+4}return t},l0=function(e,t,n,i,r,s,o,a){var c=i.length,l=n.extra,u=a&&a.length,f=qu(l);if(Vt(e,t,o!=null?33639248:67324752),t+=4,o!=null)e[t++]=20,e[t++]=n.os;e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),d=h.getFullYear()-1980;if(d<0||d>119)Mn(10);if(Vt(e,t,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,s!=-1)Vt(e,t,n.crc),Vt(e,t+4,s<0?-s-2:s),Vt(e,t+8,n.size);if(Vt(e,t+12,c),Vt(e,t+14,f),t+=16,o!=null)Vt(e,t,u),Vt(e,t+6,n.attrs),Vt(e,t+10,o),t+=14;if(e.set(i,t),t+=c,f)for(var g in l){var b=l[g],p=b.length;Vt(e,t,+g),Vt(e,t+2,p),e.set(b,t+4),t+=4+p}if(u)e.set(a,t),t+=u;return t},zT=function(e,t,n,i,r){Vt(e,t,101010256),Vt(e,t+8,n),Vt(e,t+10,n),Vt(e,t+12,i),Vt(e,t+16,r)};function y0(e,t){if(!t)t={};var n={},i=[];v0(e,"",n,t);var r=0,s=0;for(var o in n){var a=n[o],c=a[0],l=a[1],u=l.level==0?0:8,f=c0(o),h=f.length,d=l.comment,g=d&&c0(d),b=g&&g.length,p=qu(l.extra);if(h>65535)Mn(11);var m=u?_0(c,l):c,A=m.length,T=DT();T.p(c),i.push(g0(l,{size:c.length,crc:T.d(),c:m,f,m:g,u:h!=o.length||g&&d.length!=b,o:r,compression:u})),r+=30+h+p+A,s+=76+2*(h+p)+(b||0)+A}var v=new Mt(s+22),w=r,E=s-r;for(var R=0;R<i.length;++R){var f=i[R];l0(v,f.o,f,f.f,f.u,f.c.length);var _=30+f.f.length+qu(f.extra);v.set(f.c,f.o+_),l0(v,r,f,f.f,f.u,f.c.length,f.o,f.m),r+=16+_+(f.m?f.m.length:0)}return zT(v,r,i.length,E,w),v}var Va=67108864,Ku=Yt().regex(/^[a-z][a-z0-9_-]{0,79}$/),kT=Yt().regex(/^sha256:[a-f0-9]{64}$/),Qu=Qs({version:rT("kiln.asset.v1"),assetId:Ku,revisionId:Ku,parentRevision:Ku.optional(),name:Yt().min(1).max(200),tags:Ba(Yt().max(80)).max(30),createdAt:Yt().datetime(),description:Yt().max(4000).optional(),brief:Yt().max(8000).optional(),attribution:Qs({model:Yt().max(200).optional(),harness:Yt().max(200).optional(),author:Yt().max(200).optional()}).optional(),editable:Xw(),files:e0(Yt(),Qs({sha256:kT,bytes:Ww().int().nonnegative().max(Va)})),build:Qs({engine:Yt(),options:e0(Yt(),xr()),warnings:Ba(Yt()),integration:xr().optional(),qa:xr().optional(),dependencies:Ba(xr()).optional(),rebuild:t0(["engine-required","external-dependencies-required"])}).optional(),preview:Qs({fidelity:xr().optional(),error:Yt().optional()}).optional()}),BT=new Set(["asset.glb","source.kiln.js","preview.png"]);function GT(e){let t=Qu.parse(e.manifest),n=Object.keys(e.files);if(n.length!==Object.keys(t.files).length||!n.includes("asset.glb"))throw Error("Asset file inventory mismatch");let i=0;for(let r of n){if(!BT.has(r)||!t.files[r]||t.files[r].bytes!==e.files[r].length)throw Error("Invalid asset file inventory");i+=e.files[r].length}if(i>Va||t.editable!==n.includes("source.kiln.js"))throw Error("Invalid asset size or source inventory");if((e.files["source.kiln.js"]?.length??0)>1048576)throw Error("Source exceeds 1 MiB");eh(e.files["asset.glb"])}function eh(e){if(e.length<20||e.length>Va)throw Error("Invalid GLB size");let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.length||t.getUint32(16,!0)!==1313821514)throw Error("Invalid GLB header");let n=20+t.getUint32(12,!0);if(n>e.length)throw Error("Invalid GLB JSON length");let i=JSON.parse(new TextDecoder().decode(e.subarray(20,n)));for(let r of[...i.buffers??[],...i.images??[]])if(r.uri&&!String(r.uri).startsWith("data:"))throw Error("GLB must embed its resources")}function b0(e){if(!e.length||e.length>100)throw Error("Bundle requires 1..100 revisions");let t={},n=0;for(let i of e){GT(i);let r=`${i.manifest.assetId}/${i.manifest.revisionId}/`;if(t[`${r}manifest.json`])throw Error("Duplicate bundle revision");t[`${r}manifest.json`]=new TextEncoder().encode(JSON.stringify(i.manifest,null,2));for(let[s,o]of Object.entries(i.files))t[r+s]=o}for(let i of Object.values(t))n+=i.length;if(n>Va)throw Error("Bundle exceeds 64 MiB");return y0(t,{level:0})}function S0(e,t,n=40,i=[e]){let r=e.getCenter(new N),s=Math.max(e.getSize(new N).length()/2,0.01),o=new N(1,0.65,1.25).normalize(),a=new N().crossVectors(new N(0,1,0),o).normalize(),c=new N().crossVectors(o,a),l=[];for(let A of i.length?i:[e])for(let T of[A.min.x,A.max.x])for(let v of[A.min.y,A.max.y])for(let w of[A.min.z,A.max.z])l.push(new N(T,v,w));let u=1/0,f=-1/0,h=1/0,d=-1/0;for(let A of l){let T=A.clone().sub(r),v=T.dot(a),w=T.dot(c);u=Math.min(u,v),f=Math.max(f,v),h=Math.min(h,w),d=Math.max(d,w)}r.addScaledVector(a,(u+f)/2),r.addScaledVector(c,(h+d)/2);let g=Math.tan(n*Math.PI/360),b=g*t,p=s;for(let A of l){let T=A.clone().sub(r),v=T.dot(o);p=Math.max(p,v+Math.abs(T.dot(a))*1.12/b,v+Math.abs(T.dot(c))*1.12/g)}let m=r.clone().addScaledVector(o,p);return{center:r,radius:s,distance:p,position:m}}function M0(e){let t=new jl({antialias:!0,alpha:!1});t.setPixelRatio(Math.min(devicePixelRatio,2)),t.setClearColor(1382930),t.toneMapping=vs,t.toneMappingExposure=1.15,e.replaceChildren(t.domElement);let n=new Xr,i=new Pt(40,1,0.01,1000),r=new cu(i,t.domElement);r.enableDamping=!0;let s=new Gs(t),o=new lu,a=s.fromScene(o,0.04);n.environment=a.texture,o.dispose(),s.dispose();let c=new Qr(16773591,2.4);c.position.set(4,8,5),n.add(c),n.add(new ca(14806490,5065021,1.7));let l,u,f=[],h=!0,d=performance.now(),g=0,b=0,p=!1,m=(w)=>{let E=new Set,R=new Set,_=new Set;w.traverse((S)=>{let F=S;if(!F.isMesh)return;E.add(F.geometry);for(let C of Array.isArray(F.material)?F.material:[F.material]){R.add(C);for(let z of Object.values(C))if(z instanceof St)_.add(z)}});for(let S of[...E,...R,..._])S.dispose()},A=()=>{if(!l)return;let w=new Jt().setFromObject(l,!0),E=[];l.traverse((C)=>{if(C instanceof dt||C instanceof Li||C instanceof jr){let z=new Jt().setFromObject(C,!0);if(!z.isEmpty())E.push(z)}});let{center:R,radius:_,distance:S,position:F}=S0(w,i.aspect,i.fov,E);r.target.copy(R),i.position.copy(F),i.near=Math.max(_/1000,0.0001),i.far=S+_*100,r.minDistance=_*0.1,r.maxDistance=_*80,i.updateProjectionMatrix(),r.update()},T=new ResizeObserver(()=>{let{clientWidth:w,clientHeight:E}=e;if(!w||!E)return;t.setSize(w,E),i.aspect=w/E,i.updateProjectionMatrix()});T.observe(e);let v=(w)=>{if(p)return;let E=Math.min((w-d)/1000,0.1);if(d=w,h)u?.update(E);r.update(),t.render(n,i),g=requestAnimationFrame(v)};return g=requestAnimationFrame(v),{async load(w){let E=++b;eh(w);let R=new Ds;R.setURLModifier((O)=>{if(!O.startsWith("blob:")&&!O.startsWith("data:"))throw Error("External model resources are not loaded");return O});let _=await new ru(R).parseAsync(Uint8Array.from(w).buffer,"");if(p||E!==b){m(_.scene);return}if(l)u?.stopAllAction(),u?.uncacheRoot(l),n.remove(l),m(l);l=_.scene,n.add(l),f=_.animations,u=new da(l),h=!0;let{clientWidth:S,clientHeight:F}=e;t.setSize(S,F),i.aspect=S/F,A();let C=0,z=0,J=new Set;return l.traverse((O)=>{let H=O;if(!H.isMesh)return;z++,C+=(H.geometry.index?.count??H.geometry.attributes.position?.count??0)/3*(H.isInstancedMesh?H.count:1);for(let V of Array.isArray(H.material)?H.material:[H.material])J.add(V)}),{triangles:C,meshes:z,materials:J.size,clips:f.map((O)=>O.name)}},reset:A,wire(w){l?.traverse((E)=>{let R=E;if(R.isMesh){for(let _ of Array.isArray(R.material)?R.material:[R.material])if("wireframe"in _)_.wireframe=w}})},lighting(w){t.toneMappingExposure=w==="bright"?1.65:w==="soft"?0.85:1.15,c.intensity=w==="soft"?0.8:2.4},clip(w){if(u?.stopAllAction(),f[w])u?.clipAction(f[w]).play()},pause(w){h=!w},dispose(){if(p=!0,b++,cancelAnimationFrame(g),T.disconnect(),r.dispose(),l)m(l);a.dispose(),t.dispose(),e.replaceChildren()}}}async function w0(e,t,n,i,r,s){let o="";for(let a=0;a<e.length;a+=8192)o+=String.fromCharCode(...e.subarray(a,a+8192));try{if((await i("ui/download-file",{contents:[{type:"resource",resource:{uri:`file:///${t}`,mimeType:n,blob:btoa(o)}}]}))?.isError)throw Error("The chat host could not download this file.");return{}}catch(a){if(a.code!==-32601)throw a;if(s){let f=new URL(s);if(f.protocol!=="https:"&&!(f.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(f.hostname)))throw Error("Invalid host download URL");return{downloadUrl:f.href}}if(!r)throw a;let c=new File([Uint8Array.from(e)],t,{type:n}),{fileId:l}=await r.uploadFile(c),{downloadUrl:u}=await r.getFileDownloadUrl({fileId:l});if(new URL(u).protocol!=="https:")throw Error("Invalid host download URL");return{downloadUrl:u}}}var E0=16777216,A0=Math.ceil(E0/3)*4,Bt=(e)=>{throw Error(`Asset transfer ${e}. Present the saved asset again or open it in Kiln; the saved files are unchanged.`)};function HT(e){let t="";for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}function T0(e){if(typeof e!=="string"||e.length>A0)return Bt("exceeds the encoded size limit");if(e.length%4||!/^[A-Za-z0-9+/]*={0,2}$/.test(e))Bt("contains damaged base64 data");let t;try{t=atob(e)}catch{return Bt("contains damaged base64 data")}let n=Uint8Array.from(t,(i)=>i.charCodeAt(0));if(HT(n)!==e)Bt("contains noncanonical base64 data");return n}function io(e){return!!e&&typeof e==="object"&&!Array.isArray(e)}async function R0(e){if(!io(e))return Bt("metadata is missing");if(typeof e.error==="string")throw Error(e.error);let t=Qu.safeParse(e.manifest);if(!t.success||!io(e.files))return Bt("metadata is malformed");let n=t.data,i=Object.entries(e.files);if(!i.length||i.length>16||!Object.hasOwn(e.files,"asset.glb"))return Bt("file list is missing or invalid");let r=0,s=0;for(let[c,l]of i){if(!/^[a-z0-9][a-z0-9._-]{0,127}$/.test(c)||!Object.hasOwn(n.files,c))return Bt("file metadata is missing");if(r+=n.files[c].bytes,r>E0)return Bt("exceeds the decoded size limit");let u=typeof l==="string"?l:io(l)?l.data:void 0;if(typeof u!=="string")return Bt("file encoding is malformed");if(s+=u.length,s>A0)return Bt("exceeds the encoded size limit")}let o={};for(let[c,l]of i){let u=n.files[c],f;if(typeof l==="string")f=T0(l);else{if(!io(l)||l.encoding!=="kiln.deflate-base64.v1")return Bt("encoding is unsupported");let g=T0(l.data);try{f=x0(g,{out:new Uint8Array(u.bytes+1)})}catch{return Bt("compressed data is damaged")}}if(f.length!==u.bytes)return Bt("byte count does not match the saved file");let h=await crypto.subtle.digest("SHA-256",Uint8Array.from(f));if(`sha256:${Array.from(new Uint8Array(h),(g)=>g.toString(16).padStart(2,"0")).join("")}`!==u.sha256)return Bt("integrity check failed");o[c]=f}for(let c of Object.keys(n.files))if(!Object.hasOwn(o,c))return Bt("is missing a saved file");let a={};if(e.downloadUrls!==void 0){if(!io(e.downloadUrls))return Bt("download metadata is malformed");for(let[c,l]of Object.entries(e.downloadUrls)){if(typeof l!=="string")return Bt("download metadata is malformed");a[c]=l}}return{record:{manifest:n,files:o},downloadUrls:a}}var Qn=(e)=>document.getElementById(e),ei=Qn("status"),en,P0={},ro,VT=0,ti=0,Wa=new Map;function I0(e,t){let n=++VT;return new Promise((i,r)=>{let s=setTimeout(()=>{Wa.delete(n),r(Error("Chat host did not respond."))},20000);Wa.set(n,{resolve(o){clearTimeout(s),i(o)},reject(o){clearTimeout(s),r(o)}}),window.parent.postMessage({jsonrpc:"2.0",id:n,method:e,params:t},"*")})}function C0(e,t={}){window.parent.postMessage({jsonrpc:"2.0",method:e,params:t},"*")}function WT(e){let t="";for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}async function $T(e){let t=++ti;en=void 0;for(let n of document.querySelectorAll("button[data-download]"))n.disabled=!0;try{if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Asset transfer metadata is missing. Present the saved asset again.");await ZT(e,t)}catch(n){if(t!==ti)return;ei.textContent=n instanceof Error?n.message:"Asset transfer failed. Present the saved asset again."}}async function ZT(e,t){if(e.isError){ei.textContent=e.content?.find((i)=>i.type==="text")?.text??"This asset could not be opened.";return}let n;try{n=await R0(e._meta?.kilnAsset)}catch(i){if(t!==ti)return;ei.textContent=i instanceof Error?i.message:"Asset transfer failed. Present the saved asset again.";return}if(t!==ti)return;en=n.record,Qn("name").textContent=en.manifest.name,P0=n.downloadUrls,Qn("revision").textContent=`${en.manifest.editable?"Editable source included":"GLB asset"} · ${en.manifest.revisionId.slice(0,10)}`;try{ro??=M0(Qn("stage"));let i=await ro.load(en.files["asset.glb"]);if(t!==ti)return;if(i){Qn("stats").textContent=`${i.triangles.toLocaleString()} triangles · ${i.materials} materials · ${(en.files["asset.glb"].length/1024).toFixed(0)} KB`;let r=Qn("clips");r.replaceChildren(new Option("Rest pose","-1"),...i.clips.map((s,o)=>new Option(s,String(o)))),r.hidden=!i.clips.length}ei.textContent="Drag to orbit · Scroll to zoom"}catch(i){if(t!==ti)return;let r=en.files["preview.png"];if(r){let s=new Image;s.alt=en.manifest.name,s.src=`data:image/png;base64,${WT(r)}`,Qn("stage").replaceChildren(s)}ei.textContent=`3D preview unavailable: ${String(i)}`}for(let i of document.querySelectorAll("button[data-download]"))i.disabled=!1;Qn("source").hidden=!en.files["source.kiln.js"]}window.addEventListener("message",(e)=>{if(e.source!==window.parent||e.data?.jsonrpc!=="2.0")return;let t=e.data;if(t.id!==void 0&&!t.method){let n=Wa.get(t.id);if(Wa.delete(t.id),t.error)n?.reject(Object.assign(Error(t.error.message),{code:t.error.code}));else n?.resolve(t.result)}if(t.method==="ui/notifications/tool-result")$T(t.params);if(t.method==="ui/resource-teardown")ro?.dispose(),window.parent.postMessage({jsonrpc:"2.0",id:t.id,result:{}},"*")});Qn("reset").onclick=()=>ro?.reset();Qn("clips").onchange=(e)=>ro?.clip(Number(e.target.value));for(let e of document.querySelectorAll("button[data-download]"))e.onclick=async()=>{if(!en)return;let t=ti,n=e.dataset.download,i=n==="bundle"?"editable.zip":n==="source"?"source.kiln.js":"asset.glb",r=n==="bundle"?b0([en]):en.files[i],s=n==="bundle"?"application/zip":n==="source"?"text/javascript":"model/gltf-binary",o=en.manifest.name.replace(/[^a-zA-Z0-9_-]+/g,"-").slice(0,80);e.disabled=!0,ei.textContent="Requesting download…";try{let a=typeof window.openai?.uploadFile==="function"&&typeof window.openai?.getFileDownloadUrl==="function"?window.openai:void 0,c=await w0(r,`${o}-${i}`,s,I0,a,P0[i]);if(t!==ti)return;if(c.downloadUrl){let l=document.createElement("a");l.href=c.downloadUrl,l.textContent=`Save ${o}-${i}`,l.style.color="#d5f4a2",l.target="_blank",l.rel="noopener noreferrer",l.onclick=(u)=>{if(window.openai?.openExternal)u.preventDefault(),window.openai.openExternal({href:c.downloadUrl})},ei.replaceChildren("Download ready. ",l)}else ei.textContent="Download requested."}catch(a){if(t===ti)ei.textContent=`Download unavailable in this host: ${a.message}`}finally{e.disabled=!en||t!==ti}};I0("ui/initialize",{appInfo:{name:"Kiln Asset Viewer",version:"0.6.0"},appCapabilities:{},protocolVersion:"2026-01-26"}).then(()=>{C0("ui/notifications/initialized"),C0("ui/notifications/size-changed",{height:document.documentElement.scrollHeight})}).catch((e)=>{ei.textContent=e.message});
+*/var Mt=Uint8Array,gn=Uint16Array,Oh=Int32Array,lc=new Mt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),uc=new Mt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ph=new Mt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Px=function(e,t){var n=new gn(31);for(var i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Oh(n[30]);for(var i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return{b:n,r}},Ix=Px(lc,2),{b:Lx,r:Ih}=Ix;Lx[28]=258,Ih[258]=28;var Nx=Px(uc,0),{b:bA,r:wx}=Nx,Lh=new gn(32768);for(Ye=0;Ye<32768;++Ye)ri=(Ye&43690)>>1|(Ye&21845)<<1,ri=(ri&52428)>>2|(ri&13107)<<2,ri=(ri&61680)>>4|(ri&3855)<<4,Lh[Ye]=((ri&65280)>>8|(ri&255)<<8)>>1;var ri,Ye,si=function(e,t,n){var i=e.length,r=0,s=new gn(t);for(;r<i;++r)if(e[r])++s[e[r]-1];var o=new gn(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(n){a=new gn(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r]){var l=r<<4|e[r],u=t-e[r],h=o[e[r]-1]++<<u;for(var f=h|(1<<u)-1;h<=f;++h)a[Lh[h]>>c]=l}}else{a=new gn(i);for(r=0;r<i;++r)if(e[r])a[r]=Lh[o[e[r]-1]++]>>15-e[r]}return a},tr=new Mt(288);for(Ye=0;Ye<144;++Ye)tr[Ye]=8;var Ye;for(Ye=144;Ye<256;++Ye)tr[Ye]=9;var Ye;for(Ye=256;Ye<280;++Ye)tr[Ye]=7;var Ye;for(Ye=280;Ye<288;++Ye)tr[Ye]=8;var Ye,mo=new Mt(32);for(Ye=0;Ye<32;++Ye)mo[Ye]=5;var Ye,SA=si(tr,9,0),MA=si(tr,9,1),wA=si(mo,5,0),TA=si(mo,5,1),Ah=function(e){var t=e[0];for(var n=1;n<e.length;++n)if(e[n]>t)t=e[n];return t},Bn=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},Rh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Uh=function(e){return(e+7)/8|0},Fh=function(e,t,n){if(t==null||t<0)t=0;if(n==null||n>e.length)n=e.length;return new Mt(e.subarray(t,n))};var EA=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],An=function(e,t,n){var i=Error(t||EA[e]);if(i.code=e,Error.captureStackTrace)Error.captureStackTrace(i,An);if(!n)throw i;return i},AA=function(e,t,n,i){var r=e.length,s=i?i.length:0;if(!r||t.f&&!t.l)return n||new Mt(0);var o=!n,a=o||t.i!=2,c=t.i;if(o)n=new Mt(r*3);var l=function(Oe){var ze=n.length;if(Oe>ze){var Je=new Mt(Math.max(ze*2,Oe));Je.set(n),n=Je}},u=t.f||0,h=t.p||0,f=t.b||0,{l:d,d:m,m:x,n:p}=t,g=r*8;do{if(!d){u=Bn(e,h,1);var A=Bn(e,h+1,3);if(h+=3,!A){var E=Uh(h)+4,y=e[E-4]|e[E-3]<<8,w=E+y;if(w>r){if(c)An(0);break}if(a)l(f+y);n.set(e.subarray(E,w),f),t.b=f+=y,t.p=h=w*8,t.f=u;continue}else if(A==1)d=MA,m=TA,x=9,p=5;else if(A==2){var T=Bn(e,h,31)+257,R=Bn(e,h+10,15)+4,_=T+Bn(e,h+5,31)+1;h+=14;var S=new Mt(_),U=new Mt(19);for(var C=0;C<R;++C)U[Ph[C]]=Bn(e,h+C*3,7);h+=R*3;var z=Ah(U),j=(1<<z)-1,F=si(U,z,1);for(var C=0;C<_;){var H=F[Bn(e,h,j)];h+=H&15;var E=H>>4;if(E<16)S[C++]=E;else{var V=0,O=0;if(E==16)O=3+Bn(e,h,3),h+=2,V=S[C-1];else if(E==17)O=3+Bn(e,h,7),h+=3;else if(E==18)O=11+Bn(e,h,127),h+=7;while(O--)S[C++]=V}}var K=S.subarray(0,T),Q=S.subarray(T);x=Ah(K),p=Ah(Q),d=si(K,x,1),m=si(Q,p,1)}else An(1);if(h>g){if(c)An(0);break}}if(a)l(f+131072);var se=(1<<x)-1,me=(1<<p)-1,_e=h;for(;;_e=h){var V=d[Rh(e,h)&se],Xe=V>>4;if(h+=V&15,h>g){if(c)An(0);break}if(!V)An(2);if(Xe<256)n[f++]=Xe;else if(Xe==256){_e=h,d=null;break}else{var Be=Xe-254;if(Xe>264){var C=Xe-257,Z=lc[C];Be=Bn(e,h,(1<<Z)-1)+Lx[C],h+=Z}var ne=m[Rh(e,h)&me],fe=ne>>4;if(!ne)An(3);h+=ne&15;var Q=bA[fe];if(fe>3){var Z=uc[fe];Q+=Rh(e,h)&(1<<Z)-1,h+=Z}if(h>g){if(c)An(0);break}if(a)l(f+131072);var de=f+Be;if(f<Q){var Re=s-Q,$e=Math.min(Q,de);if(Re+f<0)An(3);for(;f<$e;++f)n[f]=i[Re+f]}for(;f<de;++f)n[f]=n[f-Q]}}if(t.l=d,t.p=_e,t.b=f,t.f=u,d)u=1,t.m=x,t.d=m,t.n=p}while(!u);return f!=n.length&&o?Fh(n,0,f):n.subarray(0,f)},Ei=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},fo=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},Ch=function(e,t){var n=[];for(var i=0;i<e.length;++i)if(e[i])n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return{t:Ox,l:0};if(r==1){var o=new Mt(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(w,T){return w.f-T.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,h=2;n[0]={s:-1,f:a.f+c.f,l:a,r:c};while(u!=r-1)a=n[n[l].f<n[h].f?l++:h++],c=n[l!=u&&n[l].f<n[h].f?l++:h++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var f=s[0].s;for(var i=1;i<r;++i)if(s[i].s>f)f=s[i].s;var d=new gn(f+1),m=Nh(n[u-1],d,0);if(m>t){var i=0,x=0,p=m-t,g=1<<p;s.sort(function(T,R){return d[R.s]-d[T.s]||T.f-R.f});for(;i<r;++i){var A=s[i].s;if(d[A]>t)x+=g-(1<<m-d[A]),d[A]=t;else break}x>>=p;while(x>0){var E=s[i].s;if(d[E]<t)x-=1<<t-d[E]++-1;else++i}for(;i>=0&&x;--i){var y=s[i].s;if(d[y]==t)--d[y],++x}m=t}return{t:new Mt(d),l:m}},Nh=function(e,t,n){return e.s==-1?Math.max(Nh(e.l,t,n+1),Nh(e.r,t,n+1)):t[e.s]=n},Tx=function(e){var t=e.length;while(t&&!e[--t]);var n=new gn(++t),i=0,r=e[0],s=1,o=function(c){n[i++]=c};for(var a=1;a<=t;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);if(s>2)o(s>10?s-11<<5|28690:s-3<<5|12305),s=0}else if(s>3){o(r),--s;for(;s>6;s-=6)o(8304);if(s>2)o(s-3<<5|8208),s=0}while(s--)o(r);s=1,r=e[a]}return{c:n.subarray(0,i),n:t}},po=function(e,t){var n=0;for(var i=0;i<t.length;++i)n+=e[i]*t[i];return n},Dx=function(e,t,n){var i=n.length,r=Uh(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var s=0;s<i;++s)e[r+s+4]=n[s];return(r+4+i)*8},Ex=function(e,t,n,i,r,s,o,a,c,l,u){Ei(t,u++,n),++r[256];var h=Ch(r,15),{t:f,l:d}=h,m=Ch(s,15),{t:x,l:p}=m,g=Tx(f),{c:A,n:E}=g,y=Tx(x),{c:w,n:T}=y,R=new gn(19);for(var _=0;_<A.length;++_)++R[A[_]&31];for(var _=0;_<w.length;++_)++R[w[_]&31];var S=Ch(R,7),{t:U,l:C}=S,z=19;for(;z>4&&!U[Ph[z-1]];--z);var j=l+5<<3,F=po(r,tr)+po(s,mo)+o,H=po(r,f)+po(s,x)+o+14+3*z+po(R,U)+2*R[16]+3*R[17]+7*R[18];if(c>=0&&j<=F&&j<=H)return Dx(t,u,e.subarray(c,c+l));var V,O,K,Q;if(Ei(t,u,1+(H<F)),u+=2,H<F){V=si(f,d,0),O=f,K=si(x,p,0),Q=x;var se=si(U,C,0);Ei(t,u,E-257),Ei(t,u+5,T-1),Ei(t,u+10,z-4),u+=14;for(var _=0;_<z;++_)Ei(t,u+3*_,U[Ph[_]]);u+=3*z;var me=[A,w];for(var _e=0;_e<2;++_e){var Xe=me[_e];for(var _=0;_<Xe.length;++_){var Be=Xe[_]&31;if(Ei(t,u,se[Be]),u+=U[Be],Be>15)Ei(t,u,Xe[_]>>5&127),u+=Xe[_]>>12}}}else V=SA,O=tr,K=wA,Q=mo;for(var _=0;_<a;++_){var Z=i[_];if(Z>255){var Be=Z>>18&31;if(fo(t,u,V[Be+257]),u+=O[Be+257],Be>7)Ei(t,u,Z>>23&31),u+=lc[Be];var ne=Z&31;if(fo(t,u,K[ne]),u+=Q[ne],ne>3)fo(t,u,Z>>5&8191),u+=uc[ne]}else fo(t,u,V[Z]),u+=O[Z]}return fo(t,u,V[256]),u+O[256]},RA=new Oh([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ox=new Mt(0),CA=function(e,t,n,i,r,s){var o=s.z||e.length,a=new Mt(i+o+5*(1+Math.ceil(o/7000))+r),c=a.subarray(i,a.length-r),l=s.l,u=(s.r||0)&7;if(t){if(u)c[0]=s.r>>3;var h=RA[t-1],f=h>>13,d=h&8191,m=(1<<n)-1,x=s.p||new gn(32768),p=s.h||new gn(m+1),g=Math.ceil(n/3),A=2*g,E=function(qe){return(e[qe]^e[qe+1]<<g^e[qe+2]<<A)&m},y=new Oh(25000),w=new gn(288),T=new gn(32),R=0,_=0,S=s.i||0,U=0,C=s.w||0,z=0;for(;S+2<o;++S){var j=E(S),F=S&32767,H=p[j];if(x[F]=H,p[j]=F,C<=S){var V=o-S;if((R>7000||U>24576)&&(V>423||!l)){u=Ex(e,c,0,y,w,T,_,U,z,S-z,u),U=R=_=0,z=S;for(var O=0;O<286;++O)w[O]=0;for(var O=0;O<30;++O)T[O]=0}var K=2,Q=0,se=d,me=F-H&32767;if(V>2&&j==E(S-me)){var _e=Math.min(f,V)-1,Xe=Math.min(32767,S),Be=Math.min(258,V);while(me<=Xe&&--se&&F!=H){if(e[S+K]==e[S+K-me]){var Z=0;for(;Z<Be&&e[S+Z]==e[S+Z-me];++Z);if(Z>K){if(K=Z,Q=me,Z>_e)break;var ne=Math.min(me,Z-2),fe=0;for(var O=0;O<ne;++O){var de=S-me+O&32767,Re=x[de],$e=de-Re&32767;if($e>fe)fe=$e,H=de}}}F=H,H=x[F],me+=F-H&32767}}if(Q){y[U++]=268435456|Ih[K]<<18|wx[Q];var Oe=Ih[K]&31,ze=wx[Q]&31;_+=lc[Oe]+uc[ze],++w[257+Oe],++T[ze],C=S+K,++R}else y[U++]=e[S],++w[e[S]]}}for(S=Math.max(S,C);S<o;++S)y[U++]=e[S],++w[e[S]];if(u=Ex(e,c,l,y,w,T,_,U,z,S-z,u),!l)s.r=u&7|c[u/8|0]<<3,u-=7,s.h=p,s.p=x,s.i=S,s.w=C}else{for(var S=s.w||0;S<o+l;S+=65535){var Je=S+65535;if(Je>=o)c[u/8|0]=l,Je=o;u=Dx(c,u+1,e.subarray(S,Je))}s.i=o}return Fh(a,0,i+Uh(u)+r)},PA=function(){var e=new Int32Array(256);for(var t=0;t<256;++t){var n=t,i=9;while(--i)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),IA=function(){var e=-1;return{p:function(t){var n=e;for(var i=0;i<t.length;++i)n=PA[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var LA=function(e,t,n,i,r){if(!r){if(r={l:1},t.dictionary){var s=t.dictionary.subarray(-32768),o=new Mt(s.length+e.length);o.set(s),o.set(e,s.length),e=o,r.w=s.length}}return CA(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},Ux=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var Vt=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Fx(e,t){return LA(e,t||{},0,0)}function zx(e,t){return AA(e,{i:2},t&&t.out,t&&t.dictionary)}var kx=function(e,t,n,i){for(var r in e){var s=e[r],o=t+r,a=i;if(Array.isArray(s))a=Ux(i,s[1]),s=s[0];if(s instanceof Mt)n[o]=[s,a];else n[o+="/"]=[new Mt(0),a],kx(s,o,n,i)}},Ax=typeof TextEncoder<"u"&&new TextEncoder,NA=typeof TextDecoder<"u"&&new TextDecoder,DA=0;try{NA.decode(Ox,{stream:!0}),DA=1}catch(e){}function Rx(e,t){if(t){var n=new Mt(e.length);for(var i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(Ax)return Ax.encode(e);var r=e.length,s=new Mt(e.length+(e.length>>1)),o=0,a=function(u){s[o++]=u};for(var i=0;i<r;++i){if(o+5>s.length){var c=new Mt(o+8+(r-i<<1));c.set(s),s=c}var l=e.charCodeAt(i);if(l<128||t)a(l);else if(l<2048)a(192|l>>6),a(128|l&63);else if(l>55295&&l<57344)l=65536+(l&1047552)|e.charCodeAt(++i)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63);else a(224|l>>12),a(128|l>>6&63),a(128|l&63)}return Fh(s,0,o)}var Dh=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;if(i>65535)An(9);t+=i+4}return t},Cx=function(e,t,n,i,r,s,o,a){var c=i.length,l=n.extra,u=a&&a.length,h=Dh(l);if(Vt(e,t,o!=null?33639248:67324752),t+=4,o!=null)e[t++]=20,e[t++]=n.os;e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),d=f.getFullYear()-1980;if(d<0||d>119)An(10);if(Vt(e,t,d<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,s!=-1)Vt(e,t,n.crc),Vt(e,t+4,s<0?-s-2:s),Vt(e,t+8,n.size);if(Vt(e,t+12,c),Vt(e,t+14,h),t+=16,o!=null)Vt(e,t,u),Vt(e,t+6,n.attrs),Vt(e,t+10,o),t+=14;if(e.set(i,t),t+=c,h)for(var m in l){var x=l[m],p=x.length;Vt(e,t,+m),Vt(e,t+2,p),e.set(x,t+4),t+=4+p}if(u)e.set(a,t),t+=u;return t},OA=function(e,t,n,i,r){Vt(e,t,101010256),Vt(e,t+8,n),Vt(e,t+10,n),Vt(e,t+12,i),Vt(e,t+16,r)};function Bx(e,t){if(!t)t={};var n={},i=[];kx(e,"",n,t);var r=0,s=0;for(var o in n){var a=n[o],c=a[0],l=a[1],u=l.level==0?0:8,h=Rx(o),f=h.length,d=l.comment,m=d&&Rx(d),x=m&&m.length,p=Dh(l.extra);if(f>65535)An(11);var g=u?Fx(c,l):c,A=g.length,E=IA();E.p(c),i.push(Ux(l,{size:c.length,crc:E.d(),c:g,f:h,m,u:f!=o.length||m&&d.length!=x,o:r,compression:u})),r+=30+f+p+A,s+=76+2*(f+p)+(x||0)+A}var y=new Mt(s+22),w=r,T=s-r;for(var R=0;R<i.length;++R){var h=i[R];Cx(y,h.o,h,h.f,h.u,h.c.length);var _=30+h.f.length+Dh(h.extra);y.set(h.c,h.o+_),Cx(y,r,h,h.f,h.u,h.c.length,h.o,h.m),r+=16+_+(h.m?h.m.length:0)}return OA(y,r,i.length,T,w),y}var hc=67108864,zh=jt().regex(/^[a-z][a-z0-9_-]{0,79}$/),UA=jt().regex(/^sha256:[a-f0-9]{64}$/),kh=ho({version:nA("kiln.asset.v1"),assetId:zh,revisionId:zh,parentRevision:zh.optional(),name:jt().min(1).max(200),tags:cc(jt().max(80)).max(30),createdAt:jt().datetime(),description:jt().max(4000).optional(),brief:jt().max(8000).optional(),attribution:ho({model:jt().max(200).optional(),harness:jt().max(200).optional(),author:jt().max(200).optional()}).optional(),editable:$E(),files:vx(jt(),ho({sha256:UA,bytes:HE().int().nonnegative().max(hc)})),build:ho({engine:jt(),options:vx(jt(),Tr()),warnings:cc(jt()),integration:Tr().optional(),qa:Tr().optional(),dependencies:cc(Tr()).optional(),rebuild:yx(["engine-required","external-dependencies-required"])}).optional(),preview:ho({fidelity:Tr().optional(),error:jt().optional()}).optional()}),FA=new Set(["asset.glb","source.kiln.js","preview.png"]);function zA(e){let t=kh.parse(e.manifest),n=Object.keys(e.files);if(n.length!==Object.keys(t.files).length||!n.includes("asset.glb"))throw Error("Asset file inventory mismatch");let i=0;for(let r of n){if(!FA.has(r)||!t.files[r]||t.files[r].bytes!==e.files[r].length)throw Error("Invalid asset file inventory");i+=e.files[r].length}if(i>hc||t.editable!==n.includes("source.kiln.js"))throw Error("Invalid asset size or source inventory");if((e.files["source.kiln.js"]?.length??0)>1048576)throw Error("Source exceeds 1 MiB");Bh(e.files["asset.glb"])}function Bh(e){if(e.length<20||e.length>hc)throw Error("Invalid GLB size");let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.length||t.getUint32(16,!0)!==1313821514)throw Error("Invalid GLB header");let n=20+t.getUint32(12,!0);if(n>e.length)throw Error("Invalid GLB JSON length");let i=JSON.parse(new TextDecoder().decode(e.subarray(20,n)));for(let r of[...i.buffers??[],...i.images??[]])if(r.uri&&!String(r.uri).startsWith("data:"))throw Error("GLB must embed its resources")}function Gx(e){if(!e.length||e.length>100)throw Error("Bundle requires 1..100 revisions");let t={},n=0;for(let i of e){zA(i);let r=`${i.manifest.assetId}/${i.manifest.revisionId}/`;if(t[`${r}manifest.json`])throw Error("Duplicate bundle revision");t[`${r}manifest.json`]=new TextEncoder().encode(JSON.stringify(i.manifest,null,2));for(let[s,o]of Object.entries(i.files))t[r+s]=o}for(let i of Object.values(t))n+=i.length;if(n>hc)throw Error("Bundle exceeds 64 MiB");return Bx(t,{level:0})}function Hx(e,t,n=40,i=[e]){let r=e.getCenter(new N),s=Math.max(e.getSize(new N).length()/2,0.01),o=new N(1,0.65,1.25).normalize(),a=new N().crossVectors(new N(0,1,0),o).normalize(),c=new N().crossVectors(o,a),l=[];for(let A of i.length?i:[e])for(let E of[A.min.x,A.max.x])for(let y of[A.min.y,A.max.y])for(let w of[A.min.z,A.max.z])l.push(new N(E,y,w));let u=1/0,h=-1/0,f=1/0,d=-1/0;for(let A of l){let E=A.clone().sub(r),y=E.dot(a),w=E.dot(c);u=Math.min(u,y),h=Math.max(h,y),f=Math.min(f,w),d=Math.max(d,w)}r.addScaledVector(a,(u+h)/2),r.addScaledVector(c,(f+d)/2);let m=Math.tan(n*Math.PI/360),x=m*t,p=s;for(let A of l){let E=A.clone().sub(r),y=E.dot(o);p=Math.max(p,y+Math.abs(E.dot(a))*1.12/x,y+Math.abs(E.dot(c))*1.12/m)}let g=r.clone().addScaledVector(o,p);return{center:r,radius:s,distance:p,position:g}}function Vx(e){let t=new xu({antialias:!0,alpha:!1});t.setPixelRatio(Math.min(devicePixelRatio,2)),t.setClearColor(1382930),t.toneMapping=As,t.toneMappingExposure=1.15,e.replaceChildren(t.domElement);let n=new es,i=new Pt(40,1,0.01,1000),r=new Pu(i,t.domElement);r.enableDamping=!0;let s=new Ys(t),o=new Iu,a=s.fromScene(o,0.04);n.environment=a.texture,o.dispose(),s.dispose();let c=new os(16773591,2.4);c.position.set(4,8,5),n.add(c),n.add(new ya(14806490,5065021,1.7));let l,u,h=[],f=!0,d=performance.now(),m=0,x=0,p=!1,g=(w)=>{let T=new Set,R=new Set,_=new Set;w.traverse((S)=>{let U=S;if(!U.isMesh)return;T.add(U.geometry);for(let C of Array.isArray(U.material)?U.material:[U.material]){R.add(C);for(let z of Object.values(C))if(z instanceof St)_.add(z)}});for(let S of[...T,...R,..._])S.dispose()},A=()=>{if(!l)return;let w=new Kt().setFromObject(l,!0),T=[];l.traverse((C)=>{if(C instanceof dt||C instanceof Hi||C instanceof is){let z=new Kt().setFromObject(C,!0);if(!z.isEmpty())T.push(z)}});let{center:R,radius:_,distance:S,position:U}=Hx(w,i.aspect,i.fov,T);r.target.copy(R),i.position.copy(U),i.near=Math.max(_/1000,0.0001),i.far=S+_*100,r.minDistance=_*0.1,r.maxDistance=_*80,i.updateProjectionMatrix(),r.update()},E=new ResizeObserver(()=>{let{clientWidth:w,clientHeight:T}=e;if(!w||!T)return;t.setSize(w,T),i.aspect=w/T,i.updateProjectionMatrix()});E.observe(e);let y=(w)=>{if(p)return;let T=Math.min((w-d)/1000,0.1);if(d=w,f)u?.update(T);r.update(),t.render(n,i),m=requestAnimationFrame(y)};return m=requestAnimationFrame(y),{async load(w){let T=++x;Bh(w);let R=new Hs;R.setURLModifier((F)=>{if(!F.startsWith("blob:")&&!F.startsWith("data:"))throw Error("External model resources are not loaded");return F});let _=await new Eu(R).parseAsync(Uint8Array.from(w).buffer,"");if(p||T!==x){g(_.scene);return}if(l)u?.stopAllAction(),u?.uncacheRoot(l),n.remove(l),g(l);l=_.scene,n.add(l),h=_.animations,u=new Ta(l),f=!0;let{clientWidth:S,clientHeight:U}=e;t.setSize(S,U),i.aspect=S/U,A();let C=0,z=0,j=new Set;return l.traverse((F)=>{let H=F;if(!H.isMesh)return;z++,C+=(H.geometry.index?.count??H.geometry.attributes.position?.count??0)/3*(H.isInstancedMesh?H.count:1);for(let V of Array.isArray(H.material)?H.material:[H.material])j.add(V)}),{triangles:C,meshes:z,materials:j.size,clips:h.map((F)=>F.name)}},reset:A,wire(w){l?.traverse((T)=>{let R=T;if(R.isMesh){for(let _ of Array.isArray(R.material)?R.material:[R.material])if("wireframe"in _)_.wireframe=w}})},lighting(w){t.toneMappingExposure=w==="bright"?1.65:w==="soft"?0.85:1.15,c.intensity=w==="soft"?0.8:2.4},clip(w){if(u?.stopAllAction(),h[w])u?.clipAction(h[w]).play()},pause(w){f=!w},dispose(){if(p=!0,x++,cancelAnimationFrame(m),E.disconnect(),r.dispose(),l)g(l);a.dispose(),t.dispose(),e.replaceChildren()}}}async function Wx(e,t,n,i,r,s){let o="";for(let a=0;a<e.length;a+=8192)o+=String.fromCharCode(...e.subarray(a,a+8192));try{if((await i("ui/download-file",{contents:[{type:"resource",resource:{uri:`file:///${t}`,mimeType:n,blob:btoa(o)}}]}))?.isError)throw Error("The chat host could not download this file.");return{}}catch(a){if(a.code!==-32601)throw a;if(s){let h=new URL(s);if(h.protocol!=="https:"&&!(h.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(h.hostname)))throw Error("Invalid host download URL");return{downloadUrl:h.href}}if(!r)throw a;let c=new File([Uint8Array.from(e)],t,{type:n}),{fileId:l}=await r.uploadFile(c),{downloadUrl:u}=await r.getFileDownloadUrl({fileId:l});if(new URL(u).protocol!=="https:")throw Error("Invalid host download URL");return{downloadUrl:u}}}var Zx=16777216,Xx=Math.ceil(Zx/3)*4,Gt=(e)=>{throw Error(`Asset transfer ${e}. Present the saved asset again or open it in Kiln; the saved files are unchanged.`)};function kA(e){let t="";for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}function $x(e){if(typeof e!=="string"||e.length>Xx)return Gt("exceeds the encoded size limit");if(e.length%4||!/^[A-Za-z0-9+/]*={0,2}$/.test(e))Gt("contains damaged base64 data");let t;try{t=atob(e)}catch{return Gt("contains damaged base64 data")}let n=Uint8Array.from(t,(i)=>i.charCodeAt(0));if(kA(n)!==e)Gt("contains noncanonical base64 data");return n}function go(e){return!!e&&typeof e==="object"&&!Array.isArray(e)}async function qx(e){if(!go(e))return Gt("metadata is missing");if(typeof e.error==="string")throw Error(e.error);let t=kh.safeParse(e.manifest);if(!t.success||!go(e.files))return Gt("metadata is malformed");let n=t.data,i=Object.entries(e.files);if(!i.length||i.length>16||!Object.hasOwn(e.files,"asset.glb"))return Gt("file list is missing or invalid");let r=0,s=0;for(let[c,l]of i){if(!/^[a-z0-9][a-z0-9._-]{0,127}$/.test(c)||!Object.hasOwn(n.files,c))return Gt("file metadata is missing");if(r+=n.files[c].bytes,r>Zx)return Gt("exceeds the decoded size limit");let u=typeof l==="string"?l:go(l)?l.data:void 0;if(typeof u!=="string")return Gt("file encoding is malformed");if(s+=u.length,s>Xx)return Gt("exceeds the encoded size limit")}let o={};for(let[c,l]of i){let u=n.files[c],h;if(typeof l==="string")h=$x(l);else{if(!go(l)||l.encoding!=="kiln.deflate-base64.v1")return Gt("encoding is unsupported");let m=$x(l.data);try{h=zx(m,{out:new Uint8Array(u.bytes+1)})}catch{return Gt("compressed data is damaged")}}if(h.length!==u.bytes)return Gt("byte count does not match the saved file");let f=await crypto.subtle.digest("SHA-256",Uint8Array.from(h));if(`sha256:${Array.from(new Uint8Array(f),(m)=>m.toString(16).padStart(2,"0")).join("")}`!==u.sha256)return Gt("integrity check failed");o[c]=h}for(let c of Object.keys(n.files))if(!Object.hasOwn(o,c))return Gt("is missing a saved file");let a={};if(e.downloadUrls!==void 0){if(!go(e.downloadUrls))return Gt("download metadata is malformed");for(let[c,l]of Object.entries(e.downloadUrls)){if(typeof l!=="string")return Gt("download metadata is malformed");a[c]=l}}return{record:{manifest:n,files:o},downloadUrls:a}}var oi=(e)=>document.getElementById(e),ai=oi("status"),tn,jx={},_o,BA=0,ci=0,fc=new Map;function Jx(e,t){let n=++BA;return new Promise((i,r)=>{let s=setTimeout(()=>{fc.delete(n),r(Error("Chat host did not respond."))},20000);fc.set(n,{resolve(o){clearTimeout(s),i(o)},reject(o){clearTimeout(s),r(o)}}),window.parent.postMessage({jsonrpc:"2.0",id:n,method:e,params:t},"*")})}function Yx(e,t={}){window.parent.postMessage({jsonrpc:"2.0",method:e,params:t},"*")}function GA(e){let t="";for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}async function HA(e){let t=++ci;tn=void 0;for(let n of document.querySelectorAll("button[data-download]"))n.disabled=!0;try{if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Asset transfer metadata is missing. Present the saved asset again.");await VA(e,t)}catch(n){if(t!==ci)return;ai.textContent=n instanceof Error?n.message:"Asset transfer failed. Present the saved asset again."}}async function VA(e,t){if(e.isError){ai.textContent=e.content?.find((i)=>i.type==="text")?.text??"This asset could not be opened.";return}let n;try{n=await qx(e._meta?.kilnAsset)}catch(i){if(t!==ci)return;ai.textContent=i instanceof Error?i.message:"Asset transfer failed. Present the saved asset again.";return}if(t!==ci)return;tn=n.record,oi("name").textContent=tn.manifest.name,jx=n.downloadUrls,oi("revision").textContent=`${tn.manifest.editable?"Editable source included":"GLB asset"} · ${tn.manifest.revisionId.slice(0,10)}`;try{_o??=Vx(oi("stage"));let i=await _o.load(tn.files["asset.glb"]);if(t!==ci)return;if(i){oi("stats").textContent=`${i.triangles.toLocaleString()} triangles · ${i.materials} materials · ${(tn.files["asset.glb"].length/1024).toFixed(0)} KB`;let r=oi("clips");r.replaceChildren(new Option("Rest pose","-1"),...i.clips.map((s,o)=>new Option(s,String(o)))),r.hidden=!i.clips.length}ai.textContent="Drag to orbit · Scroll to zoom"}catch(i){if(t!==ci)return;let r=tn.files["preview.png"];if(r){let s=new Image;s.alt=tn.manifest.name,s.src=`data:image/png;base64,${GA(r)}`,oi("stage").replaceChildren(s)}ai.textContent=`3D preview unavailable: ${String(i)}`}for(let i of document.querySelectorAll("button[data-download]"))i.disabled=!1;oi("source").hidden=!tn.files["source.kiln.js"]}window.addEventListener("message",(e)=>{if(e.source!==window.parent||e.data?.jsonrpc!=="2.0")return;let t=e.data;if(t.id!==void 0&&!t.method){let n=fc.get(t.id);if(fc.delete(t.id),t.error)n?.reject(Object.assign(Error(t.error.message),{code:t.error.code}));else n?.resolve(t.result)}if(t.method==="ui/notifications/tool-result")HA(t.params);if(t.method==="ui/resource-teardown")_o?.dispose(),window.parent.postMessage({jsonrpc:"2.0",id:t.id,result:{}},"*")});oi("reset").onclick=()=>_o?.reset();oi("clips").onchange=(e)=>_o?.clip(Number(e.target.value));for(let e of document.querySelectorAll("button[data-download]"))e.onclick=async()=>{if(!tn)return;let t=ci,n=e.dataset.download,i=n==="bundle"?"editable.zip":n==="source"?"source.kiln.js":"asset.glb",r=n==="bundle"?Gx([tn]):tn.files[i],s=n==="bundle"?"application/zip":n==="source"?"text/javascript":"model/gltf-binary",o=tn.manifest.name.replace(/[^a-zA-Z0-9_-]+/g,"-").slice(0,80);e.disabled=!0,ai.textContent="Requesting download…";try{let a=typeof window.openai?.uploadFile==="function"&&typeof window.openai?.getFileDownloadUrl==="function"?window.openai:void 0,c=await Wx(r,`${o}-${i}`,s,Jx,a,jx[i]);if(t!==ci)return;if(c.downloadUrl){let l=document.createElement("a");l.href=c.downloadUrl,l.textContent=`Save ${o}-${i}`,l.style.color="#d5f4a2",l.target="_blank",l.rel="noopener noreferrer",l.onclick=(u)=>{if(window.openai?.openExternal)u.preventDefault(),window.openai.openExternal({href:c.downloadUrl})},ai.replaceChildren("Download ready. ",l)}else ai.textContent="Download requested."}catch(a){if(t===ci)ai.textContent=`Download unavailable in this host: ${a.message}`}finally{e.disabled=!tn||t!==ci}};Jx("ui/initialize",{appInfo:{name:"Kiln Asset Viewer",version:"0.6.0"},appCapabilities:{},protocolVersion:"2026-01-26"}).then(()=>{Yx("ui/notifications/initialized"),Yx("ui/notifications/size-changed",{height:document.documentElement.scrollHeight})}).catch((e)=>{ai.textContent=e.message});
</script>
</body>
diff --git a/docs/plans/repo-size-and-r2-migration-2026-09-10.md b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
index b976e52b..9a8f7a05 100644
--- a/docs/plans/repo-size-and-r2-migration-2026-09-10.md
+++ b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
@@ -420,10 +420,10 @@ architectures.
| ID | Task | State |
| --- | --- | --- |
-| 6.1 | Establish whether the divergence is float formatting, buffer padding, or accessor min/max precision, by diffing one small asset's GLB JSON chunk between a Linux and a Windows render | Pending |
-| 6.2 | Decide the fix: make serialization deterministic across platforms, or make `artifactHash` cover geometry rather than serialized bytes | Pending |
-| 6.3 | Re-record the affected receipts once serialization is settled, deliberately and in one pass | Pending |
-| 6.4 | Unpin `pages.yml` from `windows-2022` and confirm the gallery builds on Ubuntu | Pending |
+| 6.1 | Establish whether the divergence is float formatting, buffer padding, or accessor min/max precision, by diffing one small asset's GLB JSON chunk between a Linux and a Windows render CLOSED 2026-09-11. The 83 gallery images are display assets; the maintainer's call. Their receipts were the only consumer of byte-identical cross-platform serialization, so the Windows host this needed now buys nothing. `artifactHash` remains a real identity claim and 9.3 may share a root cause -- reopen from there if it does, not from the posters |
+| 6.2 | Decide the fix: make serialization deterministic across platforms, or make `artifactHash` cover geometry rather than serialized bytes | REOPENED 2026-09-11, hours after being closed, and by the predicted route. `@gltf-transform` 4.5.0 changes the bytes of every exported GLB: all 83 `artifactHash` values move and the Windows gallery build fails on a stale poster. Bisected to that package alone -- main plus 4.5.0 reproduces the bumped hash exactly, while `sharp` 0.35.4 and `manifold-3d` 3.5.3 leave it untouched. So the exposure is not really cross-platform drift: it is that `artifactHash` is a hash of bytes produced by a dependency free to change them under a caret. Pinned to 4.4.1 as a stopgap. The real decision stands |
+| 6.3 | Re-record the affected receipts once serialization is settled, deliberately and in one pass CLOSED 2026-09-11. The 83 gallery images are display assets; the maintainer's call. Their receipts were the only consumer of byte-identical cross-platform serialization, so the Windows host this needed now buys nothing. `artifactHash` remains a real identity claim and 9.3 may share a root cause -- reopen from there if it does, not from the posters |
+| 6.4 | Unpin `pages.yml` from `windows-2022` and confirm the gallery builds on Ubuntu | Kept, and now the whole of Phase 6. The Windows pin is a cost paid on every gallery run, independent of receipts |
### Phase 3 rehearsal
diff --git a/package.json b/package.json
index ea2fc8ca..56c2a30f 100644
--- a/package.json
+++ b/package.json
@@ -104,29 +104,29 @@
"smoke:harness": "node scripts/harness-smoke.mjs"
},
"dependencies": {
- "@gltf-transform/core": "^4.4.1",
- "@gltf-transform/extensions": "^4.4.1",
- "@gltf-transform/functions": "^4.4.1",
+ "@gltf-transform/core": "4.4.1",
+ "@gltf-transform/extensions": "4.4.1",
+ "@gltf-transform/functions": "4.4.1",
"@modelcontextprotocol/client": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"@openrouter/ai-sdk-provider": "^2.10.0",
- "@types/three": "^0.185.1",
- "acorn": "^8.17.0",
+ "@types/three": "^0.185.4",
+ "acorn": "^8.18.0",
"acorn-walk": "^8.3.5",
"gltf-validator": "2.0.0-dev.3.10",
- "manifold-3d": "^3.5.1",
- "sharp": "^0.35.3",
+ "manifold-3d": "^3.5.3",
+ "sharp": "^0.35.4",
"three": "0.185.1",
"three-subdivide": "^1.1.5",
"xatlasjs": "^0.2.0",
- "zod": "^4.4.3"
+ "zod": "^4.6.2"
},
"peerDependencies": {
"@ai-sdk/provider": "^3.0.0",
"@strands-agents/sdk": "^1.4.0"
},
"overrides": {
- "sharp": "^0.35.3"
+ "sharp": "^0.35.4"
},
"peerDependenciesMeta": {
"@ai-sdk/provider": {
@@ -138,11 +138,11 @@
},
"devDependencies": {
"@ai-sdk/provider": "^3.0.14",
- "@anthropic-ai/sdk": "^0.110.0",
+ "@anthropic-ai/sdk": "^0.125.0",
"@aws-sdk/client-bedrock-runtime": "^3.1083.0",
- "@biomejs/biome": "^2.5.3",
- "@google/genai": "^2.17.1",
- "@strands-agents/sdk": "1.13.0",
+ "@biomejs/biome": "^2.5.13",
+ "@google/genai": "^2.22.0",
+ "@strands-agents/sdk": "1.17.0",
"@types/bun": "^1.4.2",
"ai": "^6.0.222",
"openai": "^6.46.0",
diff --git a/src/__tests__/generated-source-policy.test.ts b/src/__tests__/generated-source-policy.test.ts
index 0e7171e4..70e93691 100644
--- a/src/__tests__/generated-source-policy.test.ts
+++ b/src/__tests__/generated-source-policy.test.ts
@@ -29,13 +29,12 @@ describe('H6.5 generated-source policy', () => {
expect(policyCodes(wrap(expression))).toContain('UNSAFE_GLOBAL_ACCESS');
});
- test.each([
- "this['pro' + 'cess']",
- "globalThis['fe' + 'tch']",
- 'globalThis[`WebSocket`]',
- ])('rejects computed ambient-global access: %s', (expression) => {
- expect(policyCodes(wrap(`void ${expression};`))).toContain('UNSAFE_GLOBAL_ACCESS');
- });
+ test.each(["this['pro' + 'cess']", "globalThis['fe' + 'tch']", 'globalThis[`WebSocket`]'])(
+ 'rejects computed ambient-global access: %s',
+ (expression) => {
+ expect(policyCodes(wrap(`void ${expression};`))).toContain('UNSAFE_GLOBAL_ACCESS');
+ },
+ );
test('rejects dynamic import without echoing its specifier', async () => {
const source = wrap("return import('node:fs');");
@@ -79,12 +78,12 @@ describe('H6.5 generated-source policy', () => {
expect(policyCodes(wrap(`${expression};`))).toContain('UNSAFE_THREE_CONSTRUCTOR');
});
- test.each([
- 'const T = THREE; new T.DataTexture();',
- 'let T; T = THREE; new T.ShaderMaterial();',
- ])('rejects aliasing the THREE namespace: %s', (expression) => {
- expect(policyCodes(wrap(expression))).toContain('UNSAFE_THREE_ALIAS');
- });
+ test.each(['const T = THREE; new T.DataTexture();', 'let T; T = THREE; new T.ShaderMaterial();'])(
+ 'rejects aliasing the THREE namespace: %s',
+ (expression) => {
+ expect(policyCodes(wrap(expression))).toContain('UNSAFE_THREE_ALIAS');
+ },
+ );
test('rejects non-static computed THREE access while preserving direct safe constructors', () => {
expect(