diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f2675ca8..f5d80eba4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,7 +69,7 @@ jobs: echo "AIRDROP_API_BASE_URL=${{ env.AIRDROP_API_BASE_URL }}" >> $GITHUB_ENV echo "TELEMETRY_API_URL=${{ env.TELEMETRY_API_URL }}" >> $GITHUB_ENV echo "AIRDROP_WEBSOCKET_CRYPTO_KEY=${{ env.AIRDROP_WEBSOCKET_CRYPTO_KEY }}" >> $GITHUB_ENV - echo "TS_FEATURES=release-ci-beta, airdrop-env" >> $GITHUB_ENV + echo "TS_FEATURES=release-ci-beta, airdrop-env, telemetry-env" >> $GITHUB_ENV # numeric-only and cannot be greater than 65535 for msi target export BETA_DATE=$(date +%m%d) cd "${GITHUB_WORKSPACE}/src-tauri" diff --git a/package-lock.json b/package-lock.json index d35b097c6..a1a26040a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,67 +1,67 @@ { "name": "tari-universe", - "version": "0.8.41", + "version": "0.8.42", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tari-universe", - "version": "0.8.41", + "version": "0.8.42", "dependencies": { "@floating-ui/react": "^0.26.28", "@lottiefiles/dotlottie-react": "^0.12.0", - "@sentry/react": "^8.42.0", - "@tauri-apps/api": "^2.1.1", - "@tauri-apps/plugin-os": "^2.0.0", - "@tauri-apps/plugin-process": "^2.0.0", - "@tauri-apps/plugin-shell": "^2.0.1", - "@tauri-apps/plugin-updater": "^2.0.0", + "@sentry/react": "^8.48.0", + "@tauri-apps/api": "^2.2.0", + "@tauri-apps/plugin-os": "^2.2.0", + "@tauri-apps/plugin-process": "^2.2.0", + "@tauri-apps/plugin-shell": "^2.2.0", + "@tauri-apps/plugin-updater": "^2.3.1", "emoji-regex": "^10.4.0", - "framer-motion": "^11.13.1", - "globals": "^15.13.0", + "framer-motion": "^11.16.1", + "globals": "^15.14.0", "i18next": "^23.16.8", - "i18next-browser-languagedetector": "^8.0.0", + "i18next-browser-languagedetector": "^8.0.2", "i18next-http-backend": "^2.7.1", "linkify-react": "^4.2.0", "react": "^18.3.1", "react-dom": "^18.2.0", - "react-hook-form": "^7.53.2", - "react-i18next": "^15.1.3", + "react-hook-form": "^7.54.2", + "react-i18next": "^15.4.0", "react-icons": "^5.4.0", - "react-markdown": "^9.0.1", + "react-markdown": "^9.0.3", "socket.io-client": "^4.8.1", - "styled-components": "^6.1.12", + "styled-components": "^6.1.14", "tauri-plugin-sentry-api": "^0.2.0", "use-sync-external-store": "^1.4.0", "uuid": "^10.0.0", - "vite-tsconfig-paths": "^5.1.3", - "zustand": "^5.0.2" + "vite-tsconfig-paths": "^5.1.4", + "zustand": "^5.0.3" }, "devDependencies": { "@eslint/js": "^9.9.0", "@nabla/vite-plugin-eslint": "^2.0.5", "@sentry/vite-plugin": "^2.22.7", "@taplo/cli": "^0.7.0", - "@tauri-apps/cli": "^2.1.0", + "@tauri-apps/cli": "^2.2.2", "@types/eslint__js": "^8.42.3", - "@types/node": "^22.10.1", - "@types/react": "^18.3.14", - "@types/react-dom": "^18.3.2", + "@types/node": "^22.10.5", + "@types/react": "^18.3.18", + "@types/react-dom": "^18.3.5", "@types/uuid": "^10.0.0", "@typescript-eslint/parser": "^8.3.0", "@vitejs/plugin-react": "^4.3.4", "babel-plugin-styled-components": "^2.1.4", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-i18next": "^6.1.1", "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-react": "^7.37.2", - "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react": "^7.37.3", + "eslint-plugin-react-hooks": "^5.1.0", "prettier": "3.3.3", "prettier-eslint": "^16.3.0", "react-qr-code": "^2.0.15", - "typescript": "^5.7.2", - "typescript-eslint": "^8.17.0", + "typescript": "^5.7.3", + "typescript-eslint": "^8.19.1", "vite": "^5.4.11" } }, @@ -967,9 +967,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.16.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", - "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", + "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", "dev": true, "license": "MIT", "engines": { @@ -1570,50 +1570,50 @@ ] }, "node_modules/@sentry-internal/browser-utils": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.42.0.tgz", - "integrity": "sha512-xzgRI0wglKYsPrna574w1t38aftuvo44gjOKFvPNGPnYfiW9y4m+64kUz3JFbtanvOrKPcaITpdYiB4DeJXEbA==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.48.0.tgz", + "integrity": "sha512-pLtu0Fa1Ou0v3M1OEO1MB1EONJVmXEGtoTwFRCO1RPQI2ulmkG6BikINClFG5IBpoYKZ33WkEXuM6U5xh+pdZg==", "license": "MIT", "dependencies": { - "@sentry/core": "8.42.0" + "@sentry/core": "8.48.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/feedback": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.42.0.tgz", - "integrity": "sha512-dkIw5Wdukwzngg5gNJ0QcK48LyJaMAnBspqTqZ3ItR01STi6Z+6+/Bt5XgmrvDgRD+FNBinflc5zMmfdFXXhvw==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.48.0.tgz", + "integrity": "sha512-6PwcJNHVPg0EfZxmN+XxVOClfQpv7MBAweV8t9i5l7VFr8sM/7wPNSeU/cG7iK19Ug9ZEkBpzMOe3G4GXJ5bpw==", "license": "MIT", "dependencies": { - "@sentry/core": "8.42.0" + "@sentry/core": "8.48.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.42.0.tgz", - "integrity": "sha512-oNcJEBlDfXnRFYC5Mxj5fairyZHNqlnU4g8kPuztB9G5zlsyLgWfPxzcn1ixVQunth2/WZRklDi4o1ZfyHww7w==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.48.0.tgz", + "integrity": "sha512-csILVupc5RkrsTrncuUTGmlB56FQSFjXPYWG8I8yBTGlXEJ+o8oTuF6+55R4vbw3EIzBveXWi4kEBbnQlXW/eg==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/browser-utils": "8.48.0", + "@sentry/core": "8.48.0" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay-canvas": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.42.0.tgz", - "integrity": "sha512-XrPErqVhPsPh/oFLVKvz7Wb+Fi2J1zCPLeZCxWqFuPWI2agRyLVu0KvqJyzSpSrRAEJC/XFzuSVILlYlXXSfgA==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.48.0.tgz", + "integrity": "sha512-LdivLfBXXB9us1aAc6XaL7/L2Ob4vi3C/fEOXElehg3qHjX6q6pewiv5wBvVXGX1NfZTRvu+X11k6TZoxKsezw==", "license": "MIT", "dependencies": { - "@sentry-internal/replay": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/replay": "8.48.0", + "@sentry/core": "8.48.0" }, "engines": { "node": ">=14.18" @@ -1630,16 +1630,16 @@ } }, "node_modules/@sentry/browser": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.42.0.tgz", - "integrity": "sha512-lStrEk609KJHwXfDrOgoYVVoFFExixHywxSExk7ZDtwj2YPv6r6Y1gogvgr7dAZj7jWzadHkxZ33l9EOSJBfug==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.48.0.tgz", + "integrity": "sha512-fuuVULB5/1vI8NoIwXwR3xwhJJqk+y4RdSdajExGF7nnUDBpwUJyXsmYJnOkBO+oLeEs58xaCpotCKiPUNnE3g==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.42.0", - "@sentry-internal/feedback": "8.42.0", - "@sentry-internal/replay": "8.42.0", - "@sentry-internal/replay-canvas": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/browser-utils": "8.48.0", + "@sentry-internal/feedback": "8.48.0", + "@sentry-internal/replay": "8.48.0", + "@sentry-internal/replay-canvas": "8.48.0", + "@sentry/core": "8.48.0" }, "engines": { "node": ">=14.18" @@ -1818,22 +1818,22 @@ } }, "node_modules/@sentry/core": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.42.0.tgz", - "integrity": "sha512-ac6O3pgoIbU6rpwz6LlwW0wp3/GAHuSI0C5IsTgIY6baN8rOBnlAtG6KrHDDkGmUQ2srxkDJu9n1O6Td3cBCqw==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.48.0.tgz", + "integrity": "sha512-VGwYgTfLpvJ5LRO5A+qWo1gpo6SfqaGXL9TOzVgBucAdpzbrYHpZ87sEarDVq/4275uk1b0S293/mfsskFczyw==", "license": "MIT", "engines": { "node": ">=14.18" } }, "node_modules/@sentry/react": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-8.42.0.tgz", - "integrity": "sha512-UBi/WM4oMa+kOA99R7t7Ke57zq6uQw6mALYW4fJ+wuhHZJBLDDDHSGpEUhdWuQ1oWQv/laT34DGS44PJOjfeAg==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-8.48.0.tgz", + "integrity": "sha512-J8XAUOJYbsjXnowTEXE+zWJWLWUzQGP8kMb+smoGdRzFJwwXKrbE709Kr/Boz6rK48EbbRT4UUINoTbHgL3RHQ==", "license": "MIT", "dependencies": { - "@sentry/browser": "8.42.0", - "@sentry/core": "8.42.0", + "@sentry/browser": "8.48.0", + "@sentry/core": "8.48.0", "hoist-non-react-statics": "^3.3.2" }, "engines": { @@ -1881,9 +1881,9 @@ } }, "node_modules/@tauri-apps/api": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.1.1.tgz", - "integrity": "sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.2.0.tgz", + "integrity": "sha512-R8epOeZl1eJEl603aUMIGb4RXlhPjpgxbGVEaqY+0G5JG9vzV/clNlzTeqc+NLYXVqXcn8mb4c5b9pJIUDEyAg==", "license": "Apache-2.0 OR MIT", "funding": { "type": "opencollective", @@ -1891,9 +1891,9 @@ } }, "node_modules/@tauri-apps/cli": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.1.0.tgz", - "integrity": "sha512-K2VhcKqBhAeS5pNOVdnR/xQRU6jwpgmkSL2ejHXcl0m+kaTggT0WRDQnFtPq6NljA7aE03cvwsbCAoFG7vtkJw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.2.2.tgz", + "integrity": "sha512-5fVEdP4t4BT0ymvXZAM78kB0S/TaiRDLDoSRWGxVy1e7XCwuKyST5m6ybeyw/h/soK/91tbf+W3xXXy7XzkT4A==", "dev": true, "license": "Apache-2.0 OR MIT", "bin": { @@ -1907,22 +1907,22 @@ "url": "https://opencollective.com/tauri" }, "optionalDependencies": { - "@tauri-apps/cli-darwin-arm64": "2.1.0", - "@tauri-apps/cli-darwin-x64": "2.1.0", - "@tauri-apps/cli-linux-arm-gnueabihf": "2.1.0", - "@tauri-apps/cli-linux-arm64-gnu": "2.1.0", - "@tauri-apps/cli-linux-arm64-musl": "2.1.0", - "@tauri-apps/cli-linux-x64-gnu": "2.1.0", - "@tauri-apps/cli-linux-x64-musl": "2.1.0", - "@tauri-apps/cli-win32-arm64-msvc": "2.1.0", - "@tauri-apps/cli-win32-ia32-msvc": "2.1.0", - "@tauri-apps/cli-win32-x64-msvc": "2.1.0" + "@tauri-apps/cli-darwin-arm64": "2.2.2", + "@tauri-apps/cli-darwin-x64": "2.2.2", + "@tauri-apps/cli-linux-arm-gnueabihf": "2.2.2", + "@tauri-apps/cli-linux-arm64-gnu": "2.2.2", + "@tauri-apps/cli-linux-arm64-musl": "2.2.2", + "@tauri-apps/cli-linux-x64-gnu": "2.2.2", + "@tauri-apps/cli-linux-x64-musl": "2.2.2", + "@tauri-apps/cli-win32-arm64-msvc": "2.2.2", + "@tauri-apps/cli-win32-ia32-msvc": "2.2.2", + "@tauri-apps/cli-win32-x64-msvc": "2.2.2" } }, "node_modules/@tauri-apps/cli-darwin-arm64": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.1.0.tgz", - "integrity": "sha512-ESc6J6CE8hl1yKH2vJ+ALF+thq4Be+DM1mvmTyUCQObvezNCNhzfS6abIUd3ou4x5RGH51ouiANeT3wekU6dCw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.2.2.tgz", + "integrity": "sha512-JMXbX5hGrLOzJbjisd7gBe25PmHouXA1+f4yVWg5PRlgxW7pla7krOzhu2mchFlMVDr8aLwhMLgohvvx+raXag==", "cpu": [ "arm64" ], @@ -1937,9 +1937,9 @@ } }, "node_modules/@tauri-apps/cli-darwin-x64": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.1.0.tgz", - "integrity": "sha512-TasHS442DFs8cSH2eUQzuDBXUST4ECjCd0yyP+zZzvAruiB0Bg+c8A+I/EnqCvBQ2G2yvWLYG8q/LI7c87A5UA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.2.2.tgz", + "integrity": "sha512-i2gxKXev+Ed0UWeq0xSiyRjSkzzBbu9MCOhs/QVv1YuV+097K/fF89f+a4v5JJftCq2IOHhSKH23KyTJBLnNKQ==", "cpu": [ "x64" ], @@ -1954,9 +1954,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.1.0.tgz", - "integrity": "sha512-aP7ZBGNL4ny07Cbb6kKpUOSrmhcIK2KhjviTzYlh+pPhAptxnC78xQGD3zKQkTi2WliJLPmBYbOHWWQa57lQ9w==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.2.2.tgz", + "integrity": "sha512-iC2HndsN5smmbvEDUQFyTHyYHSgx7OwJ6puyXLLpkAHnQDo4TGSPxIlPeZFSZmEoaJEmHLdG3j1LcFWOKrxWQg==", "cpu": [ "arm" ], @@ -1971,9 +1971,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm64-gnu": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.1.0.tgz", - "integrity": "sha512-ZTdgD5gLeMCzndMT2f358EkoYkZ5T+Qy6zPzU+l5vv5M7dHVN9ZmblNAYYXmoOuw7y+BY4X/rZvHV9pcGrcanQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.2.2.tgz", + "integrity": "sha512-YzK30tleUzWxfIp1davc5RhvmNZxiZQkUnQ4zajGJZ99zxNk8kwvv8nYSC3/J2R8sYpnuv+7CzNyIwA2s6yH+w==", "cpu": [ "arm64" ], @@ -1988,9 +1988,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm64-musl": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.1.0.tgz", - "integrity": "sha512-NzwqjUCilhnhJzusz3d/0i0F1GFrwCQbkwR6yAHUxItESbsGYkZRJk0yMEWkg3PzFnyK4cWTlQJMEU52TjhEzA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.2.2.tgz", + "integrity": "sha512-nOw2apBzOCTiH1fLOjL42ajHNhMzdp640CX5RrWkDYdyVO7YbGmWzrN26PPXohScScXVjSjtDDxdeQV1gHCxhg==", "cpu": [ "arm64" ], @@ -2005,9 +2005,9 @@ } }, "node_modules/@tauri-apps/cli-linux-x64-gnu": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.1.0.tgz", - "integrity": "sha512-TyiIpMEtZxNOQmuFyfJwaaYbg3movSthpBJLIdPlKxSAB2BW0VWLY3/ZfIxm/G2YGHyREkjJvimzYE0i37PnMA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.2.2.tgz", + "integrity": "sha512-Tmm4qVY8yxSugi8sCko1dyZxyPGK8m3tWm+b1J0DXwzxqaoMqNXuYGxkwtUdkznPXEfQSD8OGBfwjXNmVGE91Q==", "cpu": [ "x64" ], @@ -2022,9 +2022,9 @@ } }, "node_modules/@tauri-apps/cli-linux-x64-musl": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.1.0.tgz", - "integrity": "sha512-/dQd0TlaxBdJACrR72DhynWftzHDaX32eBtS5WBrNJ+nnNb+znM3gON6nJ9tSE9jgDa6n1v2BkI/oIDtypfUXw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.2.2.tgz", + "integrity": "sha512-AwAcaCUhmwzOFPvje80g2BAhnkoEpXdl1E0Uk+lvr9makHM0+aV++M5jibD97yxKnK5NrQ9YXPH5Sn6CdncgUg==", "cpu": [ "x64" ], @@ -2039,9 +2039,9 @@ } }, "node_modules/@tauri-apps/cli-win32-arm64-msvc": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.1.0.tgz", - "integrity": "sha512-NdQJO7SmdYqOcE+JPU7bwg7+odfZMWO6g8xF9SXYCMdUzvM2Gv/AQfikNXz5yS7ralRhNFuW32i5dcHlxh4pDg==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.2.2.tgz", + "integrity": "sha512-u7TnwuUAN+eX6R2kDfSM8fsUFiBzNqq9PnAOsQ2qbwbHGbu7mHfGO1OFgnIzBt1C9FolFbENk2pzjiL4R9baXQ==", "cpu": [ "arm64" ], @@ -2056,9 +2056,9 @@ } }, "node_modules/@tauri-apps/cli-win32-ia32-msvc": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.1.0.tgz", - "integrity": "sha512-f5h8gKT/cB8s1ticFRUpNmHqkmaLutT62oFDB7N//2YTXnxst7EpMIn1w+QimxTvTk2gcx6EcW6bEk/y2hZGzg==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.2.2.tgz", + "integrity": "sha512-9KScbGKU6GfHThEYWdlO0+COW/8SDfIXbYgEvEcfZztE4VedHBbI0XfU+l+aS8nJN+fvYX+DtvY0tpDwyo0G4A==", "cpu": [ "ia32" ], @@ -2073,9 +2073,9 @@ } }, "node_modules/@tauri-apps/cli-win32-x64-msvc": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.1.0.tgz", - "integrity": "sha512-P/+LrdSSb5Xbho1LRP4haBjFHdyPdjWvGgeopL96OVtrFpYnfC+RctB45z2V2XxqFk3HweDDxk266btjttfjGw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.2.2.tgz", + "integrity": "sha512-ko8OWCLwFaHfdBaKbRX/C5btNt61v17qKOSQPksuc5PVvY0tAoci09612nEMlYiogZKEtn7VAqSdRAG6h0tz+g==", "cpu": [ "x64" ], @@ -2090,36 +2090,36 @@ } }, "node_modules/@tauri-apps/plugin-os": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-os/-/plugin-os-2.0.0.tgz", - "integrity": "sha512-M7hG/nNyQYTJxVG/UhTKhp9mpXriwWzrs9mqDreB8mIgqA3ek5nHLdwRZJWhkKjZrnDT4v9CpA9BhYeplTlAiA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-os/-/plugin-os-2.2.0.tgz", + "integrity": "sha512-HszbCdbisMlu5QhCNAN8YIWyz2v33abAWha6+uvV2CKX8P5VSct/y+kEe22JeyqrxCnWlQ3DRx7s49Byg7/0EA==", "license": "MIT OR Apache-2.0", "dependencies": { "@tauri-apps/api": "^2.0.0" } }, "node_modules/@tauri-apps/plugin-process": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz", - "integrity": "sha512-OYzi0GnkrF4NAnsHZU7U3tjSoP0PbeAlO7T1Z+vJoBUH9sFQ1NSLqWYWQyf8hcb3gVWe7P1JggjiskO+LST1ug==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.2.0.tgz", + "integrity": "sha512-uypN2Crmyop9z+KRJr3zl71OyVFgTuvHFjsJ0UxxQ/J5212jVa5w4nPEYjIewcn8bUEXacRebwE6F7owgrbhSw==", "license": "MIT OR Apache-2.0", "dependencies": { "@tauri-apps/api": "^2.0.0" } }, "node_modules/@tauri-apps/plugin-shell": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.0.1.tgz", - "integrity": "sha512-akU1b77sw3qHiynrK0s930y8zKmcdrSD60htjH+mFZqv5WaakZA/XxHR3/sF1nNv9Mgmt/Shls37HwnOr00aSw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.2.0.tgz", + "integrity": "sha512-iC3Ic1hLmasoboG7BO+7p+AriSoqAwKrIk+Hpk+S/bjTQdXqbl2GbdclghI4gM32X0bls7xHzIFqhRdrlvJeaA==", "license": "MIT OR Apache-2.0", "dependencies": { "@tauri-apps/api": "^2.0.0" } }, "node_modules/@tauri-apps/plugin-updater": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.0.0.tgz", - "integrity": "sha512-N0cl71g7RPr7zK2Fe5aoIwzw14NcdLcz7XMGFWZVjprsqgDRWoxbnUkknyCQMZthjhGkppCd/wN2MIsUz+eAhQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.3.1.tgz", + "integrity": "sha512-D1MOWDO1Pqy33gloq0iifny+vwHxMyTshzF0q0bJRwibjL5SXd1xSQwBX24TRug7K0QIu8yOnveQHzI3GcdmfA==", "license": "MIT OR Apache-2.0", "dependencies": { "@tauri-apps/api": "^2.0.0" @@ -2247,9 +2247,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", - "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", + "version": "22.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", + "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2262,9 +2262,9 @@ "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, "node_modules/@types/react": { - "version": "18.3.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.14.tgz", - "integrity": "sha512-NzahNKvjNhVjuPBQ+2G7WlxstQ+47kXZNHlUvFakDViuIEfGY926GqhMueQFZ7woG+sPiQKlF36XfrIUVSUfFg==", + "version": "18.3.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz", + "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==", "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -2272,13 +2272,13 @@ } }, "node_modules/@types/react-dom": { - "version": "18.3.2", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.2.tgz", - "integrity": "sha512-Fqp+rcvem9wEnGr3RY8dYNvSQ8PoLqjZ9HLgaPUOjJJD120uDyOxOjc/39M4Kddp9JQCxpGQbnhVQF0C0ncYVg==", + "version": "18.3.5", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz", + "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==", "dev": true, "license": "MIT", - "dependencies": { - "@types/react": "^18" + "peerDependencies": { + "@types/react": "^18.0.0" } }, "node_modules/@types/stylis": { @@ -2301,21 +2301,21 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.17.0.tgz", - "integrity": "sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.1.tgz", + "integrity": "sha512-tJzcVyvvb9h/PB96g30MpxACd9IrunT7GF9wfA9/0TJ1LxGOJx1TdPzSbBBnNED7K9Ka8ybJsnEpiXPktolTLg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.17.0", - "@typescript-eslint/type-utils": "8.17.0", - "@typescript-eslint/utils": "8.17.0", - "@typescript-eslint/visitor-keys": "8.17.0", + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/type-utils": "8.19.1", + "@typescript-eslint/utils": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2326,25 +2326,34 @@ }, "peerDependencies": { "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", - "eslint": "^8.57.0 || ^9.0.0" + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "typescript": ">=4.8.4" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.17.0.tgz", - "integrity": "sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.1.tgz", + "integrity": "sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.17.0", - "@typescript-eslint/types": "8.17.0", - "@typescript-eslint/typescript-estree": "8.17.0", - "@typescript-eslint/visitor-keys": "8.17.0", + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/typescript-estree": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4" }, "engines": { @@ -2355,23 +2364,19 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.17.0.tgz", - "integrity": "sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.1.tgz", + "integrity": "sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.17.0", - "@typescript-eslint/visitor-keys": "8.17.0" + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2382,16 +2387,16 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.17.0.tgz", - "integrity": "sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.1.tgz", + "integrity": "sha512-Rp7k9lhDKBMRJB/nM9Ksp1zs4796wVNyihG9/TU9R6KCJDNkQbc2EOKjrBtLYh3396ZdpXLtr/MkaSEmNMtykw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.17.0", - "@typescript-eslint/utils": "8.17.0", + "@typescript-eslint/typescript-estree": "8.19.1", + "@typescript-eslint/utils": "8.19.1", "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2401,18 +2406,27 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0" + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "typescript": ">=4.8.4" } }, "node_modules/@typescript-eslint/types": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.17.0.tgz", - "integrity": "sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.1.tgz", + "integrity": "sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==", "dev": true, "license": "MIT", "engines": { @@ -2424,20 +2438,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.17.0.tgz", - "integrity": "sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.1.tgz", + "integrity": "sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.17.0", - "@typescript-eslint/visitor-keys": "8.17.0", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2446,10 +2460,8 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { @@ -2465,17 +2477,30 @@ "node": ">=10" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/@typescript-eslint/utils": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.17.0.tgz", - "integrity": "sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.1.tgz", + "integrity": "sha512-IxG5gLO0Ne+KaUc8iW1A+XuKLd63o4wlbI1Zp692n1xojCl/THvgIKXJXBZixTh5dd5+yTJ/VXH7GJaaw21qXA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.17.0", - "@typescript-eslint/types": "8.17.0", - "@typescript-eslint/typescript-estree": "8.17.0" + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/typescript-estree": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2485,22 +2510,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.17.0.tgz", - "integrity": "sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.1.tgz", + "integrity": "sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/types": "8.19.1", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -2638,14 +2659,14 @@ "license": "Python-2.0" }, "node_modules/array-buffer-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", - "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", - "is-array-buffer": "^3.0.4" + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" }, "engines": { "node": ">= 0.4" @@ -2726,16 +2747,16 @@ } }, "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2762,20 +2783,19 @@ } }, "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", - "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", "dev": true, "license": "MIT", "dependencies": { "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.5", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.2.1", - "get-intrinsic": "^1.2.3", - "is-array-buffer": "^3.0.4", - "is-shared-array-buffer": "^1.0.2" + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" }, "engines": { "node": ">= 0.4" @@ -2904,17 +2924,47 @@ } }, "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dev": true, "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", + "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", + "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -3173,15 +3223,15 @@ "license": "MIT" }, "node_modules/data-view-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", - "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" + "is-data-view": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -3191,31 +3241,31 @@ } }, "node_modules/data-view-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", - "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" + "is-data-view": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/inspect-js" } }, "node_modules/data-view-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", - "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-data-view": "^1.0.1" }, @@ -3367,6 +3417,21 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/electron-to-chromium": { "version": "1.5.67", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.67.tgz", @@ -3403,58 +3468,63 @@ } }, "node_modules/es-abstract": { - "version": "1.23.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.5.tgz", - "integrity": "sha512-vlmniQ0WNPwXqA0BnmwV3Ng7HxiGlh6r5U6JcTMNx8OilcAGqVJBHJcPjqOMaczU9fRuRK5Px2BdVyPRnKMMVQ==", + "version": "1.23.9", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", + "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", "dev": true, "license": "MIT", "dependencies": { - "array-buffer-byte-length": "^1.0.1", - "arraybuffer.prototype.slice": "^1.0.3", + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "data-view-buffer": "^1.0.1", - "data-view-byte-length": "^1.0.1", - "data-view-byte-offset": "^1.0.0", - "es-define-property": "^1.0.0", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", - "es-set-tostringtag": "^2.0.3", - "es-to-primitive": "^1.2.1", - "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.4", - "get-symbol-description": "^1.0.2", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.0", + "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", - "gopd": "^1.0.1", + "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", "hasown": "^2.0.2", - "internal-slot": "^1.0.7", - "is-array-buffer": "^3.0.4", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", "is-callable": "^1.2.7", - "is-data-view": "^1.0.1", - "is-negative-zero": "^2.0.3", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.3", - "is-string": "^1.0.7", - "is-typed-array": "^1.1.13", - "is-weakref": "^1.0.2", + "is-data-view": "^1.0.2", + "is-regex": "^1.2.1", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.0", + "math-intrinsics": "^1.1.0", "object-inspect": "^1.13.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.5", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", "regexp.prototype.flags": "^1.5.3", - "safe-array-concat": "^1.1.2", - "safe-regex-test": "^1.0.3", - "string.prototype.trim": "^1.2.9", - "string.prototype.trimend": "^1.0.8", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", - "typed-array-buffer": "^1.0.2", - "typed-array-byte-length": "^1.0.1", - "typed-array-byte-offset": "^1.0.2", - "typed-array-length": "^1.0.6", - "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.15" + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.18" }, "engines": { "node": ">= 0.4" @@ -3464,14 +3534,11 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "dev": true, "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, "engines": { "node": ">= 0.4" } @@ -3487,27 +3554,28 @@ } }, "node_modules/es-iterator-helpers": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.0.tgz", - "integrity": "sha512-tpxqxncxnpw3c93u8n3VOzACmRFoVmWJqbWXvX/JfKbkhBw1oslgPrUfeSt2psuqyEJFD6N/9lg5i7bsKpoq+Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz", + "integrity": "sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "define-properties": "^1.2.1", - "es-abstract": "^1.23.3", + "es-abstract": "^1.23.6", "es-errors": "^1.3.0", "es-set-tostringtag": "^2.0.3", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", + "get-intrinsic": "^1.2.6", "globalthis": "^1.0.4", - "gopd": "^1.0.1", + "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.7", - "iterator.prototype": "^1.1.3", - "safe-array-concat": "^1.1.2" + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.4", + "safe-array-concat": "^1.1.3" }, "engines": { "node": ">= 0.4" @@ -3527,15 +3595,16 @@ } }, "node_modules/es-set-tostringtag": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", - "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", "dev": true, "license": "MIT", "dependencies": { - "get-intrinsic": "^1.2.4", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", - "hasown": "^2.0.1" + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -3632,9 +3701,9 @@ } }, "node_modules/eslint": { - "version": "9.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", - "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", + "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", "dev": true, "license": "MIT", "dependencies": { @@ -3643,7 +3712,7 @@ "@eslint/config-array": "^0.19.0", "@eslint/core": "^0.9.0", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.16.0", + "@eslint/js": "9.17.0", "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -3652,7 +3721,7 @@ "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.5", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.2.0", @@ -3750,29 +3819,29 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.37.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.2.tgz", - "integrity": "sha512-EsTAnj9fLVr/GZleBLFbj/sSuXeWmp1eXIN60ceYnZveqEaUCyW4X+Vh4WTdUhCkW4xutXYqTXCUSyqD4rB75w==", + "version": "7.37.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.3.tgz", + "integrity": "sha512-DomWuTQPFYZwF/7c9W2fkKkStqZmBd3uugfqBYLdkZ3Hii23WzZuOLUskGxB8qkSKqftxEeGL1TB2kMhrce0jA==", "dev": true, "license": "MIT", "dependencies": { "array-includes": "^3.1.8", "array.prototype.findlast": "^1.2.5", - "array.prototype.flatmap": "^1.3.2", + "array.prototype.flatmap": "^1.3.3", "array.prototype.tosorted": "^1.1.4", "doctrine": "^2.1.0", - "es-iterator-helpers": "^1.1.0", + "es-iterator-helpers": "^1.2.1", "estraverse": "^5.3.0", "hasown": "^2.0.2", "jsx-ast-utils": "^2.4.1 || ^3.0.0", "minimatch": "^3.1.2", "object.entries": "^1.1.8", "object.fromentries": "^2.0.8", - "object.values": "^1.2.0", + "object.values": "^1.2.1", "prop-types": "^15.8.1", "resolve": "^2.0.0-next.5", "semver": "^6.3.1", - "string.prototype.matchall": "^4.0.11", + "string.prototype.matchall": "^4.0.12", "string.prototype.repeat": "^1.0.0" }, "engines": { @@ -3783,9 +3852,9 @@ } }, "node_modules/eslint-plugin-react-hooks": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.0.0.tgz", - "integrity": "sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.1.0.tgz", + "integrity": "sha512-mpJRtPgHN2tNAvZ35AMfqeB3Xqeo273QxrHJsbBEPWODRM4r0yB6jfoROqKEYrOn27UtRPpcpHc2UqyBSuUNTw==", "dev": true, "license": "MIT", "engines": { @@ -4096,19 +4165,19 @@ } }, "node_modules/framer-motion": { - "version": "11.13.1", - "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.13.1.tgz", - "integrity": "sha512-F40tpGTHByhn9h3zdBQPcEro+pSLtzARcocbNqAyfBI+u9S+KZuHH/7O9+z+GEkoF3eqFxfvVw0eBDytohwqmQ==", + "version": "11.16.1", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.16.1.tgz", + "integrity": "sha512-xsjhEUSWHn39g334PpBTH+QissgEJVJkpRGS/4QUyMSmoJSNxA+7FTuq61s+OXPMS4muu5k9Y6r7GpcNKhd1xA==", "license": "MIT", "dependencies": { - "motion-dom": "^11.13.0", - "motion-utils": "^11.13.0", + "motion-dom": "^11.16.1", + "motion-utils": "^11.16.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", - "react": "^18.0.0", - "react-dom": "^18.0.0" + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@emotion/is-prop-valid": { @@ -4155,16 +4224,18 @@ } }, "node_modules/function.prototype.name": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", - "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "functions-have-names": "^1.2.3" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" }, "engines": { "node": ">= 0.4" @@ -4194,17 +4265,22 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", + "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", "dev": true, "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.0", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4213,16 +4289,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/get-symbol-description": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", - "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4" + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -4280,9 +4370,9 @@ } }, "node_modules/globals": { - "version": "15.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", - "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", + "version": "15.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", + "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", "license": "MIT", "engines": { "node": ">=18" @@ -4336,13 +4426,13 @@ "license": "MIT" }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "dev": true, "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.3" + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4402,11 +4492,14 @@ } }, "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", "dev": true, "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -4415,9 +4508,9 @@ } }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "dev": true, "license": "MIT", "engines": { @@ -4562,9 +4655,9 @@ } }, "node_modules/i18next-browser-languagedetector": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.0.0.tgz", - "integrity": "sha512-zhXdJXTTCoG39QsrOCiOabnWj2jecouOqbchu3EfhtSHxIB5Uugnm9JaizenOy39h7ne3+fLikIjeW88+rgszw==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.0.2.tgz", + "integrity": "sha512-shBvPmnIyZeD2VU5jVGIOWP7u9qNG3Lj7mpaiPFpbJ3LVfHZJvVzKR4v1Cb91wAOFpNw442N+LGPzHOHsten2g==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.2" @@ -4652,15 +4745,15 @@ "license": "MIT" }, "node_modules/internal-slot": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", - "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", - "hasown": "^2.0.0", - "side-channel": "^1.0.4" + "hasown": "^2.0.2", + "side-channel": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4691,14 +4784,15 @@ } }, "node_modules/is-array-buffer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", - "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -4708,13 +4802,16 @@ } }, "node_modules/is-async-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", - "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.0.tgz", + "integrity": "sha512-GExz9MtyhlZyXYLxzlJRj5WUCE661zhDa1Yna52CN57AJsymh+DvXXjyveSioqSRdxvUrdKdvqB1b5cVKsNpWQ==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4724,13 +4821,16 @@ } }, "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", "dev": true, "license": "MIT", "dependencies": { - "has-bigints": "^1.0.1" + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4750,14 +4850,14 @@ } }, "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.1.tgz", + "integrity": "sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -4796,12 +4896,14 @@ } }, "node_modules/is-data-view": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", - "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", "dev": true, "license": "MIT", "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", "is-typed-array": "^1.1.13" }, "engines": { @@ -4812,13 +4914,14 @@ } }, "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -4848,13 +4951,13 @@ } }, "node_modules/is-finalizationregistry": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.0.tgz", - "integrity": "sha512-qfMdqbAQEwBw78ZyReKnlA8ezmPdb9BemzIIip/JkjaZUhitfXDkkr+3QTboW0JrSXT1QWyYShpvnNHGZ4c4yA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7" + "call-bound": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -4864,13 +4967,16 @@ } }, "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4915,19 +5021,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-negative-zero": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4939,13 +5032,14 @@ } }, "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -4977,14 +5071,16 @@ } }, "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -5007,13 +5103,13 @@ } }, "node_modules/is-shared-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", - "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7" + "call-bound": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -5023,13 +5119,14 @@ } }, "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -5039,13 +5136,15 @@ } }, "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", "dev": true, "license": "MIT", "dependencies": { - "has-symbols": "^1.0.2" + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -5055,13 +5154,13 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", - "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "dev": true, "license": "MIT", "dependencies": { - "which-typed-array": "^1.1.14" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -5084,27 +5183,30 @@ } }, "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.0.tgz", + "integrity": "sha512-SXM8Nwyys6nT5WP6pltOwKytLV7FqQ4UiibxVmW+EIosHcmCqkkjViTb5SNssDlkCiEYRP1/pdWUKVvZBmsR2Q==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2" + "call-bound": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-weakset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", - "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4" + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -5128,17 +5230,18 @@ "license": "ISC" }, "node_modules/iterator.prototype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.3.tgz", - "integrity": "sha512-FW5iMbeQ6rBGm/oKgzq2aW4KvAGpxPzYES8N4g4xNXUKpL1mclMvOe+76AcLDTvD+Ze+sOpVhgdAQEKF4L9iGQ==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", "dev": true, "license": "MIT", "dependencies": { - "define-properties": "^1.2.1", - "get-intrinsic": "^1.2.1", - "has-symbols": "^1.0.3", - "reflect.getprototypeof": "^1.0.4", - "set-function-name": "^2.0.1" + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -5414,6 +5517,16 @@ "node": ">=12" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/mdast-util-from-markdown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", @@ -6060,14 +6173,19 @@ } }, "node_modules/motion-dom": { - "version": "11.13.0", - "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.13.0.tgz", - "integrity": "sha512-Oc1MLGJQ6nrvXccXA89lXtOqFyBmvHtaDcTRGT66o8Czl7nuA8BeHAd9MQV1pQKX0d2RHFBFaw5g3k23hQJt0w==" + "version": "11.16.1", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.16.1.tgz", + "integrity": "sha512-XVNf3iCfZn9OHPZYJQy5YXXLn0NuPNvtT3YCat89oAnr4D88Cr52KqFgKa8dWElBK8uIoQhpJMJEG+dyniYycQ==", + "license": "MIT", + "dependencies": { + "motion-utils": "^11.16.0" + } }, "node_modules/motion-utils": { - "version": "11.13.0", - "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-11.13.0.tgz", - "integrity": "sha512-lq6TzXkH5c/ysJQBxgLXgM01qwBH1b4goTPh57VvZWJbVJZF/0SB31UWEn4EIqbVPf3au88n2rvK17SpDTja1A==" + "version": "11.16.0", + "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-11.16.0.tgz", + "integrity": "sha512-ngdWPjg31rD4WGXFi0eZ00DQQqKKu04QExyv/ymlC+3k+WIgYVFbt6gS5JsFPbJODTF/r8XiE/X+SsoT9c0ocw==", + "license": "MIT" }, "node_modules/ms": { "version": "2.1.3", @@ -6171,15 +6289,17 @@ } }, "node_modules/object.assign": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", - "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "define-properties": "^1.2.1", - "has-symbols": "^1.0.3", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", "object-keys": "^1.1.1" }, "engines": { @@ -6224,13 +6344,14 @@ } }, "node_modules/object.values": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", - "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" }, @@ -6269,6 +6390,24 @@ "node": ">= 0.8.0" } }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -7101,9 +7240,9 @@ } }, "node_modules/react-hook-form": { - "version": "7.53.2", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.53.2.tgz", - "integrity": "sha512-YVel6fW5sOeedd1524pltpHX+jgU2u3DSDtXEaBORNdqiNrsX/nUI/iGXONegttg0mJVnfrIkiV0cmTU6Oo2xw==", + "version": "7.54.2", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.54.2.tgz", + "integrity": "sha512-eHpAUgUjWbZocoQYUHposymRb4ZP6d0uwUnooL2uOybA9/3tPUvoAKqEWK1WaSiTxxOfTpffNZP7QwlnM3/gEg==", "license": "MIT", "engines": { "node": ">=18.0.0" @@ -7117,9 +7256,9 @@ } }, "node_modules/react-i18next": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.1.3.tgz", - "integrity": "sha512-J11oA30FbM3NZegUZjn8ySK903z6PLBz/ZuBYyT1JMR0QPrW6PFXvl1WoUhortdGi9dM0m48/zJQlPskVZXgVw==", + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.4.0.tgz", + "integrity": "sha512-Py6UkX3zV08RTvL6ZANRoBh9sL/ne6rQq79XlkHEdd82cZr2H9usbWpUNVadJntIZP2pu3M2rL1CN+5rQYfYFw==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.25.0", @@ -7154,9 +7293,9 @@ "license": "MIT" }, "node_modules/react-markdown": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", - "integrity": "sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.3.tgz", + "integrity": "sha512-Yk7Z94dbgYTOrdk41Z74GoKA7rThnsbbqBTRYuxoe08qvfQ9tJVhmAKw6BJS/ZORG7kTy/s1QvYzSuaoBA1qfw==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -7217,19 +7356,20 @@ } }, "node_modules/reflect.getprototypeof": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.7.tgz", - "integrity": "sha512-bMvFGIUKlc/eSfXNX+aZ+EL95/EgZzuwA0OBPTbZZDEJw/0AkentjMuM1oiRfwHrshqk4RzdgiTg5CcDalXN5g==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", + "es-abstract": "^1.23.9", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "which-builtin-type": "^1.1.4" + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -7478,15 +7618,16 @@ } }, "node_modules/safe-array-concat": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", - "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4", - "has-symbols": "^1.0.3", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", "isarray": "^2.0.5" }, "engines": { @@ -7496,16 +7637,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safe-regex-test": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", - "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", - "is-regex": "^1.1.4" + "is-regex": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -7567,6 +7725,21 @@ "node": ">= 0.4" } }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/shallowequal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", @@ -7597,16 +7770,73 @@ } }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -7673,24 +7903,25 @@ } }, "node_modules/string.prototype.matchall": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", - "integrity": "sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", + "es-abstract": "^1.23.6", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.7", - "regexp.prototype.flags": "^1.5.2", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", "set-function-name": "^2.0.2", - "side-channel": "^1.0.6" + "side-channel": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -7711,16 +7942,19 @@ } }, "node_modules/string.prototype.trim": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", - "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", "define-properties": "^1.2.1", - "es-abstract": "^1.23.0", - "es-object-atoms": "^1.0.0" + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -7730,16 +7964,20 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", - "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -7812,9 +8050,9 @@ } }, "node_modules/styled-components": { - "version": "6.1.13", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.13.tgz", - "integrity": "sha512-M0+N2xSnAtwcVAQeFEsGWFFxXDftHUD7XrKla06QbpUMmbmtFBMMTcKWvFXtWxuD5qQkB8iU5gk6QASlx2ZRMw==", + "version": "6.1.14", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.14.tgz", + "integrity": "sha512-KtfwhU5jw7UoxdM0g6XU9VZQFV4do+KrM8idiVCH5h4v49W+3p3yMe0icYwJgZQZepa5DbH04Qv8P0/RdcLcgg==", "license": "MIT", "dependencies": { "@emotion/is-prop-valid": "1.2.2", @@ -8037,32 +8275,32 @@ } }, "node_modules/typed-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", - "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "is-typed-array": "^1.1.13" + "is-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" } }, "node_modules/typed-array-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", - "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13" + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" @@ -8072,19 +8310,19 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.3.tgz", - "integrity": "sha512-GsvTyUHTriq6o/bHcTd0vM7OQ9JEdlvluu9YISaA7+KzDzPaIzEeDFNkTfhdE3MYcNhNi0vq/LlegYgIs5yPAw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", "dev": true, "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13", - "reflect.getprototypeof": "^1.0.6" + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" }, "engines": { "node": ">= 0.4" @@ -8115,9 +8353,9 @@ } }, "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "devOptional": true, "license": "Apache-2.0", "bin": { @@ -8129,15 +8367,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.17.0.tgz", - "integrity": "sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.1.tgz", + "integrity": "sha512-LKPUQpdEMVOeKluHi8md7rwLcoXHhwvWp3x+sJkMuq3gGm9yaYJtPo8sRZSblMFJ5pcOGCAak/scKf1mvZDlQw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.17.0", - "@typescript-eslint/parser": "8.17.0", - "@typescript-eslint/utils": "8.17.0" + "@typescript-eslint/eslint-plugin": "8.19.1", + "@typescript-eslint/parser": "8.19.1", + "@typescript-eslint/utils": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -8147,25 +8385,24 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", + "call-bound": "^1.0.3", "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -8430,9 +8667,9 @@ } }, "node_modules/vite-tsconfig-paths": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.3.tgz", - "integrity": "sha512-0bz+PDlLpGfP2CigeSKL9NFTF1KtXkeHGZSSaGQSuPZH77GhoiQaA8IjYgOaynSuwlDTolSUEU0ErVvju3NURg==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.4.tgz", + "integrity": "sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==", "license": "MIT", "dependencies": { "debug": "^4.1.1", @@ -8622,42 +8859,45 @@ } }, "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", "dev": true, "license": "MIT", "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/which-builtin-type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.0.tgz", - "integrity": "sha512-I+qLGQ/vucCby4tf5HsLmGueEla4ZhwTBSqaooS+Y0BuxN4Cp+okmGuV+8mXZ84KDI9BA+oklo+RzKg0ONdSUA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.2", "function.prototype.name": "^1.1.6", "has-tostringtag": "^1.0.2", "is-async-function": "^2.0.0", - "is-date-object": "^1.0.5", + "is-date-object": "^1.1.0", "is-finalizationregistry": "^1.1.0", "is-generator-function": "^1.0.10", - "is-regex": "^1.1.4", + "is-regex": "^1.2.1", "is-weakref": "^1.0.2", "isarray": "^2.0.5", - "which-boxed-primitive": "^1.0.2", + "which-boxed-primitive": "^1.1.0", "which-collection": "^1.0.2", - "which-typed-array": "^1.1.15" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -8686,16 +8926,17 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.16.tgz", - "integrity": "sha512-g+N+GAWiRj66DngFwHvISJd+ITsyphZvD1vChfVg6cEdnzy53GzB3oy0fUNlvhz7H7+MiqhYr26qxQShCpKTTQ==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.18.tgz", + "integrity": "sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==", "dev": true, "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "for-each": "^0.3.3", - "gopd": "^1.0.1", + "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" }, "engines": { @@ -8772,9 +9013,9 @@ } }, "node_modules/zustand": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.2.tgz", - "integrity": "sha512-8qNdnJVJlHlrKXi50LDqqUNmUbuBjoKLrYQBnoChIbVph7vni+sY+YpvdjXG9YLd/Bxr6scMcR+rm5H3aSqPaw==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.3.tgz", + "integrity": "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==", "license": "MIT", "engines": { "node": ">=12.20.0" diff --git a/package.json b/package.json index 3d029c2c8..c989368b1 100644 --- a/package.json +++ b/package.json @@ -16,58 +16,58 @@ "dependencies": { "@floating-ui/react": "^0.26.28", "@lottiefiles/dotlottie-react": "^0.12.0", - "@sentry/react": "^8.42.0", - "@tauri-apps/api": "^2.1.1", - "@tauri-apps/plugin-os": "^2.0.0", - "@tauri-apps/plugin-process": "^2.0.0", - "@tauri-apps/plugin-shell": "^2.0.1", - "@tauri-apps/plugin-updater": "^2.0.0", + "@sentry/react": "^8.48.0", + "@tauri-apps/api": "^2.2.0", + "@tauri-apps/plugin-os": "^2.2.0", + "@tauri-apps/plugin-process": "^2.2.0", + "@tauri-apps/plugin-shell": "^2.2.0", + "@tauri-apps/plugin-updater": "^2.3.1", "emoji-regex": "^10.4.0", - "framer-motion": "^11.13.1", - "globals": "^15.13.0", + "framer-motion": "^11.16.1", + "globals": "^15.14.0", "i18next": "^23.16.8", - "i18next-browser-languagedetector": "^8.0.0", + "i18next-browser-languagedetector": "^8.0.2", "i18next-http-backend": "^2.7.1", "linkify-react": "^4.2.0", "react": "^18.3.1", "react-dom": "^18.2.0", - "react-hook-form": "^7.53.2", - "react-i18next": "^15.1.3", + "react-hook-form": "^7.54.2", + "react-i18next": "^15.4.0", "react-icons": "^5.4.0", - "react-markdown": "^9.0.1", + "react-markdown": "^9.0.3", "socket.io-client": "^4.8.1", - "styled-components": "^6.1.12", + "styled-components": "^6.1.14", "tauri-plugin-sentry-api": "^0.2.0", "use-sync-external-store": "^1.4.0", "uuid": "^10.0.0", - "vite-tsconfig-paths": "^5.1.3", - "zustand": "^5.0.2" + "vite-tsconfig-paths": "^5.1.4", + "zustand": "^5.0.3" }, "devDependencies": { "@eslint/js": "^9.9.0", "@nabla/vite-plugin-eslint": "^2.0.5", "@sentry/vite-plugin": "^2.22.7", "@taplo/cli": "^0.7.0", - "@tauri-apps/cli": "^2.1.0", + "@tauri-apps/cli": "^2.2.2", "@types/eslint__js": "^8.42.3", - "@types/node": "^22.10.1", - "@types/react": "^18.3.14", - "@types/react-dom": "^18.3.2", + "@types/node": "^22.10.5", + "@types/react": "^18.3.18", + "@types/react-dom": "^18.3.5", "@types/uuid": "^10.0.0", "@typescript-eslint/parser": "^8.3.0", "@vitejs/plugin-react": "^4.3.4", "babel-plugin-styled-components": "^2.1.4", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-i18next": "^6.1.1", "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-react": "^7.37.2", - "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react": "^7.37.3", + "eslint-plugin-react-hooks": "^5.1.0", "prettier": "3.3.3", "prettier-eslint": "^16.3.0", "react-qr-code": "^2.0.15", - "typescript": "^5.7.2", - "typescript-eslint": "^8.17.0", + "typescript": "^5.7.3", + "typescript-eslint": "^8.19.1", "vite": "^5.4.11" } } diff --git a/public/assets/glApp.js b/public/assets/glApp.js index 663542fae..9367698e9 100644 --- a/public/assets/glApp.js +++ b/public/assets/glApp.js @@ -1,12 +1,12 @@ -var Gl=Object.defineProperty;var Vl=(i,e,t)=>e in i?Gl(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var N=(i,e,t)=>Vl(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();/** +var kl=Object.defineProperty;var Vl=(i,e,t)=>e in i?kl(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var B=(i,e,t)=>Vl(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const ya="169",ei={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ti={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Wl=0,qa=1,Xl=2,Ta=1,Yl=2,fn=3,Nn=0,Ft=1,_n=2,Un=0,Si=1,Za=2,Ka=3,ja=4,ql=5,Yn=100,Zl=101,Kl=102,jl=103,$l=104,Jl=200,Ql=201,ec=202,tc=203,Os=204,Bs=205,nc=206,ic=207,rc=208,sc=209,ac=210,oc=211,lc=212,cc=213,uc=214,zs=0,Hs=1,ks=2,yi=3,Gs=4,Vs=5,Ws=6,Xs=7,ol=0,hc=1,dc=2,In=0,fc=1,pc=2,mc=3,_c=4,gc=5,vc=6,xc=7,Aa=300,Ti=301,Ai=302,Ys=303,qs=304,Yr=306,Or=1e3,gn=1001,Zs=1002,Rt=1003,Sc=1004,$i=1005,It=1006,es=1007,Zn=1008,Mc=1008,Mn=1009,ll=1010,cl=1011,Gi=1012,ba=1013,jn=1014,tn=1015,Wi=1016,wa=1017,Ra=1018,bi=1020,ul=35902,hl=1021,dl=1022,kt=1023,fl=1024,pl=1025,Mi=1026,wi=1027,ml=1028,Ca=1029,_l=1030,Pa=1031,La=1033,Pr=33776,Lr=33777,Dr=33778,Ur=33779,Ks=35840,js=35841,$s=35842,Js=35843,Qs=36196,ea=37492,ta=37496,na=37808,ia=37809,ra=37810,sa=37811,aa=37812,oa=37813,la=37814,ca=37815,ua=37816,ha=37817,da=37818,fa=37819,pa=37820,ma=37821,Ir=36492,_a=36494,ga=36495,gl=36283,va=36284,xa=36285,Sa=36286,Ec=3200,yc=3201,Tc=0,Ac=1,Ln="",sn="srgb",Fn="srgb-linear",Da="display-p3",qr="display-p3-linear",Br="linear",tt="srgb",zr="rec709",Hr="p3",ni=7680,$a=519,bc=512,wc=513,Rc=514,vl=515,Cc=516,Pc=517,Lc=518,Dc=519,Ja=35044,Uc=35048,Qa="300 es",vn=2e3,kr=2001;class Jn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,o=r.length;s>8&255]+Et[i>>16&255]+Et[i>>24&255]+"-"+Et[e&255]+Et[e>>8&255]+"-"+Et[e>>16&15|64]+Et[e>>24&255]+"-"+Et[t&63|128]+Et[t>>8&255]+"-"+Et[t>>16&255]+Et[t>>24&255]+Et[n&255]+Et[n>>8&255]+Et[n>>16&255]+Et[n>>24&255]).toLowerCase()}function wt(i,e,t){return Math.max(e,Math.min(t,i))}function Ic(i,e){return(i%e+e)%e}function ns(i,e,t){return(1-t)*i+t*e}function Ui(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Lt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class De{constructor(e=0,t=0){De.prototype.isVector2=!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 new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oe{constructor(e,t,n,r,s,o,a,l,c){Oe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],m=n[5],_=n[8],x=r[0],h=r[3],d=r[6],A=r[1],E=r[4],T=r[7],H=r[2],L=r[5],b=r[8];return s[0]=o*x+a*A+l*H,s[3]=o*h+a*E+l*L,s[6]=o*d+a*T+l*b,s[1]=c*x+u*A+f*H,s[4]=c*h+u*E+f*L,s[7]=c*d+u*T+f*b,s[2]=p*x+m*A+_*H,s[5]=p*h+m*E+_*L,s[8]=p*d+m*T+_*b,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,m=c*s-o*l,_=t*f+n*p+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=f*x,e[1]=(r*c-u*n)*x,e[2]=(a*n-r*o)*x,e[3]=p*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(n*l-c*t)*x,e[8]=(o*t-n*s)*x,this}transpose(){let e;const 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){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(is.makeScale(e,t)),this}rotate(e){return this.premultiply(is.makeRotation(-e)),this}translate(e,t){return this.premultiply(is.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const 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){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])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){const 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)}}const is=new Oe;function xl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Vi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Nc(){const i=Vi("canvas");return i.style.display="block",i}const eo={};function Nr(i){i in eo||(eo[i]=!0,console.warn(i))}function Fc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Oc(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Bc(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const to=new Oe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),no=new Oe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ii={[Fn]:{transfer:Br,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[sn]:{transfer:tt,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[qr]:{transfer:Br,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(no),fromReference:i=>i.applyMatrix3(to)},[Da]:{transfer:tt,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(no),fromReference:i=>i.applyMatrix3(to).convertLinearToSRGB()}},zc=new Set([Fn,qr]),Ze={enabled:!0,_workingColorSpace:Fn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!zc.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=Ii[e].toReference,r=Ii[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return Ii[i].primaries},getTransfer:function(i){return i===Ln?Br:Ii[i].transfer},getLuminanceCoefficients:function(i,e=this._workingColorSpace){return i.fromArray(Ii[e].luminanceCoefficients)}};function Ei(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function rs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ii;class Hc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ii===void 0&&(ii=Vi("canvas")),ii.width=e.width,ii.height=e.height;const n=ii.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ii}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Vi("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Aa)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Or:e.x=e.x-Math.floor(e.x);break;case gn:e.x=e.x<0?0:1;break;case Zs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Or:e.y=e.y-Math.floor(e.y);break;case gn:e.y=e.y<0?0:1;break;case Zs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}At.DEFAULT_IMAGE=null;At.DEFAULT_MAPPING=Aa;At.DEFAULT_ANISOTROPY=1;class lt{constructor(e=0,t=0,n=0,r=1){lt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?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){const t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],m=l[5],_=l[9],x=l[2],h=l[6],d=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-x)<.01&&Math.abs(_-h)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+x)<.1&&Math.abs(_+h)<.1&&Math.abs(c+m+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,T=(m+1)/2,H=(d+1)/2,L=(u+p)/4,b=(f+x)/4,z=(_+h)/4;return E>T&&E>H?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=L/n,s=b/n):T>H?T<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),n=L/r,s=z/r):H<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(H),n=b/s,r=z/s),this.set(n,r,s,t),this}let A=Math.sqrt((h-_)*(h-_)+(f-x)*(f-x)+(p-u)*(p-u));return Math.abs(A)<.001&&(A=1),this.x=(h-_)/A,this.y=(f-x)/A,this.z=(p-u)/A,this.w=Math.acos((c+m+d-1)/2),this}setFromMatrixPosition(e){const 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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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 Vc extends Jn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new lt(0,0,e,t),this.scissorTest=!1,this.viewport=new lt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:It,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new At(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a=0?1:-1,E=1-d*d;if(E>Number.EPSILON){const H=Math.sqrt(E),L=Math.atan2(H,d*A);h=Math.sin(h*L)/H,a=Math.sin(a*L)/H}const T=a*A;if(l=l*h+p*T,c=c*h+m*T,u=u*h+_*T,f=f*h+x*T,h===1-a){const H=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=H,c*=H,u*=H,f*=H}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],m=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*m-c*p,e[t+1]=l*_+u*p+c*f-a*m,e[t+2]=c*_+u*m+a*p-l*f,e[t+3]=u*_-a*f-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),m=l(r/2),_=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"YXZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"ZXY":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"ZYX":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"YZX":this._x=p*u*f+c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f-p*m*_;break;case"XZY":this._x=p*u*f-c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f+p*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(n>a&&n>f){const m=2*Math.sqrt(1+n-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>f){const m=2*Math.sqrt(1+a-n-f);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-n-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*f+this._w*p,this._x=n*f+this._x*p,this._y=r*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*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 U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(io.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(io.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}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){const n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return as.copy(this).projectOnVector(e),this.sub(as)}reflect(e){return this.sub(as.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const 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}}const as=new U,io=new Yt;class Yi{constructor(e=new U(1/0,1/0,1/0),t=new U(-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=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,Zt),Zt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ni),Qi.subVectors(this.max,Ni),ri.subVectors(e.a,Ni),si.subVectors(e.b,Ni),ai.subVectors(e.c,Ni),Tn.subVectors(si,ri),An.subVectors(ai,si),Bn.subVectors(ri,ai);let t=[0,-Tn.z,Tn.y,0,-An.z,An.y,0,-Bn.z,Bn.y,Tn.z,0,-Tn.x,An.z,0,-An.x,Bn.z,0,-Bn.x,-Tn.y,Tn.x,0,-An.y,An.x,0,-Bn.y,Bn.x,0];return!os(t,ri,si,ai,Qi)||(t=[1,0,0,0,1,0,0,0,1],!os(t,ri,si,ai,Qi))?!1:(er.crossVectors(Tn,An),t=[er.x,er.y,er.z],os(t,ri,si,ai,Qi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Zt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Zt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ln),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)}}const ln=[new U,new U,new U,new U,new U,new U,new U,new U],Zt=new U,Ji=new Yi,ri=new U,si=new U,ai=new U,Tn=new U,An=new U,Bn=new U,Ni=new U,Qi=new U,er=new U,zn=new U;function os(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){zn.fromArray(i,s);const a=r.x*Math.abs(zn.x)+r.y*Math.abs(zn.y)+r.z*Math.abs(zn.z),l=e.dot(zn),c=t.dot(zn),u=n.dot(zn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Xc=new Yi,Fi=new U,ls=new U;class Zr{constructor(e=new U,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){const n=this.center;t!==void 0?n.copy(t):Xc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=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;Fi.subVectors(e,this.center);const t=Fi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Fi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ls.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(ls)),this.expandByPoint(Fi.copy(e.center).sub(ls))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const cn=new U,cs=new U,tr=new U,bn=new U,us=new U,nr=new U,hs=new U;class El{constructor(e=new U,t=new U(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,cn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=cn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cn.copy(this.origin).addScaledVector(this.direction,t),cn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){cs.copy(e).add(t).multiplyScalar(.5),tr.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(cs);const s=e.distanceTo(t)*.5,o=-this.direction.dot(tr),a=bn.dot(this.direction),l=-bn.dot(tr),c=bn.lengthSq(),u=Math.abs(1-o*o);let f,p,m,_;if(u>0)if(f=o*l-a,p=o*a-l,_=s*u,f>=0)if(p>=-_)if(p<=_){const x=1/u;f*=x,p*=x,m=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p<=-_?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c):p<=_?(f=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(cs).addScaledVector(tr,p),m}intersectSphere(e,t){cn.subVectors(e.center,this.origin);const n=cn.dot(this.direction),r=cn.dot(cn)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,cn)!==null}intersectTriangle(e,t,n,r,s){us.subVectors(t,e),nr.subVectors(n,e),hs.crossVectors(us,nr);let o=this.direction.dot(hs),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;bn.subVectors(this.origin,e);const l=a*this.direction.dot(nr.crossVectors(bn,nr));if(l<0)return null;const c=a*this.direction.dot(us.cross(bn));if(c<0||l+c>o)return null;const u=-a*bn.dot(hs);return u<0?null:this.at(u/o,s)}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 it{constructor(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){it.prototype.isMatrix4=!0,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,r,s,o,a,l,c,u,f,p,m,_,x,h)}set(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=p,d[3]=m,d[7]=_,d[11]=x,d[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new it().fromArray(this.elements)}copy(e){const 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){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 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){const t=this.elements,n=e.elements,r=1/oi.setFromMatrixColumn(e,0).length(),s=1/oi.setFromMatrixColumn(e,1).length(),o=1/oi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=m+_*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=_+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p+x*a,t[4]=_*a-m,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=m*a-_,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p-x*a,t[4]=-o*f,t[8]=_+m*a,t[1]=m+_*a,t[5]=o*u,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=_*c-m,t[8]=p*c+x,t[1]=l*f,t[5]=x*c+p,t[9]=m*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=x-p*f,t[8]=_*f+m,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*f+_,t[10]=p-x*f}else if(e.order==="XZY"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+x,t[5]=o*u,t[9]=m*f-_,t[2]=_*f-m,t[6]=a*u,t[10]=x*f+p}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(Yc,e,qc)}lookAt(e,t,n){const r=this.elements;return zt.subVectors(e,t),zt.lengthSq()===0&&(zt.z=1),zt.normalize(),wn.crossVectors(n,zt),wn.lengthSq()===0&&(Math.abs(n.z)===1?zt.x+=1e-4:zt.z+=1e-4,zt.normalize(),wn.crossVectors(n,zt)),wn.normalize(),ir.crossVectors(zt,wn),r[0]=wn.x,r[4]=ir.x,r[8]=zt.x,r[1]=wn.y,r[5]=ir.y,r[9]=zt.y,r[2]=wn.z,r[6]=ir.z,r[10]=zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],m=n[13],_=n[2],x=n[6],h=n[10],d=n[14],A=n[3],E=n[7],T=n[11],H=n[15],L=r[0],b=r[4],z=r[8],ie=r[12],g=r[1],M=r[5],W=r[9],k=r[13],K=r[2],Q=r[6],X=r[10],J=r[14],V=r[3],fe=r[7],pe=r[11],ve=r[15];return s[0]=o*L+a*g+l*K+c*V,s[4]=o*b+a*M+l*Q+c*fe,s[8]=o*z+a*W+l*X+c*pe,s[12]=o*ie+a*k+l*J+c*ve,s[1]=u*L+f*g+p*K+m*V,s[5]=u*b+f*M+p*Q+m*fe,s[9]=u*z+f*W+p*X+m*pe,s[13]=u*ie+f*k+p*J+m*ve,s[2]=_*L+x*g+h*K+d*V,s[6]=_*b+x*M+h*Q+d*fe,s[10]=_*z+x*W+h*X+d*pe,s[14]=_*ie+x*k+h*J+d*ve,s[3]=A*L+E*g+T*K+H*V,s[7]=A*b+E*M+T*Q+H*fe,s[11]=A*z+E*W+T*X+H*pe,s[15]=A*ie+E*k+T*J+H*ve,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],m=e[14],_=e[3],x=e[7],h=e[11],d=e[15];return _*(+s*l*f-r*c*f-s*a*p+n*c*p+r*a*m-n*l*m)+x*(+t*l*m-t*c*p+s*o*p-r*o*m+r*c*u-s*l*u)+h*(+t*c*f-t*a*m-s*o*f+n*o*m+s*a*u-n*c*u)+d*(-r*a*u-t*l*f+t*a*p+r*o*f-n*o*p+n*l*u)}transpose(){const e=this.elements;let 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){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],m=e[11],_=e[12],x=e[13],h=e[14],d=e[15],A=f*h*c-x*p*c+x*l*m-a*h*m-f*l*d+a*p*d,E=_*p*c-u*h*c-_*l*m+o*h*m+u*l*d-o*p*d,T=u*x*c-_*f*c+_*a*m-o*x*m-u*a*d+o*f*d,H=_*f*l-u*x*l-_*a*p+o*x*p+u*a*h-o*f*h,L=t*A+n*E+r*T+s*H;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/L;return e[0]=A*b,e[1]=(x*p*s-f*h*s-x*r*m+n*h*m+f*r*d-n*p*d)*b,e[2]=(a*h*s-x*l*s+x*r*c-n*h*c-a*r*d+n*l*d)*b,e[3]=(f*l*s-a*p*s-f*r*c+n*p*c+a*r*m-n*l*m)*b,e[4]=E*b,e[5]=(u*h*s-_*p*s+_*r*m-t*h*m-u*r*d+t*p*d)*b,e[6]=(_*l*s-o*h*s-_*r*c+t*h*c+o*r*d-t*l*d)*b,e[7]=(o*p*s-u*l*s+u*r*c-t*p*c-o*r*m+t*l*m)*b,e[8]=T*b,e[9]=(_*f*s-u*x*s-_*n*m+t*x*m+u*n*d-t*f*d)*b,e[10]=(o*x*s-_*a*s+_*n*c-t*x*c-o*n*d+t*a*d)*b,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*m-t*a*m)*b,e[12]=H*b,e[13]=(u*x*r-_*f*r+_*n*p-t*x*p-u*n*h+t*f*h)*b,e[14]=(_*a*r-o*x*r-_*n*l+t*x*l+o*n*h-t*a*h)*b,e[15]=(o*f*r-u*a*r+u*n*l-t*f*l-o*n*p+t*a*p)*b,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const 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){const 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){const 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){const n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,m=s*u,_=s*f,x=o*u,h=o*f,d=a*f,A=l*c,E=l*u,T=l*f,H=n.x,L=n.y,b=n.z;return r[0]=(1-(x+d))*H,r[1]=(m+T)*H,r[2]=(_-E)*H,r[3]=0,r[4]=(m-T)*L,r[5]=(1-(p+d))*L,r[6]=(h+A)*L,r[7]=0,r[8]=(_+E)*b,r[9]=(h-A)*b,r[10]=(1-(p+x))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=oi.set(r[0],r[1],r[2]).length();const o=oi.set(r[4],r[5],r[6]).length(),a=oi.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Kt.copy(this);const c=1/s,u=1/o,f=1/a;return Kt.elements[0]*=c,Kt.elements[1]*=c,Kt.elements[2]*=c,Kt.elements[4]*=u,Kt.elements[5]*=u,Kt.elements[6]*=u,Kt.elements[8]*=f,Kt.elements[9]*=f,Kt.elements[10]*=f,t.setFromRotationMatrix(Kt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,r,s,o,a=vn){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),f=(t+e)/(t-e),p=(n+r)/(n-r);let m,_;if(a===vn)m=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===kr)m=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=vn){const l=this.elements,c=1/(t-e),u=1/(n-r),f=1/(o-s),p=(t+e)*c,m=(n+r)*u;let _,x;if(a===vn)_=(o+s)*f,x=-2*f;else if(a===kr)_=s*f,x=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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){const 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}}const oi=new U,Kt=new it,Yc=new U(0,0,0),qc=new U(1,1,1),wn=new U,ir=new U,zt=new U,ro=new it,so=new Yt;class En{constructor(e=0,t=0,n=0,r=En.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(wt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-wt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(wt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-wt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(wt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-wt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ro.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ro,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return so.setFromEuler(this),this.setFromQuaternion(so,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}En.DEFAULT_ORDER="XYZ";class yl{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),_.length>0&&(n.nodes=_)}return n.object=r,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){jt.subVectors(r,t),hn.subVectors(n,t),fs.subVectors(e,t);const o=jt.dot(jt),a=jt.dot(hn),l=jt.dot(fs),c=hn.dot(hn),u=hn.dot(fs),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,m=(c*l-a*u)*p,_=(o*u-a*l)*p;return s.set(1-m-_,_,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,dn)===null?!1:dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,dn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,dn.x),l.addScaledVector(o,dn.y),l.addScaledVector(a,dn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return gs.setScalar(0),vs.setScalar(0),xs.setScalar(0),gs.fromBufferAttribute(e,t),vs.fromBufferAttribute(e,n),xs.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(gs,s.x),o.addScaledVector(vs,s.y),o.addScaledVector(xs,s.z),o}static isFrontFacing(e,t,n,r){return jt.subVectors(n,t),hn.subVectors(e,t),jt.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return jt.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),jt.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return en.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return en.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return en.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return en.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return en.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,a;ui.subVectors(r,n),hi.subVectors(s,n),ps.subVectors(e,n);const l=ui.dot(ps),c=hi.dot(ps);if(l<=0&&c<=0)return t.copy(n);ms.subVectors(e,r);const u=ui.dot(ms),f=hi.dot(ms);if(u>=0&&f<=u)return t.copy(r);const p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(ui,o);_s.subVectors(e,s);const m=ui.dot(_s),_=hi.dot(_s);if(_>=0&&m<=_)return t.copy(s);const x=m*c-l*_;if(x<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(hi,a);const h=u*_-m*f;if(h<=0&&f-u>=0&&m-_>=0)return ho.subVectors(s,r),a=(f-u)/(f-u+(m-_)),t.copy(r).addScaledVector(ho,a);const d=1/(h+x+p);return o=x*d,a=p*d,t.copy(n).addScaledVector(ui,o).addScaledVector(hi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Tl={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},Rn={h:0,s:0,l:0},sr={h:0,s:0,l:0};function Ss(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class we{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){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ze.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ze.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ze.workingColorSpace){if(e=Ic(e,1),t=wt(t,0,1),n=wt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Ss(o,s,e+1/3),this.g=Ss(o,s,e),this.b=Ss(o,s,e-1/3)}return Ze.toWorkingColorSpace(this,r),this}setStyle(e,t=sn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){const n=Tl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),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=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this}copyLinearToSRGB(e){return this.r=rs(e.r),this.g=rs(e.g),this.b=rs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return Ze.fromWorkingColorSpace(yt.copy(this),e),Math.round(wt(yt.r*255,0,255))*65536+Math.round(wt(yt.g*255,0,255))*256+Math.round(wt(yt.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ze.workingColorSpace){Ze.fromWorkingColorSpace(yt.copy(this),t);const n=yt.r,r=yt.g,s=yt.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Si&&(n.blending=this.blending),this.side!==Nn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Os&&(n.blendSrc=this.blendSrc),this.blendDst!==Bs&&(n.blendDst=this.blendDst),this.blendEquation!==Yn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==yi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$a&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ni&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ni&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ni&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Al extends qi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new we(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 En,this.combine=ol,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const dt=new U,ar=new De;class Gt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Ja,this.updateRanges=[],this.gpuType=tn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let p=0,m=f.length;p0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(fo.copy(s).invert(),Hn.copy(e.ray).applyMatrix4(fo),!(n.boundingBox!==null&&Hn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Hn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=p.length;_t.far?null:{distance:c,point:dr.clone(),object:i}}function fr(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,lr),i.getVertexPosition(l,cr),i.getVertexPosition(c,ur);const u=eu(i,e,t,n,lr,cr,ur,mo);if(u){const f=new U;en.getBarycoord(mo,lr,cr,ur,f),r&&(u.uv=en.getInterpolatedAttribute(r,a,l,c,f,new De)),s&&(u.uv1=en.getInterpolatedAttribute(s,a,l,c,f,new De)),o&&(u.normal=en.getInterpolatedAttribute(o,a,l,c,f,new U),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new U,materialIndex:0};en.getNormal(lr,cr,ur,p.normal),u.face=p,u.barycoord=f}return u}class Zi extends rn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let p=0,m=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,r,o,2),_("x","z","y",1,-1,e,n,-t,r,o,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nn(c,3)),this.setAttribute("normal",new nn(u,3)),this.setAttribute("uv",new nn(f,2));function _(x,h,d,A,E,T,H,L,b,z,ie){const g=T/b,M=H/z,W=T/2,k=H/2,K=L/2,Q=b+1,X=z+1;let J=0,V=0;const fe=new U;for(let pe=0;pe0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(We/b),f.push(1-pe/z),J+=1}}for(let pe=0;pe>8&255]+bt[i>>16&255]+bt[i>>24&255]+"-"+bt[e&255]+bt[e>>8&255]+"-"+bt[e>>16&15|64]+bt[e>>24&255]+"-"+bt[t&63|128]+bt[t>>8&255]+"-"+bt[t>>16&255]+bt[t>>24&255]+bt[n&255]+bt[n>>8&255]+bt[n>>16&255]+bt[n>>24&255]).toLowerCase()}function Ge(i,e,t){return Math.max(e,Math.min(t,i))}function Uc(i,e){return(i%e+e)%e}function ns(i,e,t){return(1-t)*i+t*e}function Hi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Ut(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Le{constructor(e=0,t=0){Le.prototype.isVector2=!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 new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ze{constructor(e,t,n,r,s,o,a,l,c){ze.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],d=n[7],f=n[2],m=n[5],_=n[8],v=r[0],p=r[3],h=r[6],b=r[1],T=r[4],M=r[7],I=r[2],L=r[5],w=r[8];return s[0]=o*v+a*b+l*I,s[3]=o*p+a*T+l*L,s[6]=o*h+a*M+l*w,s[1]=c*v+u*b+d*I,s[4]=c*p+u*T+d*L,s[7]=c*h+u*M+d*w,s[2]=f*v+m*b+_*I,s[5]=f*p+m*T+_*L,s[8]=f*h+m*M+_*w,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*o-a*c,f=a*l-u*s,m=c*s-o*l,_=t*d+n*f+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=d*v,e[1]=(r*c-u*n)*v,e[2]=(a*n-r*o)*v,e[3]=f*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-a*t)*v,e[6]=m*v,e[7]=(n*l-c*t)*v,e[8]=(o*t-n*s)*v,this}transpose(){let e;const 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){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(is.makeScale(e,t)),this}rotate(e){return this.premultiply(is.makeRotation(-e)),this}translate(e,t){return this.premultiply(is.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const 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){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])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){const 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)}}const is=new ze;function gl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Ki(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Ic(){const i=Ki("canvas");return i.style.display="block",i}const $a={};function Ei(i){i in $a||($a[i]=!0,console.warn(i))}function Nc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Fc(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Oc(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ja=new ze().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qa=new ze().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Bc(){const i={enabled:!0,workingColorSpace:Ui,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===nt&&(r.r=An(r.r),r.g=An(r.g),r.b=An(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===nt&&(r.r=wi(r.r),r.g=wi(r.g),r.b=wi(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Nn?Gr:this.spaces[r].transfer},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}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ui]:{primaries:e,whitePoint:n,transfer:Gr,toXYZ:Ja,fromXYZ:Qa,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Zt},outputColorSpaceConfig:{drawingBufferColorSpace:Zt}},[Zt]:{primaries:e,whitePoint:n,transfer:nt,toXYZ:Ja,fromXYZ:Qa,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Zt}}}),i}const qe=Bc();function An(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function wi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let oi;class zc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{oi===void 0&&(oi=Ki("canvas")),oi.width=e.width,oi.height=e.height;const n=oi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=oi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Ki("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ta)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Vr:e.x=e.x-Math.floor(e.x);break;case Mn:e.x=e.x<0?0:1;break;case qs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Vr:e.y=e.y-Math.floor(e.y);break;case Mn:e.y=e.y<0?0:1;break;case qs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=Ta;Ct.DEFAULT_ANISOTROPY=1;class ht{constructor(e=0,t=0,n=0,r=1){ht.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?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){const t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,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);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],f=l[1],m=l[5],_=l[9],v=l[2],p=l[6],h=l[10];if(Math.abs(u-f)<.01&&Math.abs(d-v)<.01&&Math.abs(_-p)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+v)<.1&&Math.abs(_+p)<.1&&Math.abs(c+m+h-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,M=(m+1)/2,I=(h+1)/2,L=(u+f)/4,w=(d+v)/4,F=(_+p)/4;return T>M&&T>I?T<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(T),r=L/n,s=w/n):M>I?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=L/r,s=F/r):I<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),n=w/s,r=F/s),this.set(n,r,s,t),this}let b=Math.sqrt((p-_)*(p-_)+(d-v)*(d-v)+(f-u)*(f-u));return Math.abs(b)<.001&&(b=1),this.x=(p-_)/b,this.y=(d-v)/b,this.z=(f-u)/b,this.w=Math.acos((c+m+h-1)/2),this}setFromMatrixPosition(e){const 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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this.w=Ge(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this.w=Ge(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(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 Vc extends ni{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Vt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Ct(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a=0?1:-1,T=1-h*h;if(T>Number.EPSILON){const I=Math.sqrt(T),L=Math.atan2(I,h*b);p=Math.sin(p*L)/I,a=Math.sin(a*L)/I}const M=a*b;if(l=l*p+f*M,c=c*p+m*M,u=u*p+_*M,d=d*p+v*M,p===1-a){const I=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=I,c*=I,u*=I,d*=I}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],d=s[o],f=s[o+1],m=s[o+2],_=s[o+3];return e[t]=a*_+u*d+l*m-c*f,e[t+1]=l*_+u*f+c*d-a*m,e[t+2]=c*_+u*m+a*f-l*d,e[t+3]=u*_-a*d-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),d=a(s/2),f=l(n/2),m=l(r/2),_=l(s/2);switch(o){case"XYZ":this._x=f*u*d+c*m*_,this._y=c*m*d-f*u*_,this._z=c*u*_+f*m*d,this._w=c*u*d-f*m*_;break;case"YXZ":this._x=f*u*d+c*m*_,this._y=c*m*d-f*u*_,this._z=c*u*_-f*m*d,this._w=c*u*d+f*m*_;break;case"ZXY":this._x=f*u*d-c*m*_,this._y=c*m*d+f*u*_,this._z=c*u*_+f*m*d,this._w=c*u*d-f*m*_;break;case"ZYX":this._x=f*u*d-c*m*_,this._y=c*m*d+f*u*_,this._z=c*u*_-f*m*d,this._w=c*u*d+f*m*_;break;case"YZX":this._x=f*u*d+c*m*_,this._y=c*m*d+f*u*_,this._z=c*u*_-f*m*d,this._w=c*u*d-f*m*_;break;case"XZY":this._x=f*u*d-c*m*_,this._y=c*m*d-f*u*_,this._z=c*u*_+f*m*d,this._w=c*u*d+f*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],d=t[10],f=n+a+d;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(n>a&&n>d){const m=2*Math.sqrt(1+n-a-d);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>d){const m=2*Math.sqrt(1+a-n-d);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+d-n-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ge(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*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{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),d=2*(s*n-o*t);return this.x=t+l*c+o*d-a*u,this.y=n+l*u+a*c-s*d,this.z=r+l*d+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(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){const n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ss.copy(this).projectOnVector(e),this.sub(ss)}reflect(e){return this.sub(ss.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const 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}}const ss=new N,eo=new ln;class Qi{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=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,Jt),Jt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ki),ar.subVectors(this.max,ki),li.subVectors(e.a,ki),ci.subVectors(e.b,ki),ui.subVectors(e.c,ki),Rn.subVectors(ci,li),Cn.subVectors(ui,ci),Vn.subVectors(li,ui);let t=[0,-Rn.z,Rn.y,0,-Cn.z,Cn.y,0,-Vn.z,Vn.y,Rn.z,0,-Rn.x,Cn.z,0,-Cn.x,Vn.z,0,-Vn.x,-Rn.y,Rn.x,0,-Cn.y,Cn.x,0,-Vn.y,Vn.x,0];return!as(t,li,ci,ui,ar)||(t=[1,0,0,0,1,0,0,0,1],!as(t,li,ci,ui,ar))?!1:(or.crossVectors(Rn,Cn),t=[or.x,or.y,or.z],as(t,li,ci,ui,ar))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(dn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),dn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),dn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),dn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),dn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),dn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),dn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),dn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(dn),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)}}const dn=[new N,new N,new N,new N,new N,new N,new N,new N],Jt=new N,sr=new Qi,li=new N,ci=new N,ui=new N,Rn=new N,Cn=new N,Vn=new N,ki=new N,ar=new N,or=new N,Gn=new N;function as(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Gn.fromArray(i,s);const a=r.x*Math.abs(Gn.x)+r.y*Math.abs(Gn.y)+r.z*Math.abs(Gn.z),l=e.dot(Gn),c=t.dot(Gn),u=n.dot(Gn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Wc=new Qi,Vi=new N,os=new N;class Kr{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){const n=this.center;t!==void 0?n.copy(t):Wc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=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;Vi.subVectors(e,this.center);const t=Vi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Vi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(os.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Vi.copy(e.center).add(os)),this.expandByPoint(Vi.copy(e.center).sub(os))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const fn=new N,ls=new N,lr=new N,Pn=new N,cs=new N,cr=new N,us=new N;class Sl{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,fn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=fn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fn.copy(this.origin).addScaledVector(this.direction,t),fn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ls.copy(e).add(t).multiplyScalar(.5),lr.copy(t).sub(e).normalize(),Pn.copy(this.origin).sub(ls);const s=e.distanceTo(t)*.5,o=-this.direction.dot(lr),a=Pn.dot(this.direction),l=-Pn.dot(lr),c=Pn.lengthSq(),u=Math.abs(1-o*o);let d,f,m,_;if(u>0)if(d=o*l-a,f=o*a-l,_=s*u,d>=0)if(f>=-_)if(f<=_){const v=1/u;d*=v,f*=v,m=d*(d+o*f+2*a)+f*(o*d+f+2*l)+c}else f=s,d=Math.max(0,-(o*f+a)),m=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(o*f+a)),m=-d*d+f*(f+2*l)+c;else f<=-_?(d=Math.max(0,-(-o*s+a)),f=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c):f<=_?(d=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(d=Math.max(0,-(o*s+a)),f=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c);else f=o>0?-s:s,d=Math.max(0,-(o*f+a)),m=-d*d+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(ls).addScaledVector(lr,f),m}intersectSphere(e,t){fn.subVectors(e.center,this.origin);const n=fn.dot(this.direction),r=fn.dot(fn)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(a=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,fn)!==null}intersectTriangle(e,t,n,r,s){cs.subVectors(t,e),cr.subVectors(n,e),us.crossVectors(cs,cr);let o=this.direction.dot(us),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Pn.subVectors(this.origin,e);const l=a*this.direction.dot(cr.crossVectors(Pn,cr));if(l<0)return null;const c=a*this.direction.dot(cs.cross(Pn));if(c<0||l+c>o)return null;const u=-a*Pn.dot(us);return u<0?null:this.at(u/o,s)}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 ot{constructor(e,t,n,r,s,o,a,l,c,u,d,f,m,_,v,p){ot.prototype.isMatrix4=!0,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,r,s,o,a,l,c,u,d,f,m,_,v,p)}set(e,t,n,r,s,o,a,l,c,u,d,f,m,_,v,p){const h=this.elements;return h[0]=e,h[4]=t,h[8]=n,h[12]=r,h[1]=s,h[5]=o,h[9]=a,h[13]=l,h[2]=c,h[6]=u,h[10]=d,h[14]=f,h[3]=m,h[7]=_,h[11]=v,h[15]=p,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 ot().fromArray(this.elements)}copy(e){const 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){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 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){const t=this.elements,n=e.elements,r=1/hi.setFromMatrixColumn(e,0).length(),s=1/hi.setFromMatrixColumn(e,1).length(),o=1/hi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=o*u,m=o*d,_=a*u,v=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=m+_*c,t[5]=f-v*c,t[9]=-a*l,t[2]=v-f*c,t[6]=_+m*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,m=l*d,_=c*u,v=c*d;t[0]=f+v*a,t[4]=_*a-m,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=m*a-_,t[6]=v+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,m=l*d,_=c*u,v=c*d;t[0]=f-v*a,t[4]=-o*d,t[8]=_+m*a,t[1]=m+_*a,t[5]=o*u,t[9]=v-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,m=o*d,_=a*u,v=a*d;t[0]=l*u,t[4]=_*c-m,t[8]=f*c+v,t[1]=l*d,t[5]=v*c+f,t[9]=m*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,m=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=v-f*d,t[8]=_*d+m,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*d+_,t[10]=f-v*d}else if(e.order==="XZY"){const f=o*l,m=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=f*d+v,t[5]=o*u,t[9]=m*d-_,t[2]=_*d-m,t[6]=a*u,t[10]=v*d+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(Xc,e,Yc)}lookAt(e,t,n){const r=this.elements;return Ht.subVectors(e,t),Ht.lengthSq()===0&&(Ht.z=1),Ht.normalize(),Ln.crossVectors(n,Ht),Ln.lengthSq()===0&&(Math.abs(n.z)===1?Ht.x+=1e-4:Ht.z+=1e-4,Ht.normalize(),Ln.crossVectors(n,Ht)),Ln.normalize(),ur.crossVectors(Ht,Ln),r[0]=Ln.x,r[4]=ur.x,r[8]=Ht.x,r[1]=Ln.y,r[5]=ur.y,r[9]=Ht.y,r[2]=Ln.z,r[6]=ur.z,r[10]=Ht.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],d=n[5],f=n[9],m=n[13],_=n[2],v=n[6],p=n[10],h=n[14],b=n[3],T=n[7],M=n[11],I=n[15],L=r[0],w=r[4],F=r[8],E=r[12],S=r[1],C=r[5],X=r[9],V=r[13],J=r[2],ee=r[6],j=r[10],ne=r[14],G=r[3],oe=r[7],fe=r[11],Me=r[15];return s[0]=o*L+a*S+l*J+c*G,s[4]=o*w+a*C+l*ee+c*oe,s[8]=o*F+a*X+l*j+c*fe,s[12]=o*E+a*V+l*ne+c*Me,s[1]=u*L+d*S+f*J+m*G,s[5]=u*w+d*C+f*ee+m*oe,s[9]=u*F+d*X+f*j+m*fe,s[13]=u*E+d*V+f*ne+m*Me,s[2]=_*L+v*S+p*J+h*G,s[6]=_*w+v*C+p*ee+h*oe,s[10]=_*F+v*X+p*j+h*fe,s[14]=_*E+v*V+p*ne+h*Me,s[3]=b*L+T*S+M*J+I*G,s[7]=b*w+T*C+M*ee+I*oe,s[11]=b*F+T*X+M*j+I*fe,s[15]=b*E+T*V+M*ne+I*Me,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],d=e[6],f=e[10],m=e[14],_=e[3],v=e[7],p=e[11],h=e[15];return _*(+s*l*d-r*c*d-s*a*f+n*c*f+r*a*m-n*l*m)+v*(+t*l*m-t*c*f+s*o*f-r*o*m+r*c*u-s*l*u)+p*(+t*c*d-t*a*m-s*o*d+n*o*m+s*a*u-n*c*u)+h*(-r*a*u-t*l*d+t*a*f+r*o*d-n*o*f+n*l*u)}transpose(){const e=this.elements;let 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){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=e[9],f=e[10],m=e[11],_=e[12],v=e[13],p=e[14],h=e[15],b=d*p*c-v*f*c+v*l*m-a*p*m-d*l*h+a*f*h,T=_*f*c-u*p*c-_*l*m+o*p*m+u*l*h-o*f*h,M=u*v*c-_*d*c+_*a*m-o*v*m-u*a*h+o*d*h,I=_*d*l-u*v*l-_*a*f+o*v*f+u*a*p-o*d*p,L=t*b+n*T+r*M+s*I;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/L;return e[0]=b*w,e[1]=(v*f*s-d*p*s-v*r*m+n*p*m+d*r*h-n*f*h)*w,e[2]=(a*p*s-v*l*s+v*r*c-n*p*c-a*r*h+n*l*h)*w,e[3]=(d*l*s-a*f*s-d*r*c+n*f*c+a*r*m-n*l*m)*w,e[4]=T*w,e[5]=(u*p*s-_*f*s+_*r*m-t*p*m-u*r*h+t*f*h)*w,e[6]=(_*l*s-o*p*s-_*r*c+t*p*c+o*r*h-t*l*h)*w,e[7]=(o*f*s-u*l*s+u*r*c-t*f*c-o*r*m+t*l*m)*w,e[8]=M*w,e[9]=(_*d*s-u*v*s-_*n*m+t*v*m+u*n*h-t*d*h)*w,e[10]=(o*v*s-_*a*s+_*n*c-t*v*c-o*n*h+t*a*h)*w,e[11]=(u*a*s-o*d*s-u*n*c+t*d*c+o*n*m-t*a*m)*w,e[12]=I*w,e[13]=(u*v*r-_*d*r+_*n*f-t*v*f-u*n*p+t*d*p)*w,e[14]=(_*a*r-o*v*r-_*n*l+t*v*l+o*n*p-t*a*p)*w,e[15]=(o*d*r-u*a*r+u*n*l-t*d*l-o*n*f+t*a*f)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const 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){const 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){const 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){const n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,d=a+a,f=s*c,m=s*u,_=s*d,v=o*u,p=o*d,h=a*d,b=l*c,T=l*u,M=l*d,I=n.x,L=n.y,w=n.z;return r[0]=(1-(v+h))*I,r[1]=(m+M)*I,r[2]=(_-T)*I,r[3]=0,r[4]=(m-M)*L,r[5]=(1-(f+h))*L,r[6]=(p+b)*L,r[7]=0,r[8]=(_+T)*w,r[9]=(p-b)*w,r[10]=(1-(f+v))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=hi.set(r[0],r[1],r[2]).length();const o=hi.set(r[4],r[5],r[6]).length(),a=hi.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qt.copy(this);const c=1/s,u=1/o,d=1/a;return Qt.elements[0]*=c,Qt.elements[1]*=c,Qt.elements[2]*=c,Qt.elements[4]*=u,Qt.elements[5]*=u,Qt.elements[6]*=u,Qt.elements[8]*=d,Qt.elements[9]*=d,Qt.elements[10]*=d,t.setFromRotationMatrix(Qt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,r,s,o,a=En){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r);let m,_;if(a===En)m=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Wr)m=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=En){const l=this.elements,c=1/(t-e),u=1/(n-r),d=1/(o-s),f=(t+e)*c,m=(n+r)*u;let _,v;if(a===En)_=(o+s)*d,v=-2*d;else if(a===Wr)_=s*d,v=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=v,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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){const 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}}const hi=new N,Qt=new ot,Xc=new N(0,0,0),Yc=new N(1,1,1),Ln=new N,ur=new N,Ht=new N,to=new ot,no=new ln;class wn{constructor(e=0,t=0,n=0,r=wn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],d=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ge(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ge(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ge(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ge(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return to.makeRotationFromQuaternion(e),this.setFromRotationMatrix(to,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return no.setFromEuler(this),this.setFromQuaternion(no,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}wn.DEFAULT_ORDER="XYZ";class Ml{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),d.length>0&&(n.shapes=d),f.length>0&&(n.skeletons=f),m.length>0&&(n.animations=m),_.length>0&&(n.nodes=_)}return n.object=r,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){en.subVectors(r,t),mn.subVectors(n,t),ds.subVectors(e,t);const o=en.dot(en),a=en.dot(mn),l=en.dot(ds),c=mn.dot(mn),u=mn.dot(ds),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const f=1/d,m=(c*l-a*u)*f,_=(o*u-a*l)*f;return s.set(1-m-_,_,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,_n)===null?!1:_n.x>=0&&_n.y>=0&&_n.x+_n.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,_n)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,_n.x),l.addScaledVector(o,_n.y),l.addScaledVector(a,_n.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return _s.setScalar(0),gs.setScalar(0),vs.setScalar(0),_s.fromBufferAttribute(e,t),gs.fromBufferAttribute(e,n),vs.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(_s,s.x),o.addScaledVector(gs,s.y),o.addScaledVector(vs,s.z),o}static isFrontFacing(e,t,n,r){return en.subVectors(n,t),mn.subVectors(e,t),en.cross(mn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return en.subVectors(this.c,this.b),mn.subVectors(this.a,this.b),en.cross(mn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return sn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return sn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return sn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return sn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return sn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,a;pi.subVectors(r,n),mi.subVectors(s,n),fs.subVectors(e,n);const l=pi.dot(fs),c=mi.dot(fs);if(l<=0&&c<=0)return t.copy(n);ps.subVectors(e,r);const u=pi.dot(ps),d=mi.dot(ps);if(u>=0&&d<=u)return t.copy(r);const f=l*d-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(pi,o);ms.subVectors(e,s);const m=pi.dot(ms),_=mi.dot(ms);if(_>=0&&m<=_)return t.copy(s);const v=m*c-l*_;if(v<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(mi,a);const p=u*_-m*d;if(p<=0&&d-u>=0&&m-_>=0)return lo.subVectors(s,r),a=(d-u)/(d-u+(m-_)),t.copy(r).addScaledVector(lo,a);const h=1/(p+v+f);return o=v*h,a=f*h,t.copy(n).addScaledVector(pi,o).addScaledVector(mi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const El={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},Dn={h:0,s:0,l:0},dr={h:0,s:0,l:0};function xs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Pe{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){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Zt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qe.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,qe.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=qe.workingColorSpace){if(e=Uc(e,1),t=Ge(t,0,1),n=Ge(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=xs(o,s,e+1/3),this.g=xs(o,s,e),this.b=xs(o,s,e-1/3)}return qe.toWorkingColorSpace(this,r),this}setStyle(e,t=Zt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Zt){const n=El[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),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=An(e.r),this.g=An(e.g),this.b=An(e.b),this}copyLinearToSRGB(e){return this.r=wi(e.r),this.g=wi(e.g),this.b=wi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Zt){return qe.fromWorkingColorSpace(wt.copy(this),e),Math.round(Ge(wt.r*255,0,255))*65536+Math.round(Ge(wt.g*255,0,255))*256+Math.round(Ge(wt.b*255,0,255))}getHexString(e=Zt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qe.workingColorSpace){qe.fromWorkingColorSpace(wt.copy(this),t);const n=wt.r,r=wt.g,s=wt.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case n:l=(r-s)/d+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ai&&(n.blending=this.blending),this.side!==zn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Fs&&(n.blendSrc=this.blendSrc),this.blendDst!==Os&&(n.blendDst=this.blendDst),this.blendEquation!==Kn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ri&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Za&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ai&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ai&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ai&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class yl extends er{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wn,this.combine=sl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const mt=new N,fr=new Le;class Wt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ja,this.updateRanges=[],this.gpuType=an,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.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,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,f=c.length;d0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let f=0,m=d.length;f0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(co.copy(s).invert(),Wn.copy(e.ray).applyMatrix4(co),!(n.boundingBox!==null&&Wn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Wn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,f=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,v=f.length;_t.far?null:{distance:c,point:xr.clone(),object:i}}function Sr(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,mr),i.getVertexPosition(l,_r),i.getVertexPosition(c,gr);const u=Qc(i,e,t,n,mr,_r,gr,ho);if(u){const d=new N;sn.getBarycoord(ho,mr,_r,gr,d),r&&(u.uv=sn.getInterpolatedAttribute(r,a,l,c,d,new Le)),s&&(u.uv1=sn.getInterpolatedAttribute(s,a,l,c,d,new Le)),o&&(u.normal=sn.getInterpolatedAttribute(o,a,l,c,d,new N),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new N,materialIndex:0};sn.getNormal(mr,_r,gr,f.normal),u.face=f,u.barycoord=d}return u}class tr extends cn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],d=[];let f=0,m=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,r,o,2),_("x","z","y",1,-1,e,n,-t,r,o,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new on(c,3)),this.setAttribute("normal",new on(u,3)),this.setAttribute("uv",new on(d,2));function _(v,p,h,b,T,M,I,L,w,F,E){const S=M/w,C=I/F,X=M/2,V=I/2,J=L/2,ee=w+1,j=F+1;let ne=0,G=0;const oe=new N;for(let fe=0;fe0?1:-1,u.push(oe.x,oe.y,oe.z),d.push(ke/w),d.push(1-fe/F),ne+=1}}for(let fe=0;fe0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ua extends ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new it,this.projectionMatrix=new it,this.projectionMatrixInverse=new it,this.coordinateSystem=vn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Cn=new U,_o=new De,go=new De;class Qt extends Ua{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ts*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ma*2*Math.atan(Math.tan(ts*.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){Cn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z),Cn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z)}getViewSize(e,t){return this.getViewBounds(e,_o,go),t.subVectors(go,_o)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ts*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const fi=-90,pi=1;class ru extends ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Qt(fi,pi,e,t);r.layers=this.layers,this.add(r);const s=new Qt(fi,pi,e,t);s.layers=this.layers,this.add(s);const o=new Qt(fi,pi,e,t);o.layers=this.layers,this.add(o);const a=new Qt(fi,pi,e,t);a.layers=this.layers,this.add(a);const l=new Qt(fi,pi,e,t);l.layers=this.layers,this.add(l);const c=new Qt(fi,pi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===kr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const x=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=x,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(f,p,m),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Cl extends At{constructor(e,t,n,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ti,super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class su extends $n{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Cl(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:It}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;const n={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Rt extends er{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=tu,this.fragmentShader=nu,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=Ii(e.uniforms),this.uniformsGroups=eu(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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}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;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class La extends _t{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ot,this.projectionMatrix=new ot,this.projectionMatrixInverse=new ot,this.coordinateSystem=En}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Un=new N,fo=new Le,po=new Le;class rn extends La{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Sa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ts*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Sa*2*Math.atan(Math.tan(ts*.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){Un.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Un.x,Un.y).multiplyScalar(-e/Un.z),Un.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Un.x,Un.y).multiplyScalar(-e/Un.z)}getViewSize(e,t){return this.getViewBounds(e,fo,po),t.subVectors(po,fo)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ts*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const gi=-90,vi=1;class iu extends _t{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new rn(gi,vi,e,t);r.layers=this.layers,this.add(r);const s=new rn(gi,vi,e,t);s.layers=this.layers,this.add(s);const o=new rn(gi,vi,e,t);o.layers=this.layers,this.add(o);const a=new rn(gi,vi,e,t);a.layers=this.layers,this.add(a);const l=new rn(gi,vi,e,t);l.layers=this.layers,this.add(l);const c=new rn(gi,vi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===En)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Wr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,d=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(d,f,m),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class wl extends Ct{constructor(e,t,n,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ci,super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ru extends ti{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new wl(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Vt}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;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -41,9 +41,13 @@ var Gl=Object.defineProperty;var Vl=(i,e,t)=>e in i?Gl(i,e,{enumerable:!0,config gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},r=new Zi(5,5,5),s=new Tt({name:"CubemapFromEquirect",uniforms:Ri(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ft,blending:Un});s.uniforms.tEquirect.value=t;const o=new Nt(r,s),a=t.minFilter;return t.minFilter===Zn&&(t.minFilter=It),new ru(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}}const ys=new U,au=new U,ou=new Oe;class Wn{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=ys.subVectors(n,t).cross(au.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(ys),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const 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){const n=t||ou.getNormalMatrix(e),r=this.coplanarPoint(ys).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),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)}}const kn=new Zr,pr=new U;class Ia{constructor(e=new Wn,t=new Wn,n=new Wn,r=new Wn,s=new Wn,o=new Wn){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=vn){const n=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],f=r[6],p=r[7],m=r[8],_=r[9],x=r[10],h=r[11],d=r[12],A=r[13],E=r[14],T=r[15];if(n[0].setComponents(l-s,p-c,h-m,T-d).normalize(),n[1].setComponents(l+s,p+c,h+m,T+d).normalize(),n[2].setComponents(l+o,p+u,h+_,T+A).normalize(),n[3].setComponents(l-o,p-u,h-_,T-A).normalize(),n[4].setComponents(l-a,p-f,h-x,T-E).normalize(),t===vn)n[5].setComponents(l+a,p+f,h+x,T+E).normalize();else if(t===kr)n[5].setComponents(a,f,x,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),kn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),kn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(kn)}intersectsSprite(e){return kn.center.set(0,0,0),kn.radius=.7071067811865476,kn.applyMatrix4(e.matrixWorld),this.intersectsSphere(kn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,pr.y=r.normal.y>0?e.max.y:e.min.y,pr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(pr)<0)return!1}return!0}containsPoint(e){const 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)}}function Pl(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function lu(i){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){const u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((m,_)=>m.start-_.start);let p=0;for(let m=1;m0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class mo extends Ct{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Bt,u=Bt,d,f){super(null,o,a,l,c,u,r,s,d,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yr extends Wt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Es=new N,au=new N,ou=new ze;class Zn{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,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=Es.subVectors(n,t).cross(au.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Es),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const 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){const n=t||ou.getNormalMatrix(e),r=this.coplanarPoint(Es).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),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)}}const Xn=new Kr,Mr=new N;class Da{constructor(e=new Zn,t=new Zn,n=new Zn,r=new Zn,s=new Zn,o=new Zn){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=En){const n=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],d=r[6],f=r[7],m=r[8],_=r[9],v=r[10],p=r[11],h=r[12],b=r[13],T=r[14],M=r[15];if(n[0].setComponents(l-s,f-c,p-m,M-h).normalize(),n[1].setComponents(l+s,f+c,p+m,M+h).normalize(),n[2].setComponents(l+o,f+u,p+_,M+b).normalize(),n[3].setComponents(l-o,f-u,p-_,M-b).normalize(),n[4].setComponents(l-a,f-d,p-v,M-T).normalize(),t===En)n[5].setComponents(l+a,f+d,p+v,M+T).normalize();else if(t===Wr)n[5].setComponents(a,d,v,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Xn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xn)}intersectsSprite(e){return Xn.center.set(0,0,0),Xn.radius=.7071067811865476,Xn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,Mr.y=r.normal.y>0?e.max.y:e.min.y,Mr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Mr)<0)return!1}return!0}containsPoint(e){const 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 Rl extends er{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Pe(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}}const qr=new N,Zr=new N,_o=new ot,Xi=new Sl,Er=new Kr,ys=new N,go=new N;class lu extends _t{constructor(e=new cn,t=new Rl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;ys.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(ys);if(!(le.far))return{distance:l,point:go.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const vo=new N,xo=new N;class cu extends lu{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;rm.start-_.start);let f=0;for(let m=1;me in i?Gl(i,e,{enumerable:!0,config : cases.z; return clamp( threshold , 1.0e-6, 1.0 ); } -#endif`,hu=`#ifdef USE_ALPHAMAP +#endif`,bu=`#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; -#endif`,du=`#ifdef USE_ALPHAMAP +#endif`,wu=`#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,fu=`#ifdef USE_ALPHATEST +#endif`,Ru=`#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`,pu=`#ifdef USE_ALPHATEST +#endif`,Cu=`#ifdef USE_ALPHATEST uniform float alphaTest; -#endif`,mu=`#ifdef USE_AOMAP +#endif`,Pu=`#ifdef USE_AOMAP float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; reflectedLight.indirectDiffuse *= ambientOcclusion; #if defined( USE_CLEARCOAT ) @@ -104,10 +108,10 @@ var Gl=Object.defineProperty;var Vl=(i,e,t)=>e in i?Gl(i,e,{enumerable:!0,config float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); #endif -#endif`,_u=`#ifdef USE_AOMAP +#endif`,Lu=`#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; -#endif`,gu=`#ifdef USE_BATCHING +#endif`,Du=`#ifdef USE_BATCHING #if ! defined( GL_ANGLE_multi_draw ) #define gl_DrawID _gl_DrawID uniform int _gl_DrawID; @@ -141,15 +145,15 @@ var Gl=Object.defineProperty;var Vl=(i,e,t)=>e in i?Gl(i,e,{enumerable:!0,config int y = j / size; return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; } -#endif`,vu=`#ifdef USE_BATCHING +#endif`,Uu=`#ifdef USE_BATCHING mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); -#endif`,xu=`vec3 transformed = vec3( position ); +#endif`,Iu=`vec3 transformed = vec3( position ); #ifdef USE_ALPHAHASH vPosition = vec3( position ); -#endif`,Su=`vec3 objectNormal = vec3( normal ); +#endif`,Nu=`vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); -#endif`,Mu=`float G_BlinnPhong_Implicit( ) { +#endif`,Fu=`float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { @@ -163,7 +167,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`,Eu=`#ifdef USE_IRIDESCENCE +} // validated`,Ou=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, @@ -226,7 +230,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve } return max( I, vec3( 0.0 ) ); } -#endif`,yu=`#ifdef USE_BUMPMAP +#endif`,Bu=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { @@ -247,7 +251,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`,Tu=`#if NUM_CLIPPING_PLANES > 0 +#endif`,zu=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -293,26 +297,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,Au=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Hu=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,bu=`#if NUM_CLIPPING_PLANES > 0 +#endif`,ku=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,wu=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Vu=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,Ru=`#if defined( USE_COLOR_ALPHA ) +#endif`,Gu=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,Cu=`#if defined( USE_COLOR_ALPHA ) +#endif`,Wu=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,Pu=`#if defined( USE_COLOR_ALPHA ) +#endif`,Xu=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,Lu=`#if defined( USE_COLOR_ALPHA ) +#endif`,Yu=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); @@ -326,7 +330,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; -#endif`,Du=`#define PI 3.141592653589793 +#endif`,qu=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -400,7 +404,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`,Uu=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,Zu=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -493,7 +497,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`,Iu=`vec3 transformedNormal = objectNormal; +#endif`,ju=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -522,40 +526,29 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,Nu=`#ifdef USE_DISPLACEMENTMAP +#endif`,Ku=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,Fu=`#ifdef USE_DISPLACEMENTMAP +#endif`,$u=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,Ou=`#ifdef USE_EMISSIVEMAP +#endif`,Ju=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Bu=`#ifdef USE_EMISSIVEMAP +#endif`,Qu=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,zu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Hu=` -const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( - vec3( 0.8224621, 0.177538, 0.0 ), - vec3( 0.0331941, 0.9668058, 0.0 ), - vec3( 0.0170827, 0.0723974, 0.9105199 ) -); -const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( - vec3( 1.2249401, - 0.2249404, 0.0 ), - vec3( - 0.0420569, 1.0420571, 0.0 ), - vec3( - 0.0196376, - 0.0786361, 1.0982735 ) -); -vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { - return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); -} -vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { - return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); -} -vec4 LinearTransferOETF( in vec4 value ) { +#endif`,eh="gl_FragColor = linearToOutputTexel( gl_FragColor );",th=`vec4 LinearTransferOETF( in vec4 value ) { return value; } +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} 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 ); -}`,ku=`#ifdef USE_ENVMAP +}`,nh=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -584,7 +577,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,Gu=`#ifdef USE_ENVMAP +#endif`,ih=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -594,7 +587,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,Vu=`#ifdef USE_ENVMAP +#endif`,rh=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -605,7 +598,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,Wu=`#ifdef USE_ENVMAP +#endif`,sh=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -616,7 +609,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,Xu=`#ifdef USE_ENVMAP +#endif`,ah=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -633,18 +626,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,Yu=`#ifdef USE_FOG +#endif`,oh=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,qu=`#ifdef USE_FOG +#endif`,lh=`#ifdef USE_FOG varying float vFogDepth; -#endif`,Zu=`#ifdef USE_FOG +#endif`,ch=`#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`,Ku=`#ifdef USE_FOG +#endif`,uh=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -653,7 +646,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,ju=`#ifdef USE_GRADIENTMAP +#endif`,hh=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -665,12 +658,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 -}`,$u=`#ifdef USE_LIGHTMAP +}`,dh=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,Ju=`LambertMaterial material; +#endif`,fh=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Qu=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,ph=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -684,7 +677,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`,eh=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mh=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -800,7 +793,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,th=`#ifdef USE_ENVMAP +#endif`,_h=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -833,8 +826,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,nh=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,ih=`varying vec3 vViewPosition; +#endif`,gh=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,vh=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -846,11 +839,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`,rh=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xh=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,sh=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Sh=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -867,7 +860,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`,ah=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Mh=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -953,7 +946,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`,oh=`struct PhysicalMaterial { +#endif`,Eh=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1254,7 +1247,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 ); -}`,lh=` +}`,yh=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1369,7 +1362,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,ch=`#if defined( RE_IndirectDiffuse ) +#endif`,Th=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1388,33 +1381,32 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,uh=`#if defined( RE_IndirectDiffuse ) +#endif`,Ah=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,hh=`#if defined( USE_LOGDEPTHBUF ) +#endif`,bh=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,dh=`#if defined( USE_LOGDEPTHBUF ) +#endif`,wh=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,fh=`#ifdef USE_LOGDEPTHBUF +#endif`,Rh=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,ph=`#ifdef USE_LOGDEPTHBUF +#endif`,Ch=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,mh=`#ifdef USE_MAP +#endif`,Ph=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); - + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,_h=`#ifdef USE_MAP +#endif`,Lh=`#ifdef USE_MAP uniform sampler2D map; -#endif`,gh=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Dh=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1426,7 +1418,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,vh=`#if defined( USE_POINTS_UV ) +#endif`,Uh=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1438,19 +1430,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,xh=`float metalnessFactor = metalness; +#endif`,Ih=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Sh=`#ifdef USE_METALNESSMAP +#endif`,Nh=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Mh=`#ifdef USE_INSTANCING_MORPH +#endif`,Fh=`#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`,Eh=`#if defined( USE_MORPHCOLORS ) +#endif`,Oh=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1459,12 +1451,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,yh=`#ifdef USE_MORPHNORMALS +#endif`,Bh=`#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`,Th=`#ifdef USE_MORPHTARGETS +#endif`,zh=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1478,12 +1470,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,Ah=`#ifdef USE_MORPHTARGETS +#endif`,Hh=`#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`,bh=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,kh=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1524,7 +1516,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,wh=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Vh=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1539,25 +1531,25 @@ vec3 nonPerturbedNormal = normal;`,wh=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Rh=`#ifndef FLAT_SHADED +#endif`,Gh=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Ch=`#ifndef FLAT_SHADED +#endif`,Wh=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Ph=`#ifndef FLAT_SHADED +#endif`,Xh=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,Lh=`#ifdef USE_NORMALMAP +#endif`,Yh=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1579,13 +1571,13 @@ vec3 nonPerturbedNormal = normal;`,wh=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,Dh=`#ifdef USE_CLEARCOAT +#endif`,qh=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,Uh=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,Zh=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Ih=`#ifdef USE_CLEARCOATMAP +#endif`,jh=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1594,18 +1586,18 @@ vec3 nonPerturbedNormal = normal;`,wh=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,Nh=`#ifdef USE_IRIDESCENCEMAP +#endif`,Kh=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,Fh=`#ifdef OPAQUE +#endif`,$h=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Oh=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Jh=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1674,9 +1666,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,Bh=`#ifdef PREMULTIPLIED_ALPHA +}`,Qh=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,zh=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,ed=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1684,22 +1676,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,td=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,kh=`#ifdef DITHERING +#endif`,nd=`#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`,Gh=`float roughnessFactor = roughness; +#endif`,id=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,Vh=`#ifdef USE_ROUGHNESSMAP +#endif`,rd=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,Wh=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,sd=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1885,7 +1877,7 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,Xh=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,ad=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1926,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,Yh=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,od=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1958,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,qh=`float getShadowMask() { +#endif`,ld=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1990,12 +1982,12 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING #endif #endif return shadow; -}`,Zh=`#ifdef USE_SKINNING +}`,cd=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,Kh=`#ifdef USE_SKINNING +#endif`,ud=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2010,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,jh=`#ifdef USE_SKINNING +#endif`,hd=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2018,7 +2010,7 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,$h=`#ifdef USE_SKINNING +#endif`,dd=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2029,17 +2021,17 @@ gl_Position = projectionMatrix * mvPosition;`,Hh=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,Jh=`float specularStrength; +#endif`,fd=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,Qh=`#ifdef USE_SPECULARMAP +#endif`,pd=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,ed=`#if defined( TONE_MAPPING ) +#endif`,md=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,td=`#ifndef saturate +#endif`,_d=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2136,7 +2128,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; }`,nd=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,gd=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2157,7 +2149,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,id=`#ifdef USE_TRANSMISSION +#endif`,vd=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2288,7 +2280,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#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`,rd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,xd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2358,7 +2350,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,sd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Sd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2452,7 +2444,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,ad=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Md=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2523,7 +2515,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,od=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Ed=`#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; @@ -2532,12 +2524,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nd=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const ld=`varying vec2 vUv; +#endif`;const yd=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,cd=`uniform sampler2D t2D; +}`,Td=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2549,14 +2541,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,ud=`varying vec3 vWorldDirection; +}`,Ad=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,hd=`#ifdef ENVMAP_TYPE_CUBE +}`,bd=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2579,14 +2571,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,dd=`varying vec3 vWorldDirection; +}`,wd=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,fd=`uniform samplerCube tCube; +}`,Rd=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2596,7 +2588,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,pd=`#include +}`,Cd=`#include #include #include #include @@ -2623,7 +2615,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,md=`#if DEPTH_PACKING == 3200 +}`,Pd=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2657,7 +2649,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,_d=`#define DISTANCE +}`,Ld=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2684,7 +2676,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,gd=`#define DISTANCE +}`,Dd=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2708,13 +2700,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,vd=`varying vec3 vWorldDirection; +}`,Ud=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,xd=`uniform sampler2D tEquirect; +}`,Id=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2723,7 +2715,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Sd=`uniform float scale; +}`,Nd=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2745,7 +2737,7 @@ void main() { #include #include #include -}`,Md=`uniform vec3 diffuse; +}`,Fd=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2773,7 +2765,7 @@ void main() { #include #include #include -}`,Ed=`#include +}`,Od=`#include #include #include #include @@ -2805,7 +2797,7 @@ void main() { #include #include #include -}`,yd=`uniform vec3 diffuse; +}`,Bd=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2853,7 +2845,7 @@ void main() { #include #include #include -}`,Td=`#define LAMBERT +}`,zd=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2892,7 +2884,7 @@ void main() { #include #include #include -}`,Ad=`#define LAMBERT +}`,Hd=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2949,7 +2941,7 @@ void main() { #include #include #include -}`,bd=`#define MATCAP +}`,kd=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2983,7 +2975,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,wd=`#define MATCAP +}`,Vd=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3029,7 +3021,7 @@ void main() { #include #include #include -}`,Rd=`#define NORMAL +}`,Gd=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3062,7 +3054,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,Cd=`#define NORMAL +}`,Wd=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3084,7 +3076,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Pd=`#define PHONG +}`,Xd=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3123,7 +3115,7 @@ void main() { #include #include #include -}`,Ld=`#define PHONG +}`,Yd=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3182,7 +3174,7 @@ void main() { #include #include #include -}`,Dd=`#define STANDARD +}`,qd=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3225,7 +3217,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Ud=`#define STANDARD +}`,Zd=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3350,7 +3342,7 @@ void main() { #include #include #include -}`,Id=`#define TOON +}`,jd=`#define TOON varying vec3 vViewPosition; #include #include @@ -3387,7 +3379,7 @@ void main() { #include #include #include -}`,Nd=`#define TOON +}`,Kd=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3440,7 +3432,7 @@ void main() { #include #include #include -}`,Fd=`uniform float size; +}`,$d=`uniform float size; uniform float scale; #include #include @@ -3471,7 +3463,7 @@ void main() { #include #include #include -}`,Od=`uniform vec3 diffuse; +}`,Jd=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3496,7 +3488,7 @@ void main() { #include #include #include -}`,Bd=`#include +}`,Qd=`#include #include #include #include @@ -3519,7 +3511,7 @@ void main() { #include #include #include -}`,zd=`uniform vec3 color; +}`,ef=`uniform vec3 color; uniform float opacity; #include #include @@ -3535,7 +3527,7 @@ void main() { #include #include #include -}`,Hd=`uniform float rotation; +}`,tf=`uniform float rotation; uniform vec2 center; #include #include @@ -3559,7 +3551,7 @@ void main() { #include #include #include -}`,kd=`uniform vec3 diffuse; +}`,nf=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3584,7 +3576,7 @@ void main() { #include #include #include -}`,Fe={alphahash_fragment:cu,alphahash_pars_fragment:uu,alphamap_fragment:hu,alphamap_pars_fragment:du,alphatest_fragment:fu,alphatest_pars_fragment:pu,aomap_fragment:mu,aomap_pars_fragment:_u,batching_pars_vertex:gu,batching_vertex:vu,begin_vertex:xu,beginnormal_vertex:Su,bsdfs:Mu,iridescence_fragment:Eu,bumpmap_pars_fragment:yu,clipping_planes_fragment:Tu,clipping_planes_pars_fragment:Au,clipping_planes_pars_vertex:bu,clipping_planes_vertex:wu,color_fragment:Ru,color_pars_fragment:Cu,color_pars_vertex:Pu,color_vertex:Lu,common:Du,cube_uv_reflection_fragment:Uu,defaultnormal_vertex:Iu,displacementmap_pars_vertex:Nu,displacementmap_vertex:Fu,emissivemap_fragment:Ou,emissivemap_pars_fragment:Bu,colorspace_fragment:zu,colorspace_pars_fragment:Hu,envmap_fragment:ku,envmap_common_pars_fragment:Gu,envmap_pars_fragment:Vu,envmap_pars_vertex:Wu,envmap_physical_pars_fragment:th,envmap_vertex:Xu,fog_vertex:Yu,fog_pars_vertex:qu,fog_fragment:Zu,fog_pars_fragment:Ku,gradientmap_pars_fragment:ju,lightmap_pars_fragment:$u,lights_lambert_fragment:Ju,lights_lambert_pars_fragment:Qu,lights_pars_begin:eh,lights_toon_fragment:nh,lights_toon_pars_fragment:ih,lights_phong_fragment:rh,lights_phong_pars_fragment:sh,lights_physical_fragment:ah,lights_physical_pars_fragment:oh,lights_fragment_begin:lh,lights_fragment_maps:ch,lights_fragment_end:uh,logdepthbuf_fragment:hh,logdepthbuf_pars_fragment:dh,logdepthbuf_pars_vertex:fh,logdepthbuf_vertex:ph,map_fragment:mh,map_pars_fragment:_h,map_particle_fragment:gh,map_particle_pars_fragment:vh,metalnessmap_fragment:xh,metalnessmap_pars_fragment:Sh,morphinstance_vertex:Mh,morphcolor_vertex:Eh,morphnormal_vertex:yh,morphtarget_pars_vertex:Th,morphtarget_vertex:Ah,normal_fragment_begin:bh,normal_fragment_maps:wh,normal_pars_fragment:Rh,normal_pars_vertex:Ch,normal_vertex:Ph,normalmap_pars_fragment:Lh,clearcoat_normal_fragment_begin:Dh,clearcoat_normal_fragment_maps:Uh,clearcoat_pars_fragment:Ih,iridescence_pars_fragment:Nh,opaque_fragment:Fh,packing:Oh,premultiplied_alpha_fragment:Bh,project_vertex:zh,dithering_fragment:Hh,dithering_pars_fragment:kh,roughnessmap_fragment:Gh,roughnessmap_pars_fragment:Vh,shadowmap_pars_fragment:Wh,shadowmap_pars_vertex:Xh,shadowmap_vertex:Yh,shadowmask_pars_fragment:qh,skinbase_vertex:Zh,skinning_pars_vertex:Kh,skinning_vertex:jh,skinnormal_vertex:$h,specularmap_fragment:Jh,specularmap_pars_fragment:Qh,tonemapping_fragment:ed,tonemapping_pars_fragment:td,transmission_fragment:nd,transmission_pars_fragment:id,uv_pars_fragment:rd,uv_pars_vertex:sd,uv_vertex:ad,worldpos_vertex:od,background_vert:ld,background_frag:cd,backgroundCube_vert:ud,backgroundCube_frag:hd,cube_vert:dd,cube_frag:fd,depth_vert:pd,depth_frag:md,distanceRGBA_vert:_d,distanceRGBA_frag:gd,equirect_vert:vd,equirect_frag:xd,linedashed_vert:Sd,linedashed_frag:Md,meshbasic_vert:Ed,meshbasic_frag:yd,meshlambert_vert:Td,meshlambert_frag:Ad,meshmatcap_vert:bd,meshmatcap_frag:wd,meshnormal_vert:Rd,meshnormal_frag:Cd,meshphong_vert:Pd,meshphong_frag:Ld,meshphysical_vert:Dd,meshphysical_frag:Ud,meshtoon_vert:Id,meshtoon_frag:Nd,points_vert:Fd,points_frag:Od,shadow_vert:Bd,shadow_frag:zd,sprite_vert:Hd,sprite_frag:kd},ae={common:{diffuse:{value:new we(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},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 De(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:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new we(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new we(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 we(16777215)},opacity:{value:1},center:{value:new De(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},an={basic:{uniforms:bt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:Fe.meshbasic_vert,fragmentShader:Fe.meshbasic_frag},lambert:{uniforms:bt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshlambert_vert,fragmentShader:Fe.meshlambert_frag},phong:{uniforms:bt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)},specular:{value:new we(1118481)},shininess:{value:30}}]),vertexShader:Fe.meshphong_vert,fragmentShader:Fe.meshphong_frag},standard:{uniforms:bt([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new we(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag},toon:{uniforms:bt([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshtoon_vert,fragmentShader:Fe.meshtoon_frag},matcap:{uniforms:bt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matcap:{value:null}}]),vertexShader:Fe.meshmatcap_vert,fragmentShader:Fe.meshmatcap_frag},points:{uniforms:bt([ae.points,ae.fog]),vertexShader:Fe.points_vert,fragmentShader:Fe.points_frag},dashed:{uniforms:bt([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fe.linedashed_vert,fragmentShader:Fe.linedashed_frag},depth:{uniforms:bt([ae.common,ae.displacementmap]),vertexShader:Fe.depth_vert,fragmentShader:Fe.depth_frag},normal:{uniforms:bt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:Fe.meshnormal_vert,fragmentShader:Fe.meshnormal_frag},sprite:{uniforms:bt([ae.sprite,ae.fog]),vertexShader:Fe.sprite_vert,fragmentShader:Fe.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fe.background_vert,fragmentShader:Fe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Oe}},vertexShader:Fe.backgroundCube_vert,fragmentShader:Fe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fe.cube_vert,fragmentShader:Fe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fe.equirect_vert,fragmentShader:Fe.equirect_frag},distanceRGBA:{uniforms:bt([ae.common,ae.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fe.distanceRGBA_vert,fragmentShader:Fe.distanceRGBA_frag},shadow:{uniforms:bt([ae.lights,ae.fog,{color:{value:new we(0)},opacity:{value:1}}]),vertexShader:Fe.shadow_vert,fragmentShader:Fe.shadow_frag}};an.physical={uniforms:bt([an.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new De(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 we(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 De},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new we(0)},specularColor:{value:new we(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new De},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag};const mr={r:0,b:0,g:0},Gn=new En,Gd=new it;function Vd(i,e,t,n,r,s,o){const a=new we(0);let l=s===!0?0:1,c,u,f=null,p=0,m=null;function _(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function x(A){let E=!1;const T=_(A);T===null?d(a,l):T&&T.isColor&&(d(T,1),E=!0);const H=i.xr.getEnvironmentBlendMode();H==="additive"?n.buffers.color.setClear(0,0,0,1,o):H==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function h(A,E){const T=_(E);T&&(T.isCubeTexture||T.mapping===Yr)?(u===void 0&&(u=new Nt(new Zi(1,1,1),new Tt({name:"BackgroundCubeMaterial",uniforms:Ri(an.backgroundCube.uniforms),vertexShader:an.backgroundCube.vertexShader,fragmentShader:an.backgroundCube.fragmentShader,side:Ft,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(H,L,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Gn.copy(E.backgroundRotation),Gn.x*=-1,Gn.y*=-1,Gn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Gn.y*=-1,Gn.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Gd.makeRotationFromEuler(Gn)),u.material.toneMapped=Ze.getTransfer(T.colorSpace)!==tt,(f!==T||p!==T.version||m!==i.toneMapping)&&(u.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Nt(new Ci(2,2),new Tt({name:"BackgroundMaterial",uniforms:Ri(an.background.uniforms),vertexShader:an.background.vertexShader,fragmentShader:an.background.fragmentShader,side:Nn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=Ze.getTransfer(T.colorSpace)!==tt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||p!==T.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function d(A,E){A.getRGB(mr,Rl(i)),n.buffers.color.setClear(mr.r,mr.g,mr.b,E,o)}return{getClearColor:function(){return a},setClearColor:function(A,E=1){a.set(A),l=E,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,d(a,l)},render:x,addToRenderList:h}}function Wd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,o=!1;function a(g,M,W,k,K){let Q=!1;const X=f(k,W,M);s!==X&&(s=X,c(s.object)),Q=m(g,k,W,K),Q&&_(g,k,W,K),K!==null&&e.update(K,i.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,T(g,M,W,k),K!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(K).buffer))}function l(){return i.createVertexArray()}function c(g){return i.bindVertexArray(g)}function u(g){return i.deleteVertexArray(g)}function f(g,M,W){const k=W.wireframe===!0;let K=n[g.id];K===void 0&&(K={},n[g.id]=K);let Q=K[M.id];Q===void 0&&(Q={},K[M.id]=Q);let X=Q[k];return X===void 0&&(X=p(l()),Q[k]=X),X}function p(g){const M=[],W=[],k=[];for(let K=0;K=0){const pe=K[V];let ve=Q[V];if(ve===void 0&&(V==="instanceMatrix"&&g.instanceMatrix&&(ve=g.instanceMatrix),V==="instanceColor"&&g.instanceColor&&(ve=g.instanceColor)),pe===void 0||pe.attribute!==ve||ve&&pe.data!==ve.data)return!0;X++}return s.attributesNum!==X||s.index!==k}function _(g,M,W,k){const K={},Q=M.attributes;let X=0;const J=W.getAttributes();for(const V in J)if(J[V].location>=0){let pe=Q[V];pe===void 0&&(V==="instanceMatrix"&&g.instanceMatrix&&(pe=g.instanceMatrix),V==="instanceColor"&&g.instanceColor&&(pe=g.instanceColor));const ve={};ve.attribute=pe,pe&&pe.data&&(ve.data=pe.data),K[V]=ve,X++}s.attributes=K,s.attributesNum=X,s.index=k}function x(){const g=s.newAttributes;for(let M=0,W=g.length;M=0){let fe=K[J];if(fe===void 0&&(J==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),J==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const pe=fe.normalized,ve=fe.itemSize,We=e.get(fe);if(We===void 0)continue;const Ye=We.buffer,Y=We.type,te=We.bytesPerElement,_e=Y===i.INT||Y===i.UNSIGNED_INT||fe.gpuType===ba;if(fe.isInterleavedBufferAttribute){const me=fe.data,Ne=me.stride,be=fe.offset;if(me.isInstancedInterleavedBuffer){for(let He=0;He0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const b=e.get("EXT_clip_control");b.clipControlEXT(b.LOWER_LEFT_EXT,b.ZERO_TO_ONE_EXT)}const m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),T=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),H=_>0,L=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:m,maxVertexTextures:_,maxTextureSize:x,maxCubemapSize:h,maxAttributes:d,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:T,vertexTextures:H,maxSamples:L}}function qd(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new Wn,a=new Oe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||n!==0||r;return r=p,n=f.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,m){const _=f.clippingPlanes,x=f.clipIntersection,h=f.clipShadows,d=i.get(f);if(!r||_===null||_.length===0||s&&!h)s?u(null):c();else{const A=s?0:n,E=A*4;let T=d.clippingState||null;l.value=T,T=u(_,p,E,m);for(let H=0;H!==E;++H)T[H]=t[H];d.clippingState=T,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,m,_){const x=f!==null?f.length:0;let h=null;if(x!==0){if(h=l.value,_!==!0||h===null){const d=m+x*4,A=p.matrixWorldInverse;a.getNormalMatrix(A),(h===null||h.length0){const c=new su(l.height);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Na extends Ua{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const xi=4,vo=[.125,.215,.35,.446,.526,.582],qn=20,Ts=new Na,xo=new we;let As=null,bs=0,ws=0,Rs=!1;const Xn=(1+Math.sqrt(5))/2,mi=1/Xn,So=[new U(-Xn,mi,0),new U(Xn,mi,0),new U(-mi,0,Xn),new U(mi,0,Xn),new U(0,Xn,-mi),new U(0,Xn,mi),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)];class Mo{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){As=this._renderer.getRenderTarget(),bs=this._renderer.getActiveCubeFace(),ws=this._renderer.getActiveMipmapLevel(),Rs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=To(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?E:0,E,E),u.setRenderTarget(r),x&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=p,u.autoClear=f,e.background=h}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Ti||e.mapping===Ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=To()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yo());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Nt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;_r(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ts)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sqn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${qn}`);const d=[];let A=0;for(let b=0;bE-xi?r-E+xi:0),L=4*(this._cubeSize-T);_r(t,H,L,3*T,2*T),l.setRenderTarget(t),l.render(f,Ts)}}function Kd(i){const e=[],t=[],n=[];let r=i;const s=i-xi+1+vo.length;for(let o=0;oi-xi?l=vo[o-i+xi-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,_=6,x=3,h=2,d=1,A=new Float32Array(x*_*m),E=new Float32Array(h*_*m),T=new Float32Array(d*_*m);for(let L=0;L2?0:-1,ie=[b,z,0,b+2/3,z,0,b+2/3,z+1,0,b,z,0,b+2/3,z+1,0,b,z+1,0];A.set(ie,x*_*L),E.set(p,h*_*L);const g=[L,L,L,L,L,L];T.set(g,d*_*L)}const H=new rn;H.setAttribute("position",new Gt(A,x)),H.setAttribute("uv",new Gt(E,h)),H.setAttribute("faceIndex",new Gt(T,d)),e.push(H),r>xi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Eo(i,e,t){const n=new $n(i,e,t);return n.texture.mapping=Yr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function _r(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function jd(i,e,t){const n=new Float32Array(qn),r=new U(0,1,0);return new Tt({name:"SphericalGaussianBlur",defines:{n:qn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Fa(),fragmentShader:` +}`,Be={alphahash_fragment:Tu,alphahash_pars_fragment:Au,alphamap_fragment:bu,alphamap_pars_fragment:wu,alphatest_fragment:Ru,alphatest_pars_fragment:Cu,aomap_fragment:Pu,aomap_pars_fragment:Lu,batching_pars_vertex:Du,batching_vertex:Uu,begin_vertex:Iu,beginnormal_vertex:Nu,bsdfs:Fu,iridescence_fragment:Ou,bumpmap_pars_fragment:Bu,clipping_planes_fragment:zu,clipping_planes_pars_fragment:Hu,clipping_planes_pars_vertex:ku,clipping_planes_vertex:Vu,color_fragment:Gu,color_pars_fragment:Wu,color_pars_vertex:Xu,color_vertex:Yu,common:qu,cube_uv_reflection_fragment:Zu,defaultnormal_vertex:ju,displacementmap_pars_vertex:Ku,displacementmap_vertex:$u,emissivemap_fragment:Ju,emissivemap_pars_fragment:Qu,colorspace_fragment:eh,colorspace_pars_fragment:th,envmap_fragment:nh,envmap_common_pars_fragment:ih,envmap_pars_fragment:rh,envmap_pars_vertex:sh,envmap_physical_pars_fragment:_h,envmap_vertex:ah,fog_vertex:oh,fog_pars_vertex:lh,fog_fragment:ch,fog_pars_fragment:uh,gradientmap_pars_fragment:hh,lightmap_pars_fragment:dh,lights_lambert_fragment:fh,lights_lambert_pars_fragment:ph,lights_pars_begin:mh,lights_toon_fragment:gh,lights_toon_pars_fragment:vh,lights_phong_fragment:xh,lights_phong_pars_fragment:Sh,lights_physical_fragment:Mh,lights_physical_pars_fragment:Eh,lights_fragment_begin:yh,lights_fragment_maps:Th,lights_fragment_end:Ah,logdepthbuf_fragment:bh,logdepthbuf_pars_fragment:wh,logdepthbuf_pars_vertex:Rh,logdepthbuf_vertex:Ch,map_fragment:Ph,map_pars_fragment:Lh,map_particle_fragment:Dh,map_particle_pars_fragment:Uh,metalnessmap_fragment:Ih,metalnessmap_pars_fragment:Nh,morphinstance_vertex:Fh,morphcolor_vertex:Oh,morphnormal_vertex:Bh,morphtarget_pars_vertex:zh,morphtarget_vertex:Hh,normal_fragment_begin:kh,normal_fragment_maps:Vh,normal_pars_fragment:Gh,normal_pars_vertex:Wh,normal_vertex:Xh,normalmap_pars_fragment:Yh,clearcoat_normal_fragment_begin:qh,clearcoat_normal_fragment_maps:Zh,clearcoat_pars_fragment:jh,iridescence_pars_fragment:Kh,opaque_fragment:$h,packing:Jh,premultiplied_alpha_fragment:Qh,project_vertex:ed,dithering_fragment:td,dithering_pars_fragment:nd,roughnessmap_fragment:id,roughnessmap_pars_fragment:rd,shadowmap_pars_fragment:sd,shadowmap_pars_vertex:ad,shadowmap_vertex:od,shadowmask_pars_fragment:ld,skinbase_vertex:cd,skinning_pars_vertex:ud,skinning_vertex:hd,skinnormal_vertex:dd,specularmap_fragment:fd,specularmap_pars_fragment:pd,tonemapping_fragment:md,tonemapping_pars_fragment:_d,transmission_fragment:gd,transmission_pars_fragment:vd,uv_pars_fragment:xd,uv_pars_vertex:Sd,uv_vertex:Md,worldpos_vertex:Ed,background_vert:yd,background_frag:Td,backgroundCube_vert:Ad,backgroundCube_frag:bd,cube_vert:wd,cube_frag:Rd,depth_vert:Cd,depth_frag:Pd,distanceRGBA_vert:Ld,distanceRGBA_frag:Dd,equirect_vert:Ud,equirect_frag:Id,linedashed_vert:Nd,linedashed_frag:Fd,meshbasic_vert:Od,meshbasic_frag:Bd,meshlambert_vert:zd,meshlambert_frag:Hd,meshmatcap_vert:kd,meshmatcap_frag:Vd,meshnormal_vert:Gd,meshnormal_frag:Wd,meshphong_vert:Xd,meshphong_frag:Yd,meshphysical_vert:qd,meshphysical_frag:Zd,meshtoon_vert:jd,meshtoon_frag:Kd,points_vert:$d,points_frag:Jd,shadow_vert:Qd,shadow_frag:ef,sprite_vert:tf,sprite_frag:nf},se={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ze},alphaMap:{value:null},alphaMapTransform:{value:new ze},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ze}},envmap:{envMap:{value:null},envMapRotation:{value:new ze},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ze}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ze}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ze},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ze},normalScale:{value:new Le(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ze},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ze}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ze}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ze}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ze},alphaTest:{value:0},uvTransform:{value:new ze}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new Le(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ze},alphaMap:{value:null},alphaMapTransform:{value:new ze},alphaTest:{value:0}}},un={basic:{uniforms:Lt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:Lt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.fog,se.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:Lt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.fog,se.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:Lt([se.common,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.roughnessmap,se.metalnessmap,se.fog,se.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:Lt([se.common,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.gradientmap,se.fog,se.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:Lt([se.common,se.bumpmap,se.normalmap,se.displacementmap,se.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:Lt([se.points,se.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:Lt([se.common,se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:Lt([se.common,se.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:Lt([se.common,se.bumpmap,se.normalmap,se.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:Lt([se.sprite,se.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new ze},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ze}},vertexShader:Be.backgroundCube_vert,fragmentShader:Be.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Be.cube_vert,fragmentShader:Be.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Be.equirect_vert,fragmentShader:Be.equirect_frag},distanceRGBA:{uniforms:Lt([se.common,se.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distanceRGBA_vert,fragmentShader:Be.distanceRGBA_frag},shadow:{uniforms:Lt([se.lights,se.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};un.physical={uniforms:Lt([un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ze},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ze},clearcoatNormalScale:{value:new Le(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ze},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ze},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ze},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ze},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ze},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ze},transmissionSamplerSize:{value:new Le},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ze},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ze},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ze},anisotropyVector:{value:new Le},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ze}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};const br={r:0,b:0,g:0},Yn=new wn,rf=new ot;function sf(i,e,t,n,r,s,o){const a=new Pe(0);let l=s===!0?0:1,c,u,d=null,f=0,m=null;function _(T){let M=T.isScene===!0?T.background:null;return M&&M.isTexture&&(M=(T.backgroundBlurriness>0?t:e).get(M)),M}function v(T){let M=!1;const I=_(T);I===null?h(a,l):I&&I.isColor&&(h(I,1),M=!0);const L=i.xr.getEnvironmentBlendMode();L==="additive"?n.buffers.color.setClear(0,0,0,1,o):L==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||M)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function p(T,M){const I=_(M);I&&(I.isCubeTexture||I.mapping===jr)?(u===void 0&&(u=new Ft(new tr(1,1,1),new Rt({name:"BackgroundCubeMaterial",uniforms:Ii(un.backgroundCube.uniforms),vertexShader:un.backgroundCube.vertexShader,fragmentShader:un.backgroundCube.fragmentShader,side:Ot,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(L,w,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Yn.copy(M.backgroundRotation),Yn.x*=-1,Yn.y*=-1,Yn.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Yn.y*=-1,Yn.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(rf.makeRotationFromEuler(Yn)),u.material.toneMapped=qe.getTransfer(I.colorSpace)!==nt,(d!==I||f!==I.version||m!==i.toneMapping)&&(u.material.needsUpdate=!0,d=I,f=I.version,m=i.toneMapping),u.layers.enableAll(),T.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(c===void 0&&(c=new Ft(new Ni(2,2),new Rt({name:"BackgroundMaterial",uniforms:Ii(un.background.uniforms),vertexShader:un.background.vertexShader,fragmentShader:un.background.fragmentShader,side:zn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=I,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=qe.getTransfer(I.colorSpace)!==nt,I.matrixAutoUpdate===!0&&I.updateMatrix(),c.material.uniforms.uvTransform.value.copy(I.matrix),(d!==I||f!==I.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,d=I,f=I.version,m=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function h(T,M){T.getRGB(br,bl(i)),n.buffers.color.setClear(br.r,br.g,br.b,M,o)}function b(){u!==void 0&&(u.geometry.dispose(),u.material.dispose()),c!==void 0&&(c.geometry.dispose(),c.material.dispose())}return{getClearColor:function(){return a},setClearColor:function(T,M=1){a.set(T),l=M,h(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,h(a,l)},render:v,addToRenderList:p,dispose:b}}function af(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,o=!1;function a(S,C,X,V,J){let ee=!1;const j=d(V,X,C);s!==j&&(s=j,c(s.object)),ee=m(S,V,X,J),ee&&_(S,V,X,J),J!==null&&e.update(J,i.ELEMENT_ARRAY_BUFFER),(ee||o)&&(o=!1,M(S,C,X,V),J!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(J).buffer))}function l(){return i.createVertexArray()}function c(S){return i.bindVertexArray(S)}function u(S){return i.deleteVertexArray(S)}function d(S,C,X){const V=X.wireframe===!0;let J=n[S.id];J===void 0&&(J={},n[S.id]=J);let ee=J[C.id];ee===void 0&&(ee={},J[C.id]=ee);let j=ee[V];return j===void 0&&(j=f(l()),ee[V]=j),j}function f(S){const C=[],X=[],V=[];for(let J=0;J=0){const fe=J[G];let Me=ee[G];if(Me===void 0&&(G==="instanceMatrix"&&S.instanceMatrix&&(Me=S.instanceMatrix),G==="instanceColor"&&S.instanceColor&&(Me=S.instanceColor)),fe===void 0||fe.attribute!==Me||Me&&fe.data!==Me.data)return!0;j++}return s.attributesNum!==j||s.index!==V}function _(S,C,X,V){const J={},ee=C.attributes;let j=0;const ne=X.getAttributes();for(const G in ne)if(ne[G].location>=0){let fe=ee[G];fe===void 0&&(G==="instanceMatrix"&&S.instanceMatrix&&(fe=S.instanceMatrix),G==="instanceColor"&&S.instanceColor&&(fe=S.instanceColor));const Me={};Me.attribute=fe,fe&&fe.data&&(Me.data=fe.data),J[G]=Me,j++}s.attributes=J,s.attributesNum=j,s.index=V}function v(){const S=s.newAttributes;for(let C=0,X=S.length;C=0){let oe=J[ne];if(oe===void 0&&(ne==="instanceMatrix"&&S.instanceMatrix&&(oe=S.instanceMatrix),ne==="instanceColor"&&S.instanceColor&&(oe=S.instanceColor)),oe!==void 0){const fe=oe.normalized,Me=oe.itemSize,ke=e.get(oe);if(ke===void 0)continue;const je=ke.buffer,q=ke.type,re=ke.bytesPerElement,ve=q===i.INT||q===i.UNSIGNED_INT||oe.gpuType===Aa;if(oe.isInterleavedBufferAttribute){const le=oe.data,be=le.stride,Ue=oe.offset;if(le.isInstancedInterleavedBuffer){for(let He=0;He0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),h=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),I=_>0,L=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:m,maxVertexTextures:_,maxTextureSize:v,maxCubemapSize:p,maxAttributes:h,maxVertexUniforms:b,maxVaryings:T,maxFragmentUniforms:M,vertexTextures:I,maxSamples:L}}function cf(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new Zn,a=new ze,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const m=d.length!==0||f||n!==0||r;return r=f,n=d.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,f){t=u(d,f,0)},this.setState=function(d,f,m){const _=d.clippingPlanes,v=d.clipIntersection,p=d.clipShadows,h=i.get(d);if(!r||_===null||_.length===0||s&&!p)s?u(null):c();else{const b=s?0:n,T=b*4;let M=h.clippingState||null;l.value=M,M=u(_,f,T,m);for(let I=0;I!==T;++I)M[I]=t[I];h.clippingState=M,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(d,f,m,_){const v=d!==null?d.length:0;let p=null;if(v!==0){if(p=l.value,_!==!0||p===null){const h=m+v*4,b=f.matrixWorldInverse;a.getNormalMatrix(b),(p===null||p.length0){const c=new ru(l.height);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Ti=4,Ao=[.125,.215,.35,.446,.526,.582],$n=20,As=new Ia,bo=new Pe;let bs=null,ws=0,Rs=0,Cs=!1;const jn=(1+Math.sqrt(5))/2,xi=1/jn,wo=[new N(-jn,xi,0),new N(jn,xi,0),new N(-xi,0,jn),new N(xi,0,jn),new N(0,jn,-xi),new N(0,jn,xi),new N(-1,1,-1),new N(1,1,-1),new N(-1,1,1),new N(1,1,1)];class Ro{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){bs=this._renderer.getRenderTarget(),ws=this._renderer.getActiveCubeFace(),Rs=this._renderer.getActiveMipmapLevel(),Cs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Lo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Po(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),u.setRenderTarget(r),v&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Ci||e.mapping===Pi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Lo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Po());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Ft(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;wr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,As)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s$n&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${$n}`);const h=[];let b=0;for(let w=0;w<$n;++w){const F=w/v,E=Math.exp(-F*F/2);h.push(E),w===0?b+=E:wT-Ti?r-T+Ti:0),L=4*(this._cubeSize-M);wr(t,I,L,3*M,2*M),l.setRenderTarget(t),l.render(d,As)}}function hf(i){const e=[],t=[],n=[];let r=i;const s=i-Ti+1+Ao.length;for(let o=0;oi-Ti?l=Ao[o-i+Ti-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],m=6,_=6,v=3,p=2,h=1,b=new Float32Array(v*_*m),T=new Float32Array(p*_*m),M=new Float32Array(h*_*m);for(let L=0;L2?0:-1,E=[w,F,0,w+2/3,F,0,w+2/3,F+1,0,w,F,0,w+2/3,F+1,0,w,F+1,0];b.set(E,v*_*L),T.set(f,p*_*L);const S=[L,L,L,L,L,L];M.set(S,h*_*L)}const I=new cn;I.setAttribute("position",new Wt(b,v)),I.setAttribute("uv",new Wt(T,p)),I.setAttribute("faceIndex",new Wt(M,h)),e.push(I),r>Ti&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Co(i,e,t){const n=new ti(i,e,t);return n.texture.mapping=jr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function wr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function df(i,e,t){const n=new Float32Array($n),r=new N(0,1,0);return new Rt({name:"SphericalGaussianBlur",defines:{n:$n,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Fa(),fragmentShader:` precision mediump float; precision mediump int; @@ -3644,7 +3636,7 @@ void main() { } } - `,blending:Un,depthTest:!1,depthWrite:!1})}function yo(){return new Tt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Fa(),fragmentShader:` + `,blending:On,depthTest:!1,depthWrite:!1})}function Po(){return new Rt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Fa(),fragmentShader:` precision mediump float; precision mediump int; @@ -3663,7 +3655,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:Un,depthTest:!1,depthWrite:!1})}function To(){return new Tt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Fa(),fragmentShader:` + `,blending:On,depthTest:!1,depthWrite:!1})}function Lo(){return new Rt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Fa(),fragmentShader:` precision mediump float; precision mediump int; @@ -3679,7 +3671,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:Un,depthTest:!1,depthWrite:!1})}function Fa(){return` + `,blending:On,depthTest:!1,depthWrite:!1})}function Fa(){return` precision mediump float; precision mediump int; @@ -3734,16 +3726,17 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function $d(i){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ys||l===qs,u=l===Ti||l===Ai;if(c||u){let f=e.get(a);const p=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new Mo(i)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const m=a.image;return c&&m&&m.height>0||u&&m&&r(m)?(t===null&&(t=new Mo(i)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(L=Math.ceil(H/e.maxTextureSize),H=e.maxTextureSize);const b=new Float32Array(H*L*4*f),z=new Ml(b,H,L,f);z.type=tn,z.needsUpdate=!0;const ie=T*4;for(let M=0;M0)return i;const r=e*t;let s=bo[r];if(s===void 0&&(s=new Float32Array(r),bo[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function pt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0||u&&m&&r(m)?(t===null&&(t=new Ro(i)),d=c?t.fromEquirectangular(a):t.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(L=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const w=new Float32Array(I*L*4*d),F=new xl(w,I,L,d);F.type=an,F.needsUpdate=!0;const E=M*4;for(let C=0;C0)return i;const r=e*t;let s=Uo[r];if(s===void 0&&(s=new Float32Array(r),Uo[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function gt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t":" "} ${a}: ${t[o]}`)}return n.join(` -`)}function Jf(i){const e=Ze.getPrimaries(Ze.workingColorSpace),t=Ze.getPrimaries(i);let n;switch(e===t?n="":e===Hr&&t===zr?n="LinearDisplayP3ToLinearSRGB":e===zr&&t===Hr&&(n="LinearSRGBToLinearDisplayP3"),i){case Fn:case qr:return[n,"LinearTransferOETF"];case sn:case Da:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Uo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` +`)}const Ho=new ze;function fp(i){qe._getMatrix(Ho,qe.workingColorSpace,i);const e=`mat3( ${Ho.elements.map(t=>t.toFixed(4))} )`;switch(qe.getTransfer(i)){case Gr:return[e,"LinearTransferOETF"];case nt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ko(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+r+` -`+$f(i.getShaderSource(e),o)}else return r}function Qf(i,e){const t=Jf(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function ep(i,e){let t;switch(e){case fc:t="Linear";break;case pc:t="Reinhard";break;case mc:t="Cineon";break;case _c:t="ACESFilmic";break;case vc:t="AgX";break;case xc:t="Neutral";break;case gc:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const gr=new U;function tp(){Ze.getLuminanceCoefficients(gr);const i=gr.x.toFixed(4),e=gr.y.toFixed(4),t=gr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function np(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ki).join(` -`)}function ip(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function rp(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function Ea(i){return i.replace(sp,op)}const ap=new Map;function op(i,e){let t=Fe[e];if(t===void 0){const n=ap.get(e);if(n!==void 0)t=Fe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ea(t)}const lp=/#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 Fo(i){return i.replace(lp,cp)}function cp(i,e,t,n){let r="";for(let s=parseInt(e);s/gm;function Ma(i){return i.replace(Sp,Ep)}const Mp=new Map;function Ep(i,e){let t=Be[e];if(t===void 0){const n=Mp.get(e);if(n!==void 0)t=Be[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ma(t)}const yp=/#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 Wo(i){return i.replace(yp,Tp)}function Tp(i,e,t,n){let r="";for(let s=parseInt(e);s0&&(p+=` +`),h=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Zi).join(` `),h.length>0&&(h+=` -`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(ki).join(` -`),d.length>0&&(d+=` -`)):(h=[Oo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(ki).join(` -`),d=[Oo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==In?"#define TONE_MAPPING":"",t.toneMapping!==In?Fe.tonemapping_pars_fragment:"",t.toneMapping!==In?ep("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fe.colorspace_pars_fragment,Qf("linearToOutputTexel",t.outputColorSpace),tp(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(ki).join(` -`)),o=Ea(o),o=Io(o,t),o=No(o,t),a=Ea(a),a=Io(a,t),a=No(a,t),o=Fo(o),a=Fo(a),t.isRawShaderMaterial!==!0&&(A=`#version 300 es -`,h=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)):(p=[Xo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Zi).join(` +`),h=[Xo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Bn?"#define TONE_MAPPING":"",t.toneMapping!==Bn?Be.tonemapping_pars_fragment:"",t.toneMapping!==Bn?mp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Be.colorspace_pars_fragment,pp("linearToOutputTexel",t.outputColorSpace),_p(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Zi).join(` +`)),o=Ma(o),o=Vo(o,t),o=Go(o,t),a=Ma(a),a=Vo(a,t),a=Go(a,t),o=Wo(o),a=Wo(a),t.isRawShaderMaterial!==!0&&(b=`#version 300 es +`,p=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+h,d=["#define varying in",t.glslVersion===Qa?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Qa?"":"#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,h=["#define varying in",t.glslVersion===Ka?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ka?"":"#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(` `)+` -`+d);const E=A+h+o,T=A+d+a,H=Do(r,r.VERTEX_SHADER,E),L=Do(r,r.FRAGMENT_SHADER,T);r.attachShader(x,H),r.attachShader(x,L),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function b(M){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(x).trim(),k=r.getShaderInfoLog(H).trim(),K=r.getShaderInfoLog(L).trim();let Q=!0,X=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,x,H,L);else{const J=Uo(r,H,"vertex"),V=Uo(r,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` +`+h);const T=b+p+o,M=b+h+a,I=zo(r,r.VERTEX_SHADER,T),L=zo(r,r.FRAGMENT_SHADER,M);r.attachShader(v,I),r.attachShader(v,L),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function w(C){if(i.debug.checkShaderErrors){const X=r.getProgramInfoLog(v).trim(),V=r.getShaderInfoLog(I).trim(),J=r.getShaderInfoLog(L).trim();let ee=!0,j=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(ee=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,I,L);else{const ne=ko(r,I,"vertex"),G=ko(r,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+` -Material Name: `+M.name+` -Material Type: `+M.type+` +Material Name: `+C.name+` +Material Type: `+C.type+` -Program Info Log: `+W+` -`+J+` -`+V)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(k===""||K==="")&&(X=!1);X&&(M.diagnostics={runnable:Q,programLog:W,vertexShader:{log:k,prefix:h},fragmentShader:{log:K,prefix:d}})}r.deleteShader(H),r.deleteShader(L),z=new Fr(r,x),ie=rp(r,x)}let z;this.getUniforms=function(){return z===void 0&&b(this),z};let ie;this.getAttributes=function(){return ie===void 0&&b(this),ie};let g=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(x,Kf)),g},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=H,this.fragmentShader=L,this}let _p=0;class gp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vp(e),t.set(e,n)),n}}class vp{constructor(e){this.id=_p++,this.code=e,this.usedTimes=0}}function xp(i,e,t,n,r,s,o){const a=new yl,l=new gp,c=new Set,u=[],f=r.logarithmicDepthBuffer,p=r.reverseDepthBuffer,m=r.vertexTextures;let _=r.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function h(g){return c.add(g),g===0?"uv":`uv${g}`}function d(g,M,W,k,K){const Q=k.fog,X=K.geometry,J=g.isMeshStandardMaterial?k.environment:null,V=(g.isMeshStandardMaterial?t:e).get(g.envMap||J),fe=V&&V.mapping===Yr?V.image.height:null,pe=x[g.type];g.precision!==null&&(_=r.getMaxPrecision(g.precision),_!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",_,"instead."));const ve=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,We=ve!==void 0?ve.length:0;let Ye=0;X.morphAttributes.position!==void 0&&(Ye=1),X.morphAttributes.normal!==void 0&&(Ye=2),X.morphAttributes.color!==void 0&&(Ye=3);let Y,te,_e,me;if(pe){const Pt=an[pe];Y=Pt.vertexShader,te=Pt.fragmentShader}else Y=g.vertexShader,te=g.fragmentShader,l.update(g),_e=l.getVertexShaderID(g),me=l.getFragmentShaderID(g);const Ne=i.getRenderTarget(),be=K.isInstancedMesh===!0,He=K.isBatchedMesh===!0,Ke=!!g.map,Ge=!!g.matcap,R=!!V,vt=!!g.aoMap,Be=!!g.lightMap,Ve=!!g.bumpMap,Re=!!g.normalMap,Qe=!!g.displacementMap,Ce=!!g.emissiveMap,y=!!g.metalnessMap,v=!!g.roughnessMap,I=g.anisotropy>0,Z=g.clearcoat>0,ee=g.dispersion>0,q=g.iridescence>0,xe=g.sheen>0,oe=g.transmission>0,w=I&&!!g.anisotropyMap,re=Z&&!!g.clearcoatMap,j=Z&&!!g.clearcoatNormalMap,se=Z&&!!g.clearcoatRoughnessMap,Me=q&&!!g.iridescenceMap,Te=q&&!!g.iridescenceThicknessMap,ue=xe&&!!g.sheenColorMap,ze=xe&&!!g.sheenRoughnessMap,Ae=!!g.specularMap,ke=!!g.specularColorMap,C=!!g.specularIntensityMap,he=oe&&!!g.transmissionMap,G=oe&&!!g.thicknessMap,$=!!g.gradientMap,le=!!g.alphaMap,de=g.alphaTest>0,Xe=!!g.alphaHash,ht=!!g.extensions;let Ct=In;g.toneMapped&&(Ne===null||Ne.isXRRenderTarget===!0)&&(Ct=i.toneMapping);const qe={shaderID:pe,shaderType:g.type,shaderName:g.name,vertexShader:Y,fragmentShader:te,defines:g.defines,customVertexShaderID:_e,customFragmentShaderID:me,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:_,batching:He,batchingColor:He&&K._colorsTexture!==null,instancing:be,instancingColor:be&&K.instanceColor!==null,instancingMorph:be&&K.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ne===null?i.outputColorSpace:Ne.isXRRenderTarget===!0?Ne.texture.colorSpace:Fn,alphaToCoverage:!!g.alphaToCoverage,map:Ke,matcap:Ge,envMap:R,envMapMode:R&&V.mapping,envMapCubeUVHeight:fe,aoMap:vt,lightMap:Be,bumpMap:Ve,normalMap:Re,displacementMap:m&&Qe,emissiveMap:Ce,normalMapObjectSpace:Re&&g.normalMapType===Ac,normalMapTangentSpace:Re&&g.normalMapType===Tc,metalnessMap:y,roughnessMap:v,anisotropy:I,anisotropyMap:w,clearcoat:Z,clearcoatMap:re,clearcoatNormalMap:j,clearcoatRoughnessMap:se,dispersion:ee,iridescence:q,iridescenceMap:Me,iridescenceThicknessMap:Te,sheen:xe,sheenColorMap:ue,sheenRoughnessMap:ze,specularMap:Ae,specularColorMap:ke,specularIntensityMap:C,transmission:oe,transmissionMap:he,thicknessMap:G,gradientMap:$,opaque:g.transparent===!1&&g.blending===Si&&g.alphaToCoverage===!1,alphaMap:le,alphaTest:de,alphaHash:Xe,combine:g.combine,mapUv:Ke&&h(g.map.channel),aoMapUv:vt&&h(g.aoMap.channel),lightMapUv:Be&&h(g.lightMap.channel),bumpMapUv:Ve&&h(g.bumpMap.channel),normalMapUv:Re&&h(g.normalMap.channel),displacementMapUv:Qe&&h(g.displacementMap.channel),emissiveMapUv:Ce&&h(g.emissiveMap.channel),metalnessMapUv:y&&h(g.metalnessMap.channel),roughnessMapUv:v&&h(g.roughnessMap.channel),anisotropyMapUv:w&&h(g.anisotropyMap.channel),clearcoatMapUv:re&&h(g.clearcoatMap.channel),clearcoatNormalMapUv:j&&h(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&h(g.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&h(g.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&h(g.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&h(g.sheenColorMap.channel),sheenRoughnessMapUv:ze&&h(g.sheenRoughnessMap.channel),specularMapUv:Ae&&h(g.specularMap.channel),specularColorMapUv:ke&&h(g.specularColorMap.channel),specularIntensityMapUv:C&&h(g.specularIntensityMap.channel),transmissionMapUv:he&&h(g.transmissionMap.channel),thicknessMapUv:G&&h(g.thicknessMap.channel),alphaMapUv:le&&h(g.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Re||I),vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:K.isPoints===!0&&!!X.attributes.uv&&(Ke||le),fog:!!Q,useFog:g.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:g.flatShading===!0,sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:K.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:We,morphTextureStride:Ye,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&W.length>0,shadowMapType:i.shadowMap.type,toneMapping:Ct,decodeVideoTexture:Ke&&g.map.isVideoTexture===!0&&Ze.getTransfer(g.map.colorSpace)===tt,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===_n,flipSided:g.side===Ft,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:ht&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&g.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return qe.vertexUv1s=c.has(1),qe.vertexUv2s=c.has(2),qe.vertexUv3s=c.has(3),c.clear(),qe}function A(g){const M=[];if(g.shaderID?M.push(g.shaderID):(M.push(g.customVertexShaderID),M.push(g.customFragmentShaderID)),g.defines!==void 0)for(const W in g.defines)M.push(W),M.push(g.defines[W]);return g.isRawShaderMaterial===!1&&(E(M,g),T(M,g),M.push(i.outputColorSpace)),M.push(g.customProgramCacheKey),M.join()}function E(g,M){g.push(M.precision),g.push(M.outputColorSpace),g.push(M.envMapMode),g.push(M.envMapCubeUVHeight),g.push(M.mapUv),g.push(M.alphaMapUv),g.push(M.lightMapUv),g.push(M.aoMapUv),g.push(M.bumpMapUv),g.push(M.normalMapUv),g.push(M.displacementMapUv),g.push(M.emissiveMapUv),g.push(M.metalnessMapUv),g.push(M.roughnessMapUv),g.push(M.anisotropyMapUv),g.push(M.clearcoatMapUv),g.push(M.clearcoatNormalMapUv),g.push(M.clearcoatRoughnessMapUv),g.push(M.iridescenceMapUv),g.push(M.iridescenceThicknessMapUv),g.push(M.sheenColorMapUv),g.push(M.sheenRoughnessMapUv),g.push(M.specularMapUv),g.push(M.specularColorMapUv),g.push(M.specularIntensityMapUv),g.push(M.transmissionMapUv),g.push(M.thicknessMapUv),g.push(M.combine),g.push(M.fogExp2),g.push(M.sizeAttenuation),g.push(M.morphTargetsCount),g.push(M.morphAttributeCount),g.push(M.numDirLights),g.push(M.numPointLights),g.push(M.numSpotLights),g.push(M.numSpotLightMaps),g.push(M.numHemiLights),g.push(M.numRectAreaLights),g.push(M.numDirLightShadows),g.push(M.numPointLightShadows),g.push(M.numSpotLightShadows),g.push(M.numSpotLightShadowsWithMaps),g.push(M.numLightProbes),g.push(M.shadowMapType),g.push(M.toneMapping),g.push(M.numClippingPlanes),g.push(M.numClipIntersection),g.push(M.depthPacking)}function T(g,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),g.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.alphaToCoverage&&a.enable(20),g.push(a.mask)}function H(g){const M=x[g.type];let W;if(M){const k=an[M];W=Gr.clone(k.uniforms)}else W=g.uniforms;return W}function L(g,M){let W;for(let k=0,K=u.length;k0?n.push(d):m.transparent===!0?r.push(d):t.push(d)}function l(f,p,m,_,x,h){const d=o(f,p,m,_,x,h);m.transmission>0?n.unshift(d):m.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,p){t.length>1&&t.sort(f||Mp),n.length>1&&n.sort(p||Bo),r.length>1&&r.sort(p||Bo)}function u(){for(let f=e,p=i.length;f=s.length?(o=new zo,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function yp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new we};break;case"SpotLight":t={position:new U,direction:new U,color:new we,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new we,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new we,groundColor:new we};break;case"RectAreaLight":t={color:new we,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function Tp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Ap=0;function bp(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function wp(i){const e=new yp,t=Tp(),n={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 c=0;c<9;c++)n.probe.push(new U);const r=new U,s=new it,o=new it;function a(c){let u=0,f=0,p=0;for(let ie=0;ie<9;ie++)n.probe[ie].set(0,0,0);let m=0,_=0,x=0,h=0,d=0,A=0,E=0,T=0,H=0,L=0,b=0;c.sort(bp);for(let ie=0,g=c.length;ie0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ae.LTC_FLOAT_1,n.rectAreaLTC2=ae.LTC_FLOAT_2):(n.rectAreaLTC1=ae.LTC_HALF_1,n.rectAreaLTC2=ae.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=p;const z=n.hash;(z.directionalLength!==m||z.pointLength!==_||z.spotLength!==x||z.rectAreaLength!==h||z.hemiLength!==d||z.numDirectionalShadows!==A||z.numPointShadows!==E||z.numSpotShadows!==T||z.numSpotMaps!==H||z.numLightProbes!==b)&&(n.directional.length=m,n.spot.length=x,n.rectArea.length=h,n.point.length=_,n.hemi.length=d,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=T+H-L,n.spotLightMap.length=H,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=b,z.directionalLength=m,z.pointLength=_,z.spotLength=x,z.rectAreaLength=h,z.hemiLength=d,z.numDirectionalShadows=A,z.numPointShadows=E,z.numSpotShadows=T,z.numSpotMaps=H,z.numLightProbes=b,n.version=Ap++)}function l(c,u){let f=0,p=0,m=0,_=0,x=0;const h=u.matrixWorldInverse;for(let d=0,A=c.length;d=o.length?(a=new Ho(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Cp extends qi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ec,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 Pp extends qi{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}}const Lp=`void main() { +Program Info Log: `+X+` +`+ne+` +`+G)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(V===""||J==="")&&(j=!1);j&&(C.diagnostics={runnable:ee,programLog:X,vertexShader:{log:V,prefix:p},fragmentShader:{log:J,prefix:h}})}r.deleteShader(I),r.deleteShader(L),F=new kr(r,v),E=xp(r,v)}let F;this.getUniforms=function(){return F===void 0&&w(this),F};let E;this.getAttributes=function(){return E===void 0&&w(this),E};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(v,up)),S},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=hp++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=I,this.fragmentShader=L,this}let Lp=0;class Dp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Up(e),t.set(e,n)),n}}class Up{constructor(e){this.id=Lp++,this.code=e,this.usedTimes=0}}function Ip(i,e,t,n,r,s,o){const a=new Ml,l=new Dp,c=new Set,u=[],d=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(E){return c.add(E),E===0?"uv":`uv${E}`}function p(E,S,C,X,V){const J=X.fog,ee=V.geometry,j=E.isMeshStandardMaterial?X.environment:null,ne=(E.isMeshStandardMaterial?t:e).get(E.envMap||j),G=ne&&ne.mapping===jr?ne.image.height:null,oe=_[E.type];E.precision!==null&&(m=r.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const fe=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,Me=fe!==void 0?fe.length:0;let ke=0;ee.morphAttributes.position!==void 0&&(ke=1),ee.morphAttributes.normal!==void 0&&(ke=2),ee.morphAttributes.color!==void 0&&(ke=3);let je,q,re,ve;if(oe){const et=un[oe];je=et.vertexShader,q=et.fragmentShader}else je=E.vertexShader,q=E.fragmentShader,l.update(E),re=l.getVertexShaderID(E),ve=l.getFragmentShaderID(E);const le=i.getRenderTarget(),be=i.state.buffers.depth.getReversed(),Ue=V.isInstancedMesh===!0,He=V.isBatchedMesh===!0,it=!!E.map,Xe=!!E.matcap,st=!!ne,R=!!E.aoMap,Tt=!!E.lightMap,Ve=!!E.bumpMap,We=!!E.normalMap,Ee=!!E.displacementMap,tt=!!E.emissiveMap,xe=!!E.metalnessMap,y=!!E.roughnessMap,g=E.anisotropy>0,O=E.clearcoat>0,K=E.dispersion>0,te=E.iridescence>0,Y=E.sheen>0,ge=E.transmission>0,A=g&&!!E.anisotropyMap,Z=O&&!!E.clearcoatMap,ye=O&&!!E.clearcoatNormalMap,Q=O&&!!E.clearcoatRoughnessMap,ae=te&&!!E.iridescenceMap,Se=te&&!!E.iridescenceThicknessMap,we=Y&&!!E.sheenColorMap,pe=Y&&!!E.sheenRoughnessMap,Ne=!!E.specularMap,Re=!!E.specularColorMap,Qe=!!E.specularIntensityMap,P=ge&&!!E.transmissionMap,ce=ge&&!!E.thicknessMap,W=!!E.gradientMap,$=!!E.alphaMap,de=E.alphaTest>0,he=!!E.alphaHash,Oe=!!E.extensions;let lt=Bn;E.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(lt=i.toneMapping);const At={shaderID:oe,shaderType:E.type,shaderName:E.name,vertexShader:je,fragmentShader:q,defines:E.defines,customVertexShaderID:re,customFragmentShaderID:ve,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:He,batchingColor:He&&V._colorsTexture!==null,instancing:Ue,instancingColor:Ue&&V.instanceColor!==null,instancingMorph:Ue&&V.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:le===null?i.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:Ui,alphaToCoverage:!!E.alphaToCoverage,map:it,matcap:Xe,envMap:st,envMapMode:st&&ne.mapping,envMapCubeUVHeight:G,aoMap:R,lightMap:Tt,bumpMap:Ve,normalMap:We,displacementMap:f&&Ee,emissiveMap:tt,normalMapObjectSpace:We&&E.normalMapType===Tc,normalMapTangentSpace:We&&E.normalMapType===yc,metalnessMap:xe,roughnessMap:y,anisotropy:g,anisotropyMap:A,clearcoat:O,clearcoatMap:Z,clearcoatNormalMap:ye,clearcoatRoughnessMap:Q,dispersion:K,iridescence:te,iridescenceMap:ae,iridescenceThicknessMap:Se,sheen:Y,sheenColorMap:we,sheenRoughnessMap:pe,specularMap:Ne,specularColorMap:Re,specularIntensityMap:Qe,transmission:ge,transmissionMap:P,thicknessMap:ce,gradientMap:W,opaque:E.transparent===!1&&E.blending===Ai&&E.alphaToCoverage===!1,alphaMap:$,alphaTest:de,alphaHash:he,combine:E.combine,mapUv:it&&v(E.map.channel),aoMapUv:R&&v(E.aoMap.channel),lightMapUv:Tt&&v(E.lightMap.channel),bumpMapUv:Ve&&v(E.bumpMap.channel),normalMapUv:We&&v(E.normalMap.channel),displacementMapUv:Ee&&v(E.displacementMap.channel),emissiveMapUv:tt&&v(E.emissiveMap.channel),metalnessMapUv:xe&&v(E.metalnessMap.channel),roughnessMapUv:y&&v(E.roughnessMap.channel),anisotropyMapUv:A&&v(E.anisotropyMap.channel),clearcoatMapUv:Z&&v(E.clearcoatMap.channel),clearcoatNormalMapUv:ye&&v(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&v(E.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&v(E.iridescenceMap.channel),iridescenceThicknessMapUv:Se&&v(E.iridescenceThicknessMap.channel),sheenColorMapUv:we&&v(E.sheenColorMap.channel),sheenRoughnessMapUv:pe&&v(E.sheenRoughnessMap.channel),specularMapUv:Ne&&v(E.specularMap.channel),specularColorMapUv:Re&&v(E.specularColorMap.channel),specularIntensityMapUv:Qe&&v(E.specularIntensityMap.channel),transmissionMapUv:P&&v(E.transmissionMap.channel),thicknessMapUv:ce&&v(E.thicknessMap.channel),alphaMapUv:$&&v(E.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(We||g),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!ee.attributes.uv&&(it||$),fog:!!J,useFog:E.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:be,skinning:V.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:Me,morphTextureStride:ke,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,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:lt,decodeVideoTexture:it&&E.map.isVideoTexture===!0&&qe.getTransfer(E.map.colorSpace)===nt,decodeVideoTextureEmissive:tt&&E.emissiveMap.isVideoTexture===!0&&qe.getTransfer(E.emissiveMap.colorSpace)===nt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Sn,flipSided:E.side===Ot,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Oe&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Oe&&E.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return At.vertexUv1s=c.has(1),At.vertexUv2s=c.has(2),At.vertexUv3s=c.has(3),c.clear(),At}function h(E){const S=[];if(E.shaderID?S.push(E.shaderID):(S.push(E.customVertexShaderID),S.push(E.customFragmentShaderID)),E.defines!==void 0)for(const C in E.defines)S.push(C),S.push(E.defines[C]);return E.isRawShaderMaterial===!1&&(b(S,E),T(S,E),S.push(i.outputColorSpace)),S.push(E.customProgramCacheKey),S.join()}function b(E,S){E.push(S.precision),E.push(S.outputColorSpace),E.push(S.envMapMode),E.push(S.envMapCubeUVHeight),E.push(S.mapUv),E.push(S.alphaMapUv),E.push(S.lightMapUv),E.push(S.aoMapUv),E.push(S.bumpMapUv),E.push(S.normalMapUv),E.push(S.displacementMapUv),E.push(S.emissiveMapUv),E.push(S.metalnessMapUv),E.push(S.roughnessMapUv),E.push(S.anisotropyMapUv),E.push(S.clearcoatMapUv),E.push(S.clearcoatNormalMapUv),E.push(S.clearcoatRoughnessMapUv),E.push(S.iridescenceMapUv),E.push(S.iridescenceThicknessMapUv),E.push(S.sheenColorMapUv),E.push(S.sheenRoughnessMapUv),E.push(S.specularMapUv),E.push(S.specularColorMapUv),E.push(S.specularIntensityMapUv),E.push(S.transmissionMapUv),E.push(S.thicknessMapUv),E.push(S.combine),E.push(S.fogExp2),E.push(S.sizeAttenuation),E.push(S.morphTargetsCount),E.push(S.morphAttributeCount),E.push(S.numDirLights),E.push(S.numPointLights),E.push(S.numSpotLights),E.push(S.numSpotLightMaps),E.push(S.numHemiLights),E.push(S.numRectAreaLights),E.push(S.numDirLightShadows),E.push(S.numPointLightShadows),E.push(S.numSpotLightShadows),E.push(S.numSpotLightShadowsWithMaps),E.push(S.numLightProbes),E.push(S.shadowMapType),E.push(S.toneMapping),E.push(S.numClippingPlanes),E.push(S.numClipIntersection),E.push(S.depthPacking)}function T(E,S){a.disableAll(),S.supportsVertexTextures&&a.enable(0),S.instancing&&a.enable(1),S.instancingColor&&a.enable(2),S.instancingMorph&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUv1s&&a.enable(13),S.vertexUv2s&&a.enable(14),S.vertexUv3s&&a.enable(15),S.vertexTangents&&a.enable(16),S.anisotropy&&a.enable(17),S.alphaHash&&a.enable(18),S.batching&&a.enable(19),S.dispersion&&a.enable(20),S.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.reverseDepthBuffer&&a.enable(4),S.skinning&&a.enable(5),S.morphTargets&&a.enable(6),S.morphNormals&&a.enable(7),S.morphColors&&a.enable(8),S.premultipliedAlpha&&a.enable(9),S.shadowMapEnabled&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.opaque&&a.enable(17),S.pointsUvs&&a.enable(18),S.decodeVideoTexture&&a.enable(19),S.decodeVideoTextureEmissive&&a.enable(20),S.alphaToCoverage&&a.enable(21),E.push(a.mask)}function M(E){const S=_[E.type];let C;if(S){const X=un[S];C=Xr.clone(X.uniforms)}else C=E.uniforms;return C}function I(E,S){let C;for(let X=0,V=u.length;X0?n.push(h):m.transparent===!0?r.push(h):t.push(h)}function l(d,f,m,_,v,p){const h=o(d,f,m,_,v,p);m.transmission>0?n.unshift(h):m.transparent===!0?r.unshift(h):t.unshift(h)}function c(d,f){t.length>1&&t.sort(d||Fp),n.length>1&&n.sort(f||Yo),r.length>1&&r.sort(f||Yo)}function u(){for(let d=e,f=i.length;d=s.length?(o=new qo,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Bp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Pe};break;case"SpotLight":t={position:new N,direction:new N,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new N,halfWidth:new N,halfHeight:new N};break}return i[e.id]=t,t}}}function zp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Hp=0;function kp(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Vp(i){const e=new Bp,t=zp(),n={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 c=0;c<9;c++)n.probe.push(new N);const r=new N,s=new ot,o=new ot;function a(c){let u=0,d=0,f=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let m=0,_=0,v=0,p=0,h=0,b=0,T=0,M=0,I=0,L=0,w=0;c.sort(kp);for(let E=0,S=c.length;E0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=se.LTC_FLOAT_1,n.rectAreaLTC2=se.LTC_FLOAT_2):(n.rectAreaLTC1=se.LTC_HALF_1,n.rectAreaLTC2=se.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=d,n.ambient[2]=f;const F=n.hash;(F.directionalLength!==m||F.pointLength!==_||F.spotLength!==v||F.rectAreaLength!==p||F.hemiLength!==h||F.numDirectionalShadows!==b||F.numPointShadows!==T||F.numSpotShadows!==M||F.numSpotMaps!==I||F.numLightProbes!==w)&&(n.directional.length=m,n.spot.length=v,n.rectArea.length=p,n.point.length=_,n.hemi.length=h,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=M+I-L,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=w,F.directionalLength=m,F.pointLength=_,F.spotLength=v,F.rectAreaLength=p,F.hemiLength=h,F.numDirectionalShadows=b,F.numPointShadows=T,F.numSpotShadows=M,F.numSpotMaps=I,F.numLightProbes=w,n.version=Hp++)}function l(c,u){let d=0,f=0,m=0,_=0,v=0;const p=u.matrixWorldInverse;for(let h=0,b=c.length;h=o.length?(a=new Zo(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}const Wp=`void main() { gl_Position = vec4( position, 1.0 ); -}`,Dp=`uniform sampler2D shadow_pass; +}`,Xp=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3812,12 +3805,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Up(i,e,t){let n=new Ia;const r=new De,s=new De,o=new lt,a=new Cp({depthPacking:yc}),l=new Pp,c={},u=t.maxTextureSize,f={[Nn]:Ft,[Ft]:Nn,[_n]:_n},p=new Tt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new De},radius:{value:4}},vertexShader:Lp,fragmentShader:Dp}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const _=new rn;_.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Nt(_,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ta;let d=this.type;this.render=function(L,b,z){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||L.length===0)return;const ie=i.getRenderTarget(),g=i.getActiveCubeFace(),M=i.getActiveMipmapLevel(),W=i.state;W.setBlending(Un),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const k=d!==fn&&this.type===fn,K=d===fn&&this.type!==fn;for(let Q=0,X=L.length;Qu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/fe.x),r.x=s.x*fe.x,V.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/fe.y),r.y=s.y*fe.y,V.mapSize.y=s.y)),V.map===null||k===!0||K===!0){const ve=this.type!==fn?{minFilter:Rt,magFilter:Rt}:{};V.map!==null&&V.map.dispose(),V.map=new $n(r.x,r.y,ve),V.map.texture.name=J.name+".shadowMap",V.camera.updateProjectionMatrix()}i.setRenderTarget(V.map),i.clear();const pe=V.getViewportCount();for(let ve=0;ve0||b.map&&b.alphaTest>0){const W=g.uuid,k=b.uuid;let K=c[W];K===void 0&&(K={},c[W]=K);let Q=K[k];Q===void 0&&(Q=g.clone(),K[k]=Q,b.addEventListener("dispose",H)),g=Q}if(g.visible=b.visible,g.wireframe=b.wireframe,ie===fn?g.side=b.shadowSide!==null?b.shadowSide:b.side:g.side=b.shadowSide!==null?b.shadowSide:f[b.side],g.alphaMap=b.alphaMap,g.alphaTest=b.alphaTest,g.map=b.map,g.clipShadows=b.clipShadows,g.clippingPlanes=b.clippingPlanes,g.clipIntersection=b.clipIntersection,g.displacementMap=b.displacementMap,g.displacementScale=b.displacementScale,g.displacementBias=b.displacementBias,g.wireframeLinewidth=b.wireframeLinewidth,g.linewidth=b.linewidth,z.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const W=i.properties.get(g);W.light=z}return g}function T(L,b,z,ie,g){if(L.visible===!1)return;if(L.layers.test(b.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&g===fn)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,L.matrixWorld);const k=e.update(L),K=L.material;if(Array.isArray(K)){const Q=k.groups;for(let X=0,J=Q.length;X=1):J.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),Q=X>=2);let V=null,fe={};const pe=i.getParameter(i.SCISSOR_BOX),ve=i.getParameter(i.VIEWPORT),We=new lt().fromArray(pe),Ye=new lt().fromArray(ve);function Y(C,he,G,$){const le=new Uint8Array(4),de=i.createTexture();i.bindTexture(C,de),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new De,u=new WeakMap;let f;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(y,v){return m?new OffscreenCanvas(y,v):Vi("canvas")}function x(y,v,I){let Z=1;const ee=Ce(y);if((ee.width>I||ee.height>I)&&(Z=I/Math.max(ee.width,ee.height)),Z<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const q=Math.floor(Z*ee.width),xe=Math.floor(Z*ee.height);f===void 0&&(f=_(q,xe));const oe=v?_(q,xe):f;return oe.width=q,oe.height=xe,oe.getContext("2d").drawImage(y,0,0,q,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ee.width+"x"+ee.height+") to ("+q+"x"+xe+")."),oe}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ee.width+"x"+ee.height+")."),y;return y}function h(y){return y.generateMipmaps&&y.minFilter!==Rt&&y.minFilter!==It}function d(y){i.generateMipmap(y)}function A(y,v,I,Z,ee=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let q=v;if(v===i.RED&&(I===i.FLOAT&&(q=i.R32F),I===i.HALF_FLOAT&&(q=i.R16F),I===i.UNSIGNED_BYTE&&(q=i.R8)),v===i.RED_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.R8UI),I===i.UNSIGNED_SHORT&&(q=i.R16UI),I===i.UNSIGNED_INT&&(q=i.R32UI),I===i.BYTE&&(q=i.R8I),I===i.SHORT&&(q=i.R16I),I===i.INT&&(q=i.R32I)),v===i.RG&&(I===i.FLOAT&&(q=i.RG32F),I===i.HALF_FLOAT&&(q=i.RG16F),I===i.UNSIGNED_BYTE&&(q=i.RG8)),v===i.RG_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RG8UI),I===i.UNSIGNED_SHORT&&(q=i.RG16UI),I===i.UNSIGNED_INT&&(q=i.RG32UI),I===i.BYTE&&(q=i.RG8I),I===i.SHORT&&(q=i.RG16I),I===i.INT&&(q=i.RG32I)),v===i.RGB_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGB8UI),I===i.UNSIGNED_SHORT&&(q=i.RGB16UI),I===i.UNSIGNED_INT&&(q=i.RGB32UI),I===i.BYTE&&(q=i.RGB8I),I===i.SHORT&&(q=i.RGB16I),I===i.INT&&(q=i.RGB32I)),v===i.RGBA_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),I===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),I===i.UNSIGNED_INT&&(q=i.RGBA32UI),I===i.BYTE&&(q=i.RGBA8I),I===i.SHORT&&(q=i.RGBA16I),I===i.INT&&(q=i.RGBA32I)),v===i.RGB&&I===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),v===i.RGBA){const xe=ee?Br:Ze.getTransfer(Z);I===i.FLOAT&&(q=i.RGBA32F),I===i.HALF_FLOAT&&(q=i.RGBA16F),I===i.UNSIGNED_BYTE&&(q=xe===tt?i.SRGB8_ALPHA8:i.RGBA8),I===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),I===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function E(y,v){let I;return y?v===null||v===jn||v===bi?I=i.DEPTH24_STENCIL8:v===tn?I=i.DEPTH32F_STENCIL8:v===Gi&&(I=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===jn||v===bi?I=i.DEPTH_COMPONENT24:v===tn?I=i.DEPTH_COMPONENT32F:v===Gi&&(I=i.DEPTH_COMPONENT16),I}function T(y,v){return h(y)===!0||y.isFramebufferTexture&&y.minFilter!==Rt&&y.minFilter!==It?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function H(y){const v=y.target;v.removeEventListener("dispose",H),b(v),v.isVideoTexture&&u.delete(v)}function L(y){const v=y.target;v.removeEventListener("dispose",L),ie(v)}function b(y){const v=n.get(y);if(v.__webglInit===void 0)return;const I=y.source,Z=p.get(I);if(Z){const ee=Z[v.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&z(y),Object.keys(Z).length===0&&p.delete(I)}n.remove(y)}function z(y){const v=n.get(y);i.deleteTexture(v.__webglTexture);const I=y.source,Z=p.get(I);delete Z[v.__cacheKey],o.memory.textures--}function ie(y){const v=n.get(y);if(y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(v.__webglFramebuffer[Z]))for(let ee=0;ee=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),g+=1,y}function k(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function K(y,v){const I=n.get(y);if(y.isVideoTexture&&Re(y),y.isRenderTargetTexture===!1&&y.version>0&&I.__version!==y.version){const Z=y.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ye(I,y,v);return}}t.bindTexture(i.TEXTURE_2D,I.__webglTexture,i.TEXTURE0+v)}function Q(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,I.__webglTexture,i.TEXTURE0+v)}function X(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_3D,I.__webglTexture,i.TEXTURE0+v)}function J(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Y(I,y,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,I.__webglTexture,i.TEXTURE0+v)}const V={[Or]:i.REPEAT,[gn]:i.CLAMP_TO_EDGE,[Zs]:i.MIRRORED_REPEAT},fe={[Rt]:i.NEAREST,[Sc]:i.NEAREST_MIPMAP_NEAREST,[$i]:i.NEAREST_MIPMAP_LINEAR,[It]:i.LINEAR,[es]:i.LINEAR_MIPMAP_NEAREST,[Zn]:i.LINEAR_MIPMAP_LINEAR},pe={[bc]:i.NEVER,[Dc]:i.ALWAYS,[wc]:i.LESS,[vl]:i.LEQUAL,[Rc]:i.EQUAL,[Lc]:i.GEQUAL,[Cc]:i.GREATER,[Pc]:i.NOTEQUAL};function ve(y,v){if(v.type===tn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===It||v.magFilter===es||v.magFilter===$i||v.magFilter===Zn||v.minFilter===It||v.minFilter===es||v.minFilter===$i||v.minFilter===Zn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,V[v.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,V[v.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,V[v.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,fe[v.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,fe[v.minFilter]),v.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,pe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Rt||v.minFilter!==$i&&v.minFilter!==Zn||v.type===tn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const I=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,I.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function We(y,v){let I=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",H));const Z=v.source;let ee=p.get(Z);ee===void 0&&(ee={},p.set(Z,ee));const q=k(v);if(q!==y.__cacheKey){ee[q]===void 0&&(ee[q]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,I=!0),ee[q].usedTimes++;const xe=ee[y.__cacheKey];xe!==void 0&&(ee[y.__cacheKey].usedTimes--,xe.usedTimes===0&&z(v)),y.__cacheKey=q,y.__webglTexture=ee[q].texture}return I}function Ye(y,v,I){let Z=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Z=i.TEXTURE_3D);const ee=We(y,v),q=v.source;t.bindTexture(Z,y.__webglTexture,i.TEXTURE0+I);const xe=n.get(q);if(q.version!==xe.__version||ee===!0){t.activeTexture(i.TEXTURE0+I);const oe=Ze.getPrimaries(Ze.workingColorSpace),w=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),re=v.colorSpace===Ln||oe===w?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,re);let j=x(v.image,!1,r.maxTextureSize);j=Qe(v,j);const se=s.convert(v.format,v.colorSpace),Me=s.convert(v.type);let Te=A(v.internalFormat,se,Me,v.colorSpace,v.isVideoTexture);ve(Z,v);let ue;const ze=v.mipmaps,Ae=v.isVideoTexture!==!0,ke=xe.__version===void 0||ee===!0,C=q.dataReady,he=T(v,j);if(v.isDepthTexture)Te=E(v.format===wi,v.type),ke&&(Ae?t.texStorage2D(i.TEXTURE_2D,1,Te,j.width,j.height):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,null));else if(v.isDataTexture)if(ze.length>0){Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let G=0,$=ze.length;G<$;G++)ue=ze[G],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,se,Me,ue.data);v.generateMipmaps=!1}else Ae?(ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height),C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,j.width,j.height,se,Me,j.data)):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,j.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ae&&ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,ze[0].width,ze[0].height,j.depth);for(let G=0,$=ze.length;G<$;G++)if(ue=ze[G],v.format!==kt)if(se!==null)if(Ae){if(C)if(v.layerUpdates.size>0){const le=ko(ue.width,ue.height,v.format,v.type);for(const de of v.layerUpdates){const Xe=ue.data.subarray(de*le/ue.data.BYTES_PER_ELEMENT,(de+1)*le/ue.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,de,ue.width,ue.height,1,se,Xe,0,0)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ue.width,ue.height,j.depth,se,ue.data,0,0)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,G,Te,ue.width,ue.height,j.depth,0,ue.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ae?C&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ue.width,ue.height,j.depth,se,Me,ue.data):t.texImage3D(i.TEXTURE_2D_ARRAY,G,Te,ue.width,ue.height,j.depth,0,se,Me,ue.data)}else{Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let G=0,$=ze.length;G<$;G++)ue=ze[G],v.format!==kt?se!==null?Ae?C&&t.compressedTexSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,ue.data):t.compressedTexImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,se,Me,ue.data)}else if(v.isDataArrayTexture)if(Ae){if(ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,j.width,j.height,j.depth),C)if(v.layerUpdates.size>0){const G=ko(j.width,j.height,v.format,v.type);for(const $ of v.layerUpdates){const le=j.data.subarray($*G/j.data.BYTES_PER_ELEMENT,($+1)*G/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,$,j.width,j.height,1,se,Me,le)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isData3DTexture)Ae?(ke&&t.texStorage3D(i.TEXTURE_3D,he,Te,j.width,j.height,j.depth),C&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)):t.texImage3D(i.TEXTURE_3D,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isFramebufferTexture){if(ke)if(Ae)t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height);else{let G=j.width,$=j.height;for(let le=0;le>=1,$>>=1}}else if(ze.length>0){if(Ae&&ke){const G=Ce(ze[0]);t.texStorage2D(i.TEXTURE_2D,he,Te,G.width,G.height)}for(let G=0,$=ze.length;G<$;G++)ue=ze[G],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,se,Me,ue):t.texImage2D(i.TEXTURE_2D,G,Te,se,Me,ue);v.generateMipmaps=!1}else if(Ae){if(ke){const G=Ce(j);t.texStorage2D(i.TEXTURE_2D,he,Te,G.width,G.height)}C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,se,Me,j)}else t.texImage2D(i.TEXTURE_2D,0,Te,se,Me,j);h(v)&&d(Z),xe.__version=q.version,v.onUpdate&&v.onUpdate(v)}y.__version=v.version}function Y(y,v,I){if(v.image.length!==6)return;const Z=We(y,v),ee=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+I);const q=n.get(ee);if(ee.version!==q.__version||Z===!0){t.activeTexture(i.TEXTURE0+I);const xe=Ze.getPrimaries(Ze.workingColorSpace),oe=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),w=v.colorSpace===Ln||xe===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,w);const re=v.isCompressedTexture||v.image[0].isCompressedTexture,j=v.image[0]&&v.image[0].isDataTexture,se=[];for(let $=0;$<6;$++)!re&&!j?se[$]=x(v.image[$],!0,r.maxCubemapSize):se[$]=j?v.image[$].image:v.image[$],se[$]=Qe(v,se[$]);const Me=se[0],Te=s.convert(v.format,v.colorSpace),ue=s.convert(v.type),ze=A(v.internalFormat,Te,ue,v.colorSpace),Ae=v.isVideoTexture!==!0,ke=q.__version===void 0||Z===!0,C=ee.dataReady;let he=T(v,Me);ve(i.TEXTURE_CUBE_MAP,v);let G;if(re){Ae&&ke&&t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,Me.width,Me.height);for(let $=0;$<6;$++){G=se[$].mipmaps;for(let le=0;le0&&he++;const $=Ce(se[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,$.width,$.height)}for(let $=0;$<6;$++)if(j){Ae?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,se[$].width,se[$].height,Te,ue,se[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,ze,se[$].width,se[$].height,0,Te,ue,se[$].data);for(let le=0;le>q),se=Math.max(1,v.height>>q);ee===i.TEXTURE_3D||ee===i.TEXTURE_2D_ARRAY?t.texImage3D(ee,q,w,j,se,v.depth,0,xe,oe,null):t.texImage2D(ee,q,w,j,se,0,xe,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),Ve(v)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,0,Be(v)):(ee===i.TEXTURE_2D||ee>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function _e(y,v,I){if(i.bindRenderbuffer(i.RENDERBUFFER,y),v.depthBuffer){const Z=v.depthTexture,ee=Z&&Z.isDepthTexture?Z.type:null,q=E(v.stencilBuffer,ee),xe=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=Be(v);Ve(v)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,q,v.width,v.height):I?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,xe,i.RENDERBUFFER,y)}else{const Z=v.textures;for(let ee=0;ee{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,Z.removeEventListener("dispose",ee)};Z.addEventListener("dispose",ee),v.__depthDisposeCallback=ee}v.__boundDepthTexture=Z}if(y.depthTexture&&!v.__autoAllocateDepthBuffer){if(I)throw new Error("target.depthTexture not supported in Cube render targets");me(v.__webglFramebuffer,y)}else if(I){v.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[Z]),v.__webglDepthbuffer[Z]===void 0)v.__webglDepthbuffer[Z]=i.createRenderbuffer(),_e(v.__webglDepthbuffer[Z],y,!1);else{const ee=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[Z];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,ee,i.RENDERBUFFER,q)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),_e(v.__webglDepthbuffer,y,!1);else{const Z=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ee=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Z,i.RENDERBUFFER,ee)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(y,v,I){const Z=n.get(y);v!==void 0&&te(Z.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),I!==void 0&&Ne(y)}function He(y){const v=y.texture,I=n.get(y),Z=n.get(v);y.addEventListener("dispose",L);const ee=y.textures,q=y.isWebGLCubeRenderTarget===!0,xe=ee.length>1;if(xe||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=v.version,o.memory.textures++),q){I.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0){I.__webglFramebuffer[oe]=[];for(let w=0;w0){I.__webglFramebuffer=[];for(let oe=0;oe0&&Ve(y)===!1){I.__webglMultisampledFramebuffer=i.createFramebuffer(),I.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let oe=0;oe0)for(let w=0;w0)for(let w=0;w0){if(Ve(y)===!1){const v=y.textures,I=y.width,Z=y.height;let ee=i.COLOR_BUFFER_BIT;const q=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,xe=n.get(y),oe=v.length>1;if(oe)for(let w=0;w0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Re(y){const v=o.render.frame;u.get(y)!==v&&(u.set(y,v),y.update())}function Qe(y,v){const I=y.colorSpace,Z=y.format,ee=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||I!==Fn&&I!==Ln&&(Ze.getTransfer(I)===tt?(Z!==kt||ee!==Mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",I)),v}function Ce(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=M,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=X,this.setTextureCube=J,this.rebindTextures=be,this.setupRenderTarget=He,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=vt,this.setupDepthRenderbuffer=Ne,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Ve}function Bp(i,e){function t(n,r=Ln){let s;const o=Ze.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===wa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ra)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ul)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ll)return i.BYTE;if(n===cl)return i.SHORT;if(n===Gi)return i.UNSIGNED_SHORT;if(n===ba)return i.INT;if(n===jn)return i.UNSIGNED_INT;if(n===tn)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===hl)return i.ALPHA;if(n===dl)return i.RGB;if(n===kt)return i.RGBA;if(n===fl)return i.LUMINANCE;if(n===pl)return i.LUMINANCE_ALPHA;if(n===Mi)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===ml)return i.RED;if(n===Ca)return i.RED_INTEGER;if(n===_l)return i.RG;if(n===Pa)return i.RG_INTEGER;if(n===La)return i.RGBA_INTEGER;if(n===Pr||n===Lr||n===Dr||n===Ur)if(o===tt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Pr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Pr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ks||n===js||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ks)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===js)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Js)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qs||n===ea||n===ta)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qs||n===ea)return o===tt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ta)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ua||n===ha||n===da||n===fa||n===pa||n===ma)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===na)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ia)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ra)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===sa)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===aa)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===oa)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===la)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ca)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ua)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ha)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===da)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===fa)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pa)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ma)return o===tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ir||n===_a||n===ga)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ir)return o===tt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===_a)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ga)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===gl||n===va||n===xa||n===Sa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ir)return s.COMPRESSED_RED_RGTC1_EXT;if(n===va)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Sa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===bi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class zp extends Qt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class vr extends ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Hp={type:"move"};class Ps{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const h=t.getJointPose(x,n),d=this._getHandJoint(c,x);h!==null&&(d.matrix.fromArray(h.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=h.radius),d.visible=h!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),m=.02,_=.005;c.inputState.pinching&&p>m+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(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)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Hp)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const kp=` +}`;function Yp(i,e,t){let n=new Da;const r=new Le,s=new Le,o=new ht,a=new uu({depthPacking:Ec}),l=new hu,c={},u=t.maxTextureSize,d={[zn]:Ot,[Ot]:zn,[Sn]:Sn},f=new Rt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Le},radius:{value:4}},vertexShader:Wp,fragmentShader:Xp}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const _=new cn;_.setAttribute("position",new Wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ft(_,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ya;let h=this.type;this.render=function(L,w,F){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||L.length===0)return;const E=i.getRenderTarget(),S=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),X=i.state;X.setBlending(On),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const V=h!==gn&&this.type===gn,J=h===gn&&this.type!==gn;for(let ee=0,j=L.length;eeu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/oe.x),r.x=s.x*oe.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/oe.y),r.y=s.y*oe.y,G.mapSize.y=s.y)),G.map===null||V===!0||J===!0){const Me=this.type!==gn?{minFilter:Bt,magFilter:Bt}:{};G.map!==null&&G.map.dispose(),G.map=new ti(r.x,r.y,Me),G.map.texture.name=ne.name+".shadowMap",G.camera.updateProjectionMatrix()}i.setRenderTarget(G.map),i.clear();const fe=G.getViewportCount();for(let Me=0;Me0||w.map&&w.alphaTest>0){const X=S.uuid,V=w.uuid;let J=c[X];J===void 0&&(J={},c[X]=J);let ee=J[V];ee===void 0&&(ee=S.clone(),J[V]=ee,w.addEventListener("dispose",I)),S=ee}if(S.visible=w.visible,S.wireframe=w.wireframe,E===gn?S.side=w.shadowSide!==null?w.shadowSide:w.side:S.side=w.shadowSide!==null?w.shadowSide:d[w.side],S.alphaMap=w.alphaMap,S.alphaTest=w.alphaTest,S.map=w.map,S.clipShadows=w.clipShadows,S.clippingPlanes=w.clippingPlanes,S.clipIntersection=w.clipIntersection,S.displacementMap=w.displacementMap,S.displacementScale=w.displacementScale,S.displacementBias=w.displacementBias,S.wireframeLinewidth=w.wireframeLinewidth,S.linewidth=w.linewidth,F.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const X=i.properties.get(S);X.light=F}return S}function M(L,w,F,E,S){if(L.visible===!1)return;if(L.layers.test(w.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&S===gn)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,L.matrixWorld);const V=e.update(L),J=L.material;if(Array.isArray(J)){const ee=V.groups;for(let j=0,ne=ee.length;j=1):G.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),j=ne>=2);let oe=null,fe={};const Me=i.getParameter(i.SCISSOR_BOX),ke=i.getParameter(i.VIEWPORT),je=new ht().fromArray(Me),q=new ht().fromArray(ke);function re(P,ce,W,$){const de=new Uint8Array(4),he=i.createTexture();i.bindTexture(P,he),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Oe=0;Oe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Le,u=new WeakMap;let d;const f=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(y,g){return m?new OffscreenCanvas(y,g):Ki("canvas")}function v(y,g,O){let K=1;const te=xe(y);if((te.width>O||te.height>O)&&(K=O/Math.max(te.width,te.height)),K<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const Y=Math.floor(K*te.width),ge=Math.floor(K*te.height);d===void 0&&(d=_(Y,ge));const A=g?_(Y,ge):d;return A.width=Y,A.height=ge,A.getContext("2d").drawImage(y,0,0,Y,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+Y+"x"+ge+")."),A}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),y;return y}function p(y){return y.generateMipmaps}function h(y){i.generateMipmap(y)}function b(y){return y.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:y.isWebGL3DRenderTarget?i.TEXTURE_3D:y.isWebGLArrayRenderTarget||y.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(y,g,O,K,te=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let Y=g;if(g===i.RED&&(O===i.FLOAT&&(Y=i.R32F),O===i.HALF_FLOAT&&(Y=i.R16F),O===i.UNSIGNED_BYTE&&(Y=i.R8)),g===i.RED_INTEGER&&(O===i.UNSIGNED_BYTE&&(Y=i.R8UI),O===i.UNSIGNED_SHORT&&(Y=i.R16UI),O===i.UNSIGNED_INT&&(Y=i.R32UI),O===i.BYTE&&(Y=i.R8I),O===i.SHORT&&(Y=i.R16I),O===i.INT&&(Y=i.R32I)),g===i.RG&&(O===i.FLOAT&&(Y=i.RG32F),O===i.HALF_FLOAT&&(Y=i.RG16F),O===i.UNSIGNED_BYTE&&(Y=i.RG8)),g===i.RG_INTEGER&&(O===i.UNSIGNED_BYTE&&(Y=i.RG8UI),O===i.UNSIGNED_SHORT&&(Y=i.RG16UI),O===i.UNSIGNED_INT&&(Y=i.RG32UI),O===i.BYTE&&(Y=i.RG8I),O===i.SHORT&&(Y=i.RG16I),O===i.INT&&(Y=i.RG32I)),g===i.RGB_INTEGER&&(O===i.UNSIGNED_BYTE&&(Y=i.RGB8UI),O===i.UNSIGNED_SHORT&&(Y=i.RGB16UI),O===i.UNSIGNED_INT&&(Y=i.RGB32UI),O===i.BYTE&&(Y=i.RGB8I),O===i.SHORT&&(Y=i.RGB16I),O===i.INT&&(Y=i.RGB32I)),g===i.RGBA_INTEGER&&(O===i.UNSIGNED_BYTE&&(Y=i.RGBA8UI),O===i.UNSIGNED_SHORT&&(Y=i.RGBA16UI),O===i.UNSIGNED_INT&&(Y=i.RGBA32UI),O===i.BYTE&&(Y=i.RGBA8I),O===i.SHORT&&(Y=i.RGBA16I),O===i.INT&&(Y=i.RGBA32I)),g===i.RGB&&O===i.UNSIGNED_INT_5_9_9_9_REV&&(Y=i.RGB9_E5),g===i.RGBA){const ge=te?Gr:qe.getTransfer(K);O===i.FLOAT&&(Y=i.RGBA32F),O===i.HALF_FLOAT&&(Y=i.RGBA16F),O===i.UNSIGNED_BYTE&&(Y=ge===nt?i.SRGB8_ALPHA8:i.RGBA8),O===i.UNSIGNED_SHORT_4_4_4_4&&(Y=i.RGBA4),O===i.UNSIGNED_SHORT_5_5_5_1&&(Y=i.RGB5_A1)}return(Y===i.R16F||Y===i.R32F||Y===i.RG16F||Y===i.RG32F||Y===i.RGBA16F||Y===i.RGBA32F)&&e.get("EXT_color_buffer_float"),Y}function M(y,g){let O;return y?g===null||g===ei||g===Li?O=i.DEPTH24_STENCIL8:g===an?O=i.DEPTH32F_STENCIL8:g===ji&&(O=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):g===null||g===ei||g===Li?O=i.DEPTH_COMPONENT24:g===an?O=i.DEPTH_COMPONENT32F:g===ji&&(O=i.DEPTH_COMPONENT16),O}function I(y,g){return p(y)===!0||y.isFramebufferTexture&&y.minFilter!==Bt&&y.minFilter!==Vt?Math.log2(Math.max(g.width,g.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?g.mipmaps.length:1}function L(y){const g=y.target;g.removeEventListener("dispose",L),F(g),g.isVideoTexture&&u.delete(g)}function w(y){const g=y.target;g.removeEventListener("dispose",w),S(g)}function F(y){const g=n.get(y);if(g.__webglInit===void 0)return;const O=y.source,K=f.get(O);if(K){const te=K[g.__cacheKey];te.usedTimes--,te.usedTimes===0&&E(y),Object.keys(K).length===0&&f.delete(O)}n.remove(y)}function E(y){const g=n.get(y);i.deleteTexture(g.__webglTexture);const O=y.source,K=f.get(O);delete K[g.__cacheKey],o.memory.textures--}function S(y){const g=n.get(y);if(y.depthTexture&&(y.depthTexture.dispose(),n.remove(y.depthTexture)),y.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(g.__webglFramebuffer[K]))for(let te=0;te=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),C+=1,y}function J(y){const g=[];return g.push(y.wrapS),g.push(y.wrapT),g.push(y.wrapR||0),g.push(y.magFilter),g.push(y.minFilter),g.push(y.anisotropy),g.push(y.internalFormat),g.push(y.format),g.push(y.type),g.push(y.generateMipmaps),g.push(y.premultiplyAlpha),g.push(y.flipY),g.push(y.unpackAlignment),g.push(y.colorSpace),g.join()}function ee(y,g){const O=n.get(y);if(y.isVideoTexture&&Ee(y),y.isRenderTargetTexture===!1&&y.version>0&&O.__version!==y.version){const K=y.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(O,y,g);return}}t.bindTexture(i.TEXTURE_2D,O.__webglTexture,i.TEXTURE0+g)}function j(y,g){const O=n.get(y);if(y.version>0&&O.__version!==y.version){q(O,y,g);return}t.bindTexture(i.TEXTURE_2D_ARRAY,O.__webglTexture,i.TEXTURE0+g)}function ne(y,g){const O=n.get(y);if(y.version>0&&O.__version!==y.version){q(O,y,g);return}t.bindTexture(i.TEXTURE_3D,O.__webglTexture,i.TEXTURE0+g)}function G(y,g){const O=n.get(y);if(y.version>0&&O.__version!==y.version){re(O,y,g);return}t.bindTexture(i.TEXTURE_CUBE_MAP,O.__webglTexture,i.TEXTURE0+g)}const oe={[Vr]:i.REPEAT,[Mn]:i.CLAMP_TO_EDGE,[qs]:i.MIRRORED_REPEAT},fe={[Bt]:i.NEAREST,[xc]:i.NEAREST_MIPMAP_NEAREST,[rr]:i.NEAREST_MIPMAP_LINEAR,[Vt]:i.LINEAR,[es]:i.LINEAR_MIPMAP_NEAREST,[Jn]:i.LINEAR_MIPMAP_LINEAR},Me={[Ac]:i.NEVER,[Lc]:i.ALWAYS,[bc]:i.LESS,[_l]:i.LEQUAL,[wc]:i.EQUAL,[Pc]:i.GEQUAL,[Rc]:i.GREATER,[Cc]:i.NOTEQUAL};function ke(y,g){if(g.type===an&&e.has("OES_texture_float_linear")===!1&&(g.magFilter===Vt||g.magFilter===es||g.magFilter===rr||g.magFilter===Jn||g.minFilter===Vt||g.minFilter===es||g.minFilter===rr||g.minFilter===Jn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,oe[g.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,oe[g.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,oe[g.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,fe[g.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,fe[g.minFilter]),g.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,Me[g.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(g.magFilter===Bt||g.minFilter!==rr&&g.minFilter!==Jn||g.type===an&&e.has("OES_texture_float_linear")===!1)return;if(g.anisotropy>1||n.get(g).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,r.getMaxAnisotropy())),n.get(g).__currentAnisotropy=g.anisotropy}}}function je(y,g){let O=!1;y.__webglInit===void 0&&(y.__webglInit=!0,g.addEventListener("dispose",L));const K=g.source;let te=f.get(K);te===void 0&&(te={},f.set(K,te));const Y=J(g);if(Y!==y.__cacheKey){te[Y]===void 0&&(te[Y]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,O=!0),te[Y].usedTimes++;const ge=te[y.__cacheKey];ge!==void 0&&(te[y.__cacheKey].usedTimes--,ge.usedTimes===0&&E(g)),y.__cacheKey=Y,y.__webglTexture=te[Y].texture}return O}function q(y,g,O){let K=i.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(K=i.TEXTURE_2D_ARRAY),g.isData3DTexture&&(K=i.TEXTURE_3D);const te=je(y,g),Y=g.source;t.bindTexture(K,y.__webglTexture,i.TEXTURE0+O);const ge=n.get(Y);if(Y.version!==ge.__version||te===!0){t.activeTexture(i.TEXTURE0+O);const A=qe.getPrimaries(qe.workingColorSpace),Z=g.colorSpace===Nn?null:qe.getPrimaries(g.colorSpace),ye=g.colorSpace===Nn||A===Z?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);let Q=v(g.image,!1,r.maxTextureSize);Q=tt(g,Q);const ae=s.convert(g.format,g.colorSpace),Se=s.convert(g.type);let we=T(g.internalFormat,ae,Se,g.colorSpace,g.isVideoTexture);ke(K,g);let pe;const Ne=g.mipmaps,Re=g.isVideoTexture!==!0,Qe=ge.__version===void 0||te===!0,P=Y.dataReady,ce=I(g,Q);if(g.isDepthTexture)we=M(g.format===Di,g.type),Qe&&(Re?t.texStorage2D(i.TEXTURE_2D,1,we,Q.width,Q.height):t.texImage2D(i.TEXTURE_2D,0,we,Q.width,Q.height,0,ae,Se,null));else if(g.isDataTexture)if(Ne.length>0){Re&&Qe&&t.texStorage2D(i.TEXTURE_2D,ce,we,Ne[0].width,Ne[0].height);for(let W=0,$=Ne.length;W<$;W++)pe=Ne[W],Re?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,pe.width,pe.height,ae,Se,pe.data):t.texImage2D(i.TEXTURE_2D,W,we,pe.width,pe.height,0,ae,Se,pe.data);g.generateMipmaps=!1}else Re?(Qe&&t.texStorage2D(i.TEXTURE_2D,ce,we,Q.width,Q.height),P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Q.width,Q.height,ae,Se,Q.data)):t.texImage2D(i.TEXTURE_2D,0,we,Q.width,Q.height,0,ae,Se,Q.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){Re&&Qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ce,we,Ne[0].width,Ne[0].height,Q.depth);for(let W=0,$=Ne.length;W<$;W++)if(pe=Ne[W],g.format!==Gt)if(ae!==null)if(Re){if(P)if(g.layerUpdates.size>0){const de=To(pe.width,pe.height,g.format,g.type);for(const he of g.layerUpdates){const Oe=pe.data.subarray(he*de/pe.data.BYTES_PER_ELEMENT,(he+1)*de/pe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,he,pe.width,pe.height,1,ae,Oe)}g.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,pe.width,pe.height,Q.depth,ae,pe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,W,we,pe.width,pe.height,Q.depth,0,pe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Re?P&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,W,0,0,0,pe.width,pe.height,Q.depth,ae,Se,pe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,W,we,pe.width,pe.height,Q.depth,0,ae,Se,pe.data)}else{Re&&Qe&&t.texStorage2D(i.TEXTURE_2D,ce,we,Ne[0].width,Ne[0].height);for(let W=0,$=Ne.length;W<$;W++)pe=Ne[W],g.format!==Gt?ae!==null?Re?P&&t.compressedTexSubImage2D(i.TEXTURE_2D,W,0,0,pe.width,pe.height,ae,pe.data):t.compressedTexImage2D(i.TEXTURE_2D,W,we,pe.width,pe.height,0,pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Re?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,pe.width,pe.height,ae,Se,pe.data):t.texImage2D(i.TEXTURE_2D,W,we,pe.width,pe.height,0,ae,Se,pe.data)}else if(g.isDataArrayTexture)if(Re){if(Qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ce,we,Q.width,Q.height,Q.depth),P)if(g.layerUpdates.size>0){const W=To(Q.width,Q.height,g.format,g.type);for(const $ of g.layerUpdates){const de=Q.data.subarray($*W/Q.data.BYTES_PER_ELEMENT,($+1)*W/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,$,Q.width,Q.height,1,ae,Se,de)}g.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,ae,Se,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,we,Q.width,Q.height,Q.depth,0,ae,Se,Q.data);else if(g.isData3DTexture)Re?(Qe&&t.texStorage3D(i.TEXTURE_3D,ce,we,Q.width,Q.height,Q.depth),P&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,ae,Se,Q.data)):t.texImage3D(i.TEXTURE_3D,0,we,Q.width,Q.height,Q.depth,0,ae,Se,Q.data);else if(g.isFramebufferTexture){if(Qe)if(Re)t.texStorage2D(i.TEXTURE_2D,ce,we,Q.width,Q.height);else{let W=Q.width,$=Q.height;for(let de=0;de>=1,$>>=1}}else if(Ne.length>0){if(Re&&Qe){const W=xe(Ne[0]);t.texStorage2D(i.TEXTURE_2D,ce,we,W.width,W.height)}for(let W=0,$=Ne.length;W<$;W++)pe=Ne[W],Re?P&&t.texSubImage2D(i.TEXTURE_2D,W,0,0,ae,Se,pe):t.texImage2D(i.TEXTURE_2D,W,we,ae,Se,pe);g.generateMipmaps=!1}else if(Re){if(Qe){const W=xe(Q);t.texStorage2D(i.TEXTURE_2D,ce,we,W.width,W.height)}P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ae,Se,Q)}else t.texImage2D(i.TEXTURE_2D,0,we,ae,Se,Q);p(g)&&h(K),ge.__version=Y.version,g.onUpdate&&g.onUpdate(g)}y.__version=g.version}function re(y,g,O){if(g.image.length!==6)return;const K=je(y,g),te=g.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+O);const Y=n.get(te);if(te.version!==Y.__version||K===!0){t.activeTexture(i.TEXTURE0+O);const ge=qe.getPrimaries(qe.workingColorSpace),A=g.colorSpace===Nn?null:qe.getPrimaries(g.colorSpace),Z=g.colorSpace===Nn||ge===A?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Z);const ye=g.isCompressedTexture||g.image[0].isCompressedTexture,Q=g.image[0]&&g.image[0].isDataTexture,ae=[];for(let $=0;$<6;$++)!ye&&!Q?ae[$]=v(g.image[$],!0,r.maxCubemapSize):ae[$]=Q?g.image[$].image:g.image[$],ae[$]=tt(g,ae[$]);const Se=ae[0],we=s.convert(g.format,g.colorSpace),pe=s.convert(g.type),Ne=T(g.internalFormat,we,pe,g.colorSpace),Re=g.isVideoTexture!==!0,Qe=Y.__version===void 0||K===!0,P=te.dataReady;let ce=I(g,Se);ke(i.TEXTURE_CUBE_MAP,g);let W;if(ye){Re&&Qe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ce,Ne,Se.width,Se.height);for(let $=0;$<6;$++){W=ae[$].mipmaps;for(let de=0;de0&&ce++;const $=xe(ae[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ce,Ne,$.width,$.height)}for(let $=0;$<6;$++)if(Q){Re?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,ae[$].width,ae[$].height,we,pe,ae[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Ne,ae[$].width,ae[$].height,0,we,pe,ae[$].data);for(let de=0;de>Y),Se=Math.max(1,g.height>>Y);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,Y,Z,ae,Se,g.depth,0,ge,A,null):t.texImage2D(te,Y,Z,ae,Se,0,ge,A,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),We(g)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,K,te,Q.__webglTexture,0,Ve(g)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,K,te,Q.__webglTexture,Y),t.bindFramebuffer(i.FRAMEBUFFER,null)}function le(y,g,O){if(i.bindRenderbuffer(i.RENDERBUFFER,y),g.depthBuffer){const K=g.depthTexture,te=K&&K.isDepthTexture?K.type:null,Y=M(g.stencilBuffer,te),ge=g.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,A=Ve(g);We(g)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,A,Y,g.width,g.height):O?i.renderbufferStorageMultisample(i.RENDERBUFFER,A,Y,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,Y,g.width,g.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ge,i.RENDERBUFFER,y)}else{const K=g.textures;for(let te=0;te{delete g.__boundDepthTexture,delete g.__depthDisposeCallback,K.removeEventListener("dispose",te)};K.addEventListener("dispose",te),g.__depthDisposeCallback=te}g.__boundDepthTexture=K}if(y.depthTexture&&!g.__autoAllocateDepthBuffer){if(O)throw new Error("target.depthTexture not supported in Cube render targets");be(g.__webglFramebuffer,y)}else if(O){g.__webglDepthbuffer=[];for(let K=0;K<6;K++)if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[K]),g.__webglDepthbuffer[K]===void 0)g.__webglDepthbuffer[K]=i.createRenderbuffer(),le(g.__webglDepthbuffer[K],y,!1);else{const te=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Y=g.__webglDepthbuffer[K];i.bindRenderbuffer(i.RENDERBUFFER,Y),i.framebufferRenderbuffer(i.FRAMEBUFFER,te,i.RENDERBUFFER,Y)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer),g.__webglDepthbuffer===void 0)g.__webglDepthbuffer=i.createRenderbuffer(),le(g.__webglDepthbuffer,y,!1);else{const K=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=g.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,te)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function He(y,g,O){const K=n.get(y);g!==void 0&&ve(K.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),O!==void 0&&Ue(y)}function it(y){const g=y.texture,O=n.get(y),K=n.get(g);y.addEventListener("dispose",w);const te=y.textures,Y=y.isWebGLCubeRenderTarget===!0,ge=te.length>1;if(ge||(K.__webglTexture===void 0&&(K.__webglTexture=i.createTexture()),K.__version=g.version,o.memory.textures++),Y){O.__webglFramebuffer=[];for(let A=0;A<6;A++)if(g.mipmaps&&g.mipmaps.length>0){O.__webglFramebuffer[A]=[];for(let Z=0;Z0){O.__webglFramebuffer=[];for(let A=0;A0&&We(y)===!1){O.__webglMultisampledFramebuffer=i.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let A=0;A0)for(let Z=0;Z0)for(let Z=0;Z0){if(We(y)===!1){const g=y.textures,O=y.width,K=y.height;let te=i.COLOR_BUFFER_BIT;const Y=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=n.get(y),A=g.length>1;if(A)for(let Z=0;Z0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&g.__useRenderToTexture!==!1}function Ee(y){const g=o.render.frame;u.get(y)!==g&&(u.set(y,g),y.update())}function tt(y,g){const O=y.colorSpace,K=y.format,te=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||O!==Ui&&O!==Nn&&(qe.getTransfer(O)===nt?(K!==Gt||te!==bn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),g}function xe(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=X,this.setTexture2D=ee,this.setTexture2DArray=j,this.setTexture3D=ne,this.setTextureCube=G,this.rebindTextures=He,this.setupRenderTarget=it,this.updateRenderTargetMipmap=Xe,this.updateMultisampleRenderTarget=Tt,this.setupDepthRenderbuffer=Ue,this.setupFrameBufferTexture=ve,this.useMultisampledRTT=We}function Kp(i,e){function t(n,r=Nn){let s;const o=qe.getTransfer(r);if(n===bn)return i.UNSIGNED_BYTE;if(n===ba)return i.UNSIGNED_SHORT_4_4_4_4;if(n===wa)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ll)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===al)return i.BYTE;if(n===ol)return i.SHORT;if(n===ji)return i.UNSIGNED_SHORT;if(n===Aa)return i.INT;if(n===ei)return i.UNSIGNED_INT;if(n===an)return i.FLOAT;if(n===$i)return i.HALF_FLOAT;if(n===cl)return i.ALPHA;if(n===ul)return i.RGB;if(n===Gt)return i.RGBA;if(n===hl)return i.LUMINANCE;if(n===dl)return i.LUMINANCE_ALPHA;if(n===bi)return i.DEPTH_COMPONENT;if(n===Di)return i.DEPTH_STENCIL;if(n===fl)return i.RED;if(n===Ra)return i.RED_INTEGER;if(n===pl)return i.RG;if(n===Ca)return i.RG_INTEGER;if(n===Pa)return i.RGBA_INTEGER;if(n===Fr||n===Or||n===Br||n===zr)if(o===nt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Fr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Fr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Zs||n===js||n===Ks||n===$s)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Zs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===js)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ks)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Js||n===Qs||n===ea)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Js||n===Qs)return o===nt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ea)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ta||n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ua||n===ha||n===da||n===fa||n===pa)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ta)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===na)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ia)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ra)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===sa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===aa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===oa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===la)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ca)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ua)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ha)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===da)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===fa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===pa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Hr||n===ma||n===_a)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Hr)return o===nt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ma)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===_a)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ml||n===ga||n===va||n===xa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Hr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ga)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===va)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===xa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Li?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const $p={type:"move"};class Ls{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Tr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Tr,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),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Tr,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}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const p=t.getJointPose(v,n),h=this._getHandJoint(c,v);p!==null&&(h.matrix.fromArray(p.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,h.jointRadius=p.radius),h.visible=p!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),m=.02,_=.005;c.inputState.pinching&&f>m+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(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)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent($p)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Tr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Jp=` void main() { gl_Position = vec4( position, 1.0 ); -}`,Gp=` +}`,Qp=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -3836,13 +3829,13 @@ void main() { } -}`;class Vp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new At,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Tt({vertexShader:kp,fragmentShader:Gp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Nt(new Ci(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Wp extends Jn{constructor(e,t){super();const n=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,m=null,_=null;const x=new Vp,h=t.getContextAttributes();let d=null,A=null;const E=[],T=[],H=new De;let L=null;const b=new Qt;b.layers.enable(1),b.viewport=new lt;const z=new Qt;z.layers.enable(2),z.viewport=new lt;const ie=[b,z],g=new zp;g.layers.enable(1),g.layers.enable(2);let M=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getTargetRaySpace()},this.getControllerGrip=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getGripSpace()},this.getHand=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getHandSpace()};function k(Y){const te=T.indexOf(Y.inputSource);if(te===-1)return;const _e=E[te];_e!==void 0&&(_e.update(Y.inputSource,Y.frame,c||o),_e.dispatchEvent({type:Y.type,data:Y.inputSource}))}function K(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",Q);for(let Y=0;Y=0&&(T[me]=null,E[me].disconnect(_e))}for(let te=0;te=T.length){T.push(_e),me=be;break}else if(T[be]===null){T[be]=_e,me=be;break}if(me===-1)break}const Ne=E[me];Ne&&Ne.connect(_e)}}const X=new U,J=new U;function V(Y,te,_e){X.setFromMatrixPosition(te.matrixWorld),J.setFromMatrixPosition(_e.matrixWorld);const me=X.distanceTo(J),Ne=te.projectionMatrix.elements,be=_e.projectionMatrix.elements,He=Ne[14]/(Ne[10]-1),Ke=Ne[14]/(Ne[10]+1),Ge=(Ne[9]+1)/Ne[5],R=(Ne[9]-1)/Ne[5],vt=(Ne[8]-1)/Ne[0],Be=(be[8]+1)/be[0],Ve=He*vt,Re=He*Be,Qe=me/(-vt+Be),Ce=Qe*-vt;if(te.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Ce),Y.translateZ(Qe),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ne[10]===-1)Y.projectionMatrix.copy(te.projectionMatrix),Y.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const y=He+Qe,v=Ke+Qe,I=Ve-Ce,Z=Re+(me-Ce),ee=Ge*Ke/v*y,q=R*Ke/v*y;Y.projectionMatrix.makePerspective(I,Z,ee,q,y,v),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function fe(Y,te){te===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(te.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let te=Y.near,_e=Y.far;x.texture!==null&&(x.depthNear>0&&(te=x.depthNear),x.depthFar>0&&(_e=x.depthFar)),g.near=z.near=b.near=te,g.far=z.far=b.far=_e,(M!==g.near||W!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),M=g.near,W=g.far);const me=Y.parent,Ne=g.cameras;fe(g,me);for(let be=0;be0&&(h.alphaTest.value=d.alphaTest);const A=e.get(d),E=A.envMap,T=A.envMapRotation;E&&(h.envMap.value=E,Vn.copy(T),Vn.x*=-1,Vn.y*=-1,Vn.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Vn.y*=-1,Vn.z*=-1),h.envMapRotation.value.setFromMatrix4(Xp.makeRotationFromEuler(Vn)),h.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=d.reflectivity,h.ior.value=d.ior,h.refractionRatio.value=d.refractionRatio),d.lightMap&&(h.lightMap.value=d.lightMap,h.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,h.lightMapTransform)),d.aoMap&&(h.aoMap.value=d.aoMap,h.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,h.aoMapTransform))}function o(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform))}function a(h,d){h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale}function l(h,d,A,E){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.size.value=d.size*A,h.scale.value=E*.5,d.map&&(h.map.value=d.map,t(d.map,h.uvTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function c(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.rotation.value=d.rotation,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function u(h,d){h.specular.value.copy(d.specular),h.shininess.value=Math.max(d.shininess,1e-4)}function f(h,d){d.gradientMap&&(h.gradientMap.value=d.gradientMap)}function p(h,d){h.metalness.value=d.metalness,d.metalnessMap&&(h.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,h.metalnessMapTransform)),h.roughness.value=d.roughness,d.roughnessMap&&(h.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,h.roughnessMapTransform)),d.envMap&&(h.envMapIntensity.value=d.envMapIntensity)}function m(h,d,A){h.ior.value=d.ior,d.sheen>0&&(h.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),h.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(h.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,h.sheenColorMapTransform)),d.sheenRoughnessMap&&(h.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,h.sheenRoughnessMapTransform))),d.clearcoat>0&&(h.clearcoat.value=d.clearcoat,h.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(h.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,h.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(h.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Ft&&h.clearcoatNormalScale.value.negate())),d.dispersion>0&&(h.dispersion.value=d.dispersion),d.iridescence>0&&(h.iridescence.value=d.iridescence,h.iridescenceIOR.value=d.iridescenceIOR,h.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(h.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,h.iridescenceMapTransform)),d.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),d.transmission>0&&(h.transmission.value=d.transmission,h.transmissionSamplerMap.value=A.texture,h.transmissionSamplerSize.value.set(A.width,A.height),d.transmissionMap&&(h.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,h.transmissionMapTransform)),h.thickness.value=d.thickness,d.thicknessMap&&(h.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=d.attenuationDistance,h.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(h.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(h.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=d.specularIntensity,h.specularColor.value.copy(d.specularColor),d.specularColorMap&&(h.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,h.specularColorMapTransform)),d.specularIntensityMap&&(h.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,h.specularIntensityMapTransform))}function _(h,d){d.matcap&&(h.matcap.value=d.matcap)}function x(h,d){const A=e.get(d).light;h.referencePosition.value.setFromMatrixPosition(A.matrixWorld),h.nearDistance.value=A.shadow.camera.near,h.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function qp(i,e,t,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,E){const T=E.program;n.uniformBlockBinding(A,T)}function c(A,E){let T=r[A.id];T===void 0&&(_(A),T=u(A),r[A.id]=T,A.addEventListener("dispose",h));const H=E.program;n.updateUBOMapping(A,H);const L=e.render.frame;s[A.id]!==L&&(p(A),s[A.id]=L)}function u(A){const E=f();A.__bindingPointIndex=E;const T=i.createBuffer(),H=A.__size,L=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,H,L),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,T),T}function f(){for(let A=0;A0&&(T+=H-L),A.__size=T,A.__cache={},this}function x(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function h(A){const E=A.target;E.removeEventListener("dispose",h);const T=o.indexOf(E.__bindingPointIndex);o.splice(T,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function d(){for(const A in r)i.deleteBuffer(r[A]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}class Zp{constructor(e={}){const{canvas:t=Nc(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;const m=new Uint32Array(4),_=new Int32Array(4);let x=null,h=null;const d=[],A=[];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._outputColorSpace=sn,this.toneMapping=In,this.toneMappingExposure=1;const E=this;let T=!1,H=0,L=0,b=null,z=-1,ie=null;const g=new lt,M=new lt;let W=null;const k=new we(0);let K=0,Q=t.width,X=t.height,J=1,V=null,fe=null;const pe=new lt(0,0,Q,X),ve=new lt(0,0,Q,X);let We=!1;const Ye=new Ia;let Y=!1,te=!1;const _e=new it,me=new it,Ne=new U,be=new lt,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function Ge(){return b===null?J:1}let R=n;function vt(S,P){return t.getContext(S,P)}try{const S={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ya}`),t.addEventListener("webglcontextlost",$,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",de,!1),R===null){const P="webgl2";if(R=vt(P,S),R===null)throw vt(P)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let Be,Ve,Re,Qe,Ce,y,v,I,Z,ee,q,xe,oe,w,re,j,se,Me,Te,ue,ze,Ae,ke,C;function he(){Be=new Jd(R),Be.init(),Ae=new Bp(R,Be),Ve=new Yd(R,Be,e,Ae),Re=new Np(R),Ve.reverseDepthBuffer&&Re.buffers.depth.setReversed(!0),Qe=new tf(R),Ce=new Sp,y=new Op(R,Be,Re,Ce,Ve,Ae,Qe),v=new Zd(E),I=new $d(E),Z=new lu(R),ke=new Wd(R,Z),ee=new Qd(R,Z,Qe,ke),q=new rf(R,ee,Z,Qe),Te=new nf(R,Ve,y),j=new qd(Ce),xe=new xp(E,v,I,Be,Ve,ke,j),oe=new Yp(E,Ce),w=new Ep,re=new Rp(Be),Me=new Vd(E,v,I,Re,q,p,l),se=new Up(E,q,Ve),C=new qp(R,Qe,Ve,Re),ue=new Xd(R,Be,Qe),ze=new ef(R,Be,Qe),Qe.programs=xe.programs,E.capabilities=Ve,E.extensions=Be,E.properties=Ce,E.renderLists=w,E.shadowMap=se,E.state=Re,E.info=Qe}he();const G=new Wp(E,R);this.xr=G,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const S=Be.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=Be.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(S){S!==void 0&&(J=S,this.setSize(Q,X,!1))},this.getSize=function(S){return S.set(Q,X)},this.setSize=function(S,P,F=!0){if(G.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=S,X=P,t.width=Math.floor(S*J),t.height=Math.floor(P*J),F===!0&&(t.style.width=S+"px",t.style.height=P+"px"),this.setViewport(0,0,S,P)},this.getDrawingBufferSize=function(S){return S.set(Q*J,X*J).floor()},this.setDrawingBufferSize=function(S,P,F){Q=S,X=P,J=F,t.width=Math.floor(S*F),t.height=Math.floor(P*F),this.setViewport(0,0,S,P)},this.getCurrentViewport=function(S){return S.copy(g)},this.getViewport=function(S){return S.copy(pe)},this.setViewport=function(S,P,F,B){S.isVector4?pe.set(S.x,S.y,S.z,S.w):pe.set(S,P,F,B),Re.viewport(g.copy(pe).multiplyScalar(J).round())},this.getScissor=function(S){return S.copy(ve)},this.setScissor=function(S,P,F,B){S.isVector4?ve.set(S.x,S.y,S.z,S.w):ve.set(S,P,F,B),Re.scissor(M.copy(ve).multiplyScalar(J).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(S){Re.setScissorTest(We=S)},this.setOpaqueSort=function(S){V=S},this.setTransparentSort=function(S){fe=S},this.getClearColor=function(S){return S.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor.apply(Me,arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha.apply(Me,arguments)},this.clear=function(S=!0,P=!0,F=!0){let B=0;if(S){let D=!1;if(b!==null){const ne=b.texture.format;D=ne===La||ne===Pa||ne===Ca}if(D){const ne=b.texture.type,ce=ne===Mn||ne===jn||ne===Gi||ne===bi||ne===wa||ne===Ra,ge=Me.getClearColor(),Se=Me.getClearAlpha(),Pe=ge.r,Ue=ge.g,Ee=ge.b;ce?(m[0]=Pe,m[1]=Ue,m[2]=Ee,m[3]=Se,R.clearBufferuiv(R.COLOR,0,m)):(_[0]=Pe,_[1]=Ue,_[2]=Ee,_[3]=Se,R.clearBufferiv(R.COLOR,0,_))}else B|=R.COLOR_BUFFER_BIT}P&&(B|=R.DEPTH_BUFFER_BIT,R.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),F&&(B|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",$,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",de,!1),w.dispose(),re.dispose(),Ce.dispose(),v.dispose(),I.dispose(),q.dispose(),ke.dispose(),C.dispose(),xe.dispose(),G.dispose(),G.removeEventListener("sessionstart",za),G.removeEventListener("sessionend",Ha),On.stop()};function $(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const S=Qe.autoReset,P=se.enabled,F=se.autoUpdate,B=se.needsUpdate,D=se.type;he(),Qe.autoReset=S,se.enabled=P,se.autoUpdate=F,se.needsUpdate=B,se.type=D}function de(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Xe(S){const P=S.target;P.removeEventListener("dispose",Xe),ht(P)}function ht(S){Ct(S),Ce.remove(S)}function Ct(S){const P=Ce.get(S).programs;P!==void 0&&(P.forEach(function(F){xe.releaseProgram(F)}),S.isShaderMaterial&&xe.releaseShaderCache(S))}this.renderBufferDirect=function(S,P,F,B,D,ne){P===null&&(P=He);const ce=D.isMesh&&D.matrixWorld.determinant()<0,ge=Bl(S,P,F,B,D);Re.setMaterial(B,ce);let Se=F.index,Pe=1;if(B.wireframe===!0){if(Se=ee.getWireframeAttribute(F),Se===void 0)return;Pe=2}const Ue=F.drawRange,Ee=F.attributes.position;let Je=Ue.start*Pe,et=(Ue.start+Ue.count)*Pe;ne!==null&&(Je=Math.max(Je,ne.start*Pe),et=Math.min(et,(ne.start+ne.count)*Pe)),Se!==null?(Je=Math.max(Je,0),et=Math.min(et,Se.count)):Ee!=null&&(Je=Math.max(Je,0),et=Math.min(et,Ee.count));const rt=et-Je;if(rt<0||rt===1/0)return;ke.setup(D,B,ge,F,Se);let Ot,je=ue;if(Se!==null&&(Ot=Z.get(Se),je=ze,je.setIndex(Ot)),D.isMesh)B.wireframe===!0?(Re.setLineWidth(B.wireframeLinewidth*Ge()),je.setMode(R.LINES)):je.setMode(R.TRIANGLES);else if(D.isLine){let ye=B.linewidth;ye===void 0&&(ye=1),Re.setLineWidth(ye*Ge()),D.isLineSegments?je.setMode(R.LINES):D.isLineLoop?je.setMode(R.LINE_LOOP):je.setMode(R.LINE_STRIP)}else D.isPoints?je.setMode(R.POINTS):D.isSprite&&je.setMode(R.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)je.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(Be.get("WEBGL_multi_draw"))je.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ye=D._multiDrawStarts,xt=D._multiDrawCounts,$e=D._multiDrawCount,qt=Se?Z.get(Se).bytesPerElement:1,Qn=Ce.get(B).currentProgram.getUniforms();for(let Bt=0;Bt<$e;Bt++)Qn.setValue(R,"_gl_DrawID",Bt),je.render(ye[Bt]/qt,xt[Bt])}else if(D.isInstancedMesh)je.renderInstances(Je,rt,D.count);else if(F.isInstancedBufferGeometry){const ye=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,xt=Math.min(F.instanceCount,ye);je.renderInstances(Je,rt,xt)}else je.render(Je,rt)};function qe(S,P,F){S.transparent===!0&&S.side===_n&&S.forceSinglePass===!1?(S.side=Ft,S.needsUpdate=!0,ji(S,P,F),S.side=Nn,S.needsUpdate=!0,ji(S,P,F),S.side=_n):ji(S,P,F)}this.compile=function(S,P,F=null){F===null&&(F=S),h=re.get(F),h.init(P),A.push(h),F.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),S!==F&&S.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),h.setupLights();const B=new Set;return S.traverse(function(D){if(!(D.isMesh||D.isPoints||D.isLine||D.isSprite))return;const ne=D.material;if(ne)if(Array.isArray(ne))for(let ce=0;ce{function ne(){if(B.forEach(function(ce){Ce.get(ce).currentProgram.isReady()&&B.delete(ce)}),B.size===0){D(S);return}setTimeout(ne,10)}Be.get("KHR_parallel_shader_compile")!==null?ne():setTimeout(ne,10)})};let Pt=null;function on(S){Pt&&Pt(S)}function za(){On.stop()}function Ha(){On.start()}const On=new Pl;On.setAnimationLoop(on),typeof self<"u"&&On.setContext(self),this.setAnimationLoop=function(S){Pt=S,G.setAnimationLoop(S),S===null?On.stop():On.start()},G.addEventListener("sessionstart",za),G.addEventListener("sessionend",Ha),this.render=function(S,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.enabled===!0&&G.isPresenting===!0&&(G.cameraAutoUpdate===!0&&G.updateCamera(P),P=G.getCamera()),S.isScene===!0&&S.onBeforeRender(E,S,P,b),h=re.get(S,A.length),h.init(P),A.push(h),me.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),Ye.setFromProjectionMatrix(me),te=this.localClippingEnabled,Y=j.init(this.clippingPlanes,te),x=w.get(S,d.length),x.init(),d.push(x),G.enabled===!0&&G.isPresenting===!0){const ne=E.xr.getDepthSensingMesh();ne!==null&&jr(ne,P,-1/0,E.sortObjects)}jr(S,P,0,E.sortObjects),x.finish(),E.sortObjects===!0&&x.sort(V,fe),Ke=G.enabled===!1||G.isPresenting===!1||G.hasDepthSensing()===!1,Ke&&Me.addToRenderList(x,S),this.info.render.frame++,Y===!0&&j.beginShadows();const F=h.state.shadowsArray;se.render(F,S,P),Y===!0&&j.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=x.opaque,D=x.transmissive;if(h.setupLights(),P.isArrayCamera){const ne=P.cameras;if(D.length>0)for(let ce=0,ge=ne.length;ce0&&Ga(B,D,S,P),Ke&&Me.render(S),ka(x,S,P);b!==null&&(y.updateMultisampleRenderTarget(b),y.updateRenderTargetMipmap(b)),S.isScene===!0&&S.onAfterRender(E,S,P),ke.resetDefaultState(),z=-1,ie=null,A.pop(),A.length>0?(h=A[A.length-1],Y===!0&&j.setGlobalState(E.clippingPlanes,h.state.camera)):h=null,d.pop(),d.length>0?x=d[d.length-1]:x=null};function jr(S,P,F,B){if(S.visible===!1)return;if(S.layers.test(P.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(P);else if(S.isLight)h.pushLight(S),S.castShadow&&h.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Ye.intersectsSprite(S)){B&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(me);const ce=q.update(S),ge=S.material;ge.visible&&x.push(S,ce,ge,F,be.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Ye.intersectsObject(S))){const ce=q.update(S),ge=S.material;if(B&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),be.copy(S.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),be.copy(ce.boundingSphere.center)),be.applyMatrix4(S.matrixWorld).applyMatrix4(me)),Array.isArray(ge)){const Se=ce.groups;for(let Pe=0,Ue=Se.length;Pe0&&Ki(D,P,F),ne.length>0&&Ki(ne,P,F),ce.length>0&&Ki(ce,P,F),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function Ga(S,P,F,B){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;h.state.transmissionRenderTarget[B.id]===void 0&&(h.state.transmissionRenderTarget[B.id]=new $n(1,1,{generateMipmaps:!0,type:Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float")?Wi:Mn,minFilter:Zn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ze.workingColorSpace}));const ne=h.state.transmissionRenderTarget[B.id],ce=B.viewport||g;ne.setSize(ce.z,ce.w);const ge=E.getRenderTarget();E.setRenderTarget(ne),E.getClearColor(k),K=E.getClearAlpha(),K<1&&E.setClearColor(16777215,.5),E.clear(),Ke&&Me.render(F);const Se=E.toneMapping;E.toneMapping=In;const Pe=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),h.setupLightsView(B),Y===!0&&j.setGlobalState(E.clippingPlanes,B),Ki(S,F,B),y.updateMultisampleRenderTarget(ne),y.updateRenderTargetMipmap(ne),Be.has("WEBGL_multisampled_render_to_texture")===!1){let Ue=!1;for(let Ee=0,Je=P.length;Ee0),Ee=!!F.morphAttributes.position,Je=!!F.morphAttributes.normal,et=!!F.morphAttributes.color;let rt=In;B.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(rt=E.toneMapping);const Ot=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,je=Ot!==void 0?Ot.length:0,ye=Ce.get(B),xt=h.state.lights;if(Y===!0&&(te===!0||S!==ie)){const Vt=S===ie&&B.id===z;j.setState(B,S,Vt)}let $e=!1;B.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==xt.state.version||ye.outputColorSpace!==ge||D.isBatchedMesh&&ye.batching===!1||!D.isBatchedMesh&&ye.batching===!0||D.isBatchedMesh&&ye.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&ye.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&ye.instancing===!1||!D.isInstancedMesh&&ye.instancing===!0||D.isSkinnedMesh&&ye.skinning===!1||!D.isSkinnedMesh&&ye.skinning===!0||D.isInstancedMesh&&ye.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&ye.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&ye.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&ye.instancingMorph===!1&&D.morphTexture!==null||ye.envMap!==Se||B.fog===!0&&ye.fog!==ne||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==j.numPlanes||ye.numIntersection!==j.numIntersection)||ye.vertexAlphas!==Pe||ye.vertexTangents!==Ue||ye.morphTargets!==Ee||ye.morphNormals!==Je||ye.morphColors!==et||ye.toneMapping!==rt||ye.morphTargetsCount!==je)&&($e=!0):($e=!0,ye.__version=B.version);let qt=ye.currentProgram;$e===!0&&(qt=ji(B,P,D));let Qn=!1,Bt=!1,$r=!1;const ct=qt.getUniforms(),yn=ye.uniforms;if(Re.useProgram(qt.program)&&(Qn=!0,Bt=!0,$r=!0),B.id!==z&&(z=B.id,Bt=!0),Qn||ie!==S){Ve.reverseDepthBuffer?(_e.copy(S.projectionMatrix),Oc(_e),Bc(_e),ct.setValue(R,"projectionMatrix",_e)):ct.setValue(R,"projectionMatrix",S.projectionMatrix),ct.setValue(R,"viewMatrix",S.matrixWorldInverse);const Vt=ct.map.cameraPosition;Vt!==void 0&&Vt.setValue(R,Ne.setFromMatrixPosition(S.matrixWorld)),Ve.logarithmicDepthBuffer&&ct.setValue(R,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&ct.setValue(R,"isOrthographic",S.isOrthographicCamera===!0),ie!==S&&(ie=S,Bt=!0,$r=!0)}if(D.isSkinnedMesh){ct.setOptional(R,D,"bindMatrix"),ct.setOptional(R,D,"bindMatrixInverse");const Vt=D.skeleton;Vt&&(Vt.boneTexture===null&&Vt.computeBoneTexture(),ct.setValue(R,"boneTexture",Vt.boneTexture,y))}D.isBatchedMesh&&(ct.setOptional(R,D,"batchingTexture"),ct.setValue(R,"batchingTexture",D._matricesTexture,y),ct.setOptional(R,D,"batchingIdTexture"),ct.setValue(R,"batchingIdTexture",D._indirectTexture,y),ct.setOptional(R,D,"batchingColorTexture"),D._colorsTexture!==null&&ct.setValue(R,"batchingColorTexture",D._colorsTexture,y));const Jr=F.morphAttributes;if((Jr.position!==void 0||Jr.normal!==void 0||Jr.color!==void 0)&&Te.update(D,F,qt),(Bt||ye.receiveShadow!==D.receiveShadow)&&(ye.receiveShadow=D.receiveShadow,ct.setValue(R,"receiveShadow",D.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(yn.envMap.value=Se,yn.flipEnvMap.value=Se.isCubeTexture&&Se.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&P.environment!==null&&(yn.envMapIntensity.value=P.environmentIntensity),Bt&&(ct.setValue(R,"toneMappingExposure",E.toneMappingExposure),ye.needsLights&&zl(yn,$r),ne&&B.fog===!0&&oe.refreshFogUniforms(yn,ne),oe.refreshMaterialUniforms(yn,B,J,X,h.state.transmissionRenderTarget[S.id]),Fr.upload(R,Wa(ye),yn,y)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(Fr.upload(R,Wa(ye),yn,y),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&ct.setValue(R,"center",D.center),ct.setValue(R,"modelViewMatrix",D.modelViewMatrix),ct.setValue(R,"normalMatrix",D.normalMatrix),ct.setValue(R,"modelMatrix",D.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Vt=B.uniformsGroups;for(let Qr=0,kl=Vt.length;Qr0&&y.useMultisampledRTT(S)===!1?D=Ce.get(S).__webglMultisampledFramebuffer:Array.isArray(Ue)?D=Ue[F]:D=Ue,g.copy(S.viewport),M.copy(S.scissor),W=S.scissorTest}else g.copy(pe).multiplyScalar(J).floor(),M.copy(ve).multiplyScalar(J).floor(),W=We;if(Re.bindFramebuffer(R.FRAMEBUFFER,D)&&B&&Re.drawBuffers(S,D),Re.viewport(g),Re.scissor(M),Re.setScissorTest(W),ne){const Se=Ce.get(S.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+P,Se.__webglTexture,F)}else if(ce){const Se=Ce.get(S.texture),Pe=P||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Se.__webglTexture,F||0,Pe)}z=-1},this.readRenderTargetPixels=function(S,P,F,B,D,ne,ce){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){Re.bindFramebuffer(R.FRAMEBUFFER,ge);try{const Se=S.texture,Pe=Se.format,Ue=Se.type;if(!Ve.textureFormatReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ve.textureTypeReadable(Ue)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=S.width-B&&F>=0&&F<=S.height-D&&R.readPixels(P,F,B,D,Ae.convert(Pe),Ae.convert(Ue),ne)}finally{const Se=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Se)}}},this.readRenderTargetPixelsAsync=async function(S,P,F,B,D,ne,ce){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){const Se=S.texture,Pe=Se.format,Ue=Se.type;if(!Ve.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ve.textureTypeReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(P>=0&&P<=S.width-B&&F>=0&&F<=S.height-D){Re.bindFramebuffer(R.FRAMEBUFFER,ge);const Ee=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.bufferData(R.PIXEL_PACK_BUFFER,ne.byteLength,R.STREAM_READ),R.readPixels(P,F,B,D,Ae.convert(Pe),Ae.convert(Ue),0);const Je=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Je);const et=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Fc(R,et,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ne),R.deleteBuffer(Ee),R.deleteSync(et),ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(S,P=null,F=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),P=arguments[0]||null,S=arguments[1]);const B=Math.pow(2,-F),D=Math.floor(S.image.width*B),ne=Math.floor(S.image.height*B),ce=P!==null?P.x:0,ge=P!==null?P.y:0;y.setTexture2D(S,0),R.copyTexSubImage2D(R.TEXTURE_2D,F,0,0,ce,ge,D,ne),Re.unbindTexture()},this.copyTextureToTexture=function(S,P,F=null,B=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,S=arguments[1],P=arguments[2],D=arguments[3]||0,F=null);let ne,ce,ge,Se,Pe,Ue;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.min.x,Se=F.min.y):(ne=S.image.width,ce=S.image.height,ge=0,Se=0),B!==null?(Pe=B.x,Ue=B.y):(Pe=0,Ue=0);const Ee=Ae.convert(P.format),Je=Ae.convert(P.type);y.setTexture2D(P,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const et=R.getParameter(R.UNPACK_ROW_LENGTH),rt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Ot=R.getParameter(R.UNPACK_SKIP_PIXELS),je=R.getParameter(R.UNPACK_SKIP_ROWS),ye=R.getParameter(R.UNPACK_SKIP_IMAGES),xt=S.isCompressedTexture?S.mipmaps[D]:S.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,xt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,xt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,ge),R.pixelStorei(R.UNPACK_SKIP_ROWS,Se),S.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,D,Pe,Ue,ne,ce,Ee,Je,xt.data):S.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,D,Pe,Ue,xt.width,xt.height,Ee,xt.data):R.texSubImage2D(R.TEXTURE_2D,D,Pe,Ue,ne,ce,Ee,Je,xt),R.pixelStorei(R.UNPACK_ROW_LENGTH,et),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,rt),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ot),R.pixelStorei(R.UNPACK_SKIP_ROWS,je),R.pixelStorei(R.UNPACK_SKIP_IMAGES,ye),D===0&&P.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(S,P,F=null,B=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,B=arguments[1]||null,S=arguments[2],P=arguments[3],D=arguments[4]||0);let ne,ce,ge,Se,Pe,Ue,Ee,Je,et;const rt=S.isCompressedTexture?S.mipmaps[D]:S.image;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.max.z-F.min.z,Se=F.min.x,Pe=F.min.y,Ue=F.min.z):(ne=rt.width,ce=rt.height,ge=rt.depth,Se=0,Pe=0,Ue=0),B!==null?(Ee=B.x,Je=B.y,et=B.z):(Ee=0,Je=0,et=0);const Ot=Ae.convert(P.format),je=Ae.convert(P.type);let ye;if(P.isData3DTexture)y.setTexture3D(P,0),ye=R.TEXTURE_3D;else if(P.isDataArrayTexture||P.isCompressedArrayTexture)y.setTexture2DArray(P,0),ye=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const xt=R.getParameter(R.UNPACK_ROW_LENGTH),$e=R.getParameter(R.UNPACK_IMAGE_HEIGHT),qt=R.getParameter(R.UNPACK_SKIP_PIXELS),Qn=R.getParameter(R.UNPACK_SKIP_ROWS),Bt=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,rt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,rt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Se),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pe),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ue),S.isDataTexture||S.isData3DTexture?R.texSubImage3D(ye,D,Ee,Je,et,ne,ce,ge,Ot,je,rt.data):P.isCompressedArrayTexture?R.compressedTexSubImage3D(ye,D,Ee,Je,et,ne,ce,ge,Ot,rt.data):R.texSubImage3D(ye,D,Ee,Je,et,ne,ce,ge,Ot,je,rt),R.pixelStorei(R.UNPACK_ROW_LENGTH,xt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,$e),R.pixelStorei(R.UNPACK_SKIP_PIXELS,qt),R.pixelStorei(R.UNPACK_SKIP_ROWS,Qn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Bt),D===0&&P.generateMipmaps&&R.generateMipmap(ye),Re.unbindTexture()},this.initRenderTarget=function(S){Ce.get(S).__webglFramebuffer===void 0&&y.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?y.setTextureCube(S,0):S.isData3DTexture?y.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?y.setTexture2DArray(S,0):y.setTexture2D(S,0),Re.unbindTexture()},this.resetState=function(){H=0,L=0,b=null,Re.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Da?"display-p3":"srgb",t.unpackColorSpace=Ze.workingColorSpace===qr?"display-p3":"srgb"}}class Kp extends ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new En,this.environmentIntensity=1,this.environmentRotation=new En,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),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()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Go extends At{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Rt,u=Rt,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Vr extends Gt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}class Fl extends qi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new we(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}}const Wr=new U,Xr=new U,Vo=new it,zi=new El,xr=new Zr,Ls=new U,Wo=new U;class jp extends ft{constructor(e=new rn,t=new Fl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;Ls.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Ls);if(!(le.far))return{distance:l,point:Wo.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const Xo=new U,Yo=new U;class $p extends jp{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r[...n].reduce((r,[s,o])=>(r[s]=o===""?!0:o,r),{}))(new URLSearchParams(window.location.search));this.override(t)}}override(e){for(const t in e)if(this[t]!==void 0){const n=e[t].toString();typeof this[t]=="boolean"?this[t]=!(n==="0"||n===!1):typeof this[t]=="number"?this[t]=parseFloat(n):typeof this[t]=="string"&&(this[t]=n)}}}const at=new om;function lm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ol={exports:{}};(function(i){(function(e){function t(){this._listeners=[],this.dispatchCount=0}var n=t.prototype;n.add=a,n.addOnce=l,n.remove=c,n.dispatch=u;var r="Callback function is missing!",s=Array.prototype.slice;function o(f){f.sort(function(p,m){return p=p.p,m=m.p,mp?-1:0})}function a(f,p,m,_){if(!f)throw r;m=m||0;for(var x=this._listeners,h,d,A,E=x.length;E--;)if(h=x[E],h.f===f&&h.c===p)return!1;typeof m=="function"&&(d=m,m=_,A=4),x.unshift({f,c:p,p:m,r:d||f,a:s.call(arguments,A||3),j:0}),o(x)}function l(f,p,m,_){if(!f)throw r;var x=this,h=function(){return x.remove.call(x,f,p),f.apply(p,s.call(arguments,0))};_=s.call(arguments,0),_.length===1&&_.push(e),_.splice(2,0,h),a.apply(x,_)}function c(f,p){if(!f)return this._listeners.length=0,!0;for(var m=this._listeners,_,x=m.length;x--;)if(_=m[x],_.f===f&&(!p||_.c===p))return _.j=0,m.splice(x,1),!0;return!1}function u(f){f=s.call(arguments,0),this.dispatchCount++;for(var p=this.dispatchCount,m=this._listeners,_,x,h=m.length;h--;)if(_=m[h],_&&_.jMath.hypot(i,e);class um{constructor(e=0,t=0,n=0){this.id=e,this.row=t,this.col=n,this.distance=$o(t,n),this.MAX_DISTANCE=$o(Xt,Xt),this.priority=this.MAX_DISTANCE-this.distance,this.ringIndex=Math.floor(this.distance),this.isMain=t===0&&n===0,this.isBorder=Math.abs(t)===2||Math.abs(n)===2,this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0,this.neighbours=null,this.reachableNeighbours=null,this.prioritySortedReachableNeighbours=null,this.randomDelay=Math.random()*.5+(this.MAX_DISTANCE-this.priority)*.5}init(){this.reachableNeighbours=this.neighbours.filter(e=>e.row===this.row||e.col===this.col),this._sortPriorityNeighbours()}_sortPriorityNeighbours(){this.prioritySortedReachableNeighbours=[...this.reachableNeighbours].sort((e,t)=>e.priority-t.priority)}shuffleReachableNeighbours(){for(let e=this.reachableNeighbours.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[this.reachableNeighbours[e],this.reachableNeighbours[t]]=[this.reachableNeighbours[t],this.reachableNeighbours[e]]}this._sortPriorityNeighbours()}preUpdate(e){this.activeRatio=0}reset(){this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0}update(e){}}const Ut=5,pn=Ut+2,Xt=Math.floor(Ut/2),$t=Ut*Ut,hm=pn*pn;class dm{constructor(){N(this,"tiles",[]);N(this,"mainTile",null)}init(){this.tiles=Array.from({length:Ut},(e,t)=>Array.from({length:Ut},(n,r)=>{const s=t-Xt,o=r-Xt;return new um(t*Ut+r,s,o)})),this.tiles.forEach((e,t)=>e.forEach((n,r)=>{n.neighbours=this._getNeighbouringTiles(t-Xt,r-Xt),n.init()})),this.mainTile=this.getTile(0,0)}getTile(e,t){var n;return((n=this.tiles[e+Xt])==null?void 0:n[t+Xt])||null}getRandomFreeTile(){const e=this.tiles.flat().filter(t=>!t.isOccupied);return e.length?e[Math.floor(Math.random()*e.length)]:null}_getNeighbouringTiles(e,t){return[-1,0,1].flatMap(n=>[-1,0,1].map(r=>n===0&&r===0?null:this.getTile(e+n,t+r)).filter(Boolean))}reset(){this.tiles.flat().forEach(e=>e.reset())}preUpdate(e){this.tiles.flat().forEach(t=>t.preUpdate(e))}update(e){this.tiles.flat().forEach(t=>t.update(e))}}const Jt=new dm;class fm{constructor(){N(this,"time",0);N(this,"deltaTime",0);N(this,"width",0);N(this,"height",0);N(this,"viewportWidth",0);N(this,"viewportHeight",0);N(this,"cameraZoom",1);N(this,"cameraOffsetX",0);N(this,"cameraOffsetY",0);N(this,"renderer",null);N(this,"scene",null);N(this,"camera",null);N(this,"postprocessing",null);N(this,"resolution",new De);N(this,"viewportResolution",new De);N(this,"canvas",null);N(this,"isPaused",!1);N(this,"showVisual",at.SHOW_BLOCK);N(this,"sharedUniforms",{u_time:{value:0},u_deltaTime:{value:1},u_resolution:{value:this.resolution},u_viewportResolution:{value:this.viewportResolution},u_bgColor1:{value:new we},u_bgColor2:{value:new we}});N(this,"loadList",[]);N(this,"animationSpeed",1.2);N(this,"bgColor1","#ffffff");N(this,"bgColor2","#d0d0d0");N(this,"neutralColor","#ffffff");N(this,"mainColor","#0096ff");N(this,"successColor","#00c881");N(this,"failColor","#ca0101");N(this,"particlesOpacity",.75);N(this,"particlesSize",.01);N(this,"particlesColor","#505050");N(this,"goboIntensity",.7);N(this,"activeBlocksCount",0);N(this,"maxFreeBlocksCount",$t-5);N(this,"lightPositionX",-2);N(this,"lightPositionY",6);N(this,"lightPositionZ",-4);N(this,"lightCameraHelperSignal",new xn);N(this,"lightCameraUpdateSignal",new xn);N(this,"lightCameraSize",4.5);N(this,"lightCameraBias",.005);N(this,"lightCameraNear",3);N(this,"lightCameraFar",16);N(this,"errorBlock",null);N(this,"errorBlockMaxLifeCycle",2);N(this,"minSpawnedBlocksForTheErrorBlock",this.maxFreeBlocksCount-2)}}const O=new fm;class pm{constructor(){N(this,"list",[]);N(this,"loadedCount",0);N(this,"onLoadCallback",null)}loadBuf(e,t){this.list.push(async()=>{try{const r=await(await fetch(e)).arrayBuffer(),s=new Uint32Array(r,0,1)[0],o=JSON.parse(new TextDecoder().decode(new Uint8Array(r,4,s))),{vertexCount:a,indexCount:l,attributes:c}=o;let u=4+s;const f=new rn,p={};c.forEach(m=>{const{id:_,componentSize:x,storageType:h,needsPack:d,packedComponents:A}=m,E=_==="indices"?l:a,T=window[h],H=new T(r,u,E*x),L=T.BYTES_PER_ELEMENT;let b;d?b=this._packAttribute(H,E,x,A,h):(p[_]=u,b=H),_==="indices"?f.setIndex(new Gt(b,1)):f.setAttribute(_,new Gt(b,x)),u+=E*x*L}),t&&t(f),this._onLoad()}catch(n){console.error("Error loading buffer:",n)}})}_packAttribute(e,t,n,r,s){const o=r.length,a=s.indexOf("Int")===0,l=1<{new tm().load(e,n=>{n.minFilter=Mc,n.magFilter=It,n.generateMipmaps=!0,n.anisotropy=O.renderer.capabilities.getMaxAnisotropy(),n.flipY=!0,t&&t(n),this._onLoad()},void 0,n=>console.error("Error loading texture:",n))})}start(e){this.loadedCount=0,this.onLoadCallback=e,this.list.forEach(t=>t())}_onLoad(){this.loadedCount++,this.loadedCount===this.list.length&&(this.list=[],this.onLoadCallback&&this.onLoadCallback())}}const Sn=new pm,Jo={type:"change"},Us={type:"start"},Qo={type:"end"};class mm extends Jn{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=Math.PI*.2,this.maxPolarAngle=Math.PI*.45,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.15,this.enableZoom=!1,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=.5,this.enablePan=!1,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,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:ti.ROTATE,TWO:ti.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.scale=1,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(w){w.addEventListener("keydown",y),this._domElementKeyEvents=w},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.scale=1,n.object.updateProjectionMatrix(),n.dispatchEvent(Jo),n.update(),s=r.NONE},this.update=function(){const w=new U,re=new Yt().setFromUnitVectors(e.up,new U(0,1,0)),j=re.clone().invert(),se=new U,Me=new Yt,Te=2*Math.PI;return function(){const ze=n.object.position;w.copy(ze).sub(n.target),w.applyQuaternion(re),a.setFromVector3(w),n.autoRotate&&s===r.NONE&&z(L()),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let Ae=n.minAzimuthAngle,ke=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(ke)&&(Ae<-Math.PI?Ae+=Te:Ae>Math.PI&&(Ae-=Te),ke<-Math.PI?ke+=Te:ke>Math.PI&&(ke-=Te),Ae<=ke?a.theta=Math.max(Ae,Math.min(ke,a.theta)):a.theta=a.theta>(Ae+ke)/2?Math.max(Ae,a.theta):Math.min(ke,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe();let C=n.enableDamping?(n.scale-1)*n.dampingFactor+1:n.scale;return a.radius*=C,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),w.setFromSpherical(a),w.applyQuaternion(j),ze.copy(n.target).add(w),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),n.scale=n.scale/C,u||se.distanceToSquared(n.object.position)>o||8*(1-Me.dot(n.object.quaternion))>o?(n.dispatchEvent(Jo),se.copy(n.object.position),Me.copy(n.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Z),n.domElement.removeEventListener("pointerdown",R),n.domElement.removeEventListener("pointercancel",Ve),n.domElement.removeEventListener("wheel",Ce),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",y)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new jo,l=new jo,c=new U;let u=!1;const f=new De,p=new De,m=new De,_=new De,x=new De,h=new De,d=new De,A=new De,E=new De,T=[],H={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function b(){return Math.pow(.95,n.zoomSpeed)}function z(w){l.theta-=w}function ie(w){l.phi-=w}const g=function(){const w=new U;return function(j,se){w.setFromMatrixColumn(se,0),w.multiplyScalar(-j),c.add(w)}}(),M=function(){const w=new U;return function(j,se){n.screenSpacePanning===!0?w.setFromMatrixColumn(se,1):(w.setFromMatrixColumn(se,0),w.crossVectors(n.object.up,w)),w.multiplyScalar(j),c.add(w)}}(),W=function(){const w=new U;return function(j,se){const Me=n.domElement;if(n.object.isPerspectiveCamera){const Te=n.object.position;w.copy(Te).sub(n.target);let ue=w.length();ue*=Math.tan(n.object.fov/2*Math.PI/180),g(2*j*ue/Me.clientHeight,n.object.matrix),M(2*se*ue/Me.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(g(j*(n.object.right-n.object.left)/n.object.zoom/Me.clientWidth,n.object.matrix),M(se*(n.object.top-n.object.bottom)/n.object.zoom/Me.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function k(w){n.object.isPerspectiveCamera?n.scale/=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(w){n.object.isPerspectiveCamera?n.scale*=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Q(w){f.set(w.clientX,w.clientY)}function X(w){d.set(w.clientX,w.clientY)}function J(w){_.set(w.clientX,w.clientY)}function V(w){p.set(w.clientX,w.clientY),m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;z(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p),n.update()}function fe(w){A.set(w.clientX,w.clientY),E.subVectors(A,d),E.y>0?k(b()):E.y<0&&K(b()),d.copy(A),n.update()}function pe(w){x.set(w.clientX,w.clientY),h.subVectors(x,_).multiplyScalar(n.panSpeed),W(h.x,h.y),_.copy(x),n.update()}function ve(w){w.deltaY<0?K(b()):w.deltaY>0&&k(b()),n.update()}function We(w){let re=!1;switch(w.code){case n.keys.UP:W(0,n.keyPanSpeed),re=!0;break;case n.keys.BOTTOM:W(0,-n.keyPanSpeed),re=!0;break;case n.keys.LEFT:W(n.keyPanSpeed,0),re=!0;break;case n.keys.RIGHT:W(-n.keyPanSpeed,0),re=!0;break}re&&(w.preventDefault(),n.update())}function Ye(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);f.set(w,re)}}function Y(){if(T.length===1)_.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);_.set(w,re)}}function te(){const w=T[0].pageX-T[1].pageX,re=T[0].pageY-T[1].pageY,j=Math.sqrt(w*w+re*re);d.set(0,j)}function _e(){n.enableZoom&&te(),n.enablePan&&Y()}function me(){n.enableZoom&&te(),n.enableRotate&&Ye()}function Ne(w){if(T.length==1)p.set(w.pageX,w.pageY);else{const j=oe(w),se=.5*(w.pageX+j.x),Me=.5*(w.pageY+j.y);p.set(se,Me)}m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;z(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p)}function be(w){if(T.length===1)x.set(w.pageX,w.pageY);else{const re=oe(w),j=.5*(w.pageX+re.x),se=.5*(w.pageY+re.y);x.set(j,se)}h.subVectors(x,_).multiplyScalar(n.panSpeed),W(h.x,h.y),_.copy(x)}function He(w){const re=oe(w),j=w.pageX-re.x,se=w.pageY-re.y,Me=Math.sqrt(j*j+se*se);A.set(0,Me),E.set(0,Math.pow(A.y/d.y,n.zoomSpeed)),k(E.y),d.copy(A)}function Ke(w){n.enableZoom&&He(w),n.enablePan&&be(w)}function Ge(w){n.enableZoom&&He(w),n.enableRotate&&Ne(w)}function R(w){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",vt),n.domElement.addEventListener("pointerup",Be)),ee(w),w.pointerType==="touch"?v(w):Re(w))}function vt(w){n.enabled!==!1&&(w.pointerType==="touch"?I(w):Qe(w))}function Be(w){q(w),T.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be)),n.dispatchEvent(Qo),s=r.NONE}function Ve(w){q(w)}function Re(w){let re;switch(w.button){case 0:re=n.mouseButtons.LEFT;break;case 1:re=n.mouseButtons.MIDDLE;break;case 2:re=n.mouseButtons.RIGHT;break;default:re=-1}switch(re){case ei.DOLLY:if(n.enableZoom===!1)return;X(w),s=r.DOLLY;break;case ei.ROTATE:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enablePan===!1)return;J(w),s=r.PAN}else{if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}break;case ei.PAN:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}else{if(n.enablePan===!1)return;J(w),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function Qe(w){if(n.enabled!==!1)switch(s){case r.ROTATE:if(n.enableRotate===!1)return;V(w);break;case r.DOLLY:if(n.enableZoom===!1)return;fe(w);break;case r.PAN:if(n.enablePan===!1)return;pe(w);break}}function Ce(w){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(n.dispatchEvent(Us),ve(w),n.dispatchEvent(Qo))}function y(w){n.enabled===!1||n.enablePan===!1||We(w)}function v(w){switch(xe(w),T.length){case 1:switch(n.touches.ONE){case ti.ROTATE:if(n.enableRotate===!1)return;Ye(),s=r.TOUCH_ROTATE;break;case ti.PAN:if(n.enablePan===!1)return;Y(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case ti.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;_e(),s=r.TOUCH_DOLLY_PAN;break;case ti.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function I(w){switch(xe(w),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ne(w),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;be(w),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ke(w),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ge(w),n.update();break;default:s=r.NONE}}function Z(w){n.enabled}function ee(w){T.push(w)}function q(w){delete H[w.pointerId];for(let re=0;re=0&&(M[le]=null,T[le].disconnect(ve))}for(let re=0;re=M.length){M.push(ve),le=Ue;break}else if(M[Ue]===null){M[Ue]=ve,le=Ue;break}if(le===-1)break}const be=T[le];be&&be.connect(ve)}}const j=new N,ne=new N;function G(q,re,ve){j.setFromMatrixPosition(re.matrixWorld),ne.setFromMatrixPosition(ve.matrixWorld);const le=j.distanceTo(ne),be=re.projectionMatrix.elements,Ue=ve.projectionMatrix.elements,He=be[14]/(be[10]-1),it=be[14]/(be[10]+1),Xe=(be[9]+1)/be[5],st=(be[9]-1)/be[5],R=(be[8]-1)/be[0],Tt=(Ue[8]+1)/Ue[0],Ve=He*R,We=He*Tt,Ee=le/(-R+Tt),tt=Ee*-R;if(re.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(tt),q.translateZ(Ee),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),be[10]===-1)q.projectionMatrix.copy(re.projectionMatrix),q.projectionMatrixInverse.copy(re.projectionMatrixInverse);else{const xe=He+Ee,y=it+Ee,g=Ve-tt,O=We+(le-tt),K=Xe*it/y*xe,te=st*it/y*xe;q.projectionMatrix.makePerspective(g,O,K,te,xe,y),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function oe(q,re){re===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(re.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;let re=q.near,ve=q.far;v.texture!==null&&(v.depthNear>0&&(re=v.depthNear),v.depthFar>0&&(ve=v.depthFar)),S.near=F.near=w.near=re,S.far=F.far=w.far=ve,(C!==S.near||X!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),C=S.near,X=S.far),w.layers.mask=q.layers.mask|2,F.layers.mask=q.layers.mask|4,S.layers.mask=w.layers.mask|F.layers.mask;const le=q.parent,be=S.cameras;oe(S,le);for(let Ue=0;Ue0&&(p.alphaTest.value=h.alphaTest);const b=e.get(h),T=b.envMap,M=b.envMapRotation;T&&(p.envMap.value=T,qn.copy(M),qn.x*=-1,qn.y*=-1,qn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(qn.y*=-1,qn.z*=-1),p.envMapRotation.value.setFromMatrix4(nm.makeRotationFromEuler(qn)),p.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=h.reflectivity,p.ior.value=h.ior,p.refractionRatio.value=h.refractionRatio),h.lightMap&&(p.lightMap.value=h.lightMap,p.lightMapIntensity.value=h.lightMapIntensity,t(h.lightMap,p.lightMapTransform)),h.aoMap&&(p.aoMap.value=h.aoMap,p.aoMapIntensity.value=h.aoMapIntensity,t(h.aoMap,p.aoMapTransform))}function o(p,h){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,h.map&&(p.map.value=h.map,t(h.map,p.mapTransform))}function a(p,h){p.dashSize.value=h.dashSize,p.totalSize.value=h.dashSize+h.gapSize,p.scale.value=h.scale}function l(p,h,b,T){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,p.size.value=h.size*b,p.scale.value=T*.5,h.map&&(p.map.value=h.map,t(h.map,p.uvTransform)),h.alphaMap&&(p.alphaMap.value=h.alphaMap,t(h.alphaMap,p.alphaMapTransform)),h.alphaTest>0&&(p.alphaTest.value=h.alphaTest)}function c(p,h){p.diffuse.value.copy(h.color),p.opacity.value=h.opacity,p.rotation.value=h.rotation,h.map&&(p.map.value=h.map,t(h.map,p.mapTransform)),h.alphaMap&&(p.alphaMap.value=h.alphaMap,t(h.alphaMap,p.alphaMapTransform)),h.alphaTest>0&&(p.alphaTest.value=h.alphaTest)}function u(p,h){p.specular.value.copy(h.specular),p.shininess.value=Math.max(h.shininess,1e-4)}function d(p,h){h.gradientMap&&(p.gradientMap.value=h.gradientMap)}function f(p,h){p.metalness.value=h.metalness,h.metalnessMap&&(p.metalnessMap.value=h.metalnessMap,t(h.metalnessMap,p.metalnessMapTransform)),p.roughness.value=h.roughness,h.roughnessMap&&(p.roughnessMap.value=h.roughnessMap,t(h.roughnessMap,p.roughnessMapTransform)),h.envMap&&(p.envMapIntensity.value=h.envMapIntensity)}function m(p,h,b){p.ior.value=h.ior,h.sheen>0&&(p.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),p.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(p.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,p.sheenColorMapTransform)),h.sheenRoughnessMap&&(p.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,p.sheenRoughnessMapTransform))),h.clearcoat>0&&(p.clearcoat.value=h.clearcoat,p.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(p.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,p.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(p.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===Ot&&p.clearcoatNormalScale.value.negate())),h.dispersion>0&&(p.dispersion.value=h.dispersion),h.iridescence>0&&(p.iridescence.value=h.iridescence,p.iridescenceIOR.value=h.iridescenceIOR,p.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(p.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,p.iridescenceMapTransform)),h.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),h.transmission>0&&(p.transmission.value=h.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),h.transmissionMap&&(p.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,p.transmissionMapTransform)),p.thickness.value=h.thickness,h.thicknessMap&&(p.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=h.attenuationDistance,p.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(p.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(p.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=h.specularIntensity,p.specularColor.value.copy(h.specularColor),h.specularColorMap&&(p.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,p.specularColorMapTransform)),h.specularIntensityMap&&(p.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,p.specularIntensityMapTransform))}function _(p,h){h.matcap&&(p.matcap.value=h.matcap)}function v(p,h){const b=e.get(h).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function rm(i,e,t,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,T){const M=T.program;n.uniformBlockBinding(b,M)}function c(b,T){let M=r[b.id];M===void 0&&(_(b),M=u(b),r[b.id]=M,b.addEventListener("dispose",p));const I=T.program;n.updateUBOMapping(b,I);const L=e.render.frame;s[b.id]!==L&&(f(b),s[b.id]=L)}function u(b){const T=d();b.__bindingPointIndex=T;const M=i.createBuffer(),I=b.__size,L=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,M),i.bufferData(i.UNIFORM_BUFFER,I,L),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,M),M}function d(){for(let b=0;b0&&(M+=I-L),b.__size=M,b.__cache={},this}function v(b){const T={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(T.boundary=4,T.storage=4):b.isVector2?(T.boundary=8,T.storage=8):b.isVector3||b.isColor?(T.boundary=16,T.storage=12):b.isVector4?(T.boundary=16,T.storage=16):b.isMatrix3?(T.boundary=48,T.storage=48):b.isMatrix4?(T.boundary=64,T.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),T}function p(b){const T=b.target;T.removeEventListener("dispose",p);const M=o.indexOf(T.__bindingPointIndex);o.splice(M,1),i.deleteBuffer(r[T.id]),delete r[T.id],delete s[T.id]}function h(){for(const b in r)i.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:l,update:c,dispose:h}}class sm{constructor(e={}){const{canvas:t=Ic(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=o;const _=new Uint32Array(4),v=new Int32Array(4);let p=null,h=null;const b=[],T=[];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._outputColorSpace=Zt,this.toneMapping=Bn,this.toneMappingExposure=1;const M=this;let I=!1,L=0,w=0,F=null,E=-1,S=null;const C=new ht,X=new ht;let V=null;const J=new Pe(0);let ee=0,j=t.width,ne=t.height,G=1,oe=null,fe=null;const Me=new ht(0,0,j,ne),ke=new ht(0,0,j,ne);let je=!1;const q=new Da;let re=!1,ve=!1;const le=new ot,be=new ot,Ue=new N,He=new ht,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Xe=!1;function st(){return F===null?G:1}let R=n;function Tt(x,D){return t.getContext(x,D)}try{const x={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ea}`),t.addEventListener("webglcontextlost",$,!1),t.addEventListener("webglcontextrestored",de,!1),t.addEventListener("webglcontextcreationerror",he,!1),R===null){const D="webgl2";if(R=Tt(D,x),R===null)throw Tt(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(x){throw console.error("THREE.WebGLRenderer: "+x.message),x}let Ve,We,Ee,tt,xe,y,g,O,K,te,Y,ge,A,Z,ye,Q,ae,Se,we,pe,Ne,Re,Qe,P;function ce(){Ve=new pf(R),Ve.init(),Re=new Kp(R,Ve),We=new lf(R,Ve,e,Re),Ee=new Zp(R,Ve),We.reverseDepthBuffer&&f&&Ee.buffers.depth.setReversed(!0),tt=new gf(R),xe=new Np,y=new jp(R,Ve,Ee,xe,We,Re,tt),g=new uf(M),O=new ff(M),K=new yu(R),Qe=new af(R,K),te=new mf(R,K,tt,Qe),Y=new xf(R,te,K,tt),we=new vf(R,We,y),Q=new cf(xe),ge=new Ip(M,g,O,Ve,We,Qe,Q),A=new im(M,xe),Z=new Op,ye=new Gp(Ve),Se=new sf(M,g,O,Ee,Y,m,l),ae=new Yp(M,Y,We),P=new rm(R,tt,We,Ee),pe=new of(R,Ve,tt),Ne=new _f(R,Ve,tt),tt.programs=ge.programs,M.capabilities=We,M.extensions=Ve,M.properties=xe,M.renderLists=Z,M.shadowMap=ae,M.state=Ee,M.info=tt}ce();const W=new tm(M,R);this.xr=W,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const x=Ve.get("WEBGL_lose_context");x&&x.loseContext()},this.forceContextRestore=function(){const x=Ve.get("WEBGL_lose_context");x&&x.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(x){x!==void 0&&(G=x,this.setSize(j,ne,!1))},this.getSize=function(x){return x.set(j,ne)},this.setSize=function(x,D,z=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}j=x,ne=D,t.width=Math.floor(x*G),t.height=Math.floor(D*G),z===!0&&(t.style.width=x+"px",t.style.height=D+"px"),this.setViewport(0,0,x,D)},this.getDrawingBufferSize=function(x){return x.set(j*G,ne*G).floor()},this.setDrawingBufferSize=function(x,D,z){j=x,ne=D,G=z,t.width=Math.floor(x*z),t.height=Math.floor(D*z),this.setViewport(0,0,x,D)},this.getCurrentViewport=function(x){return x.copy(C)},this.getViewport=function(x){return x.copy(Me)},this.setViewport=function(x,D,z,H){x.isVector4?Me.set(x.x,x.y,x.z,x.w):Me.set(x,D,z,H),Ee.viewport(C.copy(Me).multiplyScalar(G).round())},this.getScissor=function(x){return x.copy(ke)},this.setScissor=function(x,D,z,H){x.isVector4?ke.set(x.x,x.y,x.z,x.w):ke.set(x,D,z,H),Ee.scissor(X.copy(ke).multiplyScalar(G).round())},this.getScissorTest=function(){return je},this.setScissorTest=function(x){Ee.setScissorTest(je=x)},this.setOpaqueSort=function(x){oe=x},this.setTransparentSort=function(x){fe=x},this.getClearColor=function(x){return x.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor.apply(Se,arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha.apply(Se,arguments)},this.clear=function(x=!0,D=!0,z=!0){let H=0;if(x){let U=!1;if(F!==null){const ie=F.texture.format;U=ie===Pa||ie===Ca||ie===Ra}if(U){const ie=F.texture.type,ue=ie===bn||ie===ei||ie===ji||ie===Li||ie===ba||ie===wa,me=Se.getClearColor(),_e=Se.getClearAlpha(),Ie=me.r,Fe=me.g,Te=me.b;ue?(_[0]=Ie,_[1]=Fe,_[2]=Te,_[3]=_e,R.clearBufferuiv(R.COLOR,0,_)):(v[0]=Ie,v[1]=Fe,v[2]=Te,v[3]=_e,R.clearBufferiv(R.COLOR,0,v))}else H|=R.COLOR_BUFFER_BIT}D&&(H|=R.DEPTH_BUFFER_BIT),z&&(H|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",$,!1),t.removeEventListener("webglcontextrestored",de,!1),t.removeEventListener("webglcontextcreationerror",he,!1),Se.dispose(),Z.dispose(),ye.dispose(),xe.dispose(),g.dispose(),O.dispose(),Y.dispose(),Qe.dispose(),P.dispose(),ge.dispose(),W.dispose(),W.removeEventListener("sessionstart",Oa),W.removeEventListener("sessionend",Ba),Hn.stop()};function $(x){x.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const x=tt.autoReset,D=ae.enabled,z=ae.autoUpdate,H=ae.needsUpdate,U=ae.type;ce(),tt.autoReset=x,ae.enabled=D,ae.autoUpdate=z,ae.needsUpdate=H,ae.type=U}function he(x){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",x.statusMessage)}function Oe(x){const D=x.target;D.removeEventListener("dispose",Oe),lt(D)}function lt(x){At(x),xe.remove(x)}function At(x){const D=xe.get(x).programs;D!==void 0&&(D.forEach(function(z){ge.releaseProgram(z)}),x.isShaderMaterial&&ge.releaseShaderCache(x))}this.renderBufferDirect=function(x,D,z,H,U,ie){D===null&&(D=it);const ue=U.isMesh&&U.matrixWorld.determinant()<0,me=Fl(x,D,z,H,U);Ee.setMaterial(H,ue);let _e=z.index,Ie=1;if(H.wireframe===!0){if(_e=te.getWireframeAttribute(z),_e===void 0)return;Ie=2}const Fe=z.drawRange,Te=z.attributes.position;let Ye=Fe.start*Ie,Ke=(Fe.start+Fe.count)*Ie;ie!==null&&(Ye=Math.max(Ye,ie.start*Ie),Ke=Math.min(Ke,(ie.start+ie.count)*Ie)),_e!==null?(Ye=Math.max(Ye,0),Ke=Math.min(Ke,_e.count)):Te!=null&&(Ye=Math.max(Ye,0),Ke=Math.min(Ke,Te.count));const pt=Ke-Ye;if(pt<0||pt===1/0)return;Qe.setup(U,H,me,z,_e);let ct,Ze=pe;if(_e!==null&&(ct=K.get(_e),Ze=Ne,Ze.setIndex(ct)),U.isMesh)H.wireframe===!0?(Ee.setLineWidth(H.wireframeLinewidth*st()),Ze.setMode(R.LINES)):Ze.setMode(R.TRIANGLES);else if(U.isLine){let Ae=H.linewidth;Ae===void 0&&(Ae=1),Ee.setLineWidth(Ae*st()),U.isLineSegments?Ze.setMode(R.LINES):U.isLineLoop?Ze.setMode(R.LINE_LOOP):Ze.setMode(R.LINE_STRIP)}else U.isPoints?Ze.setMode(R.POINTS):U.isSprite&&Ze.setMode(R.TRIANGLES);if(U.isBatchedMesh)if(U._multiDrawInstances!==null)Ze.renderMultiDrawInstances(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount,U._multiDrawInstances);else if(Ve.get("WEBGL_multi_draw"))Ze.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{const Ae=U._multiDrawStarts,Mt=U._multiDrawCounts,$e=U._multiDrawCount,$t=_e?K.get(_e).bytesPerElement:1,ii=xe.get(H).currentProgram.getUniforms();for(let zt=0;zt<$e;zt++)ii.setValue(R,"_gl_DrawID",zt),Ze.render(Ae[zt]/$t,Mt[zt])}else if(U.isInstancedMesh)Ze.renderInstances(Ye,pt,U.count);else if(z.isInstancedBufferGeometry){const Ae=z._maxInstanceCount!==void 0?z._maxInstanceCount:1/0,Mt=Math.min(z.instanceCount,Ae);Ze.renderInstances(Ye,pt,Mt)}else Ze.render(Ye,pt)};function et(x,D,z){x.transparent===!0&&x.side===Sn&&x.forceSinglePass===!1?(x.side=Ot,x.needsUpdate=!0,ir(x,D,z),x.side=zn,x.needsUpdate=!0,ir(x,D,z),x.side=Sn):ir(x,D,z)}this.compile=function(x,D,z=null){z===null&&(z=x),h=ye.get(z),h.init(D),T.push(h),z.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(h.pushLight(U),U.castShadow&&h.pushShadow(U))}),x!==z&&x.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(h.pushLight(U),U.castShadow&&h.pushShadow(U))}),h.setupLights();const H=new Set;return x.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;const ie=U.material;if(ie)if(Array.isArray(ie))for(let ue=0;ue{function ie(){if(H.forEach(function(ue){xe.get(ue).currentProgram.isReady()&&H.delete(ue)}),H.size===0){U(x);return}setTimeout(ie,10)}Ve.get("KHR_parallel_shader_compile")!==null?ie():setTimeout(ie,10)})};let Kt=null;function hn(x){Kt&&Kt(x)}function Oa(){Hn.stop()}function Ba(){Hn.start()}const Hn=new Pl;Hn.setAnimationLoop(hn),typeof self<"u"&&Hn.setContext(self),this.setAnimationLoop=function(x){Kt=x,W.setAnimationLoop(x),x===null?Hn.stop():Hn.start()},W.addEventListener("sessionstart",Oa),W.addEventListener("sessionend",Ba),this.render=function(x,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(D),D=W.getCamera()),x.isScene===!0&&x.onBeforeRender(M,x,D,F),h=ye.get(x,T.length),h.init(D),T.push(h),be.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),q.setFromProjectionMatrix(be),ve=this.localClippingEnabled,re=Q.init(this.clippingPlanes,ve),p=Z.get(x,b.length),p.init(),b.push(p),W.enabled===!0&&W.isPresenting===!0){const ie=M.xr.getDepthSensingMesh();ie!==null&&Jr(ie,D,-1/0,M.sortObjects)}Jr(x,D,0,M.sortObjects),p.finish(),M.sortObjects===!0&&p.sort(oe,fe),Xe=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,Xe&&Se.addToRenderList(p,x),this.info.render.frame++,re===!0&&Q.beginShadows();const z=h.state.shadowsArray;ae.render(z,x,D),re===!0&&Q.endShadows(),this.info.autoReset===!0&&this.info.reset();const H=p.opaque,U=p.transmissive;if(h.setupLights(),D.isArrayCamera){const ie=D.cameras;if(U.length>0)for(let ue=0,me=ie.length;ue0&&Ha(H,U,x,D),Xe&&Se.render(x),za(p,x,D);F!==null&&(y.updateMultisampleRenderTarget(F),y.updateRenderTargetMipmap(F)),x.isScene===!0&&x.onAfterRender(M,x,D),Qe.resetDefaultState(),E=-1,S=null,T.pop(),T.length>0?(h=T[T.length-1],re===!0&&Q.setGlobalState(M.clippingPlanes,h.state.camera)):h=null,b.pop(),b.length>0?p=b[b.length-1]:p=null};function Jr(x,D,z,H){if(x.visible===!1)return;if(x.layers.test(D.layers)){if(x.isGroup)z=x.renderOrder;else if(x.isLOD)x.autoUpdate===!0&&x.update(D);else if(x.isLight)h.pushLight(x),x.castShadow&&h.pushShadow(x);else if(x.isSprite){if(!x.frustumCulled||q.intersectsSprite(x)){H&&He.setFromMatrixPosition(x.matrixWorld).applyMatrix4(be);const ue=Y.update(x),me=x.material;me.visible&&p.push(x,ue,me,z,He.z,null)}}else if((x.isMesh||x.isLine||x.isPoints)&&(!x.frustumCulled||q.intersectsObject(x))){const ue=Y.update(x),me=x.material;if(H&&(x.boundingSphere!==void 0?(x.boundingSphere===null&&x.computeBoundingSphere(),He.copy(x.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),He.copy(ue.boundingSphere.center)),He.applyMatrix4(x.matrixWorld).applyMatrix4(be)),Array.isArray(me)){const _e=ue.groups;for(let Ie=0,Fe=_e.length;Ie0&&nr(U,D,z),ie.length>0&&nr(ie,D,z),ue.length>0&&nr(ue,D,z),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function Ha(x,D,z,H){if((z.isScene===!0?z.overrideMaterial:null)!==null)return;h.state.transmissionRenderTarget[H.id]===void 0&&(h.state.transmissionRenderTarget[H.id]=new ti(1,1,{generateMipmaps:!0,type:Ve.has("EXT_color_buffer_half_float")||Ve.has("EXT_color_buffer_float")?$i:bn,minFilter:Jn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qe.workingColorSpace}));const ie=h.state.transmissionRenderTarget[H.id],ue=H.viewport||C;ie.setSize(ue.z,ue.w);const me=M.getRenderTarget();M.setRenderTarget(ie),M.getClearColor(J),ee=M.getClearAlpha(),ee<1&&M.setClearColor(16777215,.5),M.clear(),Xe&&Se.render(z);const _e=M.toneMapping;M.toneMapping=Bn;const Ie=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),h.setupLightsView(H),re===!0&&Q.setGlobalState(M.clippingPlanes,H),nr(x,z,H),y.updateMultisampleRenderTarget(ie),y.updateRenderTargetMipmap(ie),Ve.has("WEBGL_multisampled_render_to_texture")===!1){let Fe=!1;for(let Te=0,Ye=D.length;Te0),Te=!!z.morphAttributes.position,Ye=!!z.morphAttributes.normal,Ke=!!z.morphAttributes.color;let pt=Bn;H.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(pt=M.toneMapping);const ct=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,Ze=ct!==void 0?ct.length:0,Ae=xe.get(H),Mt=h.state.lights;if(re===!0&&(ve===!0||x!==S)){const Pt=x===S&&H.id===E;Q.setState(H,x,Pt)}let $e=!1;H.version===Ae.__version?(Ae.needsLights&&Ae.lightsStateVersion!==Mt.state.version||Ae.outputColorSpace!==me||U.isBatchedMesh&&Ae.batching===!1||!U.isBatchedMesh&&Ae.batching===!0||U.isBatchedMesh&&Ae.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&Ae.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&Ae.instancing===!1||!U.isInstancedMesh&&Ae.instancing===!0||U.isSkinnedMesh&&Ae.skinning===!1||!U.isSkinnedMesh&&Ae.skinning===!0||U.isInstancedMesh&&Ae.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Ae.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&Ae.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&Ae.instancingMorph===!1&&U.morphTexture!==null||Ae.envMap!==_e||H.fog===!0&&Ae.fog!==ie||Ae.numClippingPlanes!==void 0&&(Ae.numClippingPlanes!==Q.numPlanes||Ae.numIntersection!==Q.numIntersection)||Ae.vertexAlphas!==Ie||Ae.vertexTangents!==Fe||Ae.morphTargets!==Te||Ae.morphNormals!==Ye||Ae.morphColors!==Ke||Ae.toneMapping!==pt||Ae.morphTargetsCount!==Ze)&&($e=!0):($e=!0,Ae.__version=H.version);let $t=Ae.currentProgram;$e===!0&&($t=ir(H,D,U));let ii=!1,zt=!1,zi=!1;const at=$t.getUniforms(),Xt=Ae.uniforms;if(Ee.useProgram($t.program)&&(ii=!0,zt=!0,zi=!0),H.id!==E&&(E=H.id,zt=!0),ii||S!==x){Ee.buffers.depth.getReversed()?(le.copy(x.projectionMatrix),Fc(le),Oc(le),at.setValue(R,"projectionMatrix",le)):at.setValue(R,"projectionMatrix",x.projectionMatrix),at.setValue(R,"viewMatrix",x.matrixWorldInverse);const Dt=at.map.cameraPosition;Dt!==void 0&&Dt.setValue(R,Ue.setFromMatrixPosition(x.matrixWorld)),We.logarithmicDepthBuffer&&at.setValue(R,"logDepthBufFC",2/(Math.log(x.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&at.setValue(R,"isOrthographic",x.isOrthographicCamera===!0),S!==x&&(S=x,zt=!0,zi=!0)}if(U.isSkinnedMesh){at.setOptional(R,U,"bindMatrix"),at.setOptional(R,U,"bindMatrixInverse");const Pt=U.skeleton;Pt&&(Pt.boneTexture===null&&Pt.computeBoneTexture(),at.setValue(R,"boneTexture",Pt.boneTexture,y))}U.isBatchedMesh&&(at.setOptional(R,U,"batchingTexture"),at.setValue(R,"batchingTexture",U._matricesTexture,y),at.setOptional(R,U,"batchingIdTexture"),at.setValue(R,"batchingIdTexture",U._indirectTexture,y),at.setOptional(R,U,"batchingColorTexture"),U._colorsTexture!==null&&at.setValue(R,"batchingColorTexture",U._colorsTexture,y));const Yt=z.morphAttributes;if((Yt.position!==void 0||Yt.normal!==void 0||Yt.color!==void 0)&&we.update(U,z,$t),(zt||Ae.receiveShadow!==U.receiveShadow)&&(Ae.receiveShadow=U.receiveShadow,at.setValue(R,"receiveShadow",U.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(Xt.envMap.value=_e,Xt.flipEnvMap.value=_e.isCubeTexture&&_e.isRenderTargetTexture===!1?-1:1),H.isMeshStandardMaterial&&H.envMap===null&&D.environment!==null&&(Xt.envMapIntensity.value=D.environmentIntensity),zt&&(at.setValue(R,"toneMappingExposure",M.toneMappingExposure),Ae.needsLights&&Ol(Xt,zi),ie&&H.fog===!0&&A.refreshFogUniforms(Xt,ie),A.refreshMaterialUniforms(Xt,H,G,ne,h.state.transmissionRenderTarget[x.id]),kr.upload(R,Va(Ae),Xt,y)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(kr.upload(R,Va(Ae),Xt,y),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&at.setValue(R,"center",U.center),at.setValue(R,"modelViewMatrix",U.modelViewMatrix),at.setValue(R,"normalMatrix",U.normalMatrix),at.setValue(R,"modelMatrix",U.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const Pt=H.uniformsGroups;for(let Dt=0,Qr=Pt.length;Dt0&&y.useMultisampledRTT(x)===!1?U=xe.get(x).__webglMultisampledFramebuffer:Array.isArray(Fe)?U=Fe[z]:U=Fe,C.copy(x.viewport),X.copy(x.scissor),V=x.scissorTest}else C.copy(Me).multiplyScalar(G).floor(),X.copy(ke).multiplyScalar(G).floor(),V=je;if(Ee.bindFramebuffer(R.FRAMEBUFFER,U)&&H&&Ee.drawBuffers(x,U),Ee.viewport(C),Ee.scissor(X),Ee.setScissorTest(V),ie){const _e=xe.get(x.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+D,_e.__webglTexture,z)}else if(ue){const _e=xe.get(x.texture),Ie=D||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,_e.__webglTexture,z||0,Ie)}E=-1},this.readRenderTargetPixels=function(x,D,z,H,U,ie,ue){if(!(x&&x.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=xe.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&&ue!==void 0&&(me=me[ue]),me){Ee.bindFramebuffer(R.FRAMEBUFFER,me);try{const _e=x.texture,Ie=_e.format,Fe=_e.type;if(!We.textureFormatReadable(Ie)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=x.width-H&&z>=0&&z<=x.height-U&&R.readPixels(D,z,H,U,Re.convert(Ie),Re.convert(Fe),ie)}finally{const _e=F!==null?xe.get(F).__webglFramebuffer:null;Ee.bindFramebuffer(R.FRAMEBUFFER,_e)}}},this.readRenderTargetPixelsAsync=async function(x,D,z,H,U,ie,ue){if(!(x&&x.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let me=xe.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&&ue!==void 0&&(me=me[ue]),me){const _e=x.texture,Ie=_e.format,Fe=_e.type;if(!We.textureFormatReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=x.width-H&&z>=0&&z<=x.height-U){Ee.bindFramebuffer(R.FRAMEBUFFER,me);const Te=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Te),R.bufferData(R.PIXEL_PACK_BUFFER,ie.byteLength,R.STREAM_READ),R.readPixels(D,z,H,U,Re.convert(Ie),Re.convert(Fe),0);const Ye=F!==null?xe.get(F).__webglFramebuffer:null;Ee.bindFramebuffer(R.FRAMEBUFFER,Ye);const Ke=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Nc(R,Ke,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Te),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ie),R.deleteBuffer(Te),R.deleteSync(Ke),ie}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(x,D=null,z=0){x.isTexture!==!0&&(Ei("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,x=arguments[1]);const H=Math.pow(2,-z),U=Math.floor(x.image.width*H),ie=Math.floor(x.image.height*H),ue=D!==null?D.x:0,me=D!==null?D.y:0;y.setTexture2D(x,0),R.copyTexSubImage2D(R.TEXTURE_2D,z,0,0,ue,me,U,ie),Ee.unbindTexture()};const zl=R.createFramebuffer(),Hl=R.createFramebuffer();this.copyTextureToTexture=function(x,D,z=null,H=null,U=0,ie=null){x.isTexture!==!0&&(Ei("WebGLRenderer: copyTextureToTexture function signature has changed."),H=arguments[0]||null,x=arguments[1],D=arguments[2],ie=arguments[3]||0,z=null),ie===null&&(U!==0?(Ei("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ie=U,U=0):ie=0);let ue,me,_e,Ie,Fe,Te,Ye,Ke,pt;const ct=x.isCompressedTexture?x.mipmaps[ie]:x.image;if(z!==null)ue=z.max.x-z.min.x,me=z.max.y-z.min.y,_e=z.isBox3?z.max.z-z.min.z:1,Ie=z.min.x,Fe=z.min.y,Te=z.isBox3?z.min.z:0;else{const Yt=Math.pow(2,-U);ue=Math.floor(ct.width*Yt),me=Math.floor(ct.height*Yt),x.isDataArrayTexture?_e=ct.depth:x.isData3DTexture?_e=Math.floor(ct.depth*Yt):_e=1,Ie=0,Fe=0,Te=0}H!==null?(Ye=H.x,Ke=H.y,pt=H.z):(Ye=0,Ke=0,pt=0);const Ze=Re.convert(D.format),Ae=Re.convert(D.type);let Mt;D.isData3DTexture?(y.setTexture3D(D,0),Mt=R.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(y.setTexture2DArray(D,0),Mt=R.TEXTURE_2D_ARRAY):(y.setTexture2D(D,0),Mt=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,D.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,D.unpackAlignment);const $e=R.getParameter(R.UNPACK_ROW_LENGTH),$t=R.getParameter(R.UNPACK_IMAGE_HEIGHT),ii=R.getParameter(R.UNPACK_SKIP_PIXELS),zt=R.getParameter(R.UNPACK_SKIP_ROWS),zi=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,ct.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,ct.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ie),R.pixelStorei(R.UNPACK_SKIP_ROWS,Fe),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Te);const at=x.isDataArrayTexture||x.isData3DTexture,Xt=D.isDataArrayTexture||D.isData3DTexture;if(x.isDepthTexture){const Yt=xe.get(x),Pt=xe.get(D),Dt=xe.get(Yt.__renderTarget),Qr=xe.get(Pt.__renderTarget);Ee.bindFramebuffer(R.READ_FRAMEBUFFER,Dt.__webglFramebuffer),Ee.bindFramebuffer(R.DRAW_FRAMEBUFFER,Qr.__webglFramebuffer);for(let kn=0;kn<_e;kn++)at&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,xe.get(x).__webglTexture,U,Te+kn),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,xe.get(D).__webglTexture,ie,pt+kn)),R.blitFramebuffer(Ie,Fe,ue,me,Ye,Ke,ue,me,R.DEPTH_BUFFER_BIT,R.NEAREST);Ee.bindFramebuffer(R.READ_FRAMEBUFFER,null),Ee.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(U!==0||x.isRenderTargetTexture||xe.has(x)){const Yt=xe.get(x),Pt=xe.get(D);Ee.bindFramebuffer(R.READ_FRAMEBUFFER,zl),Ee.bindFramebuffer(R.DRAW_FRAMEBUFFER,Hl);for(let Dt=0;Dt<_e;Dt++)at?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Yt.__webglTexture,U,Te+Dt):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Yt.__webglTexture,U),Xt?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Pt.__webglTexture,ie,pt+Dt):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Pt.__webglTexture,ie),U!==0?R.blitFramebuffer(Ie,Fe,ue,me,Ye,Ke,ue,me,R.COLOR_BUFFER_BIT,R.NEAREST):Xt?R.copyTexSubImage3D(Mt,ie,Ye,Ke,pt+Dt,Ie,Fe,ue,me):R.copyTexSubImage2D(Mt,ie,Ye,Ke,Ie,Fe,ue,me);Ee.bindFramebuffer(R.READ_FRAMEBUFFER,null),Ee.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else Xt?x.isDataTexture||x.isData3DTexture?R.texSubImage3D(Mt,ie,Ye,Ke,pt,ue,me,_e,Ze,Ae,ct.data):D.isCompressedArrayTexture?R.compressedTexSubImage3D(Mt,ie,Ye,Ke,pt,ue,me,_e,Ze,ct.data):R.texSubImage3D(Mt,ie,Ye,Ke,pt,ue,me,_e,Ze,Ae,ct):x.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,ie,Ye,Ke,ue,me,Ze,Ae,ct.data):x.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,ie,Ye,Ke,ct.width,ct.height,Ze,ct.data):R.texSubImage2D(R.TEXTURE_2D,ie,Ye,Ke,ue,me,Ze,Ae,ct);R.pixelStorei(R.UNPACK_ROW_LENGTH,$e),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,$t),R.pixelStorei(R.UNPACK_SKIP_PIXELS,ii),R.pixelStorei(R.UNPACK_SKIP_ROWS,zt),R.pixelStorei(R.UNPACK_SKIP_IMAGES,zi),ie===0&&D.generateMipmaps&&R.generateMipmap(Mt),Ee.unbindTexture()},this.copyTextureToTexture3D=function(x,D,z=null,H=null,U=0){return x.isTexture!==!0&&(Ei("WebGLRenderer: copyTextureToTexture3D function signature has changed."),z=arguments[0]||null,H=arguments[1]||null,x=arguments[2],D=arguments[3],U=arguments[4]||0),Ei('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(x,D,z,H,U)},this.initRenderTarget=function(x){xe.get(x).__webglFramebuffer===void 0&&y.setupRenderTarget(x)},this.initTexture=function(x){x.isCubeTexture?y.setTextureCube(x,0):x.isData3DTexture?y.setTexture3D(x,0):x.isDataArrayTexture||x.isCompressedArrayTexture?y.setTexture2DArray(x,0):y.setTexture2D(x,0),Ee.unbindTexture()},this.resetState=function(){L=0,w=0,F=null,Ee.reset(),Qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return En}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=qe._getDrawingBufferColorSpace(e),t.unpackColorSpace=qe._getUnpackColorSpace()}}class am{constructor(){B(this,"APP_ID","glApp");B(this,"ASSETS_PATH","/assets/");B(this,"DPR",Math.min(2,window.devicePixelRatio||1));B(this,"USE_PIXEL_LIMIT",!0);B(this,"MAX_PIXEL_COUNT",2560*1440);B(this,"DEFAULT_POSITION",[-20,18,20]);B(this,"DEFAULT_LOOKAT_POSITION",[0,0,0]);B(this,"WEBGL_OPTS",{antialias:!0,alpha:!1});B(this,"FREE_BLOCKS_COUNT",12);B(this,"AUTO_RESTART",!0);B(this,"AUTO_START",!1);B(this,"SHOW_BLOCK",!1);if(window.URLSearchParams){const t=(n=>[...n].reduce((r,[s,o])=>(r[s]=o===""?!0:o,r),{}))(new URLSearchParams(window.location.search));this.override(t)}}override(e){for(const t in e)if(this[t]!==void 0){const n=e[t].toString();typeof this[t]=="boolean"?this[t]=!(n==="0"||n===!1):typeof this[t]=="number"?this[t]=parseFloat(n):typeof this[t]=="string"&&(this[t]=n)}}}const ft=new am;function om(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Nl={exports:{}};(function(i){(function(e){function t(){this._listeners=[],this.dispatchCount=0}var n=t.prototype;n.add=a,n.addOnce=l,n.remove=c,n.dispatch=u;var r="Callback function is missing!",s=Array.prototype.slice;function o(d){d.sort(function(f,m){return f=f.p,m=m.p,mf?-1:0})}function a(d,f,m,_){if(!d)throw r;m=m||0;for(var v=this._listeners,p,h,b,T=v.length;T--;)if(p=v[T],p.f===d&&p.c===f)return!1;typeof m=="function"&&(h=m,m=_,b=4),v.unshift({f:d,c:f,p:m,r:h||d,a:s.call(arguments,b||3),j:0}),o(v)}function l(d,f,m,_){if(!d)throw r;var v=this,p=function(){return v.remove.call(v,d,f),d.apply(f,s.call(arguments,0))};_=s.call(arguments,0),_.length===1&&_.push(e),_.splice(2,0,p),a.apply(v,_)}function c(d,f){if(!d)return this._listeners.length=0,!0;for(var m=this._listeners,_,v=m.length;v--;)if(_=m[v],_.f===d&&(!f||_.c===f))return _.j=0,m.splice(v,1),!0;return!1}function u(d){d=s.call(arguments,0),this.dispatchCount++;for(var f=this.dispatchCount,m=this._listeners,_,v,p=m.length;p--;)if(_=m[p],_&&_.jMath.hypot(i,e);class cm{constructor(e=0,t=0,n=0){this.id=e,this.row=t,this.col=n,this.distance=jo(t,n),this.MAX_DISTANCE=jo(jt,jt),this.priority=this.MAX_DISTANCE-this.distance,this.ringIndex=Math.floor(this.distance),this.isMain=t===0&&n===0,this.isBorder=Math.abs(t)===2||Math.abs(n)===2,this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0,this.neighbours=null,this.reachableNeighbours=null,this.prioritySortedReachableNeighbours=null,this.randomDelay=Math.random()*.5+(this.MAX_DISTANCE-this.priority)*.5}init(){this.reachableNeighbours=this.neighbours.filter(e=>e.row===this.row||e.col===this.col),this._sortPriorityNeighbours()}_sortPriorityNeighbours(){this.prioritySortedReachableNeighbours=[...this.reachableNeighbours].sort((e,t)=>e.priority-t.priority)}shuffleReachableNeighbours(){for(let e=this.reachableNeighbours.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[this.reachableNeighbours[e],this.reachableNeighbours[t]]=[this.reachableNeighbours[t],this.reachableNeighbours[e]]}this._sortPriorityNeighbours()}preUpdate(e){this.activeRatio=0}reset(){this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0}update(e){}}const Nt=5,vn=Nt+2,jt=Math.floor(Nt/2),tn=Nt*Nt,um=vn*vn;class hm{constructor(){B(this,"tiles",[]);B(this,"mainTile",null)}init(){this.tiles=Array.from({length:Nt},(e,t)=>Array.from({length:Nt},(n,r)=>{const s=t-jt,o=r-jt;return new cm(t*Nt+r,s,o)})),this.tiles.forEach((e,t)=>e.forEach((n,r)=>{n.neighbours=this._getNeighbouringTiles(t-jt,r-jt),n.init()})),this.mainTile=this.getTile(0,0)}getTile(e,t){var n;return((n=this.tiles[e+jt])==null?void 0:n[t+jt])||null}getRandomFreeTile(){const e=this.tiles.flat().filter(t=>!t.isOccupied);return e.length?e[Math.floor(Math.random()*e.length)]:null}_getNeighbouringTiles(e,t){return[-1,0,1].flatMap(n=>[-1,0,1].map(r=>n===0&&r===0?null:this.getTile(e+n,t+r)).filter(Boolean))}reset(){this.tiles.flat().forEach(e=>e.reset())}preUpdate(e){this.tiles.flat().forEach(t=>t.preUpdate(e))}update(e){this.tiles.flat().forEach(t=>t.update(e))}}const nn=new hm;class dm{constructor(){B(this,"time",0);B(this,"deltaTime",0);B(this,"width",0);B(this,"height",0);B(this,"viewportWidth",0);B(this,"viewportHeight",0);B(this,"cameraZoom",1);B(this,"cameraOffsetX",0);B(this,"cameraOffsetY",0);B(this,"renderer",null);B(this,"scene",null);B(this,"camera",null);B(this,"postprocessing",null);B(this,"resolution",new Le);B(this,"viewportResolution",new Le);B(this,"canvas",null);B(this,"isPaused",!1);B(this,"showVisual",ft.SHOW_BLOCK);B(this,"sharedUniforms",{u_time:{value:0},u_deltaTime:{value:1},u_resolution:{value:this.resolution},u_viewportResolution:{value:this.viewportResolution},u_bgColor1:{value:new Pe},u_bgColor2:{value:new Pe}});B(this,"loadList",[]);B(this,"animationSpeed",1.2);B(this,"bgColor1","#ffffff");B(this,"bgColor2","#d0d0d0");B(this,"neutralColor","#ffffff");B(this,"mainColor","#0096ff");B(this,"successColor","#00c881");B(this,"failColor","#ca0101");B(this,"particlesOpacity",.75);B(this,"particlesSize",.01);B(this,"particlesColor","#505050");B(this,"goboIntensity",.7);B(this,"activeBlocksCount",0);B(this,"maxFreeBlocksCount",tn-5);B(this,"lightPositionX",-2);B(this,"lightPositionY",6);B(this,"lightPositionZ",-4);B(this,"lightCameraHelperSignal",new yn);B(this,"lightCameraUpdateSignal",new yn);B(this,"lightCameraSize",4.5);B(this,"lightCameraBias",.005);B(this,"lightCameraNear",3);B(this,"lightCameraFar",16);B(this,"errorBlock",null);B(this,"errorBlockMaxLifeCycle",2);B(this,"minSpawnedBlocksForTheErrorBlock",this.maxFreeBlocksCount-2)}}const k=new dm;class fm{constructor(){B(this,"list",[]);B(this,"loadedCount",0);B(this,"onLoadCallback",null)}loadBuf(e,t){this.list.push(async()=>{try{const r=await(await fetch(e)).arrayBuffer(),s=new Uint32Array(r,0,1)[0],o=JSON.parse(new TextDecoder().decode(new Uint8Array(r,4,s))),{vertexCount:a,indexCount:l,attributes:c}=o;let u=4+s;const d=new cn,f={};c.forEach(m=>{const{id:_,componentSize:v,storageType:p,needsPack:h,packedComponents:b}=m,T=_==="indices"?l:a,M=window[p],I=new M(r,u,T*v),L=M.BYTES_PER_ELEMENT;let w;h?w=this._packAttribute(I,T,v,b,p):(f[_]=u,w=I),_==="indices"?d.setIndex(new Wt(w,1)):d.setAttribute(_,new Wt(w,v)),u+=T*v*L}),t&&t(d),this._onLoad()}catch(n){console.error("Error loading buffer:",n)}})}_packAttribute(e,t,n,r,s){const o=r.length,a=s.indexOf("Int")===0,l=1<{new mu().load(e,n=>{n.minFilter=Sc,n.magFilter=Vt,n.generateMipmaps=!0,n.anisotropy=k.renderer.capabilities.getMaxAnisotropy(),n.flipY=!0,t&&t(n),this._onLoad()},void 0,n=>console.error("Error loading texture:",n))})}start(e){this.loadedCount=0,this.onLoadCallback=e,this.list.forEach(t=>t())}_onLoad(){this.loadedCount++,this.loadedCount===this.list.length&&(this.list=[],this.onLoadCallback&&this.onLoadCallback())}}const Tn=new fm,Ko={type:"change"},Ds={type:"start"},$o={type:"end"};class pm extends ni{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=Math.PI*.2,this.maxPolarAngle=Math.PI*.45,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.15,this.enableZoom=!1,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=.5,this.enablePan=!1,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ri.ROTATE,MIDDLE:ri.DOLLY,RIGHT:ri.PAN},this.touches={ONE:si.ROTATE,TWO:si.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.scale=1,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(A){A.addEventListener("keydown",xe),this._domElementKeyEvents=A},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.scale=1,n.object.updateProjectionMatrix(),n.dispatchEvent(Ko),n.update(),s=r.NONE},this.update=function(){const A=new N,Z=new ln().setFromUnitVectors(e.up,new N(0,1,0)),ye=Z.clone().invert(),Q=new N,ae=new ln,Se=2*Math.PI;return function(){const pe=n.object.position;A.copy(pe).sub(n.target),A.applyQuaternion(Z),a.setFromVector3(A),n.autoRotate&&s===r.NONE&&F(L()),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let Ne=n.minAzimuthAngle,Re=n.maxAzimuthAngle;isFinite(Ne)&&isFinite(Re)&&(Ne<-Math.PI?Ne+=Se:Ne>Math.PI&&(Ne-=Se),Re<-Math.PI?Re+=Se:Re>Math.PI&&(Re-=Se),Ne<=Re?a.theta=Math.max(Ne,Math.min(Re,a.theta)):a.theta=a.theta>(Ne+Re)/2?Math.max(Ne,a.theta):Math.min(Re,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe();let Qe=n.enableDamping?(n.scale-1)*n.dampingFactor+1:n.scale;return a.radius*=Qe,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),A.setFromSpherical(a),A.applyQuaternion(ye),pe.copy(n.target).add(A),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),n.scale=n.scale/Qe,u||Q.distanceToSquared(n.object.position)>o||8*(1-ae.dot(n.object.quaternion))>o?(n.dispatchEvent(Ko),Q.copy(n.object.position),ae.copy(n.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",O),n.domElement.removeEventListener("pointerdown",st),n.domElement.removeEventListener("pointercancel",Ve),n.domElement.removeEventListener("wheel",tt),n.domElement.removeEventListener("pointermove",R),n.domElement.removeEventListener("pointerup",Tt),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",xe)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new yo,l=new yo,c=new N;let u=!1;const d=new Le,f=new Le,m=new Le,_=new Le,v=new Le,p=new Le,h=new Le,b=new Le,T=new Le,M=[],I={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function w(){return Math.pow(.95,n.zoomSpeed)}function F(A){l.theta-=A}function E(A){l.phi-=A}const S=function(){const A=new N;return function(ye,Q){A.setFromMatrixColumn(Q,0),A.multiplyScalar(-ye),c.add(A)}}(),C=function(){const A=new N;return function(ye,Q){n.screenSpacePanning===!0?A.setFromMatrixColumn(Q,1):(A.setFromMatrixColumn(Q,0),A.crossVectors(n.object.up,A)),A.multiplyScalar(ye),c.add(A)}}(),X=function(){const A=new N;return function(ye,Q){const ae=n.domElement;if(n.object.isPerspectiveCamera){const Se=n.object.position;A.copy(Se).sub(n.target);let we=A.length();we*=Math.tan(n.object.fov/2*Math.PI/180),S(2*ye*we/ae.clientHeight,n.object.matrix),C(2*Q*we/ae.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(S(ye*(n.object.right-n.object.left)/n.object.zoom/ae.clientWidth,n.object.matrix),C(Q*(n.object.top-n.object.bottom)/n.object.zoom/ae.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function V(A){n.object.isPerspectiveCamera?n.scale/=A:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*A)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function J(A){n.object.isPerspectiveCamera?n.scale*=A:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/A)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ee(A){d.set(A.clientX,A.clientY)}function j(A){h.set(A.clientX,A.clientY)}function ne(A){_.set(A.clientX,A.clientY)}function G(A){f.set(A.clientX,A.clientY),m.subVectors(f,d).multiplyScalar(n.rotateSpeed);const Z=n.domElement;F(2*Math.PI*m.x/Z.clientHeight),E(2*Math.PI*m.y/Z.clientHeight),d.copy(f),n.update()}function oe(A){b.set(A.clientX,A.clientY),T.subVectors(b,h),T.y>0?V(w()):T.y<0&&J(w()),h.copy(b),n.update()}function fe(A){v.set(A.clientX,A.clientY),p.subVectors(v,_).multiplyScalar(n.panSpeed),X(p.x,p.y),_.copy(v),n.update()}function Me(A){A.deltaY<0?J(w()):A.deltaY>0&&V(w()),n.update()}function ke(A){let Z=!1;switch(A.code){case n.keys.UP:X(0,n.keyPanSpeed),Z=!0;break;case n.keys.BOTTOM:X(0,-n.keyPanSpeed),Z=!0;break;case n.keys.LEFT:X(n.keyPanSpeed,0),Z=!0;break;case n.keys.RIGHT:X(-n.keyPanSpeed,0),Z=!0;break}Z&&(A.preventDefault(),n.update())}function je(){if(M.length===1)d.set(M[0].pageX,M[0].pageY);else{const A=.5*(M[0].pageX+M[1].pageX),Z=.5*(M[0].pageY+M[1].pageY);d.set(A,Z)}}function q(){if(M.length===1)_.set(M[0].pageX,M[0].pageY);else{const A=.5*(M[0].pageX+M[1].pageX),Z=.5*(M[0].pageY+M[1].pageY);_.set(A,Z)}}function re(){const A=M[0].pageX-M[1].pageX,Z=M[0].pageY-M[1].pageY,ye=Math.sqrt(A*A+Z*Z);h.set(0,ye)}function ve(){n.enableZoom&&re(),n.enablePan&&q()}function le(){n.enableZoom&&re(),n.enableRotate&&je()}function be(A){if(M.length==1)f.set(A.pageX,A.pageY);else{const ye=ge(A),Q=.5*(A.pageX+ye.x),ae=.5*(A.pageY+ye.y);f.set(Q,ae)}m.subVectors(f,d).multiplyScalar(n.rotateSpeed);const Z=n.domElement;F(2*Math.PI*m.x/Z.clientHeight),E(2*Math.PI*m.y/Z.clientHeight),d.copy(f)}function Ue(A){if(M.length===1)v.set(A.pageX,A.pageY);else{const Z=ge(A),ye=.5*(A.pageX+Z.x),Q=.5*(A.pageY+Z.y);v.set(ye,Q)}p.subVectors(v,_).multiplyScalar(n.panSpeed),X(p.x,p.y),_.copy(v)}function He(A){const Z=ge(A),ye=A.pageX-Z.x,Q=A.pageY-Z.y,ae=Math.sqrt(ye*ye+Q*Q);b.set(0,ae),T.set(0,Math.pow(b.y/h.y,n.zoomSpeed)),V(T.y),h.copy(b)}function it(A){n.enableZoom&&He(A),n.enablePan&&Ue(A)}function Xe(A){n.enableZoom&&He(A),n.enableRotate&&be(A)}function st(A){n.enabled!==!1&&(M.length===0&&(n.domElement.setPointerCapture(A.pointerId),n.domElement.addEventListener("pointermove",R),n.domElement.addEventListener("pointerup",Tt)),K(A),A.pointerType==="touch"?y(A):We(A))}function R(A){n.enabled!==!1&&(A.pointerType==="touch"?g(A):Ee(A))}function Tt(A){te(A),M.length===0&&(n.domElement.releasePointerCapture(A.pointerId),n.domElement.removeEventListener("pointermove",R),n.domElement.removeEventListener("pointerup",Tt)),n.dispatchEvent($o),s=r.NONE}function Ve(A){te(A)}function We(A){let Z;switch(A.button){case 0:Z=n.mouseButtons.LEFT;break;case 1:Z=n.mouseButtons.MIDDLE;break;case 2:Z=n.mouseButtons.RIGHT;break;default:Z=-1}switch(Z){case ri.DOLLY:if(n.enableZoom===!1)return;j(A),s=r.DOLLY;break;case ri.ROTATE:if(A.ctrlKey||A.metaKey||A.shiftKey){if(n.enablePan===!1)return;ne(A),s=r.PAN}else{if(n.enableRotate===!1)return;ee(A),s=r.ROTATE}break;case ri.PAN:if(A.ctrlKey||A.metaKey||A.shiftKey){if(n.enableRotate===!1)return;ee(A),s=r.ROTATE}else{if(n.enablePan===!1)return;ne(A),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function Ee(A){if(n.enabled!==!1)switch(s){case r.ROTATE:if(n.enableRotate===!1)return;G(A);break;case r.DOLLY:if(n.enableZoom===!1)return;oe(A);break;case r.PAN:if(n.enablePan===!1)return;fe(A);break}}function tt(A){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(n.dispatchEvent(Ds),Me(A),n.dispatchEvent($o))}function xe(A){n.enabled===!1||n.enablePan===!1||ke(A)}function y(A){switch(Y(A),M.length){case 1:switch(n.touches.ONE){case si.ROTATE:if(n.enableRotate===!1)return;je(),s=r.TOUCH_ROTATE;break;case si.PAN:if(n.enablePan===!1)return;q(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case si.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ve(),s=r.TOUCH_DOLLY_PAN;break;case si.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;le(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function g(A){switch(Y(A),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;be(A),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Ue(A),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;it(A),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Xe(A),n.update();break;default:s=r.NONE}}function O(A){n.enabled}function K(A){M.push(A)}function te(A){delete I[A.pointerId];for(let Z=0;Z{e.generateMipmaps=!1,e.minFilter=e.magFilter=Rt,e.wrapS=e.wrapT=Or,e.needsUpdate=!0,this.sharedUniforms.u_blueNoiseTexture.value=e,this.sharedUniforms.u_blueNoiseTexelSize.value=new De(1/this.TEXTURE_SIZE,1/this.TEXTURE_SIZE)}),Fe.getBlueNoise=_m}update(e){this.sharedUniforms.u_blueNoiseCoordOffset.value.set(Math.random(),Math.random())}}const Pi=new gm;class vm{constructor(){N(this,"PI",Math.PI)}clamp(e,t,n){return en?n:e}mix(e,t,n){return e+(t-e)*n}cUnMix(e,t,n){return this.clamp((n-e)/(t-e),0,1)}saturate(e){return this.clamp(e,0,1)}fit(e,t,n,r,s,o){return e=this.cUnMix(t,n,e),o&&(e=o(e)),r+e*(s-r)}}const Ie=new vm;class xm{quartInOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}sineOut(e){return Math.sin(e*Math.PI/2)}backIn(e){let t=1.70158;return e*e*((t+1)*e-t)}backOut(e,t=1.70158){return--e*e*((t+1)*e+t)+1}backInOut(e){let t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}}function Sm(i,e,t,n,r){if(i===0)return 0;if(i===1)return 1;function s(l,c,u,f,p){const m=3*(u-c),_=3*(f-u)-m;return(((p-c-m-_)*l+_)*l+m)*l+c}function o(l,c,u,f=1e-6){let p=0,m=1,_=l;for(;p{var l;return(a==null?void 0:a.id)===((l=O.errorBlock)==null?void 0:l.id)});o&&(o.isErrorBlock=!1,Dn.resetBlockFromLogicBlock(o)),O.errorBlock=null}this.statusUpdateQueue.push(()=>t?this._updateStatusAndResult(e,t,n):this._updateStatus(e))}reset(){this._queueStatusUpdate(nt.NOT_STARTED,ot.NONE)}setStart(){this._queueStatusUpdate(nt.STARTED)}setFree(){this._queueStatusUpdate(nt.FREE)}setPause(){O.isPaused=!0}setResume(){O.isPaused=!1}setStop(){this._queueStatusUpdate(nt.RESULT,ot.STOP)}setComplete(){this._queueStatusUpdate(nt.RESULT,ot.COMPLETED,Kn.LEVEL_1)}setComplete2(){this._queueStatusUpdate(nt.RESULT,ot.COMPLETED,Kn.LEVEL_2)}setComplete3(){this._queueStatusUpdate(nt.RESULT,ot.COMPLETED,Kn.LEVEL_3)}setFail(){this._queueStatusUpdate(nt.RESULT,ot.FAILED)}setResultAnimation(){this._queueStatusUpdate(nt.RESULT_ANIMATION)}setRestartAnimation(){this._queueStatusUpdate(nt.RESTART_ANIMATION)}setRestart(){this.statusUpdateQueue.push(()=>{this._updateStatus(nt.RESTART)&&this.gameEndedSignal.dispatch()})}}const Le=new Mm;class el{constructor(e,t=!1){N(this,"id",-1);N(this,"isMoving",!1);N(this,"hasBeenSpawned",!1);N(this,"hasAnimationEnded",!1);N(this,"hasBeenEvaluated",!1);N(this,"currentTile",null);N(this,"targetTile",null);N(this,"moveAnimationRatio",0);N(this,"spawnAnimationRatio",0);N(this,"spawnAnimationRatioUnclamped",-Math.random());N(this,"easedAnimationRatio",0);N(this,"randomVector",{x:Math.random()-.5,y:Math.random()-.5});N(this,"lifeCycle",0);N(this,"easingFunction",null);N(this,"errorLifeCycle",0);N(this,"isErrorBlock",!1);N(this,"errorPreFallAnimationTime",0);N(this,"errorPreFallAnimationTimeScale",0);N(this,"errorFallAnimationTime",0);this.id=e,this.init(),t&&(this.isErrorBlock=!1,O.errorBlock=null)}init(){this._setNewEasingFunction()}_setNewEasingFunction(){const e=Math.random(),t=.25;this.easingFunction=n=>vi(Ie.fit(n,e*t,e*t+(1-t),0,1))}updateTile(){this.currentTile&&(this.currentTile.isOccupied=!0,this.currentTile.willBeOccupied=!1)}_findBestTile(e,t){return e.find(n=>n.isOccupied||n.willBeOccupied||n.isMain?!1:t||this.currentTile.priority>=n.priority)}moveToNextTile(e=!1,t=0){if(this.hasBeenEvaluated=!0,this.moveAnimationRatio=-t*(this.isErrorBlock?0:1),!this.currentTile)return;if(this.isErrorBlock){this.isMoving=!0,this.targetTile=this.currentTile;return}this.currentTile.shuffleReachableNeighbours();const n=e?this.currentTile.reachableNeighbours:this.currentTile.prioritySortedReachableNeighbours,r=this._findBestTile(n,e);r&&(!this.currentTile.isMain||Math.random()<=.8)?(this.targetTile=r,this.targetTile.willBeOccupied=!0,this.isMoving=!0):this.hasAnimationEnded=!0}resetAfterCycle(){var a;this.hasBeenEvaluated=!1,this.hasAnimationEnded=!1,this.moveAnimationRatio=0,this.easedAnimationRatio=0,this.isMoving=!1,this.lifeCycle++,this.isErrorBlock&&this.errorLifeCycle++;const e=(a=this.currentTile)==null?void 0:a.isBorder,t=!O.errorBlock,n=O.activeBlocksCount>=O.minSpawnedBlocksForTheErrorBlock,s=window.crypto.getRandomValues(new Uint32Array(1))[0]*Math.pow(2,-32)<.5;Le.isFree&&s&&n&&e&&t&&(this.isErrorBlock=!0,O.errorBlock=this),this._setNewEasingFunction(),this.updateTile()}reset(e=!1){var t;this.isErrorBlock&&(this.errorLifeCycle=0,this.isErrorBlock=!1,this.currentTile.reset(),(t=this.targetTile)==null||t.reset(),this.errorFallAnimationTime=0),this.id=e?this.id:-1,this.isMoving=!1,this.hasBeenSpawned=!1,this.hasAnimationEnded=!1,this.hasBeenEvaluated=!1,this.currentTile=null,this.targetTile=null,this.moveAnimationRatio=0,this.spawnAnimationRatio=0,this.spawnAnimationRatioUnclamped=-Math.random(),this.easedAnimationRatio=0,this.lifeCycle=0,this.errorPreFallAnimationTime=0,this.errorPreFallAnimationTimeScale=0,this.errorFallAnimationTime=0}_onMovementEnd(){this.moveAnimationRatio=1,this.currentTile&&(this.currentTile.isOccupied=!1),this.currentTile=this.targetTile,this.targetTile=null,this.hasAnimationEnded=!0,this.updateTile()}_updateSpawnAnimation(e){this.spawnAnimationRatioUnclamped+=.75*O.animationSpeed*e,this.spawnAnimationRatio=Math.max(0,Math.min(1,this.spawnAnimationRatioUnclamped)),this.spawnAnimationRatio===1&&(this.hasBeenSpawned=!0)}_updateMovement(e){(this.isMoving&&!this.hasAnimationEnded||Le.isResultAnimation)&&(this.moveAnimationRatio=Math.min(1,this.moveAnimationRatio+O.animationSpeed*e*(this.isErrorBlock?.7:1)),this.easedAnimationRatio=this.easingFunction(Math.max(0,this.moveAnimationRatio)),this.easedAnimationRatio===1&&(Le.isFree||Le.isResult)&&this._onMovementEnd())}_updateTileRatios(){const e=Math.max(0,Math.min(1,this.hasBeenSpawned?this.easedAnimationRatio:this.spawnAnimationRatio));this.currentTile&&(this.currentTile.activeRatio=this.hasBeenSpawned?this.targetTile?1-e:1:this.spawnAnimationRatio),this.targetTile&&(this.targetTile.activeRatio=e),this.isErrorBlock&&this.errorLifeCycle>=O.errorBlockMaxLifeCycle-1&&(this.currentTile.activeRatio=0,this.targetTile&&(this.targetTile.activeRatio=0))}update(e){this.hasBeenSpawned?this._updateMovement(e):this._updateSpawnAnimation(e),this.errorLifeCycle>=O.errorBlockMaxLifeCycle-1&&(this.errorFallAnimationTime=this.errorFallAnimationTime+3*O.animationSpeed*e),this.isErrorBlock&&(this.errorPreFallAnimationTimeScale=this.errorPreFallAnimationTimeScale+3*e,this.errorPreFallAnimationTimeScale=Math.min(20,this.errorPreFallAnimationTimeScale),this.errorPreFallAnimationTime=this.errorPreFallAnimationTime+this.errorPreFallAnimationTimeScale*e),this._updateTileRatios()}}class Em{constructor(){N(this,"currentAnimationStyle",null);N(this,"ratio",0);N(this,"duration",8);N(this,"towerRotationRatio",0);N(this,"floatingCoinsRatio",0);N(this,"floatingCubesRatio",0);N(this,"vortexCoinsRatio",0);N(this,"pushDownRatio",0);N(this,"successColorTowerRatio",0);N(this,"floatingCubesDisplacement",1);N(this,"completeAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===nt.RESULT&&t===ot.COMPLETED&&this.triggerNewAnimation(n)})}triggerNewAnimation(e){this.currentAnimationStyle=e}resetRatios(){this.ratio=0,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=0,this.vortexCoinsRatio=0,this.pushDownRatio=0,this.successColorTowerRatio=0,this.floatingCubesDisplacement=1,this.currentAnimationStyle=null}updateRatios1(){this.floatingCubesDisplacement=1,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios2(){this.floatingCubesDisplacement=1.5,this.floatingCoinsRatio=0,this.towerRotationRatio=Ie.fit(this.ratio,.1,.45,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.15,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios3(){this.floatingCubesDisplacement=2,this.towerRotationRatio=Ie.fit(this.ratio,.1,.5,0,1),this.floatingCoinsRatio=Ie.fit(this.ratio,.2,.51,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.6,1,0,1)}update(e){switch(this.ratio+=(this.currentAnimationStyle?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.currentAnimationStyle){case Kn.LEVEL_1:this.updateRatios1();break;case Kn.LEVEL_2:this.updateRatios2();break;case Kn.LEVEL_3:this.updateRatios3();break}this.ratio===1&&(this.completeAnimationEndedSignal.dispatch(),this.resetRatios())}}const Dt=new Em;class ym{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"stopAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===nt.RESULT&&t===ot.STOP&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.spawnRatio=Ie.fit(this.ratio,0,.25,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.ratio===1&&(this.stopAnimationEndedSignal.dispatch(),this.resetRatios())}}const mn=new ym;class Tm{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"shakeRatio",0);N(this,"floatingCubesRatio",0);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"errorAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===nt.RESULT&&t===ot.FAILED&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.shakeRatio=0,this.floatingCubesRatio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.shakeRatio=Ie.fit(this.ratio,0,.3,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.35,.65,0,1),this.spawnRatio=Ie.fit(this.ratio,.3,.55,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.6,.8,0,1),this.ratio===1&&(this.errorAnimationEndedSignal.dispatch(),this.resetRatios())}}const St=new Tm;class Am{constructor(){N(this,"blocks",[]);N(this,"lastSpawnedBlock",null);N(this,"cycleIndex",0);N(this,"animationSpeedRatio",0);N(this,"firstStartAnimationRatio",0);N(this,"previousSuccessBlocksAnimationRatio",0);N(this,"isEndAnimationActive",!1);N(this,"wasSuccess",!1)}init(){Le.init(),Dt.init(),mn.init(),St.init(),Jt.init(),Dt.completeAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()}),mn.stopAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()}),St.errorAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()})}_spawnBlock(){this._shouldPreventSpawn()||(Le.isSuccessResult?this._spawnMultipleBlocks():this._spawnSingleBlock(),!(this.blocks.length===O.maxFreeBlocksCount&&Le.isFree)&&Le.spawnSignal.dispatch())}_shouldPreventSpawn(){return Le.isFailResult||Le.isStopped||this.blocks.length>=$t||Jt.mainTile.isOccupied&&!Le.isSuccessResult}_spawnMultipleBlocks(){let e=$t-O.activeBlocksCount;O.errorBlock&&(O.errorBlock.currentTile.isOccupied=!1,e+=1);for(let t=0;t=O.errorBlockMaxLifeCycle),n=!!(this.blocks.lengthe.resetAfterCycle()),Le.endCycleSignal.dispatch(),this.cycleIndex++,this._spawnBlock(),this._calculatePaths()))}_calculatePaths(){var t;(t=this.lastSpawnedBlock)!=null&&t.hasBeenSpawned&&this.lastSpawnedBlock.moveToNextTile(Le.isFree,0);const e=this.cycleIndex%2===0?!0:O.activeBlocksCount{!n.hasBeenEvaluated&&n.hasBeenSpawned&&n.moveToNextTile(e,r*.2)})}reset(){this.blocks.forEach(t=>t.reset()),Dn.reset(),Jt.reset(),this.blocks=[],this.lastSpawnedBlock=null,this.cycleIndex=0,this.animationSpeedRatio=0,this.previousSuccessBlocksAnimationRatio=this.wasSuccess?1:0,this.isEndAnimationActive=!1;const e=at.AUTO_RESTART&&[ot.FAILED,ot.COMPLETED].includes(Le.result);Le.reset(),this._startNewCycle(),e&&(Le.setStart(),Le.updateFlags())}_updateAnimationRatios(e){const{isResult:t}=Le;this.firstStartAnimationRatio=Ie.saturate(this.firstStartAnimationRatio+e*(O.showVisual?1:0)),this.animationSpeedRatio=Math.min(1,this.animationSpeedRatio+e*(t?1:0)),this.previousSuccessBlocksAnimationRatio=Ie.saturate(this.previousSuccessBlocksAnimationRatio-.25*e)}_checkCycleCompletion(){let e=!0;return this.lastSpawnedBlock&&(e=e&&this.lastSpawnedBlock.hasBeenSpawned),this.blocks.forEach(t=>{t.lifeCycle>0?e=e&&t.hasBeenEvaluated&&t.hasAnimationEnded:e=e&&t.spawnAnimationRatio===1}),e||Le.isResultAnimation||Le.isFailResult||Le.isStopped}update(e){if(this._updateAnimationRatios(e),Dt.update(e),mn.update(e),St.update(e),Le.hasNotStarted){this._startNewCycle();return}if(Le.isRestart){this.wasSuccess=Le.result===ot.COMPLETED,this.reset();return}Le.isResultAnimation&&Le.setRestartAnimation(),Jt.preUpdate(e),this.lastSpawnedBlock&&this.lastSpawnedBlock.update(e),this.blocks.forEach(n=>n.update(e)),Jt.update(e),this._checkCycleCompletion()&&this._startNewCycle()}}const Mt=new Am,bm=Math.PI/2,_i=new U;class wm{constructor(){this.animation=0,this.boardDir=new De,this.boardPos=new De,this.pos=new U,this.orient=new Yt,this.showRatio=0,this.spinPivot=new U,this.spinOrient=new Yt,this.spinOrient2=new Yt}reset(){this.animation=0,this.boardDir.set(0,0),this.boardPos.set(0,0),this.pos.set(0,0,0),this.orient.identity(),this.showRatio=0,this.spinPivot.set(0,0,0),this.spinOrient.identity()}update(e){this.pos.set(this.boardPos.x,0,-this.boardPos.y),this.spinPivot.set(this.boardDir.x*.5,-.5,-this.boardDir.y*.5),_i.set(-this.boardDir.y,0,-this.boardDir.x),this.spinOrient.setFromAxisAngle(_i,this.animation*bm)}addsFallAnimation(e){_i.set(this.boardDir.x,-e,-this.boardDir.y),this.pos.addScaledVector(_i,e),_i.set(this.boardDir.x*.5,0,-this.boardDir.y*.5),this.spinPivot.lerp(_i,Ie.saturate(e))}}var Tr=`#ifndef IS_BASE +}`;class _m{constructor(){B(this,"sharedUniforms",{u_blueNoiseTexture:{value:null},u_blueNoiseTexelSize:{value:null},u_blueNoiseCoordOffset:{value:new Le}});B(this,"TEXTURE_SIZE",128)}preInit(){Tn.loadTexture(ft.ASSETS_PATH+"textures/LDR_RGB1_0.png",e=>{e.generateMipmaps=!1,e.minFilter=e.magFilter=Bt,e.wrapS=e.wrapT=Vr,e.needsUpdate=!0,this.sharedUniforms.u_blueNoiseTexture.value=e,this.sharedUniforms.u_blueNoiseTexelSize.value=new Le(1/this.TEXTURE_SIZE,1/this.TEXTURE_SIZE)}),Be.getBlueNoise=mm}update(e){this.sharedUniforms.u_blueNoiseCoordOffset.value.set(Math.random(),Math.random())}}const Fi=new _m;class gm{constructor(){B(this,"PI",Math.PI)}clamp(e,t,n){return en?n:e}mix(e,t,n){return e+(t-e)*n}cUnMix(e,t,n){return this.clamp((n-e)/(t-e),0,1)}saturate(e){return this.clamp(e,0,1)}fit(e,t,n,r,s,o){return e=this.cUnMix(t,n,e),o&&(e=o(e)),r+e*(s-r)}}const De=new gm;class vm{quartInOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}sineOut(e){return Math.sin(e*Math.PI/2)}backIn(e){let t=1.70158;return e*e*((t+1)*e-t)}backOut(e,t=1.70158){return--e*e*((t+1)*e+t)+1}backInOut(e){let t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}}function xm(i,e,t,n,r){if(i===0)return 0;if(i===1)return 1;function s(l,c,u,d,f){const m=3*(u-c),_=3*(d-u)-m;return(((f-c-m-_)*l+_)*l+m)*l+c}function o(l,c,u,d=1e-6){let f=0,m=1,_=l;for(;f{var l;return(a==null?void 0:a.id)===((l=k.errorBlock)==null?void 0:l.id)});o&&(o.isErrorBlock=!1,Fn.resetBlockFromLogicBlock(o)),k.errorBlock=null}this.statusUpdateQueue.push(()=>t?this._updateStatusAndResult(e,t,n):this._canUpdateStatus(e))}reset(){this._queueStatusUpdate(rt.NOT_STARTED,Je.NONE)}setStart(){this._queueStatusUpdate(rt.STARTED)}setFree(){this._queueStatusUpdate(rt.FREE)}setPause(){k.isPaused=!0}setResume(){k.isPaused=!1}setStop(){this._queueStatusUpdate(rt.RESULT,Je.STOP)}setComplete(e=!1){const t=e&&this.hasNotStarted?Je.REPLAY:Je.COMPLETED;this._queueStatusUpdate(rt.RESULT,t,Qn.LEVEL_1)}setComplete2(e=!1){const t=e&&this.hasNotStarted?Je.REPLAY:Je.COMPLETED;this._queueStatusUpdate(rt.RESULT,t,Qn.LEVEL_2)}setComplete3(e=!1){const t=e&&this.hasNotStarted?Je.REPLAY:Je.COMPLETED;this._queueStatusUpdate(rt.RESULT,t,Qn.LEVEL_3)}setFail(){this._queueStatusUpdate(rt.RESULT,Je.FAILED)}setResultAnimation(){this._queueStatusUpdate(rt.RESULT_ANIMATION)}setRestartAnimation(){this._queueStatusUpdate(rt.RESTART_ANIMATION)}setRestart(e=!1){(this._canUpdateStatus(rt.RESTART)||e)&&this.statusUpdateQueue.push(()=>{this.reset()})}}const Ce=new Em;class Jo{constructor(e,t=!1){B(this,"id",-1);B(this,"isMoving",!1);B(this,"hasBeenSpawned",!1);B(this,"hasAnimationEnded",!1);B(this,"hasBeenEvaluated",!1);B(this,"currentTile",null);B(this,"targetTile",null);B(this,"moveAnimationRatio",0);B(this,"spawnAnimationRatio",0);B(this,"spawnAnimationRatioUnclamped",-Math.random());B(this,"easedAnimationRatio",0);B(this,"randomVector",{x:Math.random()-.5,y:Math.random()-.5});B(this,"lifeCycle",0);B(this,"easingFunction",null);B(this,"errorLifeCycle",0);B(this,"isErrorBlock",!1);B(this,"errorPreFallAnimationTime",0);B(this,"errorPreFallAnimationTimeScale",0);B(this,"errorFallAnimationTime",0);this.id=e,this.init(),t&&(this.isErrorBlock=!1,k.errorBlock=null)}init(){this._setNewEasingFunction()}_setNewEasingFunction(){const e=Math.random(),t=.25;this.easingFunction=n=>yi(De.fit(n,e*t,e*t+(1-t),0,1))}updateTile(){this.currentTile&&(this.currentTile.isOccupied=!0,this.currentTile.willBeOccupied=!1)}_findBestTile(e,t){return e.find(n=>n.isOccupied||n.willBeOccupied||n.isMain?!1:t||this.currentTile.priority>=n.priority)}moveToNextTile(e=!1,t=0){if(this.hasBeenEvaluated=!0,this.moveAnimationRatio=-t*(this.isErrorBlock?0:1),!this.currentTile)return;if(this.isErrorBlock){this.isMoving=!0,this.targetTile=this.currentTile;return}this.currentTile.shuffleReachableNeighbours();const n=e?this.currentTile.reachableNeighbours:this.currentTile.prioritySortedReachableNeighbours,r=this._findBestTile(n,e);r&&(!this.currentTile.isMain||Math.random()<=.8)?(this.targetTile=r,this.targetTile.willBeOccupied=!0,this.isMoving=!0):this.hasAnimationEnded=!0}resetAfterCycle(){var a;this.hasBeenEvaluated=!1,this.hasAnimationEnded=!1,this.moveAnimationRatio=0,this.easedAnimationRatio=0,this.isMoving=!1,this.lifeCycle++,this.isErrorBlock&&this.errorLifeCycle++;const e=(a=this.currentTile)==null?void 0:a.isBorder,t=!k.errorBlock,n=k.activeBlocksCount>=k.minSpawnedBlocksForTheErrorBlock,s=window.crypto.getRandomValues(new Uint32Array(1))[0]*Math.pow(2,-32)<.5;Ce.isFree&&s&&n&&e&&t&&(this.isErrorBlock=!0,k.errorBlock=this),this._setNewEasingFunction(),this.updateTile()}reset(e=!1){var t;this.isErrorBlock&&(this.errorLifeCycle=0,this.isErrorBlock=!1,this.currentTile.reset(),(t=this.targetTile)==null||t.reset(),this.errorFallAnimationTime=0),this.id=e?this.id:-1,this.isMoving=!1,this.hasBeenSpawned=!1,this.hasAnimationEnded=!1,this.hasBeenEvaluated=!1,this.currentTile=null,this.targetTile=null,this.moveAnimationRatio=0,this.spawnAnimationRatio=0,this.spawnAnimationRatioUnclamped=-Math.random(),this.easedAnimationRatio=0,this.lifeCycle=0,this.errorPreFallAnimationTime=0,this.errorPreFallAnimationTimeScale=0,this.errorFallAnimationTime=0}_onMovementEnd(){this.moveAnimationRatio=1,this.currentTile&&(this.currentTile.isOccupied=!1),this.currentTile=this.targetTile,this.targetTile=null,this.hasAnimationEnded=!0,this.updateTile()}_updateSpawnAnimation(e){this.spawnAnimationRatioUnclamped+=.75*k.animationSpeed*e,this.spawnAnimationRatio=Math.max(0,Math.min(1,this.spawnAnimationRatioUnclamped)),this.spawnAnimationRatio===1&&(this.hasBeenSpawned=!0)}_updateMovement(e){(this.isMoving&&!this.hasAnimationEnded||Ce.isResultAnimation)&&(this.moveAnimationRatio=Math.min(1,this.moveAnimationRatio+k.animationSpeed*e*(this.isErrorBlock?.7:1)),this.easedAnimationRatio=this.easingFunction(Math.max(0,this.moveAnimationRatio)),this.easedAnimationRatio===1&&(Ce.isFree||Ce.isResult)&&this._onMovementEnd())}_updateTileRatios(){const e=Math.max(0,Math.min(1,this.hasBeenSpawned?this.easedAnimationRatio:this.spawnAnimationRatio));this.currentTile&&(this.currentTile.activeRatio=this.hasBeenSpawned?this.targetTile?1-e:1:this.spawnAnimationRatio),this.targetTile&&(this.targetTile.activeRatio=e),this.isErrorBlock&&this.errorLifeCycle>=k.errorBlockMaxLifeCycle-1&&(this.currentTile.activeRatio=0,this.targetTile&&(this.targetTile.activeRatio=0))}update(e){this.hasBeenSpawned?this._updateMovement(e):this._updateSpawnAnimation(e),this.errorLifeCycle>=k.errorBlockMaxLifeCycle-1&&(this.errorFallAnimationTime=this.errorFallAnimationTime+3*k.animationSpeed*e),this.isErrorBlock&&(this.errorPreFallAnimationTimeScale=this.errorPreFallAnimationTimeScale+3*e,this.errorPreFallAnimationTimeScale=Math.min(20,this.errorPreFallAnimationTimeScale),this.errorPreFallAnimationTime=this.errorPreFallAnimationTime+this.errorPreFallAnimationTimeScale*e),this._updateTileRatios()}}class ym{constructor(){B(this,"currentAnimationStyle",null);B(this,"ratio",0);B(this,"duration",8);B(this,"towerRotationRatio",0);B(this,"floatingCoinsRatio",0);B(this,"floatingCubesRatio",0);B(this,"vortexCoinsRatio",0);B(this,"pushDownRatio",0);B(this,"successColorTowerRatio",0);B(this,"floatingCubesDisplacement",1);B(this,"completeAnimationEndedSignal",new yn)}init(){Ce.stateSignal.add((e,t,n)=>{e===rt.RESULT&&(t===Je.COMPLETED||t===Je.REPLAY)&&this.triggerNewAnimation(n)})}triggerNewAnimation(e){this.currentAnimationStyle=e}resetRatios(){this.ratio=0,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=0,this.vortexCoinsRatio=0,this.pushDownRatio=0,this.successColorTowerRatio=0,this.floatingCubesDisplacement=1,this.currentAnimationStyle=null}updateRatios1(){this.floatingCubesDisplacement=1,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=De.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=De.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=De.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=De.fit(this.ratio,.55,1,0,1)}updateRatios2(){this.floatingCubesDisplacement=1.5,this.floatingCoinsRatio=0,this.towerRotationRatio=De.fit(this.ratio,.1,.45,0,1),this.floatingCubesRatio=De.fit(this.ratio,.15,.49,0,1.2),this.pushDownRatio=De.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=De.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=De.fit(this.ratio,.55,1,0,1)}updateRatios3(){this.floatingCubesDisplacement=2,this.towerRotationRatio=De.fit(this.ratio,.1,.5,0,1),this.floatingCoinsRatio=De.fit(this.ratio,.2,.51,0,1),this.floatingCubesRatio=De.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=De.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=De.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=De.fit(this.ratio,.6,1,0,1)}update(e){switch(this.ratio+=(this.currentAnimationStyle?1:0)*e/this.duration,this.ratio=De.clamp(this.ratio,0,1),this.currentAnimationStyle){case Qn.LEVEL_1:this.updateRatios1();break;case Qn.LEVEL_2:this.updateRatios2();break;case Qn.LEVEL_3:this.updateRatios3();break}this.ratio>=1&&(this.completeAnimationEndedSignal.dispatch(),this.resetRatios())}}const It=new ym;class Tm{constructor(){B(this,"isActive",!1);B(this,"ratio",0);B(this,"duration",4);B(this,"spawnRatio",0);B(this,"pushDownRatio",0);B(this,"stopAnimationEndedSignal",new yn)}init(){Ce.stateSignal.add((e,t)=>{e===rt.RESULT&&t===Je.STOP&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=De.clamp(this.ratio,0,1),this.spawnRatio=De.fit(this.ratio,0,.25,0,2.5),this.pushDownRatio=De.fit(this.ratio,.45,.55,0,1),this.ratio>=1&&(this.stopAnimationEndedSignal.dispatch(),this.resetRatios())}}const xn=new Tm;class Am{constructor(){B(this,"isActive",!1);B(this,"ratio",0);B(this,"duration",4);B(this,"shakeRatio",0);B(this,"floatingCubesRatio",0);B(this,"spawnRatio",0);B(this,"pushDownRatio",0);B(this,"errorAnimationEndedSignal",new yn)}init(){Ce.stateSignal.add((e,t)=>{e===rt.RESULT&&t===Je.FAILED&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.shakeRatio=0,this.floatingCubesRatio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=De.clamp(this.ratio,0,1),this.shakeRatio=De.fit(this.ratio,0,.3,0,1),this.floatingCubesRatio=De.fit(this.ratio,.35,.65,0,1),this.spawnRatio=De.fit(this.ratio,.3,.55,0,2.5),this.pushDownRatio=De.fit(this.ratio,.6,.8,0,1),this.ratio>=1&&(this.errorAnimationEndedSignal.dispatch(),this.resetRatios())}}const Et=new Am;class bm{constructor(){B(this,"blocks",[]);B(this,"lastSpawnedBlock",null);B(this,"cycleIndex",0);B(this,"animationSpeedRatio",0);B(this,"firstStartAnimationRatio",0);B(this,"previousSuccessBlocksAnimationRatio",0)}init(){Ce.init(),It.init(),xn.init(),Et.init(),nn.init(),It.completeAnimationEndedSignal.add(()=>{Ce.setRestart(!0),this._startNewCycle(),this.previousSuccessBlocksAnimationRatio=1}),xn.stopAnimationEndedSignal.add(()=>{Ce.setRestart(!0),this.reset()}),Et.errorAnimationEndedSignal.add(()=>{Ce.setRestart(!0),this._startNewCycle()})}_spawnBlock(){this._shouldPreventSpawn()||(Ce.isSuccessResult||Ce.isReplayResult?this._spawnMultipleBlocks():this._spawnSingleBlock(),!(this.blocks.length===k.maxFreeBlocksCount&&Ce.isFree)&&Ce.spawnSignal.dispatch())}_shouldPreventSpawn(){return Ce.isFailResult||Ce.isStopped||this.blocks.length>=tn||nn.mainTile.isOccupied&&!Ce.isSuccessResult&&!Ce.isReplayResult}_spawnMultipleBlocks(){let e=tn-k.activeBlocksCount;k.errorBlock&&(k.errorBlock.currentTile.isOccupied=!1,e+=1);for(let t=0;t=k.errorBlockMaxLifeCycle),n=!!(this.blocks.lengthe.resetAfterCycle()),Ce.endCycleSignal.dispatch(),this.cycleIndex++,this._spawnBlock(),this._calculatePaths()))}_calculatePaths(){var t;(t=this.lastSpawnedBlock)!=null&&t.hasBeenSpawned&&this.lastSpawnedBlock.moveToNextTile(Ce.isFree,0);const e=this.cycleIndex%2===0?!0:k.activeBlocksCount{!n.hasBeenEvaluated&&n.hasBeenSpawned&&n.moveToNextTile(e,r*.2)})}reset(){this.blocks.forEach(t=>t.reset()),Fn.reset(),nn.reset(),this.blocks=[],this.lastSpawnedBlock=null,this.cycleIndex=0,this.animationSpeedRatio=0;const e=Mm.includes(Ce.result);Ce.reset(),this._startNewCycle(),e&&Ce.setStart()}_updateAnimationRatios(e){const t=Ce.isResult;this.firstStartAnimationRatio=De.saturate(this.firstStartAnimationRatio+e*(k.showVisual?1:0)),this.animationSpeedRatio=Math.min(1,this.animationSpeedRatio+e*(t?1:0)),this.previousSuccessBlocksAnimationRatio=De.saturate(this.previousSuccessBlocksAnimationRatio-e/1.5)}_checkCycleCompletion(){let e=!0;return this.lastSpawnedBlock&&(e=e&&this.lastSpawnedBlock.hasBeenSpawned),this.blocks.forEach(t=>{t.lifeCycle>0?e=e&&t.hasBeenEvaluated&&t.hasAnimationEnded:e=e&&t.spawnAnimationRatio===1}),e||Ce.isResultAnimation||Ce.isFailResult||Ce.isStopped}update(e){if(this._updateAnimationRatios(e),It.update(e),xn.update(e),Et.update(e),Ce.hasNotStarted){this._startNewCycle();return}if(Ce.isRestart){this.reset();return}Ce.isResultAnimation&&Ce.setRestartAnimation(),nn.preUpdate(e),this.lastSpawnedBlock&&this.lastSpawnedBlock.update(e),this.blocks.forEach(n=>n.update(e)),nn.update(e),this._checkCycleCompletion()&&this._startNewCycle()}}const yt=new bm,wm=Math.PI/2,Si=new N;class Rm{constructor(){this.animation=0,this.boardDir=new Le,this.boardPos=new Le,this.pos=new N,this.orient=new ln,this.showRatio=0,this.spinPivot=new N,this.spinOrient=new ln}reset(){this.animation=0,this.boardDir.set(0,0),this.boardPos.set(0,0),this.pos.set(0,0,0),this.orient.identity(),this.showRatio=0,this.spinPivot.set(0,0,0),this.spinOrient.identity()}update(e){this.pos.set(this.boardPos.x,0,-this.boardPos.y),this.spinPivot.set(this.boardDir.x*.5,-.5,-this.boardDir.y*.5),Si.set(-this.boardDir.y,0,-this.boardDir.x),this.spinOrient.setFromAxisAngle(Si,this.animation*wm)}addsFallAnimation(e){Si.set(this.boardDir.x,-e,-this.boardDir.y),this.pos.addScaledVector(Si,e),Si.set(this.boardDir.x*.5,0,-this.boardDir.y*.5),this.spinPivot.lerp(Si,De.saturate(e))}}var Lr=`#ifndef IS_BASE attribute vec3 instancePos; attribute vec4 instanceOrient; attribute float instanceShowRatio; @@ -4018,7 +4011,7 @@ void main () { #endif -}`,tl=`uniform vec3 u_lightPosition; +}`,Qo=`uniform vec3 u_lightPosition; uniform sampler2D u_infoTexture; uniform sampler2D u_infoTextureLinear; uniform sampler2D u_goboTexture; @@ -4311,7 +4304,7 @@ void main () { gl_FragColor.rgb = mix(linearToSRGB(mix(u_bgColor1, u_bgColor2, screenUv.y)), gl_FragColor.rgb, alpha); #endif -}`,nl=`#include +}`,el=`#include #include varying vec2 vHighPrecisionZW; @@ -4324,7 +4317,7 @@ void main() { float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; gl_FragColor = packDepthToRGBA( fragCoordZ ); -}`;const Hi=2*$t,gt=new De,Ar=new De,gi=new U,il=new U,Is=new Yt,rl=new Yt,sl=new we,br=new we,Ns=new we,wr=new we,Pn=new we,Rr=new we;class Rm{constructor(){N(this,"container",new ft);N(this,"_baseMesh");N(this,"_blocksMesh");N(this,"_blockList",[]);N(this,"_blockRenderList",[]);N(this,"sharedUniforms",{u_lightPosition:{value:new U(-2,6,-4)},u_goboTexture:{value:null},u_goboIntensity:{value:0},u_infoTexture:{value:null},u_infoTextureLinear:{value:null},u_restartAnimationRatio:{value:0},u_endAnimationRatio:{value:0}});N(this,"successColorRatio",0);N(this,"infoTexture",null)}preload(){this._blockList=Array(Hi).fill().map(()=>new wm),this._blockRenderList=[...this._blockList],Sn.loadBuf(at.ASSETS_PATH+"models/BASE.buf",e=>{this._onBaseBlocksLoaded(e)}),Sn.loadBuf(at.ASSETS_PATH+"models/BOX.buf",e=>{this._onBoxLoaded(e)}),Sn.loadBuf(at.ASSETS_PATH+"models/lose_animation.buf",e=>{const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/$t,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}),Sn.loadTexture(at.ASSETS_PATH+"textures/gobo.jpg",e=>{e.flipY=!1,e.needsUpdate=!0,this.sharedUniforms.u_goboTexture.value=e})}_onBaseBlocksLoaded(e){const t=new Tt({uniforms:{...Gr.merge([ae.lights]),...O.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,u_color:{value:new we(this.neutralColor)},u_blocksColor:{value:new we},u_yDisplacement:{value:0},u_prevSuccessColor:{value:new we(O.successColor).convertSRGBToLinear()},u_successColor:{value:new we(O.successColor).convertSRGBToLinear()},u_successAnimationRatio:{value:0}},vertexShader:Tr,fragmentShader:tl,lights:!0,transparent:!0});this._baseMesh=new Nt(e,t),this._baseMesh.receiveShadow=this._baseMesh.castShadow=!0,this._baseMesh.frustumCulled=!1,this._baseMesh.material.defines.IS_BASE=!0,this._baseMesh.customDepthMaterial=new Tt({vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0,IS_BASE:!0}}),this.container.add(this._baseMesh)}_onBoxLoaded(e){const t=new Ba;t.index=e.index,Object.keys(e.attributes).forEach(s=>{t.setAttribute(s,e.attributes[s])}),t.instanceCount=Hi;const n=(s,o)=>{const a=new Float32Array(Hi*o);return t.setAttribute(s,new Vr(a,o).setUsage(Uc)),a};this._instancePosArray=n("instancePos",3),this._instanceOrientArray=n("instanceOrient",4),this._instanceShowRatioArray=n("instanceShowRatio",1),this._instanceSpinPivotArray=n("instanceSpinPivot",3),this._instanceSpinOrientArray=n("instanceSpinOrient",4),this._instanceColorArray=n("instanceColor",3),this._instanceIsActiveArray=n("instanceIsActive",1),this._instanceNextDirectionArray=n("instanceNextDirection",2);const r=new Tt({uniforms:{...Gr.merge([ae.lights]),...O.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms},vertexShader:Tr,fragmentShader:tl,lights:!0});this._blocksMesh=new Nt(t,r),this._blocksMesh.frustumCulled=!1,this._blocksMesh.castShadow=this._blocksMesh.receiveShadow=!0,this._blocksMesh.customDepthMaterial=new Tt({uniforms:{...this.sharedUniforms},vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0}}),this.container.add(this._blocksMesh)}init(){this.directLight=new sm(16777215,1),this.directLight.castShadow=!0,this.directLight.shadow.camera.near=O.lightCameraNear,this.directLight.shadow.camera.far=O.lightCameraFar,this.directLight.shadow.camera.right=O.lightCameraSize,this.directLight.shadow.camera.left=-O.lightCameraSize,this.directLight.shadow.camera.top=O.lightCameraSize,this.directLight.shadow.camera.bottom=-O.lightCameraSize,this.directLight.shadow.bias=O.lightCameraBias,this.directLight.shadow.mapSize.width=768,this.directLight.shadow.mapSize.height=768,O.scene.add(this.directLight),O.scene.add(this.directLight.target),this.isShadowCameraHelperVisible=!1,this.shadowCameraHelper=new am(this.directLight.shadow.camera,1,"#ff0000"),O.lightCameraUpdateSignal.add(()=>{this.directLight.shadow.camera.updateProjectionMatrix(),this.shadowCameraHelper.update()}),O.lightCameraHelperSignal.add(()=>{this.isShadowCameraHelperVisible=!this.isShadowCameraHelperVisible,this.isShadowCameraHelperVisible?O.scene.add(this.shadowCameraHelper):O.scene.remove(this.shadowCameraHelper)}),this._assignFinalAnimationToTiles();let e=new Float32Array(hm*4);for(let t=0,n=0;t{e.forEach((n,r)=>{const s=t*Ut+r;n.loseAnimationPositionArray=new Float32Array(this.animationTotalFrames*3),n.loseAnimationOrientArray=new Float32Array(this.animationTotalFrames*4);for(let o=0;oe.reset())}resetBlockFromLogicBlock(e){this._blockList[e.id].reset()}_updateColors(e){sl.set(O.mainColor),br.set(O.successColor),Ns.set(O.failColor),wr.set(O.neutralColor),Pn.copy(sl),Le.result===ot.FAILED&&St.floatingCubesRatio>0&&Pn.copy(Ns),Le.result===ot.COMPLETED&&(this.successColorRatio=Math.min(1,this.successColorRatio+.5*e),Pn.lerp(br,this.successColorRatio)),Le.result!==ot.COMPLETED&&Pn.lerp(wr,Ie.saturate(mn.pushDownRatio+St.pushDownRatio)),Pn.convertSRGBToLinear(),wr.convertSRGBToLinear(),br.convertSRGBToLinear();for(let n=0;na.id===n)[0],s=n0&&(a=Ie.saturate(.5*(1-Math.cos(14*r.errorFallAnimationTime)))),Rr.lerpColors(o,Ns,a),this._instanceColorArray.set([Rr.r,Rr.g,Rr.b],n*3)}else this._instanceColorArray.set([o.r,o.g,o.b],n*3);this._instanceIsActiveArray[n]=s?1:0}const t=this._baseMesh.material.uniforms;t.u_color.value.set(O.neutralColor).convertSRGBToLinear(),t.u_blocksColor.value.copy(Pn),t.u_successColor.value.copy(br),t.u_prevSuccessColor.value.set(O.neutralColor),t.u_prevSuccessColor.value.lerp(Pn.set(O.successColor),Mt.previousSuccessBlocksAnimationRatio),t.u_prevSuccessColor.value.convertSRGBToLinear()}_updateInfoTexture(){Jt.tiles.forEach(e=>{e.forEach(t=>{let n=t.id%Ut+1,s=((Math.floor(t.id/Ut)+1)*pn+n)*4,o=.5*Dt.floatingCubesRatio*Ie.fit(Dt.pushDownRatio,0,.1,1,0);o+=(St.floatingCubesRatio>0?1:0)*Ie.fit(St.pushDownRatio,0,.1,1,0),o+=mn.spawnRatio*Ie.fit(mn.pushDownRatio,0,.1,1,0),o=Math.min(1,o),this.infoTexture.image.data[s+0]=t.activeRatio*(1-o),this.infoTexture.image.data[s+1]=t.isOccupied||t.willBeOccupied?1:0,this.infoTexture.image.data[s+2]=t.isMain?1:0,this.infoTexture.image.data[s+3]=t.isBorder?1:0})}),this.infoTexture.needsUpdate=!0,this.infoTextureLinear.needsUpdate=!0}_updateFreeBlocks(e){if(Mt.lastSpawnedBlock){const t=this._blockList[Mt.lastSpawnedBlock.id];t.boardPos.set(Mt.lastSpawnedBlock.currentTile.row,Mt.lastSpawnedBlock.currentTile.col),t.showRatio=vi(Ie.saturate(Mt.lastSpawnedBlock.spawnAnimationRatioUnclamped))}Mt.blocks.forEach(t=>{const n=this._blockList[t.id];n&&(n.showRatio=vi(Ie.saturate(t.spawnAnimationRatioUnclamped)),n.boardPos.set(t.currentTile.row,t.currentTile.col),t.targetTile&&n.boardDir.set(t.targetTile.row-t.currentTile.row,t.targetTile.col-t.currentTile.col),n.animation=t.hasAnimationEnded?0:t.easedAnimationRatio)})}_updateAttributes(e){for(let n=0;n=$t){const n=t-$t,r=n%Ut-Xt,s=Math.floor(n/Ut)-Xt,o=Jt.getTile(s,r);if(!o.isOccupied){const a=Ie.saturate(mn.spawnRatio-o.randomDelay);o.activeRatio=a,e.showRatio=vi(a),e.boardPos.set(s,r)}}}_updateLongBlockAnimation(e,t){if(e&&e.isErrorBlock&&e.errorLifeCycle>=O.errorBlockMaxLifeCycle-1){const n=e.currentTile,r=e.errorFallAnimationTime;t.boardPos.set(n.row,n.col),gt.set(n.row,n.col).normalize(),Math.abs(gt.x)>Math.abs(gt.y)?gt.set(Math.sign(gt.x),0):gt.set(0,Math.sign(gt.y)),t.boardDir.set(gt.x,gt.y),t.animation=Ie.fit(r*r,0,1,0,1),t.animation+=Math.max(0,r-.5),t.update(O.deltaTime),t.addsFallAnimation(Math.max(0,r-.5))}}_updateFailAnimation(e,t,n){if(Le.result===ot.FAILED){if(e){const r=e.currentTile;if(St.floatingCubesRatio>0){const s=Math.floor(St.floatingCubesRatio*this.animationTotalFrames),o=Math.min(s+1,this.animationTotalFrames-1),a=St.floatingCubesRatio*this.animationTotalFrames-s;gi.fromArray(r.loseAnimationPositionArray,s*3),il.fromArray(r.loseAnimationPositionArray,o*3),gi.lerp(il,a),gi.y*=.5,t.pos.set(gi.z,gi.y,-gi.x),Is.fromArray(r.loseAnimationOrientArray,s*4),rl.fromArray(r.loseAnimationOrientArray,o*4),Is.slerp(rl,a),t.orient.copy(Is)}if(St.shakeRatio>0){const s=Ie.fit(St.shakeRatio,0,1,0,1,Er.sineOut);if(gt.set(r.row,r.col),gt.normalize(),gt.multiplyScalar(.1*s),t.pos.x+=gt.x,t.pos.z-=gt.y,St.shakeRatio<1){const o=s*Ie.fit(St.shakeRatio,.5,.8,1,0);gt.set(e.randomVector.x,e.randomVector.y),gt.normalize(),gt.multiplyScalar(o),Ar.set(0,0),Ar.addScaledVector(gt,.08*o*Math.sin(o*80)),t.pos.x+=Ar.x,t.pos.z+=Ar.y}}}if(n>=$t){const r=n-$t,s=r%Ut-Xt,o=Math.floor(r/Ut)-Xt,a=Jt.getTile(o,s),l=Ie.saturate(St.spawnRatio-a.randomDelay);a.isOccupied||(a.activeRatio=l),t.showRatio=vi(l),t.boardPos.set(o,s)}}}_updateFloatAnimation(e,t){if(Le.result===ot.COMPLETED&&e){const r=.1*e.currentTile.randomDelay,s=Dt.floatingCubesRatio-r;let o=Ie.fit(s,0,.5,0,1,a=>1-Math.pow(1-a,5));o=Ie.fit(s,.7,1,o,0,a=>Math.pow(a,5)),t.pos.y+=Dt.floatingCubesDisplacement*o}}update(e){this._updateFreeBlocks(e),this._updateColors(e);let t=0;for(let o=0;oc.id===o)[0];a.showRatio>0&&(this._blockRenderList[t++]=a),this._updateFailAnimation(l,a,o),this._updateLongBlockAnimation(l,a),this._updateStopAnimation(a,o),this._updateFloatAnimation(l,a,o)}this._updateInfoTexture(),this._updateAttributes(t);const n=Math.min(1,mn.pushDownRatio+St.pushDownRatio+Dt.pushDownRatio),r=Er.backOut(n,3),s=1-vi(Mt.firstStartAnimationRatio);this.container.position.y=-r-2*s,this.container.rotation.y=.5*Math.PI*s,this.container.rotation.y+=2*Math.PI*Er.quartInOut(Dt.towerRotationRatio),this._baseMesh.material.uniforms.u_yDisplacement.value=-r-5*s,this._baseMesh.material.uniforms.u_successAnimationRatio.value=Dt.successColorTowerRatio,this.sharedUniforms.u_endAnimationRatio.value=Math.min(1,Ie.fit(mn.spawnRatio,.5,2,0,1)+Ie.fit(St.spawnRatio,.5,2,0,1)+Ie.fit(Dt.ratio,0,.2,0,1)),this.sharedUniforms.u_restartAnimationRatio.value=n,this.sharedUniforms.u_goboIntensity.value=O.goboIntensity,this.sharedUniforms.u_lightPosition.value.set(O.lightPositionX,O.lightPositionY,O.lightPositionZ),this.directLight.position.copy(this.sharedUniforms.u_lightPosition.value),this.directLight.shadow.camera.near=O.lightCameraNear,this.directLight.shadow.camera.far=O.lightCameraFar,this.directLight.shadow.camera.right=O.lightCameraSize,this.directLight.shadow.camera.left=-O.lightCameraSize,this.directLight.shadow.camera.top=O.lightCameraSize,this.directLight.shadow.camera.bottom=-O.lightCameraSize,this.directLight.shadow.bias=O.lightCameraBias}}const Dn=new Rm;var al=`uniform float u_time; +}`;const Yi=2*tn,St=new Le,Dr=new Le,Mi=new N,tl=new N,Us=new ln,nl=new ln,il=new Pe,Ur=new Pe,Is=new Pe,qi=new Pe,In=new Pe,Ir=new Pe;class Cm{constructor(){B(this,"container",new _t);B(this,"_baseMesh");B(this,"_blocksMesh");B(this,"_blockList",[]);B(this,"_blockRenderList",[]);B(this,"sharedUniforms",{u_lightPosition:{value:new N(-2,6,-4)},u_goboTexture:{value:null},u_goboIntensity:{value:0},u_infoTexture:{value:null},u_infoTextureLinear:{value:null},u_restartAnimationRatio:{value:0},u_endAnimationRatio:{value:0}});B(this,"successColorRatio",0);B(this,"infoTexture",null)}preload(){this._blockList=Array.from({length:Yi},e=>new Rm),this._blockRenderList=[...this._blockList],Tn.loadBuf(ft.ASSETS_PATH+"models/BASE.buf",e=>{this._onBaseBlocksLoaded(e)}),Tn.loadBuf(ft.ASSETS_PATH+"models/BOX.buf",e=>{this._onBoxLoaded(e)}),Tn.loadBuf(ft.ASSETS_PATH+"models/lose_animation.buf",e=>{const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/tn,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}),Tn.loadTexture(ft.ASSETS_PATH+"textures/gobo.jpg",e=>{e.flipY=!1,e.needsUpdate=!0,this.sharedUniforms.u_goboTexture.value=e})}_onBaseBlocksLoaded(e){const t=new Rt({uniforms:{...Xr.merge([se.lights]),...k.sharedUniforms,...this.sharedUniforms,...Fi.sharedUniforms,u_color:{value:new Pe(k.neutralColor)},u_blocksColor:{value:new Pe},u_yDisplacement:{value:0},u_prevSuccessColor:{value:new Pe(k.neutralColor).convertSRGBToLinear()},u_successColor:{value:new Pe(k.successColor).convertSRGBToLinear()},u_successAnimationRatio:{value:0}},vertexShader:Lr,fragmentShader:Qo,lights:!0,transparent:!0});this._baseMesh=new Ft(e,t),this._baseMesh.receiveShadow=this._baseMesh.castShadow=!0,this._baseMesh.frustumCulled=!1,this._baseMesh.material.defines.IS_BASE=!0,this._baseMesh.customDepthMaterial=new Rt({vertexShader:Lr,fragmentShader:el,defines:{IS_DEPTH:!0,IS_BASE:!0}}),this.container.add(this._baseMesh)}_onBoxLoaded(e){const t=new Na;t.index=e.index,Object.keys(e.attributes).forEach(s=>{t.setAttribute(s,e.attributes[s])}),t.instanceCount=Yi;const n=(s,o)=>{const a=new Float32Array(Yi*o);return t.setAttribute(s,new Yr(a,o,o!==4).setUsage(Dc)),a};this._instancePosArray=n("instancePos",3),this._instanceOrientArray=n("instanceOrient",4),this._instanceShowRatioArray=n("instanceShowRatio",1),this._instanceSpinPivotArray=n("instanceSpinPivot",3),this._instanceSpinOrientArray=n("instanceSpinOrient",4),this._instanceColorArray=n("instanceColor",3),this._instanceIsActiveArray=n("instanceIsActive",1),this._instanceNextDirectionArray=n("instanceNextDirection",2);const r=new Rt({uniforms:{...Xr.merge([se.lights]),...k.sharedUniforms,...this.sharedUniforms,...Fi.sharedUniforms},vertexShader:Lr,fragmentShader:Qo,lights:!0});this._blocksMesh=new Ft(t,r),this._blocksMesh.frustumCulled=!1,this._blocksMesh.castShadow=this._blocksMesh.receiveShadow=!0,this._blocksMesh.customDepthMaterial=new Rt({uniforms:{...this.sharedUniforms},vertexShader:Lr,fragmentShader:el,defines:{IS_DEPTH:!0}}),this.container.add(this._blocksMesh)}init(){this.directLight=new xu(16777215,1),this.directLight.castShadow=!0,this.directLight.shadow.camera.near=k.lightCameraNear,this.directLight.shadow.camera.far=k.lightCameraFar,this.directLight.shadow.camera.right=k.lightCameraSize,this.directLight.shadow.camera.left=-k.lightCameraSize,this.directLight.shadow.camera.top=k.lightCameraSize,this.directLight.shadow.camera.bottom=-k.lightCameraSize,this.directLight.shadow.bias=k.lightCameraBias,this.directLight.shadow.mapSize.width=768,this.directLight.shadow.mapSize.height=768,k.scene.add(this.directLight),k.scene.add(this.directLight.target),this.isShadowCameraHelperVisible=!1,this.shadowCameraHelper=new Mu(this.directLight.shadow.camera,1,"#ff0000"),k.lightCameraUpdateSignal.add(()=>{this.directLight.shadow.camera.updateProjectionMatrix(),this.shadowCameraHelper.update()}),k.lightCameraHelperSignal.add(()=>{this.isShadowCameraHelperVisible=!this.isShadowCameraHelperVisible,this.isShadowCameraHelperVisible?k.scene.add(this.shadowCameraHelper):k.scene.remove(this.shadowCameraHelper)}),this._assignFinalAnimationToTiles();let e=new Float32Array(um*4);for(let t=0,n=0;t{e.forEach((n,r)=>{const s=t*Nt+r;n.loseAnimationPositionArray=new Float32Array(this.animationTotalFrames*3),n.loseAnimationOrientArray=new Float32Array(this.animationTotalFrames*4);for(let o=0;oe.reset())}resetBlockFromLogicBlock(e){this._blockList[e.id].reset()}_updateColors(e){il.set(k.mainColor),Ur.set(k.successColor),Is.set(k.failColor),qi.set(k.neutralColor),In.copy(il),Ce.result===Je.FAILED&&Et.floatingCubesRatio>0&&In.copy(Is),(Ce.result===Je.COMPLETED||Ce.result===Je.REPLAY)&&(this.successColorRatio=Math.min(1,this.successColorRatio+.5*e),In.lerp(Ur,this.successColorRatio)),(Ce.result!==Je.COMPLETED||Ce.result!==Je.REPLAY)&&In.lerp(qi,De.saturate(xn.pushDownRatio+Et.pushDownRatio)),In.convertSRGBToLinear(),qi.convertSRGBToLinear(),Ur.convertSRGBToLinear();for(let n=0;na.id===n)[0],s=n0&&(a=De.saturate(.5*(1-Math.cos(14*r.errorFallAnimationTime)))),Ir.lerpColors(o,Is,a),this._instanceColorArray.set([Ir.r,Ir.g,Ir.b],n*3)}else this._instanceColorArray.set([o.r,o.g,o.b],n*3);this._instanceIsActiveArray[n]=s?1:0}const t=this._baseMesh.material.uniforms;t.u_color.value.set(k.neutralColor).convertSRGBToLinear(),t.u_blocksColor.value.copy(In),t.u_successColor.value.copy(Ur),t.u_prevSuccessColor.value.set(qi),t.u_prevSuccessColor.value.lerp(In.set(k.successColor),yt.previousSuccessBlocksAnimationRatio),t.u_prevSuccessColor.value.convertSRGBToLinear()}_updateInfoTexture(){nn.tiles.forEach(e=>{e.forEach(t=>{let n=t.id%Nt+1,s=((Math.floor(t.id/Nt)+1)*vn+n)*4,o=.5*It.floatingCubesRatio*De.fit(It.pushDownRatio,0,.1,1,0);o+=(Et.floatingCubesRatio>0?1:0)*De.fit(Et.pushDownRatio,0,.1,1,0),o+=xn.spawnRatio*De.fit(xn.pushDownRatio,0,.1,1,0),o=Math.min(1,o),this.infoTexture.image.data[s]=t.activeRatio*(1-o),this.infoTexture.image.data[s+1]=t.isOccupied||t.willBeOccupied?1:0,this.infoTexture.image.data[s+2]=t.isMain?1:0,this.infoTexture.image.data[s+3]=t.isBorder?1:0})}),this.infoTexture.needsUpdate=!0,this.infoTextureLinear.needsUpdate=!0}_updateFreeBlocks(){if(yt.lastSpawnedBlock){const e=this._blockList[yt.lastSpawnedBlock.id];e.boardPos.set(yt.lastSpawnedBlock.currentTile.row,yt.lastSpawnedBlock.currentTile.col),e.showRatio=yi(De.saturate(yt.lastSpawnedBlock.spawnAnimationRatioUnclamped))}yt.blocks.forEach(e=>{const t=this._blockList[e.id];t&&(t.showRatio=yi(De.saturate(e.spawnAnimationRatioUnclamped)),t.boardPos.set(e.currentTile.row,e.currentTile.col),e.targetTile&&t.boardDir.set(e.targetTile.row-e.currentTile.row,e.targetTile.col-e.currentTile.col),t.animation=e.hasAnimationEnded?0:e.easedAnimationRatio)})}_updateAttributes(e){for(let n=0;n=tn){const n=t-tn,r=n%Nt-jt,s=Math.floor(n/Nt)-jt,o=nn.getTile(s,r);if(!o.isOccupied){const a=De.saturate(xn.spawnRatio-o.randomDelay);o.activeRatio=a,e.showRatio=yi(a),e.boardPos.set(s,r)}}}_updateLongBlockAnimation(e,t){if(e&&e.isErrorBlock&&e.errorLifeCycle>=k.errorBlockMaxLifeCycle-1){const n=e.currentTile,r=e.errorFallAnimationTime;t.boardPos.set(n.row,n.col),St.set(n.row,n.col).normalize(),Math.abs(St.x)>Math.abs(St.y)?St.set(Math.sign(St.x),0):St.set(0,Math.sign(St.y)),t.boardDir.set(St.x,St.y),t.animation=De.fit(r*r,0,1,0,1),t.animation+=Math.max(0,r-.5),t.update(k.deltaTime),t.addsFallAnimation(Math.max(0,r-.5))}}_updateFailAnimation(e,t,n){if(Ce.result===Je.FAILED){if(e){const r=e.currentTile;if(Et.floatingCubesRatio>0){const s=Math.floor(Et.floatingCubesRatio*this.animationTotalFrames),o=Math.min(s+1,this.animationTotalFrames-1),a=Et.floatingCubesRatio*this.animationTotalFrames-s;Mi.fromArray(r.loseAnimationPositionArray,s*3),tl.fromArray(r.loseAnimationPositionArray,o*3),Mi.lerp(tl,a),Mi.y*=.5,t.pos.set(Mi.z,Mi.y,-Mi.x),Us.fromArray(r.loseAnimationOrientArray,s*4),nl.fromArray(r.loseAnimationOrientArray,o*4),Us.slerp(nl,a),t.orient.copy(Us)}if(Et.shakeRatio>0){const s=De.fit(Et.shakeRatio,0,1,0,1,Cr.sineOut);if(St.set(r.row,r.col),St.normalize(),St.multiplyScalar(.1*s),t.pos.x+=St.x,t.pos.z-=St.y,Et.shakeRatio<1){const o=s*De.fit(Et.shakeRatio,.5,.8,1,0);St.set(e.randomVector.x,e.randomVector.y),St.normalize(),St.multiplyScalar(o),Dr.set(0,0),Dr.addScaledVector(St,.08*o*Math.sin(o*80)),t.pos.x+=Dr.x,t.pos.z+=Dr.y}}}if(n>=tn){const r=n-tn,s=r%Nt-jt,o=Math.floor(r/Nt)-jt,a=nn.getTile(o,s),l=De.saturate(Et.spawnRatio-a.randomDelay);a.isOccupied||(a.activeRatio=l),t.showRatio=yi(l),t.boardPos.set(o,s)}}}_updateFloatAnimation(e,t){if((Ce.result===Je.COMPLETED||Ce.result===Je.REPLAY)&&e){const r=.1*e.currentTile.randomDelay,s=It.floatingCubesRatio-r;let o=De.fit(s,0,.5,0,1,a=>1-Math.pow(1-a,5));o=De.fit(s,.7,1,o,0,a=>Math.pow(a,5)),t.pos.y+=It.floatingCubesDisplacement*o}}update(e){this._updateFreeBlocks(),this._updateColors(e);let t=0;for(let o=0;oc.id===o)[0];a.showRatio>0&&(this._blockRenderList[t++]=a),this._updateFailAnimation(l,a,o),this._updateLongBlockAnimation(l,a),this._updateStopAnimation(a,o),this._updateFloatAnimation(l,a,o)}this._updateInfoTexture(),this._updateAttributes(t);const n=Math.min(1,xn.pushDownRatio+Et.pushDownRatio+It.pushDownRatio),r=Cr.backOut(n,3),s=1-yi(yt.firstStartAnimationRatio);this.container.position.y=-r-2*s,this.container.rotation.y=.5*Math.PI*s,this.container.rotation.y+=2*Math.PI*Cr.quartInOut(It.towerRotationRatio),this._baseMesh.material.uniforms.u_yDisplacement.value=-r-5*s,this._baseMesh.material.uniforms.u_successAnimationRatio.value=It.successColorTowerRatio,this.sharedUniforms.u_endAnimationRatio.value=Math.min(1,De.fit(xn.spawnRatio,.5,2,0,1)+De.fit(Et.spawnRatio,.5,2,0,1)+De.fit(It.ratio,0,.2,0,1)),this.sharedUniforms.u_restartAnimationRatio.value=n,this.sharedUniforms.u_goboIntensity.value=k.goboIntensity,this.sharedUniforms.u_lightPosition.value.set(k.lightPositionX,k.lightPositionY,k.lightPositionZ),this.directLight.position.copy(this.sharedUniforms.u_lightPosition.value),this.directLight.shadow.camera.top=k.lightCameraSize,this.directLight.shadow.camera.bottom=-k.lightCameraSize,this.directLight.shadow.bias=k.lightCameraBias}}const Fn=new Cm;var rl=`uniform float u_time; uniform float u_ratio; uniform float u_isFloating; @@ -4463,7 +4456,7 @@ void main () { vHighPrecisionZW = gl_Position.zw; #endif -}`,Cm=`uniform vec3 u_bgColor1; +}`,Pm=`uniform vec3 u_bgColor1; uniform vec3 u_bgColor2; uniform vec2 u_resolution; uniform vec3 u_lightPosition; @@ -4562,7 +4555,7 @@ void main () { float alpha = linearstep(-6.0, -2.0, v_worldPosition.y); gl_FragColor.rgb = mix(linearToSRGB(mix(u_bgColor1, u_bgColor2, screenUv.y)), gl_FragColor.rgb, alpha); -}`,Pm=`#include +}`,Lm=`#include #include varying vec2 vHighPrecisionZW; @@ -4570,12 +4563,12 @@ varying vec2 vHighPrecisionZW; void main() { float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; gl_FragColor = packDepthToRGBA( fragCoordZ ); -}`;class Lm{constructor(){N(this,"container",new ft);N(this,"coinMesh",null);N(this,"coinGeometry",null);N(this,"coinMaterial",null);N(this,"positionsArray",null);N(this,"orientArray",null);N(this,"curveuArray",null);N(this,"aoNArray",null);N(this,"aoPArray",null);N(this,"coinsCount",0);N(this,"animationRatio",0);N(this,"isFloating",!0);N(this,"sharedUniforms",{u_time:{value:0},u_ratio:{value:0},u_isFloating:{value:1}})}preload(){Sn.loadTexture(at.ASSETS_PATH+"textures/matcap_gold.jpg",e=>{this.matcapTexture=e,this.matcapTexture.needsUpdate=!0}),Sn.loadBuf(at.ASSETS_PATH+"models/COIN.buf",e=>{this.refGeometry=e}),Sn.loadBuf(at.ASSETS_PATH+"models/COIN_PLACEMENT.buf",e=>{const{position:t,aoN:n,aoP:r,curveu:s,orient:o}=e.attributes;this.positionsArray=t.array,this.aoNArray=n.array,this.aoPArray=r.array,this.curveuArray=s.array,this.orientArray=o.array,this.coinsCount=t.count})}init(){this._setupGeometry(),this._setupMaterial(),this._setupMesh(),this.container.add(this.coinMesh)}_setupGeometry(){this.refGeometry.computeVertexNormals();const e=new Ba;e.index=this.refGeometry.index,Object.entries(this.refGeometry.attributes).forEach(([n,r])=>e.setAttribute(n,r)),this.randsArray=new Float32Array(this.coinsCount*3).map(()=>Math.random()*2-1),[["a_instancePosition",this.positionsArray,3],["a_instanceQuaternion",this.orientArray,4],["a_instanceCurveUV",this.curveuArray,1],["a_instanceAoN",this.aoNArray,3],["a_instanceAoP",this.aoPArray,3],["a_instanceRand",this.randsArray,3]].forEach(([n,r,s])=>{e.setAttribute(n,new Vr(r,s))}),this.coinGeometry=e}_setupMaterial(){this.coinMaterial=new Tt({uniforms:{...Dn.sharedUniforms,...O.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,...Gr.merge([ae.lights]),u_matcapTexture:{value:this.matcapTexture}},vertexShader:al,fragmentShader:Cm,lights:!0})}_setupMesh(){this.coinMesh=new Nt(this.coinGeometry,this.coinMaterial),this.coinMesh.frustumCulled=!1,this.coinMesh.castShadow=!0,this.coinMesh.receiveShadow=!0,this.coinMesh.customDepthMaterial=new Tt({uniforms:{...this.sharedUniforms},vertexShader:al,fragmentShader:Pm,defines:{IS_DEPTH:!0}})}update(e){const t=Dt.vortexCoinsRatio===0;this.animationRatio=t?Dt.floatingCoinsRatio:Dt.vortexCoinsRatio,this.sharedUniforms.u_ratio.value=this.animationRatio,this.sharedUniforms.u_time.value+=e,this.sharedUniforms.u_isFloating.value=t?1:0,this.coinMesh.rotation.y=(this.isFloating?0:4)*this.animationRatio,this.coinMesh.visible=this.animationRatio>0&&this.animationRatio<1}}const Cr=new Lm;var Dm=`varying vec2 v_uv; +}`;class Dm{constructor(){B(this,"container",new _t);B(this,"coinMesh",null);B(this,"coinGeometry",null);B(this,"coinMaterial",null);B(this,"positionsArray",null);B(this,"orientArray",null);B(this,"curveuArray",null);B(this,"aoNArray",null);B(this,"aoPArray",null);B(this,"coinsCount",0);B(this,"animationRatio",0);B(this,"isFloating",!0);B(this,"sharedUniforms",{u_time:{value:0},u_ratio:{value:0},u_isFloating:{value:1}})}preload(){Tn.loadTexture(ft.ASSETS_PATH+"textures/matcap_gold.jpg",e=>{this.matcapTexture=e,this.matcapTexture.needsUpdate=!0}),Tn.loadBuf(ft.ASSETS_PATH+"models/COIN.buf",e=>{this.refGeometry=e}),Tn.loadBuf(ft.ASSETS_PATH+"models/COIN_PLACEMENT.buf",e=>{const{position:t,aoN:n,aoP:r,curveu:s,orient:o}=e.attributes;this.positionsArray=t.array,this.aoNArray=n.array,this.aoPArray=r.array,this.curveuArray=s.array,this.orientArray=o.array,this.coinsCount=t.count})}init(){this._setupGeometry(),this._setupMaterial(),this._setupMesh(),this.container.add(this.coinMesh)}_setupGeometry(){this.refGeometry.computeVertexNormals();const e=new Na;e.index=this.refGeometry.index,Object.entries(this.refGeometry.attributes).forEach(([n,r])=>e.setAttribute(n,r)),this.randsArray=new Float32Array(this.coinsCount*3).map(()=>Math.random()*2-1),[["a_instancePosition",this.positionsArray,3],["a_instanceQuaternion",this.orientArray,4],["a_instanceCurveUV",this.curveuArray,1],["a_instanceAoN",this.aoNArray,3],["a_instanceAoP",this.aoPArray,3],["a_instanceRand",this.randsArray,3]].forEach(([n,r,s])=>{e.setAttribute(n,new Yr(r,s))}),this.coinGeometry=e}_setupMaterial(){this.coinMaterial=new Rt({uniforms:{...Fn.sharedUniforms,...k.sharedUniforms,...this.sharedUniforms,...Fi.sharedUniforms,...Xr.merge([se.lights]),u_matcapTexture:{value:this.matcapTexture}},vertexShader:rl,fragmentShader:Pm,lights:!0})}_setupMesh(){this.coinMesh=new Ft(this.coinGeometry,this.coinMaterial),this.coinMesh.frustumCulled=!1,this.coinMesh.castShadow=!0,this.coinMesh.receiveShadow=!0,this.coinMesh.customDepthMaterial=new Rt({uniforms:{...this.sharedUniforms},vertexShader:rl,fragmentShader:Lm,defines:{IS_DEPTH:!0}})}update(e){const t=It.vortexCoinsRatio===0;this.animationRatio=t?It.floatingCoinsRatio:It.vortexCoinsRatio,this.sharedUniforms.u_ratio.value=this.animationRatio,this.sharedUniforms.u_time.value+=e,this.sharedUniforms.u_isFloating.value=t?1:0,this.coinMesh.rotation.y=(this.isFloating?0:4)*this.animationRatio,this.coinMesh.visible=this.animationRatio>0&&this.animationRatio<1}}const Nr=new Dm;var Um=`varying vec2 v_uv; void main() { gl_Position = vec4(position.xy, 1.0, 1.0); v_uv = uv; -}`,Um=`uniform vec2 u_resolution; +}`,Im=`uniform vec2 u_resolution; uniform vec3 u_bgColor1; uniform vec3 u_bgColor2; @@ -4590,7 +4583,7 @@ vec3 linearToSRGB(vec3 color) { void main() { vec3 color = mix(u_bgColor1, u_bgColor2, v_uv.y); gl_FragColor = vec4(linearToSRGB(color) + getBlueNoise(gl_FragCoord.xy) * .004, 1.0); -}`,Im=`attribute vec3 a_instancePosition; +}`,Nm=`attribute vec3 a_instancePosition; attribute vec3 a_instanceRandom; varying vec2 v_uv; @@ -4726,7 +4719,7 @@ void main() { v_uv = uv; v_opacity = sin(PI * ratio); -}`,Nm=`varying vec2 v_uv; +}`,Fm=`varying vec2 v_uv; varying float v_opacity; uniform vec3 u_color; uniform float u_opacity; @@ -4736,4 +4729,4 @@ void main() { float alpha = 1.0 - dist; gl_FragColor = vec4(u_color, u_opacity * alpha * v_opacity); -}`;class Fm{constructor(){N(this,"container",new ft)}init(){const e=new Tt({uniforms:Object.assign({u_resolution:O.sharedUniforms.u_resolution,u_bgColor1:O.sharedUniforms.u_bgColor1,u_bgColor2:O.sharedUniforms.u_bgColor2},Pi.sharedUniforms),vertexShader:Dm,fragmentShader:Um});this.mesh=new Nt(new Ci(2,2),e),this.mesh.renderOrder=1,this.container.add(this.mesh),this.initParticles()}initParticles(){const t=new Ci(1,1),n=new Ba;n.index=t.index,Object.keys(t.attributes).forEach(a=>{n.setAttribute(a,t.attributes[a])}),n.instanceCount=50;const r=new Float32Array(50*3),s=new Float32Array(50*3);for(let a=0;a<50;a++)r[a*3]=3*(Math.random()*2-1),r[a*3+1]=1*(Math.random()*2-1),r[a*3+2]=.5+.5*Math.random(),s[a*3]=Math.random(),s[a*3+1]=Math.random(),s[a*3+2]=Math.random();n.setAttribute("a_instancePosition",new Vr(r,3)),n.setAttribute("a_instanceRandom",new Vr(s,3));const o=new Tt({vertexShader:Im,fragmentShader:Nm,uniforms:{u_time:O.sharedUniforms.u_time,u_resolution:O.sharedUniforms.u_resolution,u_size:{value:.01},u_color:{value:new we},u_opacity:{value:0}},transparent:!0});this.particles=new Nt(n,o),this.particles.renderOrder=2,this.particles.frustumCulled=!1,this.container.add(this.particles)}resize(){}update(e){this.particles.material.uniforms.u_size.value=O.particlesSize,this.particles.material.uniforms.u_color.value.set(O.particlesColor),this.particles.material.uniforms.u_opacity.value=O.particlesOpacity}}const Fs=new Fm;Ze.enabled=!1;class Om{preload(e,t){at.override(e),at.WEBGL_OPTS.canvas=O.canvas=e.canvas,O.orbitTarget=e.orbitTarget,Dn.preload(),Cr.preload(),Pi.preInit(),O.renderer=new Zp(at.WEBGL_OPTS),Sn.start(t)}init(){O.renderer.shadowMap.enabled=!0,O.renderer.shadowMap.type=Ta,O.scene=new Kp,O.camera=new Na(-1,1,1,-1,1,60),O.scene.add(O.camera),O.camera.position.fromArray(at.DEFAULT_POSITION),O.orbitCamera=O.camera.clone();let e=O.orbitControls=new mm(O.orbitCamera,O.orbitTarget);e.enableDamping=!0,e.target0.fromArray(at.DEFAULT_LOOKAT_POSITION),e.reset(),Mt.init(),Dn.init(),Cr.init(),Fs.init(),O.scene.add(Dn.container),O.scene.add(Cr.container),O.scene.add(Fs.container)}setSize(e,t){O.viewportWidth=e,O.viewportHeight=t,O.viewportResolution.set(e,window.innerHeight);let n=e*at.DPR,r=t*at.DPR;if(at.USE_PIXEL_LIMIT===!0&&n*r>at.MAX_PIXEL_COUNT){let s=n/r;r=Math.sqrt(at.MAX_PIXEL_COUNT/s),n=Math.ceil(r*s),r=Math.ceil(r)}O.width=n,O.height=r,O.resolution.set(n,r),O.camera.aspect=n/r,O.camera.updateProjectionMatrix(),O.renderer.setSize(n,r),O.canvas.style.width=`${e}px`,O.canvas.style.height=`${t}px`}render(e){O.isPaused&&(e*=0),O.time+=e,O.deltaTime=e,O.sharedUniforms.u_time.value=O.time,O.sharedUniforms.u_deltaTime.value=e;let t=O.sharedUniforms.u_bgColor1.value,n=O.sharedUniforms.u_bgColor2.value;t.set(O.bgColor1).convertSRGBToLinear(),n.set(O.bgColor2).convertSRGBToLinear();let r=O.viewportWidth,s=O.viewportHeight,o=O.cameraZoom*s/10,a=O.cameraOffsetX,l=O.cameraOffsetY;O.camera.zoom=o,O.camera.left=-r/2-a*r/o/2,O.camera.right=r/2-a*r/o/2,O.camera.top=s/2-l*s/o/2,O.camera.bottom=-s/2-l*s/o/2,O.camera.updateProjectionMatrix(),Pi.update(e),Mt.update(e);let c=O.camera;O.orbitControls.update(),O.orbitCamera.updateMatrix(),O.orbitCamera.matrix.decompose(c.position,c.quaternion,c.scale),c.matrix.compose(c.position,c.quaternion,c.scale),Dn.update(e),Cr.update(e),Fs.update(e),O.renderer.setClearColor(O.bgColor,1),O.renderer.render(O.scene,O.camera)}}let Di=new Om;Di.properties=O;Di.stateManager=Le;Di.STATUS=Le.STATUS;Di.RESULT=Le.RESULT;Di.setState=i=>{Le.set(i)};window[at.APP_ID]=Di; +}`;class Om{constructor(){B(this,"container",new _t)}init(){const e=new Rt({uniforms:Object.assign({u_resolution:k.sharedUniforms.u_resolution,u_bgColor1:k.sharedUniforms.u_bgColor1,u_bgColor2:k.sharedUniforms.u_bgColor2},Fi.sharedUniforms),vertexShader:Um,fragmentShader:Im});this.mesh=new Ft(new Ni(2,2),e),this.mesh.renderOrder=1,this.container.add(this.mesh),this.initParticles()}initParticles(){const t=new Ni(1,1),n=new Na;n.index=t.index,Object.keys(t.attributes).forEach(a=>{n.setAttribute(a,t.attributes[a])}),n.instanceCount=50;const r=new Float32Array(50*3),s=new Float32Array(50*3);for(let a=0;a<50;a++)r[a*3]=3*(Math.random()*2-1),r[a*3+1]=1*(Math.random()*2-1),r[a*3+2]=.5+.5*Math.random(),s[a*3]=Math.random(),s[a*3+1]=Math.random(),s[a*3+2]=Math.random();n.setAttribute("a_instancePosition",new Yr(r,3)),n.setAttribute("a_instanceRandom",new Yr(s,3));const o=new Rt({vertexShader:Nm,fragmentShader:Fm,uniforms:{u_time:k.sharedUniforms.u_time,u_resolution:k.sharedUniforms.u_resolution,u_size:{value:.01},u_color:{value:new Pe},u_opacity:{value:0}},transparent:!0});this.particles=new Ft(n,o),this.particles.renderOrder=2,this.particles.frustumCulled=!1,this.container.add(this.particles)}resize(){}update(e){this.particles.material.uniforms.u_size.value=k.particlesSize,this.particles.material.uniforms.u_color.value.set(k.particlesColor),this.particles.material.uniforms.u_opacity.value=k.particlesOpacity}}const Ns=new Om;qe.enabled=!1;class Bm{preload(e,t){ft.override(e),ft.WEBGL_OPTS.canvas=k.canvas=e.canvas,k.orbitTarget=e.orbitTarget,Fn.preload(),Nr.preload(),Fi.preInit(),k.renderer=new sm(ft.WEBGL_OPTS),Tn.start(t)}init(){k.renderer.shadowMap.enabled=!0,k.renderer.shadowMap.type=ya,k.scene=new su,k.camera=new Ia(-1,1,1,-1,1,60),k.scene.add(k.camera),k.camera.position.fromArray(ft.DEFAULT_POSITION),k.orbitCamera=k.camera.clone();let e=k.orbitControls=new pm(k.orbitCamera,k.orbitTarget);e.enableDamping=!0,e.target0.fromArray(ft.DEFAULT_LOOKAT_POSITION),e.reset(),yt.init(),Fn.init(),Nr.init(),Ns.init(),k.scene.add(Fn.container),k.scene.add(Nr.container),k.scene.add(Ns.container)}setSize(e,t){k.viewportWidth=e,k.viewportHeight=t,k.viewportResolution.set(e,window.innerHeight);let n=e*ft.DPR,r=t*ft.DPR;if(ft.USE_PIXEL_LIMIT===!0&&n*r>ft.MAX_PIXEL_COUNT){let s=n/r;r=Math.sqrt(ft.MAX_PIXEL_COUNT/s),n=Math.ceil(r*s),r=Math.ceil(r)}k.width=n,k.height=r,k.resolution.set(n,r),k.camera.aspect=n/r,k.camera.updateProjectionMatrix(),k.renderer.setSize(n,r),k.canvas.style.width=`${e}px`,k.canvas.style.height=`${t}px`}render(e){k.isPaused&&(e*=0),e=Math.min(e,1/15),k.time+=e,k.deltaTime=e,k.sharedUniforms.u_time.value=k.time,k.sharedUniforms.u_deltaTime.value=e;let t=k.sharedUniforms.u_bgColor1.value,n=k.sharedUniforms.u_bgColor2.value;t.set(k.bgColor1).convertSRGBToLinear(),n.set(k.bgColor2).convertSRGBToLinear();let r=k.viewportWidth,s=k.viewportHeight,o=k.cameraZoom*s/10,a=k.cameraOffsetX,l=k.cameraOffsetY;k.camera.zoom=o,k.camera.left=-r/2-a*r/o/2,k.camera.right=r/2-a*r/o/2,k.camera.top=s/2-l*s/o/2,k.camera.bottom=-s/2-l*s/o/2,k.camera.updateProjectionMatrix(),Fi.update(e),yt.update(e);let c=k.camera;k.orbitControls.update(),k.orbitCamera.updateMatrix(),k.orbitCamera.matrix.decompose(c.position,c.quaternion,c.scale),c.matrix.compose(c.position,c.quaternion,c.scale),Fn.update(e),Nr.update(e),Ns.update(e),k.renderer.setClearColor(k.bgColor,1),k.renderer.render(k.scene,k.camera)}}let Bi=new Bm;Bi.properties=k;Bi.stateManager=Ce;Bi.STATUS=Ce.STATUS;Bi.RESULT=Ce.RESULT;Bi.setState=(i,e=!1)=>{Ce.set(i,e)};window[ft.APP_ID]=Bi; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index f9581b452..055c021e0 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "arbitrary" @@ -186,9 +186,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-broadcast" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" dependencies = [ "event-listener", "event-listener-strategy", @@ -307,7 +307,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -347,7 +347,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -358,13 +358,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -377,7 +377,7 @@ dependencies = [ "chrono", "crc32fast", "futures-lite", - "pin-project 1.1.7", + "pin-project 1.1.8", "thiserror 1.0.69", "tokio", "tokio-util 0.7.13", @@ -566,9 +566,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" dependencies = [ "serde", ] @@ -657,7 +657,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -716,9 +716,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" [[package]] name = "byteorder" @@ -774,7 +774,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cairo-sys-rs", "glib", "libc", @@ -813,16 +813,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +checksum = "8769706aad5d996120af43197bf46ef6ad0fda35216b4505f926a365a232d924" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.10", ] [[package]] @@ -837,9 +837,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.3" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "jobserver", "libc", @@ -984,9 +984,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" dependencies = [ "clap_builder", "clap_derive", @@ -994,9 +994,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" dependencies = [ "anstream", "anstyle", @@ -1006,23 +1006,23 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.38" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9647a559c112175f17cf724dc72d3645680a883c58481332779192b0d8e7a01" +checksum = "33a7e468e750fa4b6be660e8b5651ad47372e8fb114030b594c2d75d48c5ffd0" dependencies = [ - "clap 4.5.23", + "clap 4.5.26", ] [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1033,11 +1033,11 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clap_mangen" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" +checksum = "acbfe6ac42a2438d0968beba18e3c35cacf16b0c25310bc22b1f5f3cffff09f4" dependencies = [ - "clap 4.5.23", + "clap 4.5.26", "roff", ] @@ -1047,7 +1047,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f79398230a6e2c08f5c9760610eb6924b52aa9e7950a619602baba59dcbbdbb2" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block", "cocoa-foundation", "core-foundation 0.10.0", @@ -1063,7 +1063,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14045fb83be07b5acf1c0884b2180461635b433455fa35d1cd6f17f1450679d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block", "core-foundation 0.10.0", "core-graphics-types", @@ -1168,7 +1168,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation 0.10.0", "core-graphics-types", "foreign-types 0.5.0", @@ -1181,7 +1181,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation 0.10.0", "libc", ] @@ -1269,18 +1269,18 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1354,7 +1354,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1364,7 +1364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1402,7 +1402,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1426,7 +1426,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1437,7 +1437,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1510,7 +1510,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1523,7 +1523,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1575,7 +1575,7 @@ dependencies = [ "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1595,7 +1595,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1685,7 +1685,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1708,7 +1708,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1737,7 +1737,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1862,7 +1862,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1883,7 +1883,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1914,9 +1914,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.3.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -2069,7 +2069,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2194,7 +2194,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2441,7 +2441,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "futures-channel", "futures-core", "futures-executor", @@ -2469,7 +2469,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2484,9 +2484,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "gobject-sys" @@ -2570,7 +2570,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2686,7 +2686,7 @@ checksum = "8270a1857fb962b9914aafd46a89a187a4e63d0eb4190c327e7c7b8256a2d055" dependencies = [ "async-recursion", "async-trait", - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "data-encoding", "enum-as-inner", @@ -2742,11 +2742,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2839,9 +2839,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes 1.9.0", "futures-channel", @@ -2860,9 +2860,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http", @@ -3072,7 +3072,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3150,7 +3150,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3416,7 +3416,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "serde", "unicode-segmentation", ] @@ -3431,7 +3431,7 @@ dependencies = [ "linux-keyutils", "log", "security-framework 2.11.1", - "security-framework 3.0.1", + "security-framework 3.2.0", "windows-sys 0.59.0", ] @@ -3480,9 +3480,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.168" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "liblmdb-sys" @@ -3526,7 +3526,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "libc", "redox_syscall", ] @@ -3554,15 +3554,15 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "761e49ec5fd8a5a463f9b84e877c373d888935b71c6be78f3767fe2ae6bed18e" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "libc", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "litemap" @@ -3816,7 +3816,7 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c4d14bcca0fd3ed165a03000480aaa364c6860c34e900cb2dafdf3b95340e77" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "debugid", "num-derive", "num-traits", @@ -3831,7 +3831,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abcd9c8a1e6e1e9d56ce3627851f39a17ea83e17c96bc510f29d7e43d78a7d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "byteorder", "cfg-if", "crash-context", @@ -3893,9 +3893,9 @@ checksum = "6367d84fb54d4242af283086402907277715b8fe46976963af5ebf173f8efba3" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", "simd-adler32", @@ -4097,7 +4097,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "jni-sys", "log", "ndk-sys", @@ -4148,7 +4148,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "cfg_aliases 0.1.1", "libc", @@ -4160,7 +4160,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "cfg_aliases 0.2.1", "libc", @@ -4222,7 +4222,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4271,7 +4271,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4280,7 +4280,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c9bff0aa1d48904a1385ea2a8b97576fbdcbc9a3cfccd0d31fe978e1c4038c5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "libloading 0.8.6", "nvml-wrapper-sys", "static_assertions", @@ -4331,7 +4331,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "libc", "objc2", @@ -4347,7 +4347,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-core-location", @@ -4371,7 +4371,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-foundation", @@ -4413,7 +4413,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "libc", "objc2", @@ -4437,7 +4437,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-foundation", @@ -4449,7 +4449,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-foundation", @@ -4472,7 +4472,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-cloud-kit", @@ -4504,7 +4504,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-core-location", @@ -4517,7 +4517,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68bc69301064cebefc6c4c90ce9cba69225239e4b8ff99d445a2b5563797da65" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "block2", "objc2", "objc2-app-kit", @@ -4526,9 +4526,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.5" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -4551,10 +4551,11 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "open" -version = "5.3.1" +version = "5.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" dependencies = [ + "dunce", "is-wsl", "libc", "pathdiff", @@ -4566,7 +4567,7 @@ version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -4583,7 +4584,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4641,9 +4642,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.9.0" +version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ca711d8b83edbb00b44d504503cd247c9c0bd8b0fa2694f2a1a3d8165379ce" +checksum = "6e6520c8cc998c5741ee68ec1dc369fc47e5f0ea5320018ecf2a1ccd6328f48b" dependencies = [ "log", "serde", @@ -4842,12 +4843,12 @@ dependencies = [ [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ - "phf_macros 0.11.2", - "phf_shared 0.11.2", + "phf_macros 0.11.3", + "phf_shared 0.11.3", ] [[package]] @@ -4892,11 +4893,11 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ - "phf_shared 0.11.2", + "phf_shared 0.11.3", "rand 0.8.5", ] @@ -4916,15 +4917,15 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", + "phf_generator 0.11.3", + "phf_shared 0.11.3", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4933,7 +4934,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -4942,16 +4943,16 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] @@ -4960,7 +4961,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dfa808155f59afafc457bd1a3835cb35d827f4387238099faa673447a656bfb" dependencies = [ - "clap 4.5.23", + "clap 4.5.26", "clap_complete", "clap_mangen", "include-lines", @@ -4979,11 +4980,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" dependencies = [ - "pin-project-internal 1.1.7", + "pin-project-internal 1.1.8", ] [[package]] @@ -4999,20 +5000,20 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -5068,9 +5069,9 @@ dependencies = [ [[package]] name = "png" -version = "0.17.15" +version = "0.17.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -5156,12 +5157,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "483f8c21f64f3ea09fe0f30f5d48c3e8eefe5dac9129f0075f76593b4c1da705" dependencies = [ "proc-macro2", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5258,7 +5259,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "hex", ] @@ -5316,11 +5317,11 @@ dependencies = [ "multimap 0.10.0", "once_cell", "petgraph", - "prettyplease 0.2.25", + "prettyplease 0.2.27", "prost 0.13.4", "prost-types 0.13.4", "regex", - "syn 2.0.90", + "syn 2.0.96", "tempfile", ] @@ -5347,7 +5348,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5396,7 +5397,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.6", + "thiserror 2.0.10", "tokio", "tracing", ] @@ -5415,7 +5416,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.6", + "thiserror 2.0.10", "tinyvec", "tracing", "web-time", @@ -5423,9 +5424,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" dependencies = [ "cfg_aliases 0.2.1", "libc", @@ -5437,9 +5438,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -5628,7 +5629,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", ] [[package]] @@ -5673,9 +5674,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes 1.9.0", @@ -5713,6 +5714,7 @@ dependencies = [ "tokio-native-tls", "tokio-rustls", "tokio-util 0.7.13", + "tower 0.5.2", "tower-service", "url", "wasm-bindgen", @@ -5802,11 +5804,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "errno", "libc", "linux-raw-sys", @@ -5815,9 +5817,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.20" +version = "0.23.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" +checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" dependencies = [ "log", "once_cell", @@ -5839,9 +5841,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time", ] @@ -5859,9 +5861,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -5930,7 +5932,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5956,7 +5958,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5968,7 +5970,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5990,7 +5992,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -5999,11 +6001,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.0.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation 0.10.0", "core-foundation-sys", "libc", @@ -6012,9 +6014,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -6136,7 +6138,7 @@ checksum = "b3b211916a3aed3398125b02b98a5cd4fc530c5626dd28a3c86865fe6cd93935" dependencies = [ "minidumper-child", "sentry", - "thiserror 2.0.6", + "thiserror 2.0.10", ] [[package]] @@ -6170,9 +6172,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] @@ -6210,13 +6212,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6227,14 +6229,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa 1.0.14", "memchr", @@ -6250,7 +6252,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6276,9 +6278,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", @@ -6294,14 +6296,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6439,6 +6441,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -6462,7 +6470,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6717,9 +6725,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -6755,7 +6763,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6787,7 +6795,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -6817,11 +6825,11 @@ dependencies = [ [[package]] name = "tao" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b53216f32e60efc27dfa111268481e4dfba53e553e4cdebcaed9db36c11bb" +checksum = "3731d04d4ac210cd5f344087733943b9bfb1a32654387dad4d1c70de21aee2c9" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cocoa", "core-foundation 0.10.0", "core-graphics", @@ -6861,7 +6869,7 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -6955,7 +6963,7 @@ dependencies = [ "tari_shutdown", "tari_utilities", "tauri", - "tauri-build 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-build", "tauri-plugin-cli", "tauri-plugin-os", "tauri-plugin-process", @@ -6963,7 +6971,7 @@ dependencies = [ "tauri-plugin-shell", "tauri-plugin-single-instance", "tauri-plugin-updater", - "thiserror 1.0.69", + "thiserror 2.0.10", "tokio", "tokio-util 0.7.13", "winreg 0.52.0", @@ -7036,7 +7044,7 @@ version = "1.9.1-rc.1" source = "git+https://github.com/tari-project/tari.git?tag=v1.9.1-rc.1#65a61008a5f7c05c34453535894b9a24132d2665" dependencies = [ "base64 0.21.7", - "bitflags 2.6.0", + "bitflags 2.7.0", "blake2", "borsh", "bs58 0.5.1", @@ -7063,7 +7071,7 @@ source = "git+https://github.com/tari-project/tari.git?tag=v1.9.1-rc.1#65a61008a dependencies = [ "anyhow", "async-trait", - "bitflags 2.6.0", + "bitflags 2.7.0", "blake2", "bytes 1.9.0", "chrono", @@ -7078,7 +7086,7 @@ dependencies = [ "multiaddr", "nom", "once_cell", - "pin-project 1.1.7", + "pin-project 1.1.8", "prost 0.13.4", "rand 0.8.5", "serde", @@ -7106,7 +7114,7 @@ version = "1.9.1-rc.1" source = "git+https://github.com/tari-project/tari.git?tag=v1.9.1-rc.1#65a61008a5f7c05c34453535894b9a24132d2665" dependencies = [ "anyhow", - "bitflags 2.6.0", + "bitflags 2.7.0", "blake2", "chacha20 0.7.3", "chacha20poly1305", @@ -7153,7 +7161,7 @@ dependencies = [ "anyhow", "async-trait", "bincode", - "bitflags 2.6.0", + "bitflags 2.7.0", "blake2", "borsh", "bytes 0.5.6", @@ -7431,8 +7439,9 @@ dependencies = [ [[package]] name = "tauri" -version = "2.1.1" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e2e3349fbb2be7af9fad1b43d61ac83ba55ab48d47fbe1b2732f0c8211610a9" dependencies = [ "anyhow", "bytes 1.9.0", @@ -7463,12 +7472,12 @@ dependencies = [ "serde_repr", "serialize-to-javascript", "swift-rs", - "tauri-build 2.0.3 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", + "tauri-build", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", - "thiserror 2.0.6", + "tauri-utils", + "thiserror 2.0.10", "tokio", "tray-icon", "url", @@ -7482,31 +7491,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd2a4bcfaf5fb9f4be72520eefcb61ae565038f8ccba2a497d8c28f463b8c01" -dependencies = [ - "anyhow", - "cargo_toml", - "dirs 5.0.1", - "glob", - "heck 0.5.0", - "json-patch", - "schemars", - "semver", - "serde", - "serde_json", - "tauri-codegen 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tauri-winres", - "toml 0.8.19", - "walkdir", -] - -[[package]] -name = "tauri-build" -version = "2.0.3" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +checksum = "b274ec7239ada504deb615f1c8abd7ba99631e879709e6f10e5d17217058d976" dependencies = [ "anyhow", "cargo_toml", @@ -7518,7 +7505,8 @@ dependencies = [ "semver", "serde", "serde_json", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", + "tauri-codegen", + "tauri-utils", "tauri-winres", "toml 0.8.19", "walkdir", @@ -7526,34 +7514,9 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf79faeecf301d3e969b1fae977039edb77a4c1f25cc0a961be298b54bff97cf" -dependencies = [ - "base64 0.22.1", - "ico", - "json-patch", - "plist", - "png", - "proc-macro2", - "quote", - "semver", - "serde", - "serde_json", - "sha2", - "syn 2.0.90", - "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 2.0.6", - "time", - "url", - "uuid", - "walkdir", -] - -[[package]] -name = "tauri-codegen" -version = "2.0.3" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +checksum = "f77894f9ddb5cb6c04fcfe8c8869ebe0aded4dabf19917118d48be4a95599ab5" dependencies = [ "base64 0.22.1", "brotli", @@ -7567,9 +7530,9 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.90", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", - "thiserror 2.0.6", + "syn 2.0.96", + "tauri-utils", + "thiserror 2.0.10", "time", "url", "uuid", @@ -7578,22 +7541,23 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.3" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3240a5caed760a532e8f687be6f05b2c7d11a1d791fb53ccc08cfeb3e5308736" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", - "tauri-codegen 2.0.3 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", + "syn 2.0.96", + "tauri-codegen", + "tauri-utils", ] [[package]] name = "tauri-plugin" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e753f2a30933a9bbf0a202fa47d7cc4a3401f06e8d6dcc53b79aa62954828c79" +checksum = "5841b9a0200e954ef7457f8d327091424328891e267a97b641dc246cc54d0dec" dependencies = [ "anyhow", "glob", @@ -7601,7 +7565,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-utils", "toml 0.8.19", "walkdir", ] @@ -7609,21 +7573,23 @@ dependencies = [ [[package]] name = "tauri-plugin-cli" version = "2.2.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5458ae16eac81bdbe8d9da2a9f3e01e8cdedbc381cc1727c01127542c8a61c5" dependencies = [ - "clap 4.5.23", + "clap 4.5.26", "log", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror 2.0.6", + "thiserror 2.0.10", ] [[package]] name = "tauri-plugin-os" version = "2.2.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dda2d571a9baf0664c1f2088db227e3072f9028602fafa885deade7547c3b738" dependencies = [ "gethostname", "log", @@ -7634,13 +7600,14 @@ dependencies = [ "sys-locale", "tauri", "tauri-plugin", - "thiserror 2.0.6", + "thiserror 2.0.10", ] [[package]] name = "tauri-plugin-process" version = "2.2.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40cc553ab29581c8c43dfa5fb0c9d5aee8ba962ad3b42908eea26c79610441b7" dependencies = [ "tauri", "tauri-plugin", @@ -7648,8 +7615,9 @@ dependencies = [ [[package]] name = "tauri-plugin-sentry" -version = "0.3.0" -source = "git+https://github.com/tari-project/sentry-tauri?rev=7554b9a8738d6442d175aa2add55ecc11c52842d#7554b9a8738d6442d175aa2add55ecc11c52842d" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b3b2c8b1f9f445d03ce7f5ce99687cb5b277b58501deca6704a2b0ce891088" dependencies = [ "base64 0.22.1", "schemars", @@ -7658,13 +7626,14 @@ dependencies = [ "serde", "tauri", "tauri-plugin", - "thiserror 2.0.6", + "thiserror 2.0.10", ] [[package]] name = "tauri-plugin-shell" version = "2.2.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2c50a63e60fb8925956cc5b7569f4b750ac197a4d39f13b8dd46ea8e2bad79" dependencies = [ "encoding_rs", "log", @@ -7677,19 +7646,20 @@ dependencies = [ "shared_child", "tauri", "tauri-plugin", - "thiserror 2.0.6", + "thiserror 2.0.10", "tokio", ] [[package]] name = "tauri-plugin-single-instance" version = "2.2.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f36019ee9832dc99e4450bb55a21cfad8633b19c2c18bd17c7741939b070ede" dependencies = [ "serde", "serde_json", "tauri", - "thiserror 2.0.6", + "thiserror 2.0.10", "tracing", "windows-sys 0.59.0", "zbus", @@ -7697,8 +7667,9 @@ dependencies = [ [[package]] name = "tauri-plugin-updater" -version = "2.3.0" -source = "git+https://github.com/tari-project/tauri-plugins-workspace?rev=09f29b0abe2cb1eb81365b65a3aa3f73325e4e17#09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2d39224390c41ba544f02b4f1721f42256320b3fb8c371e9425cbddeb4a68c" dependencies = [ "base64 0.22.1", "dirs 5.0.1", @@ -7716,7 +7687,7 @@ dependencies = [ "tauri", "tauri-plugin", "tempfile", - "thiserror 2.0.6", + "thiserror 2.0.10", "time", "tokio", "url", @@ -7726,8 +7697,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.2.0" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2274ef891ccc0a8d318deffa9d70053f947664d12d58b9c0d1ae5e89237e01f7" dependencies = [ "dpi", "gtk", @@ -7736,16 +7708,17 @@ dependencies = [ "raw-window-handle", "serde", "serde_json", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", - "thiserror 2.0.6", + "tauri-utils", + "thiserror 2.0.10", "url", "windows 0.58.0", ] [[package]] name = "tauri-runtime-wry" -version = "2.2.0" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3707b40711d3b9f6519150869e358ffbde7c57567fb9b5a8b51150606939b2a0" dependencies = [ "gtk", "http", @@ -7759,7 +7732,7 @@ dependencies = [ "softbuffer", "tao", "tauri-runtime", - "tauri-utils 2.1.0 (git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25)", + "tauri-utils", "url", "webkit2gtk", "webview2-com", @@ -7769,47 +7742,9 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9271a88f99b4adea0dc71d0baca4505475a0bbd139fb135f62958721aaa8fe54" -dependencies = [ - "aes-gcm", - "cargo_metadata", - "ctor", - "dunce", - "getrandom 0.2.15", - "glob", - "html5ever", - "http", - "infer", - "json-patch", - "kuchikiki", - "log", - "memchr", - "phf 0.11.2", - "proc-macro2", - "quote", - "regex", - "schemars", - "semver", - "serde", - "serde-untagged", - "serde_json", - "serde_with", - "serialize-to-javascript", - "swift-rs", - "thiserror 2.0.6", - "toml 0.8.19", - "url", - "urlpattern", - "uuid", - "walkdir", -] - -[[package]] -name = "tauri-utils" -version = "2.1.0" -source = "git+https://github.com/tari-project/tauri.git?rev=67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25#67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25" +checksum = "96fb10e7cc97456b2d5b9c03e335b5de5da982039a303a20d10006885e4523a0" dependencies = [ "aes-gcm", "brotli", @@ -7825,7 +7760,7 @@ dependencies = [ "kuchikiki", "log", "memchr", - "phf 0.11.2", + "phf 0.11.3", "proc-macro2", "quote", "regex", @@ -7837,7 +7772,7 @@ dependencies = [ "serde_with", "serialize-to-javascript", "swift-rs", - "thiserror 2.0.6", + "thiserror 2.0.10", "toml 0.8.19", "url", "urlpattern", @@ -7857,12 +7792,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom 0.2.15", "once_cell", "rustix", "windows-sys 0.59.0", @@ -7905,11 +7841,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "a3ac7f54ca534db81081ef1c1e7f6ea8a3ef428d2fc069097c079443d24124d3" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.10", ] [[package]] @@ -7920,18 +7856,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "9e9465d30713b56a37ede7185763c3492a91be2f5fa68d958c44e41ab9248beb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -8016,9 +7952,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -8031,9 +7967,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes 1.9.0", @@ -8049,13 +7985,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -8195,7 +8131,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow 0.6.22", ] [[package]] @@ -8217,7 +8153,7 @@ dependencies = [ "hyper-timeout", "hyper-util", "percent-encoding", - "pin-project 1.1.7", + "pin-project 1.1.8", "prost 0.13.4", "rustls-pemfile", "socket2", @@ -8236,12 +8172,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11" dependencies = [ - "prettyplease 0.2.25", + "prettyplease 0.2.27", "proc-macro2", "prost-build 0.13.4", "prost-types 0.13.4", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -8254,7 +8190,7 @@ dependencies = [ "futures-util", "hdrhistogram", "indexmap 1.9.3", - "pin-project 1.1.7", + "pin-project 1.1.8", "pin-project-lite", "rand 0.8.5", "slab", @@ -8275,6 +8211,7 @@ dependencies = [ "futures-util", "pin-project-lite", "sync_wrapper", + "tokio", "tower-layer", "tower-service", ] @@ -8311,7 +8248,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -8465,15 +8402,15 @@ dependencies = [ [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" @@ -8608,9 +8545,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "b913a3b5fe84142e269d63cc62b64319ccaf89b748fc31fe025177f767a756c4" dependencies = [ "getrandom 0.2.15", "serde", @@ -8732,7 +8669,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "wasm-bindgen-shared", ] @@ -8767,7 +8704,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -8866,9 +8803,9 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61ff3d9d0ee4efcb461b14eb3acfda2702d10dc329f339303fc3e57215ae2c" +checksum = "823e7ebcfaea51e78f72c87fc3b65a1e602c321f407a0b36dbb327d7bb7cd921" dependencies = [ "webview2-com-macros", "webview2-com-sys", @@ -8886,14 +8823,14 @@ checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "webview2-com-sys" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a3e2eeb58f82361c93f9777014668eb3d07e7d174ee4c819575a9208011886" +checksum = "7a82bce72db6e5ee83c68b5de1e2cd6ea195b9fbff91cb37df5884cbe3222df4" dependencies = [ "thiserror 1.0.69", "windows 0.58.0", @@ -9044,7 +8981,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9055,7 +8992,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9066,7 +9003,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9077,7 +9014,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9194,20 +9131,36 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows-version" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6998aa457c9ba8ff2fb9f13e9d2a930dabcea28f1d0ab94d687d8b3654844515" +checksum = "c12476c23a74725c539b24eae8bfc0dac4029c39cdb561d9f23616accd4ae26d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.53.0", ] [[package]] @@ -9228,6 +9181,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -9246,6 +9205,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -9264,12 +9229,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -9288,6 +9265,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -9306,6 +9289,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -9324,6 +9313,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -9342,6 +9337,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" version = "0.5.40" @@ -9353,9 +9354,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" dependencies = [ "memchr", ] @@ -9398,7 +9399,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9415,9 +9416,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "wry" -version = "0.47.2" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ce51277d65170f6379d8cda935c80e3c2d1f0ff712a123c8bddb11b31a4b73" +checksum = "1e644bf458e27b11b0ecafc9e5633d1304fdae82baca1d42185669752fe6ca4f" dependencies = [ "base64 0.22.1", "block2", @@ -9445,7 +9446,7 @@ dependencies = [ "sha2", "soup3", "tao-macros", - "thiserror 1.0.69", + "thiserror 2.0.10", "url", "webkit2gtk", "webkit2gtk-sys", @@ -9488,9 +9489,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909" dependencies = [ "libc", "linux-raw-sys", @@ -9526,7 +9527,7 @@ dependencies = [ "log", "nohash-hasher", "parking_lot", - "pin-project 1.1.7", + "pin-project 1.1.8", "rand 0.8.5", "static_assertions", "web-time", @@ -9561,7 +9562,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "synstructure 0.13.1", ] @@ -9612,7 +9613,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "zvariant_utils", ] @@ -9645,7 +9646,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9665,7 +9666,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "synstructure 0.13.1", ] @@ -9686,7 +9687,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -9708,14 +9709,14 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "zip" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d52293fc86ea7cf13971b3bb81eb21683636e7ae24c729cdaf1b7c4157a352" +checksum = "ae9c1ea7b3a5e1f4b922ff856a129881167511563dc219869afe3787fc0c1a45" dependencies = [ "aes", "arbitrary", @@ -9733,7 +9734,7 @@ dependencies = [ "pbkdf2", "rand 0.8.5", "sha1", - "thiserror 2.0.6", + "thiserror 2.0.10", "time", "zeroize", "zopfli", @@ -9804,7 +9805,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "zvariant_utils", ] @@ -9816,5 +9817,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 608eac6c4..9f8afcd9c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -63,12 +63,12 @@ tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v tari_core = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1", features = [ "transactions", ] } -tauri-plugin-single-instance = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } +tauri-plugin-single-instance = '2' tari_crypto = "0.21.0" tari_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" } tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" } tari_utilities = "0.8.0" -tauri = { git = "https://github.com/tari-project/tauri.git", rev = "67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25", features = [ +tauri = { version = "2", features = [ "isolation", "macos-private-api", "image-png", @@ -76,18 +76,18 @@ tauri = { git = "https://github.com/tari-project/tauri.git", rev = "67a06c8a9bae "tray-icon", "devtools", # TODO: Remove this before mainnet ] } -tauri-plugin-cli = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } -tauri-plugin-os = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } -tauri-plugin-sentry = { git = "https://github.com/tari-project/sentry-tauri", rev = "7554b9a8738d6442d175aa2add55ecc11c52842d" } -tauri-plugin-shell = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } -tauri-plugin-updater = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } -thiserror = "1.0.26" +tauri-plugin-cli = "2" +tauri-plugin-os = "2" +tauri-plugin-sentry = "0.3" +tauri-plugin-shell = "2" +tauri-plugin-updater = "2" +thiserror = "2.0.10" tokio = { version = "1", features = ["full"] } tokio-util = { version = "0.7.11", features = ["compat"] } xz2 = { version = "0.1.7", features = ["static"] } # static bind lzma zip = "2.2.0" dirs = "5.0.1" -tauri-plugin-process = { git = "https://github.com/tari-project/tauri-plugins-workspace", rev = "09f29b0abe2cb1eb81365b65a3aa3f73325e4e17" } +tauri-plugin-process = "2" ring = "0.17.8" hex = "0.4.3" @@ -123,8 +123,8 @@ release-ci-beta = ["tauri/custom-protocol"] [package.metadata.cargo-machete] ignored = [ + "device_query", "libsqlite3-sys", - "log4rs", "minotari_wallet_grpc_client", "xz2", "openssl", diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 540160433..c8de5d43b 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -1,6 +1,9 @@ { "identifier": "default", - "windows": ["main"], + "windows": [ + "main", + "splashscreen" + ], "permissions": [ "core:path:default", "core:event:default", diff --git a/src-tauri/capabilities/desktop.json b/src-tauri/capabilities/desktop.json index 00ff1a697..d7ce6a382 100644 --- a/src-tauri/capabilities/desktop.json +++ b/src-tauri/capabilities/desktop.json @@ -5,6 +5,10 @@ "windows", "linux" ], + "windows": [ + "main", + "splashscreen" + ], "permissions": [ "updater:default" ] diff --git a/src-tauri/capabilities/migrated.json b/src-tauri/capabilities/migrated.json index 2018241e2..157c8fae0 100644 --- a/src-tauri/capabilities/migrated.json +++ b/src-tauri/capabilities/migrated.json @@ -3,7 +3,8 @@ "description": "permissions that were migrated from v1", "local": true, "windows": [ - "main" + "main", + "splashscreen" ], "permissions": [ "core:default", diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 41e24ac98..425a3a2ba 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -647,7 +647,7 @@ pub async fn get_seed_words( } #[tauri::command] -pub async fn get_tari_wallet_details( +pub async fn emit_tari_wallet_details( state: tauri::State<'_, UniverseAppState>, ) -> Result { let timer = Instant::now(); @@ -1431,7 +1431,6 @@ pub async fn set_visual_mode<'r>( #[tauri::command] pub async fn setup_application( - window: tauri::Window, state: tauri::State<'_, UniverseAppState>, app: tauri::AppHandle, ) -> Result { @@ -1443,7 +1442,7 @@ pub async fn setup_application( return Ok(res); } rollback.set_value(true, Duration::from_millis(1000)).await; - setup_inner(window, state.clone(), app).await.map_err(|e| { + setup_inner(state.clone(), app).await.map_err(|e| { warn!(target: LOG_TARGET, "Error setting up application: {:?}", e); sentry::capture_event(Event { level: sentry::Level::Error, diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6f75805b5..d9eeccadc 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -51,6 +51,7 @@ use tari_shutdown::Shutdown; use tauri::async_runtime::{block_on, JoinHandle}; use tauri::{Emitter, Listener, Manager, RunEvent}; use tauri_plugin_sentry::{minidump, sentry}; +use tokio::select; use tokio::sync::{Mutex, RwLock}; use tokio::time; use utils::logging_utils::setup_logging; @@ -120,7 +121,6 @@ mod tests; mod tor_adapter; mod tor_manager; mod updates_manager; -mod user_listener; mod utils; mod wallet_adapter; mod wallet_manager; @@ -156,7 +156,6 @@ struct CriticalProblemEvent { #[allow(clippy::too_many_lines)] async fn setup_inner( - window: tauri::Window, state: tauri::State<'_, UniverseAppState>, app: tauri::AppHandle, ) -> Result<(), anyhow::Error> { @@ -225,6 +224,7 @@ async fn setup_inner( let cpu_miner_config = state.cpu_miner_config.read().await; let app_config = state.config.read().await; let use_tor = app_config.use_tor(); + let p2pool_enabled = app_config.p2pool_enabled(); drop(app_config); let mm_proxy_manager = state.mm_proxy_manager.clone(); @@ -253,7 +253,7 @@ async fn setup_inner( .telemetry_manager .write() .await - .initialize(state.airdrop_access_token.clone(), window.clone()) + .initialize(state.airdrop_access_token.clone(), app.clone()) .await?; let mut telemetry_id = state @@ -575,8 +575,17 @@ async fn setup_inner( .await; progress.set_max(75).await; state.node_manager.wait_synced(progress.clone()).await?; + let mut telemetry_id = state + .telemetry_manager + .read() + .await + .get_unique_string() + .await; + if telemetry_id.is_empty() { + telemetry_id = "unknown_miner_tari_universe".to_string(); + } - if state.config.read().await.p2pool_enabled() { + if p2pool_enabled { let _unused = telemetry_service .send( "starting-p2pool".to_string(), @@ -637,7 +646,7 @@ async fn setup_inner( log_path: log_dir.clone(), tari_address: cpu_miner_config.tari_address.clone(), coinbase_extra: telemetry_id, - p2pool_enabled: config.p2pool_enabled(), + p2pool_enabled, monero_nodes: config.mmproxy_monero_nodes().clone(), use_monero_fail: config.mmproxy_use_monero_fail(), }) @@ -669,17 +678,39 @@ async fn setup_inner( let move_handle = app.clone(); tauri::async_runtime::spawn(async move { + let app_state = move_handle.state::().clone(); let mut interval: time::Interval = time::interval(Duration::from_secs(1)); + let mut shutdown_signal = app_state.shutdown.to_signal(); loop { - let app_state = move_handle.state::().clone(); - - if app_state.shutdown.is_triggered() { - break; + select! { + _ = interval.tick() => { + if let Ok(metrics_ret) = commands::get_miner_metrics(app_state.clone()).await { + drop(move_handle.emit("miner_metrics", metrics_ret)); + } + }, + _ = shutdown_signal.wait() => { + break; + }, } + } + }); - interval.tick().await; - if let Ok(metrics_ret) = commands::get_miner_metrics(app_state).await { - drop(move_handle.clone().emit("miner_metrics", metrics_ret)); + let w_move_handle = app.clone(); + tauri::async_runtime::spawn(async move { + let app_state = w_move_handle.state::().clone(); + let mut interval = time::interval(Duration::from_secs(10)); + let mut shutdown_signal = app_state.shutdown.to_signal(); + + loop { + select! { + _ = interval.tick() => { + if let Ok(wallet) = commands::emit_tari_wallet_details(app_state.clone()).await { + drop(w_move_handle.emit("wallet_details", wallet)); + } + }, + _ = shutdown_signal.wait() => { + break; + }, } } }); @@ -1060,7 +1091,7 @@ fn main() { commands::get_p2pool_stats, commands::get_paper_wallet_details, commands::get_seed_words, - commands::get_tari_wallet_details, + commands::emit_tari_wallet_details, commands::get_tor_config, commands::get_tor_entry_guards, commands::get_transaction_history, diff --git a/src-tauri/src/telemetry_manager.rs b/src-tauri/src/telemetry_manager.rs index ff30c8353..2e87a0f0e 100644 --- a/src-tauri/src/telemetry_manager.rs +++ b/src-tauri/src/telemetry_manager.rs @@ -280,11 +280,11 @@ impl TelemetryManager { pub async fn initialize( &mut self, airdrop_access_token: Arc>>, - window: tauri::Window, + app: tauri::AppHandle, ) -> Result<()> { info!(target: LOG_TARGET, "Starting telemetry manager"); self.airdrop_access_token = airdrop_access_token.clone(); - self.start_telemetry_process(TelemetryFrequency::default().into(), window) + self.start_telemetry_process(TelemetryFrequency::default().into(), app.clone()) .await?; Ok(()) } @@ -292,7 +292,7 @@ impl TelemetryManager { async fn start_telemetry_process( &mut self, timeout: Duration, - window: tauri::Window, + app: tauri::AppHandle, ) -> Result<(), TelemetryManagerError> { let cpu_miner = self.cpu_miner.clone(); let gpu_status = self.gpu_status.clone(); @@ -314,7 +314,7 @@ impl TelemetryManager { let airdrop_access_token_validated = validate_jwt(airdrop_access_token.clone()).await; let telemetry_data = get_telemetry_data(&cpu_miner, &gpu_status, &node_status, &p2pool_status, &config, network).await; let airdrop_api_url = in_memory_config_cloned.read().await.airdrop_api_url.clone(); - handle_telemetry_data(telemetry_data, airdrop_api_url, airdrop_access_token_validated, window.clone()).await; + handle_telemetry_data(telemetry_data, airdrop_api_url, airdrop_access_token_validated, app.clone()).await; } sleep(timeout); } @@ -577,7 +577,7 @@ async fn handle_telemetry_data( telemetry: Result, airdrop_api_url: String, airdrop_access_token: Option, - window: tauri::Window, + app: tauri::AppHandle, ) { match telemetry { Ok(telemetry) => { @@ -610,8 +610,7 @@ async fn handle_telemetry_data( referral_count: response_inner, }; - window - .emit("UserPoints", emit_data) + app.emit("UserPoints", emit_data) .map_err(|e| { error!("could not send user points as an event: {}", e) }) diff --git a/src-tauri/src/user_listener.rs b/src-tauri/src/user_listener.rs deleted file mode 100644 index bff90178b..000000000 --- a/src-tauri/src/user_listener.rs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2024. The Tari Project -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -// following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following -// disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the -// following disclaimer in the documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use device_query::{DeviceQuery, DeviceState}; -use log::{error, info}; -use tauri::Emitter; -use tokio::time::{sleep, Duration}; -use tokio_util::sync::CancellationToken; - -#[allow(dead_code)] -const LOG_TARGET: &str = "tari::universe::user_listener"; - -#[derive(Debug, Clone)] -pub struct UserListener { - pub is_listening: bool, - pub is_mining_initialized: bool, - pub cancelation_token: Option, -} - -#[derive(Clone, serde::Serialize)] -pub struct UserActivityEventPayload { - event_type: String, -} - -#[derive(Clone, serde::Serialize)] -pub struct CurrentTimeoutDurationEventPayload { - event_type: String, - duration: u64, -} - -#[allow(dead_code)] -impl UserListener { - pub fn new() -> Self { - Self { - is_listening: false, - is_mining_initialized: false, - cancelation_token: None, - } - } - - pub fn read_user_mouse_coords() -> (i32, i32) { - let device_state = DeviceState::new(); - let mouse = device_state.get_mouse(); - - mouse.coords - } - - pub fn start_listening_to_mouse_poisition_change( - &mut self, - timeout: Duration, - window: tauri::Window, - ) { - println!("UserListener::start_listening_to_mouse_poisition_change"); - - let cancellation_token = CancellationToken::new(); - self.cancelation_token = Some(cancellation_token.clone()); - self.is_listening = true; - - let mut user_listener = self.to_owned(); - let window = window.clone(); - - let mut timeout_counter: Duration = Duration::from_secs(0); - let mut last_mouse_coords = UserListener::read_user_mouse_coords(); - - tokio::spawn(async move { - tokio::select! { - _ = async { - println!("UserListener::listening for user inactivity has been started"); - info!(target: LOG_TARGET, "UserListener::listening for user inactivity has been started"); - loop { - println!("Listening for user inactivity, is_mining_initialized: {}, timeout: {}, timeout_counter: {}", user_listener.is_mining_initialized, timeout.as_secs(), timeout_counter.as_secs()); - let current_mouse_coords = UserListener::read_user_mouse_coords(); - - if current_mouse_coords == last_mouse_coords { - timeout_counter += Duration::from_secs(1); - } else { - last_mouse_coords = current_mouse_coords; - timeout_counter = Duration::from_secs(0); - } - - - if timeout_counter >= timeout && !user_listener.is_mining_initialized { - UserListener::on_user_idle(&window); - user_listener.is_mining_initialized = true; - } - - if timeout_counter < timeout && user_listener.is_mining_initialized { - UserListener::on_user_active(&window); - user_listener.is_mining_initialized = false; - } - - - UserListener::emit_current_timeout_duration(&window, timeout.saturating_sub(timeout_counter)); - sleep(Duration::from_secs(1)).await; - } - } => {}, - _ = cancellation_token.cancelled() => { - info!(target: LOG_TARGET, "UserListener::listening for user inactivity has been cancelled"); - if user_listener.is_mining_initialized { - UserListener::on_user_active(&window); - user_listener.is_mining_initialized = false; - } - - } - } - }); - } - - pub fn stop_listening_to_mouse_poisition_change(&mut self) { - match &self.cancelation_token { - Some(token) => { - info!(target: LOG_TARGET, "UserListener::triggered cancelation of listening for user inactivity"); - token.cancel(); - self.is_listening = false; - } - None => { - info!(target: LOG_TARGET, - "UserListener::triggered cancelation of listening for user inactivity but no cancelation token was found" - ); - } - } - } - - pub fn on_user_idle(window: &tauri::Window) { - println!("User is idle"); - window - .emit( - "message", - UserActivityEventPayload { - event_type: "user_idle".to_string(), - }, - ) - .unwrap_or_else(|e| { - error!(target: LOG_TARGET,"Error emitting user_idle event: {}", e); - }); - } - - pub fn on_user_active(window: &tauri::Window) { - println!("User is active"); - window - .emit( - "message", - UserActivityEventPayload { - event_type: "user_active".to_string(), - }, - ) - .unwrap_or_else(|e| { - error!(target: LOG_TARGET,"Error emitting user_active event: {}", e); - }); - } - - pub fn emit_current_timeout_duration(window: &tauri::Window, timeout: Duration) { - window - .emit( - "message", - CurrentTimeoutDurationEventPayload { - event_type: "current_timeout_duration".to_string(), - duration: timeout.as_secs(), - }, - ) - .unwrap_or_else(|e| { - error!(target: LOG_TARGET,"Error emitting current_timeout_duration event: {}", e); - }); - } -} diff --git a/src/App/AppWrapper.tsx b/src/App/AppWrapper.tsx index 668e61126..c5e1c2886 100644 --- a/src/App/AppWrapper.tsx +++ b/src/App/AppWrapper.tsx @@ -1,12 +1,8 @@ import { useEffect } from 'react'; -// import { defaultOptions } from 'tauri-plugin-sentry-api'; -// import * as Sentry from '@sentry/react'; -// import { IGNORE_FETCHING } from '@app/App/sentryIgnore'; import { initSystray } from '@app/utils'; import { useDetectMode, useDisableRefresh, useLangaugeResolver, useListenForExternalDependencies } from '@app/hooks'; -// import packageInfo from '../../package.json'; import { useAppConfigStore } from '../store/useAppConfigStore.ts'; import setupLogger from '../utils/shared-logger.ts'; import App from './App.tsx'; @@ -15,26 +11,9 @@ import { useMiningStore } from '@app/store/useMiningStore.ts'; // FOR ANYTHING THAT NEEDS TO BE INITIALISED -// const environment = import.meta.env.MODE; -// const sentryOptions = { -// ...defaultOptions, -// dsn: 'https://edd6b9c1494eb7fda6ee45590b80bcee@o4504839079002112.ingest.us.sentry.io/4507979991285760', -// integrations: [Sentry.captureConsoleIntegration({ levels: ['warn', 'error'] }), Sentry.extraErrorDataIntegration()], -// release: packageInfo.version, -// environment, -// // Set tracesSampleRate to 1.0 to capture 100% -// // of transactions for tracing. -// tracesSampleRate: 1.0, -// attachStacktrace: true, -// autoSessionTracking: false, -// ignoreErrors: [...IGNORE_FETCHING], -// enabled: environment !== 'development', -// }; - setupLogger(); export default function AppWrapper() { - // const allowTelemetry = useAppConfigStore((s) => s.allow_telemetry); const fetchAppConfig = useAppConfigStore((s) => s.fetchAppConfig); const setMiningNetwork = useMiningStore((s) => s.setMiningNetwork); @@ -54,15 +33,5 @@ export default function AppWrapper() { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - // We think Sentry/Vite is causing the crashing issues. Disable on the front end for now. - // - // useEffect(() => { - // if (allowTelemetry && environment !== 'development') { - // Sentry.init(sentryOptions); - // } else { - // Sentry.close(); - // } - // }, [allowTelemetry]); - return ; } diff --git a/src/containers/floating/Settings/sections/connections/ConnectionStatus.tsx b/src/containers/floating/Settings/sections/connections/ConnectionStatus.tsx index 32f9ab6a2..dc7b1b469 100644 --- a/src/containers/floating/Settings/sections/connections/ConnectionStatus.tsx +++ b/src/containers/floating/Settings/sections/connections/ConnectionStatus.tsx @@ -3,11 +3,11 @@ import { Stack } from '@app/components/elements/Stack.tsx'; import { ConnectionIcon } from '../../components/Settings.styles.tsx'; import { Typography } from '@app/components/elements/Typography.tsx'; import { useTranslation } from 'react-i18next'; -import { useMiningStore } from '@app/store/useMiningStore.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; export default function ConnectionStatus() { const { t } = useTranslation('settings'); - const isConnectedToTariNetwork = useMiningStore((s) => s.base_node?.is_connected); + const isConnectedToTariNetwork = useMiningMetricsStore((s) => s.base_node?.is_connected); return ( diff --git a/src/containers/floating/Settings/sections/connections/Network.tsx b/src/containers/floating/Settings/sections/connections/Network.tsx index fd70a7763..65d25ae30 100644 --- a/src/containers/floating/Settings/sections/connections/Network.tsx +++ b/src/containers/floating/Settings/sections/connections/Network.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'; import { Typography } from '@app/components/elements/Typography.tsx'; import { Stack } from '@app/components/elements/Stack.tsx'; -import { useMiningStore } from '@app/store/useMiningStore.ts'; + import ConnectionStatus from '../connections/ConnectionStatus.tsx'; import { @@ -12,11 +12,12 @@ import { SettingsGroupWrapper, } from '../../components/SettingsGroup.styles.ts'; import { formatHashrate } from '@app/utils/formatters.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; export default function Network() { const { t } = useTranslation('settings'); - const sha_network_hash_rate = useMiningStore((state) => state?.sha_network_hash_rate); - const randomx_network_hash_rate = useMiningStore((state) => state?.randomx_network_hash_rate); + const sha_network_hash_rate = useMiningMetricsStore((state) => state?.sha_network_hash_rate); + const randomx_network_hash_rate = useMiningMetricsStore((state) => state?.randomx_network_hash_rate); return ( diff --git a/src/containers/floating/Settings/sections/connections/Peers.tsx b/src/containers/floating/Settings/sections/connections/Peers.tsx index 67d4f38e7..8132fcbcf 100644 --- a/src/containers/floating/Settings/sections/connections/Peers.tsx +++ b/src/containers/floating/Settings/sections/connections/Peers.tsx @@ -1,7 +1,5 @@ import styled from 'styled-components'; import { useTranslation } from 'react-i18next'; - -import { useMiningStore } from '@app/store/useMiningStore.ts'; import { Typography } from '@app/components/elements/Typography.tsx'; import { Stack } from '@app/components/elements/Stack.tsx'; @@ -11,6 +9,7 @@ import { SettingsGroupTitle, SettingsGroupWrapper, } from '../../components/SettingsGroup.styles.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; const Count = styled.div<{ $count: number }>` border-radius: 11px; @@ -29,7 +28,7 @@ const Count = styled.div<{ $count: number }>` export default function Peers() { const { t } = useTranslation('settings'); - const connectedPeers = useMiningStore((state) => state.base_node?.connected_peers || []); + const connectedPeers = useMiningMetricsStore((state) => state.base_node?.connected_peers || []); const connectedPeersCount = connectedPeers?.length || 0; const listMarkup = connectedPeersCount ? connectedPeers.map((peer, i) =>
  • {peer}
  • ) diff --git a/src/containers/floating/Settings/sections/mining/GpuDevices.tsx b/src/containers/floating/Settings/sections/mining/GpuDevices.tsx index 3faf7104a..29f137a47 100644 --- a/src/containers/floating/Settings/sections/mining/GpuDevices.tsx +++ b/src/containers/floating/Settings/sections/mining/GpuDevices.tsx @@ -14,19 +14,21 @@ import { } from '../../components/SettingsGroup.styles.ts'; import { Stack } from '@app/components/elements/Stack'; import { useAppConfigStore } from '@app/store/useAppConfigStore'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; const GpuDevices = () => { const { t } = useTranslation(['common', 'settings'], { useSuspense: false }); const miningAllowed = useAppStateStore((s) => !s.isSettingUp); - const isCPUMining = useMiningStore((s) => s.cpu.mining.is_mining); - const isGPUMining = useMiningStore((s) => s.gpu.mining.is_mining); + const isCPUMining = useMiningMetricsStore((s) => s.cpu.mining.is_mining); + const isGPUMining = useMiningMetricsStore((s) => s.gpu.mining.is_mining); + const gpuDevices = useMiningMetricsStore((s) => s.gpu.hardware); + const miningInitiated = useMiningStore((s) => s.miningInitiated); const isGpuMiningEnabled = useAppConfigStore((s) => s.gpu_mining_enabled); const isMiningInProgress = isCPUMining || isGPUMining; const isDisabled = isMiningInProgress || miningInitiated || !miningAllowed || !isGpuMiningEnabled; const excludedDevices = useMiningStore((s) => s.excludedGpuDevices); const setExcludedDevice = useMiningStore((s) => s.setExcludedGpuDevice); - const gpuDevices = useMiningStore((s) => s.gpu.hardware); const handleSetExcludedDevice = useCallback( async (device: number) => { diff --git a/src/containers/floating/Settings/sections/mining/GpuMiningMarkup.tsx b/src/containers/floating/Settings/sections/mining/GpuMiningMarkup.tsx index 2912ecf14..aa5412a92 100644 --- a/src/containers/floating/Settings/sections/mining/GpuMiningMarkup.tsx +++ b/src/containers/floating/Settings/sections/mining/GpuMiningMarkup.tsx @@ -1,6 +1,5 @@ import { useCallback, useMemo } from 'react'; import { useAppStateStore } from '@app/store/appStateStore.ts'; -import { useMiningStore } from '@app/store/useMiningStore.ts'; import { Typography } from '@app/components/elements/Typography.tsx'; import { ToggleSwitch } from '@app/components/elements/ToggleSwitch.tsx'; import { useTranslation } from 'react-i18next'; @@ -12,14 +11,15 @@ import { SettingsGroupTitle, SettingsGroupWrapper, } from '../../components/SettingsGroup.styles.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; const GpuMiningMarkup = () => { const { t } = useTranslation(['settings'], { useSuspense: false }); const setGpuMiningEnabled = useAppConfigStore((s) => s.setGpuMiningEnabled); const isGpuMiningEnabled = useAppConfigStore((s) => s.gpu_mining_enabled); const isSettingUp = useAppStateStore((s) => s.isSettingUp); + const gpuDevicesHardware = useMiningMetricsStore((s) => s.gpu.hardware); - const gpuDevicesHardware = useMiningStore((s) => s.gpu.hardware); const isGPUMiningAvailable = useMemo(() => { if (!gpuDevicesHardware) return false; if (gpuDevicesHardware.length === 0) return false; diff --git a/src/containers/floating/StagedSecurity/sections/SeedPhrase/SeedPhrase.tsx b/src/containers/floating/StagedSecurity/sections/SeedPhrase/SeedPhrase.tsx index 0a5cb22b4..f5f5d2a96 100644 --- a/src/containers/floating/StagedSecurity/sections/SeedPhrase/SeedPhrase.tsx +++ b/src/containers/floating/StagedSecurity/sections/SeedPhrase/SeedPhrase.tsx @@ -28,6 +28,14 @@ interface Props { words: string[]; } +const seedWordGroups = (words: string[]) => { + const groups: string[][] = []; + for (let i = 0; i < words.length; i += 6) { + groups.push(words.slice(i, i + 6)); + } + return groups; +}; + const SeedPhrase = ({ setSection, words }: Props) => { const { t } = useTranslation('staged-security'); const { isCopied, copyToClipboard } = useCopyToClipboard(); @@ -41,12 +49,6 @@ const SeedPhrase = ({ setSection, words }: Props) => { setChecked(!checked); }; - const wordGroups: string[][] = []; - - for (let i = 0; i < words.length; i += 6) { - wordGroups.push(words.slice(i, i + 6)); - } - return ( @@ -56,7 +58,7 @@ const SeedPhrase = ({ setSection, words }: Props) => { - {wordGroups.map((group, groupIndex) => ( + {seedWordGroups(words).map((group, groupIndex) => ( {group.map((word, index) => ( diff --git a/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedIn/segments/Flare/Flare.tsx b/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedIn/segments/Flare/Flare.tsx index 01fb27f4d..a64df7af6 100644 --- a/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedIn/segments/Flare/Flare.tsx +++ b/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedIn/segments/Flare/Flare.tsx @@ -3,7 +3,7 @@ import FriendAccepted from './FriendAccepted/FriendAccepted'; import GoalComplete from './GoalComplete/GoalComplete'; import { Wrapper } from './styles'; import { useAirdropStore } from '@app/store/useAirdropStore.ts'; -import { useCallback, useEffect } from 'react'; +import { useEffect } from 'react'; interface Props { gems: number; diff --git a/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedOut/LoggedOut.tsx b/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedOut/LoggedOut.tsx index 4e0a85831..8eb469bc4 100644 --- a/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedOut/LoggedOut.tsx +++ b/src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedOut/LoggedOut.tsx @@ -12,8 +12,7 @@ export default function LoggedOut() { const [modalIsOpen, setModalIsOpen] = useState(false); const { t } = useTranslation(['airdrop'], { useSuspense: false }); const restartMining = useMiningStore((s) => s.restartMining); - const { referralQuestPoints, authUuid, setAuthUuid, setAirdropTokens, setUserPoints, backendInMemoryConfig } = - useAirdropStore(); + const { referralQuestPoints, authUuid, setAuthUuid, setAirdropTokens, backendInMemoryConfig } = useAirdropStore(); const handleAuth = useCallback( (code?: string) => { diff --git a/src/containers/main/Dashboard/MiningView/components/BlockTime.tsx b/src/containers/main/Dashboard/MiningView/components/BlockTime.tsx index 1223d8a0a..d34bd1c47 100644 --- a/src/containers/main/Dashboard/MiningView/components/BlockTime.tsx +++ b/src/containers/main/Dashboard/MiningView/components/BlockTime.tsx @@ -1,15 +1,15 @@ import { useTranslation } from 'react-i18next'; -import { useMiningStore } from '@app/store/useMiningStore.ts'; import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore'; import { BlockTimeContainer, SpacedNum, TimerTypography, TitleTypography } from './BlockTime.styles'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; function BlockTime() { const { t } = useTranslation('mining-view', { useSuspense: false }); - const isCPUMining = useMiningStore((s) => s.cpu.mining.is_mining); - const isGPUMining = useMiningStore((s) => s.gpu.mining.is_mining); + const isCPUMining = useMiningMetricsStore((s) => s.cpu.mining.is_mining); + const isGPUMining = useMiningMetricsStore((s) => s.gpu.mining.is_mining); const blockTime = useBlockchainVisualisationStore((s) => s.displayBlockTime); - const isConnectedToTari = useMiningStore((s) => s.base_node?.is_connected); + const isConnectedToTari = useMiningMetricsStore((s) => s.base_node?.is_connected); const isMining = isCPUMining || isGPUMining; const { daysString, hoursString, minutes, seconds } = blockTime || {}; diff --git a/src/containers/main/SideBar/Miner/Miner.tsx b/src/containers/main/SideBar/Miner/Miner.tsx index d55d77541..7032ee5ce 100644 --- a/src/containers/main/SideBar/Miner/Miner.tsx +++ b/src/containers/main/SideBar/Miner/Miner.tsx @@ -18,6 +18,7 @@ import { ExpandedContentTile, } from '@app/containers/main/SideBar/Miner/components/ExpandableTile.styles.ts'; import { formatHashrate, formatNumber, FormatPreset } from '@app/utils/formatters.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; export default function Miner() { useMiningStatesSync(); @@ -27,12 +28,12 @@ export default function Miner() { const miningInitiated = useMiningStore((s) => s.miningInitiated); const isCpuMiningEnabled = useAppConfigStore((s) => s.cpu_mining_enabled); const isGpuMiningEnabled = useAppConfigStore((s) => s.gpu_mining_enabled); - const { cpu_estimated_earnings, cpu_hash_rate, cpu_is_mining } = useMiningStore((s) => ({ + const { cpu_estimated_earnings, cpu_hash_rate, cpu_is_mining } = useMiningMetricsStore((s) => ({ cpu_estimated_earnings: s.cpu.mining.estimated_earnings, cpu_hash_rate: s.cpu.mining.hash_rate, cpu_is_mining: s.cpu.mining.is_mining, })); - const { gpu_estimated_earnings, gpu_hash_rate, gpu_is_mining } = useMiningStore((s) => ({ + const { gpu_estimated_earnings, gpu_hash_rate, gpu_is_mining } = useMiningMetricsStore((s) => ({ gpu_estimated_earnings: s.gpu.mining.estimated_earnings, gpu_hash_rate: s.gpu.mining.hash_rate, gpu_is_mining: s.gpu.mining.is_mining, diff --git a/src/containers/main/SideBar/Miner/components/CustomPowerLevels/CustomPowerLevelsDialog.tsx b/src/containers/main/SideBar/Miner/components/CustomPowerLevels/CustomPowerLevelsDialog.tsx index 2fd038b27..1be8a593b 100644 --- a/src/containers/main/SideBar/Miner/components/CustomPowerLevels/CustomPowerLevelsDialog.tsx +++ b/src/containers/main/SideBar/Miner/components/CustomPowerLevels/CustomPowerLevelsDialog.tsx @@ -18,6 +18,7 @@ import { LinearProgress } from '@app/components/elements/LinearProgress.tsx'; import { Controller, useFieldArray, useForm } from 'react-hook-form'; import { modeType } from '@app/store/types.ts'; import { Button } from '@app/components/elements/buttons/Button.tsx'; +import { changeMiningMode } from '@app/store/miningStoreActions.ts'; enum FormFields { CPU = 'cpu', @@ -83,7 +84,6 @@ export function CustomPowerLevelsDialog({ const configCpuLevels = useAppConfigStore((s) => s.custom_max_cpu_usage); const configGpuLevels = useAppConfigStore((s) => s.custom_max_gpu_usage); - const changeMiningMode = useMiningStore((s) => s.changeMiningMode); const isChangingMode = useMiningStore((s) => s.isChangingMode); const { control, handleSubmit, setValue } = useForm({ @@ -107,16 +107,13 @@ export function CustomPowerLevelsDialog({ } }, [saved]); - const onSubmit = useCallback( - (data: FormValues) => { - changeMiningMode({ - mode: 'Custom', - customCpuLevels: data[FormFields.CPU], - customGpuLevels: data[FormFields.GPUS], - }).then(() => setSaved(true)); - }, - [changeMiningMode] - ); + const onSubmit = useCallback((data: FormValues) => { + changeMiningMode({ + mode: 'Custom', + customCpuLevels: data[FormFields.CPU], + customGpuLevels: data[FormFields.GPUS], + }).then(() => setSaved(true)); + }, []); if (!maxAvailableThreads) return ; diff --git a/src/containers/main/SideBar/Miner/components/ModeSelect.tsx b/src/containers/main/SideBar/Miner/components/ModeSelect.tsx index 6729ef2fe..0e56f866c 100644 --- a/src/containers/main/SideBar/Miner/components/ModeSelect.tsx +++ b/src/containers/main/SideBar/Miner/components/ModeSelect.tsx @@ -12,17 +12,18 @@ import { useMiningStore } from '@app/store/useMiningStore.ts'; import { useAppConfigStore } from '@app/store/useAppConfigStore'; import { modeType } from '@app/store/types'; import { CustomPowerLevelsDialogContainer } from './CustomPowerLevels/CustomPowerLevelsDialogContainer'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; +import { changeMiningMode } from '@app/store/miningStoreActions.ts'; function ModeSelect() { const { t } = useTranslation('common', { useSuspense: false }); const isSettingUp = useAppStateStore((s) => s.isSettingUp); const mode = useAppConfigStore((s) => s.mode); - const isCPUMining = useMiningStore((s) => s.cpu.mining.is_mining); - const isGPUMining = useMiningStore((s) => s.gpu.mining.is_mining); + const isCPUMining = useMiningMetricsStore((s) => s.cpu.mining.is_mining); + const isGPUMining = useMiningMetricsStore((s) => s.gpu.mining.is_mining); const setCustomLevelsDialog = useMiningStore((s) => s.setCustomLevelsDialogOpen); const isMiningControlsEnabled = useMiningStore((s) => s.miningControlsEnabled); const isChangingMode = useMiningStore((s) => s.isChangingMode); - const changeMiningMode = useMiningStore((s) => s.changeMiningMode); const isMiningInitiated = useMiningStore((s) => s.miningInitiated); const isMining = isCPUMining || isGPUMining; const isMiningLoading = (isMining && !isMiningInitiated) || (isMiningInitiated && !isMining); @@ -36,7 +37,7 @@ function ModeSelect() { } await changeMiningMode({ mode: newMode as modeType }); }, - [changeMiningMode, setCustomLevelsDialog] + [setCustomLevelsDialog] ); const tabOptions = useMemo(() => { diff --git a/src/containers/main/SideBar/components/MiningButton/MiningButton.tsx b/src/containers/main/SideBar/components/MiningButton/MiningButton.tsx index 4aa174225..68db6022d 100644 --- a/src/containers/main/SideBar/components/MiningButton/MiningButton.tsx +++ b/src/containers/main/SideBar/components/MiningButton/MiningButton.tsx @@ -12,6 +12,8 @@ import LoadingSvg from '@app/components/svgs/LoadingSvg.tsx'; import ButtonOrbitAnimation from '../../Miner/components/ButtonOrbitAnimation.tsx'; import { IconWrapper, StyledButton, ButtonWrapper } from './MiningButton.styles.ts'; import { SpinnerIcon } from '@app/components/elements/loaders/SpinnerIcon.tsx'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; +import { startMining, stopMining } from '@app/store/miningStoreActions.ts'; enum MiningButtonStateText { STARTED = 'stop-mining', @@ -20,13 +22,11 @@ enum MiningButtonStateText { export default function MiningButton() { const { t } = useTranslation('mining-view', { useSuspense: false }); - const startMining = useMiningStore((s) => s.startMining); - const stopMining = useMiningStore((s) => s.stopMining); const isAppSettingUp = useAppStateStore((s) => s.isSettingUp); const isMiningControlsEnabled = useMiningStore((s) => s.miningControlsEnabled); const isMiningInitiated = useMiningStore((s) => s.miningInitiated); - const isCPUMining = useMiningStore((s) => s.cpu.mining.is_mining); - const isGPUMining = useMiningStore((s) => s.gpu.mining.is_mining); + const isCPUMining = useMiningMetricsStore((s) => s.cpu.mining.is_mining); + const isGPUMining = useMiningMetricsStore((s) => s.gpu.mining.is_mining); const isCpuMiningEnabled = useAppConfigStore((s) => s.cpu_mining_enabled); const isGPUMiningEnabled = useAppConfigStore((s) => s.gpu_mining_enabled); const isMining = isCPUMining || isGPUMining; @@ -45,7 +45,7 @@ export default function MiningButton() { } else { await stopMining(); } - }, [isMining, startMining, stopMining]); + }, [isMining]); const icon = isMining ? : ; const iconFinal = {isMiningLoading ? : icon}; diff --git a/src/containers/main/SideBar/components/VersionChip/VersionChip.tsx b/src/containers/main/SideBar/components/VersionChip/VersionChip.tsx index 22ca1c6b6..cbfe8841b 100644 --- a/src/containers/main/SideBar/components/VersionChip/VersionChip.tsx +++ b/src/containers/main/SideBar/components/VersionChip/VersionChip.tsx @@ -1,7 +1,8 @@ import { useTranslation } from 'react-i18next'; import ConnectedPulse from './ConnectedPulse/ConnectedPulse'; import { Divider, Wrapper } from './styles'; -import { useMiningStore } from '@app/store/useMiningStore'; + +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; interface Props { version: string; @@ -10,7 +11,7 @@ interface Props { export default function VersionChip({ version }: Props) { const { t } = useTranslation('common', { useSuspense: false }); - const isConnectedToTariNetwork = useMiningStore((s) => s.base_node?.is_connected); + const isConnectedToTariNetwork = useMiningMetricsStore((s) => s.base_node?.is_connected); return ( diff --git a/src/containers/main/SideBar/components/Wallet/HistoryItem.tsx b/src/containers/main/SideBar/components/Wallet/HistoryItem.tsx index 55dd575af..9db3b4cc4 100644 --- a/src/containers/main/SideBar/components/Wallet/HistoryItem.tsx +++ b/src/containers/main/SideBar/components/Wallet/HistoryItem.tsx @@ -1,4 +1,4 @@ -import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore'; +import { handleWinReplay } from '@app/store/useBlockchainVisualisationStore'; import { ButtonWrapper, EarningsWrapper, @@ -17,7 +17,7 @@ import { useTheme } from 'styled-components'; import { TariSvg } from '@app/assets/icons/tari.tsx'; import { useTranslation } from 'react-i18next'; -import { useCallback, useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { AnimatePresence } from 'framer-motion'; import gemImage from '../../../Airdrop/AirdropGiftTracker/images/gem.png'; import { useShareRewardStore } from '@app/store/useShareRewardStore.ts'; @@ -53,8 +53,6 @@ export default function HistoryItem({ item }: HistoryItemProps) { const systemLang = useAppConfigStore((s) => s.should_always_use_system_language); const sharingEnabled = useAppConfigStore((s) => s.sharing_enabled); - const handleWinReplay = useBlockchainVisualisationStore((s) => s.handleWinReplay); - const { t } = useTranslation('sidebar', { useSuspense: false }); const earningsFormatted = formatNumber(item.amount, FormatPreset.TXTM_COMPACT).toLowerCase(); const referralQuestPoints = useAirdropStore((s) => s.referralQuestPoints); @@ -67,10 +65,6 @@ export default function HistoryItem({ item }: HistoryItemProps) { return randomGradientColours[getRandomInt(9)]; }, []); - const handleReplay = useCallback(() => { - handleWinReplay(item); - }, [handleWinReplay, item]); - const itemTitle = `${t('block')} #${item.mined_in_block_height}`; const itemTime = new Date(item.timestamp * 1000)?.toLocaleString(systemLang ? undefined : appLanguage, { month: 'short', @@ -106,7 +100,7 @@ export default function HistoryItem({ item }: HistoryItemProps) { )} - + handleWinReplay(item)}> diff --git a/src/containers/main/SideBar/components/Wallet/Wallet.tsx b/src/containers/main/SideBar/components/Wallet/Wallet.tsx index 3881ea67b..dc37c4bf0 100644 --- a/src/containers/main/SideBar/components/Wallet/Wallet.tsx +++ b/src/containers/main/SideBar/components/Wallet/Wallet.tsx @@ -8,11 +8,10 @@ import { formatNumber, FormatPreset } from '@app/utils/formatters.ts'; import { Typography } from '@app/components/elements/Typography.tsx'; import { Stack } from '@app/components/elements/Stack.tsx'; -import { useWalletStore } from '@app/store/useWalletStore.ts'; +import { handleTransactions, useWalletStore } from '@app/store/useWalletStore.ts'; import { usePaperWalletStore } from '@app/store/usePaperWalletStore.ts'; import { useAppConfigStore } from '@app/store/useAppConfigStore.ts'; -import useFetchTx from '@app/hooks/mining/useTransactions.ts'; import SyncTooltip from './SyncTooltip/SyncTooltip.tsx'; import History from './History.tsx'; @@ -46,7 +45,6 @@ export default function Wallet() { const [showLongBalance, setShowLongBalance] = useState(false); const [animateNumbers, setShowAnimateNumbers] = useState(true); - const fetchTx = useFetchTx(); const formatted = formatNumber(balance || 0, FormatPreset.TXTM_COMPACT); const formattedLong = formatNumber(balance || 0, FormatPreset.TXTM_LONG); @@ -64,14 +62,13 @@ export default function Wallet() { const handleShowClick = useCallback(async () => { if (balance && !transactions.length && !isTransactionLoading) { - await fetchTx(); + await handleTransactions(); } else { setRecapCount(undefined); } setShowHistory((c) => !c); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [balance, fetchTx, isTransactionLoading, transactions?.length]); + }, [balance, isTransactionLoading, setRecapCount, transactions.length]); const handleSyncButtonClick = () => { setShowPaperWalletModal(true); diff --git a/src/containers/phase/Setup/components/AppVersion.tsx b/src/containers/phase/Setup/components/AppVersion.tsx index 95b482ad1..cfcb53021 100644 --- a/src/containers/phase/Setup/components/AppVersion.tsx +++ b/src/containers/phase/Setup/components/AppVersion.tsx @@ -12,7 +12,7 @@ export default function AppVersion() { }, []); return tariVersion ? ( - + {tariVersion} ) : null; diff --git a/src/glApp.d.ts b/src/glApp.d.ts index e1c7ca459..ce052d48a 100644 --- a/src/glApp.d.ts +++ b/src/glApp.d.ts @@ -17,7 +17,7 @@ export type GlAppState = | 'restart'; export interface GlApp { - setState(e: GlAppState): void; + setState(e: GlAppState, isReplay?: boolean): void; init(): void; properties: Properties; stateManager: StateManager; diff --git a/src/hooks/airdrop/stateHelpers/useGetAirdropUserDetails.ts b/src/hooks/airdrop/stateHelpers/useGetAirdropUserDetails.ts index 508c1da42..a4852d35e 100644 --- a/src/hooks/airdrop/stateHelpers/useGetAirdropUserDetails.ts +++ b/src/hooks/airdrop/stateHelpers/useGetAirdropUserDetails.ts @@ -5,7 +5,6 @@ import { useAirdropRequest } from '../utils/useHandleRequest'; export const useGetAirdropUserDetails = () => { const baseUrl = useAirdropStore((state) => state.backendInMemoryConfig?.airdropApiUrl); const airdropToken = useAirdropStore((state) => state.airdropTokens?.token); - const userDetails = useAirdropStore((state) => state.userDetails); const setUserDetails = useAirdropStore((state) => state.setUserDetails); const setUserPoints = useAirdropStore((state) => state.setUserPoints); const setReferralCount = useAirdropStore((state) => state.setReferralCount); diff --git a/src/hooks/airdrop/useWebsocket.ts b/src/hooks/airdrop/useWebsocket.ts index faaa41bfd..bb121f689 100644 --- a/src/hooks/airdrop/useWebsocket.ts +++ b/src/hooks/airdrop/useWebsocket.ts @@ -8,6 +8,7 @@ import { invoke } from '@tauri-apps/api/core'; import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore'; import { useAppStateStore } from '@app/store/appStateStore'; import { MINING_EVENT_INTERVAL_MS, useShellOfSecretsStore } from '@app/store/useShellOfSecretsStore'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; let socket: ReturnType | null; @@ -22,11 +23,11 @@ export const useWebsocket = () => { const airdropToken = useAirdropStore((state) => state.airdropTokens?.token); const userId = useAirdropStore((state) => state.userDetails?.user?.id); const baseUrl = useAirdropStore((state) => state.backendInMemoryConfig?.airdropApiUrl); - const cpu = useMiningStore((state) => state.cpu); - const gpu = useMiningStore((state) => state.gpu); + const cpu = useMiningMetricsStore((state) => state.cpu); + const gpu = useMiningMetricsStore((state) => state.gpu); const network = useMiningStore((state) => state.network); const appId = useAppConfigStore((state) => state.anon_id); - const base_node = useMiningStore((state) => state.base_node); + const base_node = useMiningMetricsStore((state) => state.base_node); const handleWsUserIdEvent = useHandleWsUserIdEvent(); const [connectedSocket, setConnectedSocket] = useState(false); const height = useBlockchainVisualisationStore((s) => s.displayBlockHeight); @@ -34,8 +35,7 @@ export const useWebsocket = () => { const registerWsConnectionEvent = useShellOfSecretsStore((state) => state.registerWsConnectionEvent); const isMining = useMemo(() => { - const isMining = (cpu?.mining.is_mining || gpu?.mining.is_mining) && base_node?.is_connected; - return isMining; + return (cpu?.mining.is_mining || gpu?.mining.is_mining) && base_node?.is_connected; }, [base_node?.is_connected, cpu?.mining.is_mining, gpu?.mining.is_mining]); const handleEmitMiningStatus = useCallback( @@ -115,7 +115,7 @@ export const useWebsocket = () => { socket.on(userId as string, handleWsUserIdEvent); }); - socket.on('connect_error', (e) => { + socket.on('connect_error', (_e) => { registerWsConnectionEvent({ state: 'error', error: 'could not connect to server', @@ -128,7 +128,7 @@ export const useWebsocket = () => { }); console.error(reason, details); }); - socket.io.on('reconnect', (e) => { + socket.io.on('reconnect', (_e) => { registerWsConnectionEvent({ state: 'up', }); diff --git a/src/hooks/app/index.ts b/src/hooks/app/index.ts index 1af1019ab..e83f98588 100644 --- a/src/hooks/app/index.ts +++ b/src/hooks/app/index.ts @@ -1,6 +1,5 @@ export * from './useDisableRefresh.ts'; export * from './useEnvironment.ts'; -export * from './useHardwareStats.ts'; export * from './useLanguageResolver.ts'; export * from './useListenForExternalDependencies.ts'; export * from './useSetUp.ts'; diff --git a/src/hooks/app/useHardwareStats.ts b/src/hooks/app/useHardwareStats.ts deleted file mode 100644 index 7fb940967..000000000 --- a/src/hooks/app/useHardwareStats.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { useMiningStore } from '@app/store/useMiningStore'; -import { HardwareParameters } from '../../types/app-status'; -import { useMemo } from 'react'; - -const roundTo = (num: number, precision = 2) => { - const factor = 10 ** precision; - return Math.round(num * factor) / factor; -}; - -export function useHardwareStats() { - const cpuHardwareStats = useMiningStore((s) => s.cpu.hardware); - const gpuHardwareStats = useMiningStore((s) => s.gpu.hardware); - - const cpu = useMemo(() => { - if (cpuHardwareStats) { - return cpuHardwareStats - .filter((cpu) => cpu.status.is_reader_implemented) - .map((stats) => ({ - label: stats.name, - usage_percentage: roundTo(stats.parameters?.usage_percentage ?? 0), - current_temperature: roundTo(stats.parameters?.current_temperature ?? 0), - max_temperature: roundTo(stats.parameters?.max_temperature ?? 0), - })); - } - return undefined; - }, [cpuHardwareStats]); - - const gpu = useMemo(() => { - if (gpuHardwareStats) { - return gpuHardwareStats - .filter((gpu) => gpu.status.is_reader_implemented) - .map((stats) => ({ - label: stats.name, - usage_percentage: roundTo(stats.parameters?.usage_percentage ?? 0), - current_temperature: roundTo(stats.parameters?.current_temperature ?? 0), - max_temperature: roundTo(stats.parameters?.max_temperature ?? 0), - })); - } - return undefined; - }, [gpuHardwareStats]); - - const doesAnyCpuHasReadings = cpuHardwareStats?.some((cpu) => cpu.status.is_reader_implemented); - const doesAnyGpuHasReadings = gpuHardwareStats?.some((gpu) => gpu.status.is_reader_implemented); - - return { cpu, gpu, doesAnyCpuHasReadings, doesAnyGpuHasReadings }; -} diff --git a/src/hooks/app/useShuttingDown.ts b/src/hooks/app/useShuttingDown.ts index 298c2d059..7b30cd3b2 100644 --- a/src/hooks/app/useShuttingDown.ts +++ b/src/hooks/app/useShuttingDown.ts @@ -1,9 +1,9 @@ import { tray } from '@app/utils'; import { useEffect, useState } from 'react'; -import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { resetAllStores } from '@app/store/create.ts'; import { invoke } from '@tauri-apps/api/core'; -const appWindow = getCurrentWebviewWindow(); +import { getCurrentWindow } from '@tauri-apps/api/window'; +const appWindow = getCurrentWindow(); export function useShuttingDown() { const [isShuttingDown, setIsShuttingDown] = useState(false); diff --git a/src/hooks/app/useSystemTray.ts b/src/hooks/app/useSystemTray.ts index 867cc903e..16ff54a1a 100644 --- a/src/hooks/app/useSystemTray.ts +++ b/src/hooks/app/useSystemTray.ts @@ -1,4 +1,3 @@ -import { MinerMetrics } from '@app/types/app-status'; import { menu, CPU_HASH_ITEM_ID, @@ -7,14 +6,14 @@ import { UNMINIMIZE_ITEM_ID, MINIMIZE_ITEM_ID, } from '@app/utils'; -import { listen } from '@tauri-apps/api/event'; -import { getCurrentWindow } from '@tauri-apps/api/window'; -import { useCallback, useEffect, useRef } from 'react'; + +import { useCallback, useDeferredValue, useEffect, useRef } from 'react'; import { formatHashrate, formatNumber, FormatPreset } from '@app/utils'; import { MenuItem } from '@tauri-apps/api/menu/menuItem'; - -const currentWindow = getCurrentWindow(); +import { getCurrentWindow } from '@tauri-apps/api/window'; +import { MinerMetrics } from '@app/types/app-status.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; const SysTrayCopy = { [CPU_HASH_ITEM_ID]: (cpu: string) => `CPU Hashrate: ${cpu}`, @@ -22,8 +21,10 @@ const SysTrayCopy = { [EARNINGS_ITEM_ID]: (earnings: string) => `Est earning: ${earnings} tXTM/day`, }; +const currentWindow = getCurrentWindow(); export function useUpdateSystemTray() { - const cachedMetrics = useRef(); + const metrics = useMiningMetricsStore((s) => s); + const deferredMetrics = useDeferredValue(metrics); const minimizedRef = useRef(); const updateMenuItemEnabled = useCallback(async (itemId: string, enabled: boolean) => { @@ -39,50 +40,42 @@ export function useUpdateSystemTray() { }, []); const updateMenuItem = useCallback(async (itemId: string, itemText: string) => { - const item = await menu.get(itemId); + const item = await menu?.get(itemId); if (item && itemText) { - await item.setText(itemText); + await item?.setText(itemText); } }, []); - useEffect(() => { - const handleUpdateMenu = () => { - const { cpu, gpu } = cachedMetrics.current || {}; + const handleUpdateMenu = useCallback( + async (metrics: MinerMetrics) => { + const { cpu, gpu } = metrics || {}; + const minimized = await currentWindow.isMinimized(); + + if (minimizedRef.current !== minimized) { + minimizedRef.current = minimized; + await updateMenuItemEnabled(UNMINIMIZE_ITEM_ID, minimized); + await updateMenuItemEnabled(MINIMIZE_ITEM_ID, !minimized); + } // --- Update CPU const cpuHashItemText = cpu?.mining?.hash_rate ? `${formatHashrate(cpu?.mining?.hash_rate)}` : '-'; - updateMenuItem(CPU_HASH_ITEM_ID, SysTrayCopy[CPU_HASH_ITEM_ID](cpuHashItemText)); + await updateMenuItem(CPU_HASH_ITEM_ID, SysTrayCopy[CPU_HASH_ITEM_ID](cpuHashItemText)); // --- Update GPU const gpuHashItemText = gpu?.mining?.hash_rate ? `${formatHashrate(gpu?.mining?.hash_rate)}` : '-'; - updateMenuItem(GPU_HASH_ITEM_ID, SysTrayCopy[GPU_HASH_ITEM_ID](gpuHashItemText)); + await updateMenuItem(GPU_HASH_ITEM_ID, SysTrayCopy[GPU_HASH_ITEM_ID](gpuHashItemText)); // --- Update Total const cpu_est = cpu?.mining?.estimated_earnings || 0; const gpu_est = gpu?.mining?.estimated_earnings || 0; const total = cpu_est + gpu_est; const totalFormatted = total > 0 ? formatNumber(total, FormatPreset.TXTM_COMPACT) : '-'; - updateMenuItem(EARNINGS_ITEM_ID, SysTrayCopy[EARNINGS_ITEM_ID](totalFormatted)); - }; - handleUpdateMenu(); - const interval = setInterval(handleUpdateMenu, 1000 * 10); // 10s - - return () => clearInterval(interval); - }, [updateMenuItem]); + await updateMenuItem(EARNINGS_ITEM_ID, SysTrayCopy[EARNINGS_ITEM_ID](totalFormatted)); + }, + [updateMenuItem, updateMenuItemEnabled] + ); useEffect(() => { - const ul = listen('miner_metrics', async ({ payload }) => { - if (payload) { - cachedMetrics.current = { ...payload } as MinerMetrics; - } - - const minimized = await currentWindow.isMinimized(); - if (minimizedRef.current !== minimized) { - minimizedRef.current = minimized; - await updateMenuItemEnabled(UNMINIMIZE_ITEM_ID, minimized); - await updateMenuItemEnabled(MINIMIZE_ITEM_ID, !minimized); - } - }); - return () => { - ul.then((unlisten) => unlisten()); - }; - }, [updateMenuItemEnabled]); + if (deferredMetrics && metrics !== deferredMetrics) { + handleUpdateMenu(deferredMetrics); + } + }, [deferredMetrics, handleUpdateMenu, metrics]); } diff --git a/src/hooks/mining/index.ts b/src/hooks/mining/index.ts index 9370dfdb7..3f934cdbb 100644 --- a/src/hooks/mining/index.ts +++ b/src/hooks/mining/index.ts @@ -3,4 +3,3 @@ export * from './useEarningsRecap.ts'; export * from './useMiningMetricsUpdater.ts'; export * from './useMiningStatesSync.ts'; export * from './useMiningUiStateMachine.ts'; -export * from './useTransactions.ts'; diff --git a/src/hooks/mining/useBlockInfo.ts b/src/hooks/mining/useBlockInfo.ts index 3c97746b9..81df24609 100644 --- a/src/hooks/mining/useBlockInfo.ts +++ b/src/hooks/mining/useBlockInfo.ts @@ -1,10 +1,10 @@ import { useEffect, useMemo, useRef } from 'react'; -import { useMiningStore } from '@app/store/useMiningStore.ts'; import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore'; import calculateTimeSince from '@app/utils/calculateTimeSince.ts'; import { useInterval } from '../helpers/useInterval'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; const INTERVAL = 1000; // 1 sec @@ -12,7 +12,7 @@ export function useBlockInfo() { const setDisplayBlockTime = useBlockchainVisualisationStore((s) => s.setDisplayBlockTime); const setDebugBlockTime = useBlockchainVisualisationStore((s) => s.setDebugBlockTime); const displayBlockHeight = useBlockchainVisualisationStore((s) => s.displayBlockHeight); - const block_time = useMiningStore((s) => s.base_node.block_time); + const block_time = useMiningMetricsStore((s) => s.base_node.block_time); const diff = useMemo(() => { const now = new Date(); diff --git a/src/hooks/mining/useEarningsRecap.ts b/src/hooks/mining/useEarningsRecap.ts index a4b5d3652..0d3749764 100644 --- a/src/hooks/mining/useEarningsRecap.ts +++ b/src/hooks/mining/useEarningsRecap.ts @@ -1,14 +1,10 @@ -import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore.ts'; +import { handleWinRecap, useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore.ts'; import { useCallback, useEffect } from 'react'; import { listen } from '@tauri-apps/api/event'; -import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { useWalletStore } from '@app/store/useWalletStore.ts'; -import { debounce } from '@app/utils/debounce'; -const appWindow = getCurrentWebviewWindow(); export default function useEarningsRecap() { const recapIds = useBlockchainVisualisationStore((s) => s.recapIds); - const handleWinRecap = useBlockchainVisualisationStore((s) => s.handleWinRecap); const transactions = useWalletStore((s) => s.transactions); const getMissedEarnings = useCallback(() => { @@ -21,26 +17,15 @@ export default function useEarningsRecap() { handleWinRecap({ count, totalEarnings }); } } - // eslint-disable-next-line react-hooks/exhaustive-deps }, [recapIds, transactions]); useEffect(() => { - // Debounced function to check if the window is minimized - const debouncedIsMinimized = debounce(async () => { - const minimized = await appWindow?.isMinimized(); + const listener = listen('tauri://focus', () => { const documentIsVisible = document?.visibilityState === 'visible' || false; - if (documentIsVisible && !minimized) { + if (documentIsVisible) { getMissedEarnings(); } - }, 1000); // 1 second debounce - - const listener = listen( - 'tauri://focus', - () => { - debouncedIsMinimized(); - }, - { target: { kind: 'WebviewWindow', label: 'main' } } - ); + }); return () => { listener.then((unlisten) => unlisten()); diff --git a/src/hooks/mining/useMiningMetricsUpdater.ts b/src/hooks/mining/useMiningMetricsUpdater.ts index 9eb6fb801..1506c9e51 100644 --- a/src/hooks/mining/useMiningMetricsUpdater.ts +++ b/src/hooks/mining/useMiningMetricsUpdater.ts @@ -1,26 +1,23 @@ -import { useCallback } from 'react'; +import { useCallback, useDeferredValue } from 'react'; import { MinerMetrics } from '@app/types/app-status'; - +import { handleNewBlock, useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; import { setAnimationState } from '@app/visuals.ts'; -import { useMiningStore } from '@app/store/useMiningStore'; -import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore.ts'; - -import useFetchTx from './useTransactions.ts'; export default function useMiningMetricsUpdater() { - const fetchTx = useFetchTx(); - const currentBlockHeight = useMiningStore((s) => s.base_node.block_height); - const baseNodeConnected = useMiningStore((s) => s.base_node.is_connected); - const setMiningMetrics = useMiningStore((s) => s.setMiningMetrics); - const handleNewBlock = useBlockchainVisualisationStore((s) => s.handleNewBlock); + const setMiningMetrics = useMiningMetricsStore((s) => s.setMiningMetrics); + const currentBlockHeight = useMiningMetricsStore((s) => s.base_node.block_height); + const baseNodeConnected = useMiningMetricsStore((s) => s.base_node.is_connected); + const displayBlockHeight = useBlockchainVisualisationStore((s) => s.displayBlockHeight); const setDisplayBlockHeight = useBlockchainVisualisationStore((s) => s.setDisplayBlockHeight); + const deferredblock = useDeferredValue(currentBlockHeight); + return useCallback( async (metrics: MinerMetrics) => { if (metrics) { const isMining = metrics.cpu?.mining.is_mining || metrics.gpu?.mining.is_mining; - // Pause animation when lost connection to the Tari Network if (isMining) { if (!metrics.base_node?.is_connected && baseNodeConnected) { @@ -32,27 +29,24 @@ export default function useMiningMetricsUpdater() { } const blockHeight = metrics.base_node.block_height; - if (blockHeight > 0 && currentBlockHeight > 0 && blockHeight > currentBlockHeight) { + const isNewBlock = blockHeight > 0 && deferredblock > 0 && blockHeight > deferredblock; + + if (isNewBlock) { try { - fetchTx() - .then(async () => { - await handleNewBlock(blockHeight, isMining); - }) - .catch(() => { - setDisplayBlockHeight(blockHeight); - }); + await handleNewBlock(blockHeight, isMining); } catch (_) { setDisplayBlockHeight(blockHeight); + } finally { + setMiningMetrics(metrics); } } else { if (blockHeight && !displayBlockHeight) { setDisplayBlockHeight(blockHeight); } + setMiningMetrics(metrics); } - setMiningMetrics(metrics); } }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [baseNodeConnected, currentBlockHeight, displayBlockHeight, fetchTx] + [baseNodeConnected, deferredblock, displayBlockHeight, setDisplayBlockHeight, setMiningMetrics] ); } diff --git a/src/hooks/mining/useMiningStatesSync.ts b/src/hooks/mining/useMiningStatesSync.ts index 52dcc6228..0cbec71b7 100644 --- a/src/hooks/mining/useMiningStatesSync.ts +++ b/src/hooks/mining/useMiningStatesSync.ts @@ -1,4 +1,4 @@ -import { MinerMetrics } from '@app/types/app-status'; +import { MinerMetrics, TariWalletDetails } from '@app/types/app-status'; import { listen } from '@tauri-apps/api/event'; import { useEffect, useRef } from 'react'; @@ -13,32 +13,38 @@ import { deepEqual } from '@app/utils/objectDeepEqual.ts'; export function useMiningStatesSync() { const handleMiningMetrics = useMiningMetricsUpdater(); - const fetchWalletDetails = useWalletStore((s) => s.fetchWalletDetails); + const setWalletDetails = useWalletStore((s) => s.setWalletDetails); const setupProgress = useAppStateStore((s) => s.setupProgress); const isSettingUp = useAppStateStore((s) => s.isSettingUp); - const prevPayload = useRef(); + const prevMetricsPayload = useRef(); + const prevWalletPayload = useRef(); useBlockInfo(); useUiMiningStateMachine(); useEarningsRecap(); - // intervalItems useEffect(() => { if (setupProgress < 0.75) return; - const fetchInterval = setInterval(fetchWalletDetails, 1000); + const ul = listen('wallet_details', ({ payload }) => { + if (!payload) return; + const payloadChanged = !deepEqual(payload as TariWalletDetails, prevWalletPayload.current); + if (payloadChanged) { + prevWalletPayload.current = payload as TariWalletDetails; + setWalletDetails(payload as TariWalletDetails); + } + }); return () => { - clearInterval(fetchInterval); + ul.then((unlisten) => unlisten()); }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [setupProgress]); + }, [setWalletDetails, setupProgress]); useEffect(() => { if (isSettingUp) return; const ul = listen('miner_metrics', async ({ payload }) => { if (!payload) return; - const payloadChanged = !deepEqual(payload as MinerMetrics, prevPayload.current); + const payloadChanged = !deepEqual(payload as MinerMetrics, prevMetricsPayload.current); if (payloadChanged) { - prevPayload.current = payload as MinerMetrics; + prevMetricsPayload.current = payload as MinerMetrics; await handleMiningMetrics(payload as MinerMetrics); } }); diff --git a/src/hooks/mining/useMiningUiStateMachine.ts b/src/hooks/mining/useMiningUiStateMachine.ts index c25b24117..bf90a2c9b 100644 --- a/src/hooks/mining/useMiningUiStateMachine.ts +++ b/src/hooks/mining/useMiningUiStateMachine.ts @@ -2,13 +2,13 @@ import { useAppStateStore } from '@app/store/appStateStore'; import { useMiningStore } from '@app/store/useMiningStore'; import { setAnimationState } from '@app/visuals'; import { useEffect } from 'react'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; export const useUiMiningStateMachine = () => { const isMiningInitiated = useMiningStore((s) => s.miningInitiated); const isChangingMode = useMiningStore((s) => s.isChangingMode); - const isReplaying = useMiningStore((s) => s.isReplaying); - const cpuIsMining = useMiningStore((s) => s.cpu.mining.is_mining); - const gpuIsMining = useMiningStore((s) => s.gpu.mining.is_mining); + const cpuIsMining = useMiningMetricsStore((s) => s.cpu.mining.is_mining); + const gpuIsMining = useMiningMetricsStore((s) => s.gpu.mining.is_mining); const isSettingUp = useAppStateStore((s) => s.isSettingUp); const isMining = cpuIsMining || gpuIsMining; @@ -24,10 +24,10 @@ export const useUiMiningStateMachine = () => { useEffect(() => { const notStopped = window?.glApp?.stateManager?.status !== 'not-started'; - const preventStop = isSettingUp || isMiningInitiated || isChangingMode || isReplaying; + const preventStop = isSettingUp || isMiningInitiated || isChangingMode; const shouldStop = !isMining && notStopped && !preventStop; if (shouldStop) { setAnimationState('stop'); } - }, [statusIndex, isSettingUp, isMiningInitiated, isMining, isChangingMode, isReplaying]); + }, [statusIndex, isSettingUp, isMiningInitiated, isMining, isChangingMode]); }; diff --git a/src/hooks/mining/useTransactions.ts b/src/hooks/mining/useTransactions.ts deleted file mode 100644 index c92c89a56..000000000 --- a/src/hooks/mining/useTransactions.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ALREADY_FETCHING } from '@app/App/sentryIgnore'; -import { useCallback } from 'react'; -import { invoke } from '@tauri-apps/api/core'; -import { useAppStateStore } from '@app/store/appStateStore.ts'; -import { useWalletStore } from '@app/store/useWalletStore.ts'; - -export default function useFetchTx() { - const isTransactionLoading = useWalletStore((s) => s.isTransactionLoading); - const setTransactionsLoading = useWalletStore((s) => s.setTransactionsLoading); - const setupProgress = useAppStateStore((s) => s.setupProgress); - const setTransactions = useWalletStore((s) => s.setTransactions); - - return useCallback(async () => { - if (isTransactionLoading || setupProgress < 0.75) return; - setTransactionsLoading(true); - - try { - const txs = await invoke('get_transaction_history'); - const sortedTransactions = txs.sort((a, b) => b.timestamp - a.timestamp); - if (sortedTransactions?.length) { - setTransactions(sortedTransactions); - } - setTransactionsLoading(false); - } catch (error) { - setTransactionsLoading(false); - - if (error !== ALREADY_FETCHING.HISTORY) { - console.error('Could not get transaction history: ', error); - } - } finally { - setTransactionsLoading(false); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isTransactionLoading, setupProgress]); -} diff --git a/src/store/appStateStore.ts b/src/store/appStateStore.ts index 47065e268..22b941fb3 100644 --- a/src/store/appStateStore.ts +++ b/src/store/appStateStore.ts @@ -3,8 +3,9 @@ import { setAnimationState } from '@app/visuals'; import { create } from './create'; import { invoke } from '@tauri-apps/api/core'; import { useAppConfigStore } from './useAppConfigStore'; -import { useMiningStore } from './useMiningStore'; + import { addToast } from '@app/components/ToastStack/useToastStore'; +import { startMining } from '@app/store/miningStoreActions.ts'; interface AppState { criticalError?: string; @@ -65,7 +66,6 @@ export const useAppStateStore = create()((set, getState) => ({ // Proceed with auto mining when enabled const { mine_on_app_start, cpu_mining_enabled, gpu_mining_enabled } = useAppConfigStore.getState(); if (mine_on_app_start && (cpu_mining_enabled || gpu_mining_enabled)) { - const startMining = useMiningStore.getState().startMining; await startMining(); } set({ isSettingUp: false }); diff --git a/src/store/miningStoreActions.ts b/src/store/miningStoreActions.ts new file mode 100644 index 000000000..56a9c1949 --- /dev/null +++ b/src/store/miningStoreActions.ts @@ -0,0 +1,87 @@ +import { invoke } from '@tauri-apps/api/core'; +import { useAppStateStore } from '@app/store/appStateStore.ts'; +import { useBlockchainVisualisationStore } from '@app/store/useBlockchainVisualisationStore.ts'; +import { useMiningStore } from '@app/store/useMiningStore.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; +import { useAppConfigStore } from '@app/store/useAppConfigStore.ts'; +import { modeType } from '@app/store/types.ts'; +import { GpuThreads } from '@app/types/app-status.ts'; + +interface ChangeMiningModeArgs { + mode: modeType; + customGpuLevels?: GpuThreads[]; + customCpuLevels?: number; +} + +const stopMining = async () => { + console.info('Mining stopping...'); + useMiningStore.setState({ miningInitiated: false }); + try { + await invoke('stop_mining', {}); + console.info('Mining stopped.'); + } catch (e) { + const appStateStore = useAppStateStore.getState(); + console.error('Failed to stop mining: ', e); + appStateStore.setError(e as string); + useMiningStore.setState({ miningInitiated: true }); + } +}; +const startMining = async () => { + console.info('Mining starting....'); + useMiningStore.setState({ miningInitiated: true }); + useBlockchainVisualisationStore + .getState() + .setDisplayBlockTime({ daysString: '', hoursString: '', minutes: '00', seconds: '00' }); + try { + await invoke('start_mining', {}); + console.info('Mining started.'); + } catch (e) { + const appStateStore = useAppStateStore.getState(); + console.error('Failed to start mining: ', e); + appStateStore.setError(e as string); + useMiningStore.setState({ miningInitiated: false }); + } +}; +const pauseMining = async () => { + console.info('Mining pausing...'); + try { + await invoke('stop_mining', {}); + console.info('Mining paused.'); + } catch (e) { + const appStateStore = useAppStateStore.getState(); + console.error('Failed to pause (stop) mining: ', e); + appStateStore.setError(e as string); + useMiningStore.setState({ miningInitiated: true }); + } +}; + +const changeMiningMode = async (params: ChangeMiningModeArgs) => { + const { mode, customGpuLevels, customCpuLevels } = params; + console.info(`Changing mode to ${mode}...`); + const metricsState = useMiningMetricsStore.getState(); + useMiningStore.setState({ isChangingMode: true }); + + if (metricsState.cpu.mining.is_mining || metricsState.gpu.mining.is_mining) { + console.info('Pausing mining...'); + await pauseMining(); + } + try { + const appConfigState = useAppConfigStore.getState(); + await appConfigState.setMode({ + mode: mode as modeType, + customGpuLevels: customGpuLevels || [], + customCpuLevels, + }); + console.info(`Mode changed to ${mode}`); + if (useMiningStore.getState().miningInitiated) { + console.info('Restarting mining...'); + await startMining(); + } + } catch (e) { + console.error('Failed to change mode: ', e); + } finally { + useMiningStore.setState({ isChangingMode: false }); + } +}; + +export { startMining, pauseMining, stopMining, changeMiningMode }; diff --git a/src/store/useAppConfigStore.ts b/src/store/useAppConfigStore.ts index adeefed24..18d5c8e28 100644 --- a/src/store/useAppConfigStore.ts +++ b/src/store/useAppConfigStore.ts @@ -7,6 +7,8 @@ import { Language } from '@app/i18initializer.ts'; import { useMiningStore } from '@app/store/useMiningStore.ts'; import { changeLanguage } from 'i18next'; import { useUIStore } from '@app/store/useUIStore.ts'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; +import { pauseMining, startMining, stopMining } from '@app/store/miningStoreActions.ts'; type State = Partial; interface SetModeProps { @@ -139,15 +141,16 @@ export const useAppConfigStore = create()((set, getState) = setCpuMiningEnabled: async (enabled) => { set({ cpu_mining_enabled: enabled }); const miningState = useMiningStore.getState(); - if (miningState.cpu.mining.is_mining || miningState.gpu.mining.is_mining) { - await miningState.pauseMining(); + const metricsState = useMiningMetricsStore.getState(); + if (metricsState.cpu.mining.is_mining || metricsState.gpu.mining.is_mining) { + await pauseMining(); } invoke('set_cpu_mining_enabled', { enabled }) .then(async () => { - if (miningState.miningInitiated && (enabled || miningState.gpu.mining.is_mining)) { - await miningState.startMining(); + if (miningState.miningInitiated && (enabled || metricsState.gpu.mining.is_mining)) { + await startMining(); } else { - miningState.stopMining(); + await stopMining(); } }) .catch((e) => { @@ -158,26 +161,27 @@ export const useAppConfigStore = create()((set, getState) = if ( miningState.miningInitiated && - !miningState.cpu.mining.is_mining && - !miningState.gpu.mining.is_mining + !metricsState.cpu.mining.is_mining && + !metricsState.gpu.mining.is_mining ) { - miningState.stopMining(); + void stopMining(); } }); }, setGpuMiningEnabled: async (enabled) => { set({ gpu_mining_enabled: enabled }); const miningState = useMiningStore.getState(); - if (miningState.cpu.mining.is_mining || miningState.gpu.mining.is_mining) { - await miningState.pauseMining(); + const metricsState = useMiningMetricsStore.getState(); + if (metricsState.cpu.mining.is_mining || metricsState.gpu.mining.is_mining) { + await pauseMining(); } invoke('set_gpu_mining_enabled', { enabled }) .then(async () => { - if (miningState.miningInitiated && (miningState.cpu.mining.is_mining || enabled)) { - await miningState.startMining(); + if (miningState.miningInitiated && (metricsState.cpu.mining.is_mining || enabled)) { + await startMining(); } else { - miningState.stopMining(); + void stopMining(); } }) .catch((e) => { @@ -188,10 +192,10 @@ export const useAppConfigStore = create()((set, getState) = if ( miningState.miningInitiated && - !miningState.cpu.mining.is_mining && - !miningState.gpu.mining.is_mining + !metricsState.cpu.mining.is_mining && + !metricsState.gpu.mining.is_mining ) { - miningState.stopMining(); + void stopMining(); } }); }, diff --git a/src/store/useBlockchainVisualisationStore.ts b/src/store/useBlockchainVisualisationStore.ts index ce70b69db..347f3ac87 100644 --- a/src/store/useBlockchainVisualisationStore.ts +++ b/src/store/useBlockchainVisualisationStore.ts @@ -1,12 +1,11 @@ import { create } from './create'; import { useMiningStore } from './useMiningStore.ts'; - -import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; +import { getCurrentWindow } from '@tauri-apps/api/window'; import { BlockTimeData } from '@app/types/mining.ts'; import { setAnimationState } from '@app/visuals.ts'; import { TransactionInfo } from '@app/types/app-status.ts'; -import { useWalletStore } from './useWalletStore.ts'; -const appWindow = getCurrentWebviewWindow(); +import { handleTransactions } from './useWalletStore.ts'; +const appWindow = getCurrentWindow(); interface Recap { count: number; @@ -26,14 +25,8 @@ interface State { interface WinAnimation { latestTx: TransactionInfo; canAnimate?: boolean; - isRecap?: boolean; } interface Actions { - handleWin: ({ latestTx, canAnimate, isRecap }: WinAnimation) => Promise; - handleWinRecap: (recapData: Recap) => void; - handleWinReplay: (txItem: TransactionInfo) => void; - handleFail: (blockHeight: number, canAnimate?: boolean) => Promise; - handleNewBlock: (newBlockHeight: number, isMining?: boolean) => Promise; setDisplayBlockHeight: (displayBlockHeight: number) => void; setDisplayBlockTime: (displayBlockTime: BlockTimeData) => void; setDebugBlockTime: (displayBlockTime: BlockTimeData) => void; @@ -42,111 +35,97 @@ interface Actions { type BlockchainVisualisationStoreState = State & Actions; -const checkCanAnimate = async () => { - const focused = await appWindow?.isFocused(); - const minimized = await appWindow?.isMinimized(); - const documentIsVisible = document?.visibilityState === 'visible' || false; - - return !minimized && (focused || documentIsVisible); -}; - -function getSuccessTier(earnings: number) { +const getSuccessTier = (earnings: number) => { const humanValue = earnings / 1_000_000; - if (humanValue < 100) { return 'success'; } - if (humanValue <= 1000) { return 'success2'; } - return 'success3'; -} +}; -export const useBlockchainVisualisationStore = create()((set, getState) => ({ +export const useBlockchainVisualisationStore = create()((set) => ({ recapIds: [], - handleWinRecap: (recapData) => { + + setDisplayBlockHeight: (displayBlockHeight) => set({ displayBlockHeight }), + setDisplayBlockTime: (displayBlockTime) => set({ displayBlockTime }), + setDebugBlockTime: (debugBlockTime) => set({ debugBlockTime }), + setRecapCount: (recapCount) => set({ recapCount }), +})); + +const handleWin = async ({ latestTx, canAnimate }: WinAnimation) => { + const blockHeight = Number(latestTx?.mined_in_block_height); + const earnings = latestTx.amount; + + console.info(`Block #${blockHeight} mined! Earnings: ${earnings}`); + + if (canAnimate) { useMiningStore.getState().setMiningControlsEnabled(false); - const successTier = getSuccessTier(recapData.totalEarnings); + const successTier = getSuccessTier(earnings); + setAnimationState(successTier); - set({ recapData, recapCount: recapData.count }); + useBlockchainVisualisationStore.setState({ earnings }); setTimeout(() => { useMiningStore.getState().setMiningControlsEnabled(true); - set({ recapData: undefined, recapIds: [] }); + useBlockchainVisualisationStore.setState({ displayBlockHeight: blockHeight, earnings: undefined }); }, 2000); - }, - handleWinReplay: (txItem) => { - useMiningStore.getState().setIsReplaying(true); - const isAnimating = window.glApp.stateManager.status == 'free'; - const earnings = txItem.amount; - const successTier = getSuccessTier(earnings); - const handleReplay = () => { - set({ replayItem: txItem }); - setAnimationState(successTier); - setTimeout(() => { - set({ replayItem: undefined }); - useMiningStore.getState().setIsReplaying(false); - }, 1500); - }; - if (!isAnimating) { - setAnimationState('start'); - setTimeout(() => { - handleReplay(); - }, 1500); - } else { - handleReplay(); - } - }, - handleWin: async ({ latestTx, canAnimate }) => { - const blockHeight = Number(latestTx?.mined_in_block_height); - const earnings = latestTx.amount; - - console.info(`Block #${blockHeight} mined! Earnings: ${earnings}`); + } else { + useBlockchainVisualisationStore.setState((curr) => ({ + recapIds: [...curr.recapIds, latestTx.tx_id], + displayBlockHeight: blockHeight, + earnings: undefined, + })); + } +}; +const handleFail = async (blockHeight: number, canAnimate: boolean) => { + if (canAnimate) { + useMiningStore.getState().setMiningControlsEnabled(false); + setAnimationState('fail'); + setTimeout(() => { + useMiningStore.getState().setMiningControlsEnabled(true); + useBlockchainVisualisationStore.setState({ displayBlockHeight: blockHeight }); + }, 1000); + } else { + useBlockchainVisualisationStore.setState({ displayBlockHeight: blockHeight }); + } +}; - if (canAnimate) { - useMiningStore.getState().setMiningControlsEnabled(false); - const successTier = getSuccessTier(earnings); +export const handleWinRecap = (recapData: Recap) => { + useMiningStore.getState().setMiningControlsEnabled(false); + const successTier = getSuccessTier(recapData.totalEarnings); + setAnimationState(successTier); + useBlockchainVisualisationStore.setState({ recapData, recapCount: recapData.count }); + setTimeout(() => { + useMiningStore.getState().setMiningControlsEnabled(true); + useBlockchainVisualisationStore.setState({ recapData: undefined, recapIds: [] }); + }, 2000); +}; +export const handleWinReplay = (txItem: TransactionInfo) => { + const earnings = txItem.amount; + const successTier = getSuccessTier(earnings); + useBlockchainVisualisationStore.setState({ replayItem: txItem }); + setAnimationState(successTier, true); + setTimeout(() => { + useBlockchainVisualisationStore.setState({ replayItem: undefined }); + }, 1500); +}; +export const handleNewBlock = async (newBlockHeight: number, isMining?: boolean) => { + if (isMining) { + const tx = await handleTransactions(); + const minimized = await appWindow?.isMinimized(); + const documentIsVisible = document?.visibilityState === 'visible' || false; + const canAnimate = !minimized && documentIsVisible; + const latestTx = tx?.[0]; + const latestTxBlock = latestTx?.mined_in_block_height; - setAnimationState(successTier); - set({ earnings }); - setTimeout(() => { - useMiningStore.getState().setMiningControlsEnabled(true); - set({ displayBlockHeight: blockHeight, earnings: undefined }); - }, 2000); + if (latestTx && latestTxBlock === newBlockHeight) { + await handleWin({ latestTx, canAnimate }); } else { - set((curr) => ({ recapIds: [...curr.recapIds, latestTx.tx_id] })); - set({ displayBlockHeight: blockHeight, earnings: undefined }); + await handleFail(newBlockHeight, canAnimate); } - }, - handleFail: async (blockHeight, canAnimate) => { - if (canAnimate) { - useMiningStore.getState().setMiningControlsEnabled(false); - setAnimationState('fail'); - setTimeout(() => { - useMiningStore.getState().setMiningControlsEnabled(true); - set({ displayBlockHeight: blockHeight }); - }, 1000); - } else { - set({ displayBlockHeight: blockHeight }); - } - }, - handleNewBlock: async (newBlockHeight, isMining) => { - if (isMining) { - const canAnimate = await checkCanAnimate(); - const latestTransaction = useWalletStore.getState().transactions?.[0]; - const latestTxBlock = latestTransaction?.message?.split(': ')?.[1]; - if (latestTxBlock === newBlockHeight.toString()) { - await getState().handleWin({ latestTx: latestTransaction, canAnimate }); - } else { - await getState().handleFail(newBlockHeight, canAnimate); - } - } else { - set({ displayBlockHeight: newBlockHeight }); - } - }, - setDisplayBlockHeight: (displayBlockHeight) => set({ displayBlockHeight }), - setDisplayBlockTime: (displayBlockTime) => set({ displayBlockTime }), - setDebugBlockTime: (debugBlockTime) => set({ debugBlockTime }), - setRecapCount: (recapCount) => set({ recapCount }), -})); + } else { + useBlockchainVisualisationStore.setState({ displayBlockHeight: newBlockHeight }); + } +}; diff --git a/src/store/useMiningMetricsStore.ts b/src/store/useMiningMetricsStore.ts new file mode 100644 index 000000000..5ad3a8b69 --- /dev/null +++ b/src/store/useMiningMetricsStore.ts @@ -0,0 +1,43 @@ +import { MinerMetrics } from '@app/types/app-status'; +import { create } from './create'; + +interface Actions { + setMiningMetrics: (metrics: MinerMetrics) => void; +} + +type MiningMetricsStoreState = MinerMetrics & Actions; + +const initialState: MinerMetrics = { + cpu: { + hardware: [], + mining: { + is_mining: false, + hash_rate: 0, + estimated_earnings: 0, + connection: { is_connected: false }, + }, + }, + gpu: { + hardware: [], + mining: { + is_mining: false, + hash_rate: 0, + estimated_earnings: 0, + is_available: true, + }, + }, + sha_network_hash_rate: 0, + randomx_network_hash_rate: 0, + base_node: { + block_height: 0, + block_time: 0, + is_synced: false, + is_connected: false, + connected_peers: [], + }, +}; + +export const useMiningMetricsStore = create()((set) => ({ + ...initialState, + setMiningMetrics: (metrics) => set({ ...metrics }), +})); diff --git a/src/store/useMiningStore.ts b/src/store/useMiningStore.ts index 19cb329c3..8ca81d906 100644 --- a/src/store/useMiningStore.ts +++ b/src/store/useMiningStore.ts @@ -1,19 +1,17 @@ -import { GpuThreads, MaxConsumptionLevels, MinerMetrics } from '@app/types/app-status'; +import { MaxConsumptionLevels } from '@app/types/app-status'; import { create } from './create'; import * as Sentry from '@sentry/react'; import { invoke } from '@tauri-apps/api/core'; import { useAppStateStore } from './appStateStore'; -import { useAppConfigStore } from './useAppConfigStore'; -import { modeType } from './types'; -import { useBlockchainVisualisationStore } from './useBlockchainVisualisationStore'; +import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; +import { pauseMining, startMining } from '@app/store/miningStoreActions.ts'; -interface State extends MinerMetrics { +interface State { hashrateReady?: boolean; miningInitiated: boolean; miningControlsEnabled: boolean; isChangingMode: boolean; - isReplaying: boolean; excludedGpuDevices: number[]; counter: number; customLevelsDialogOpen: boolean; @@ -22,70 +20,32 @@ interface State extends MinerMetrics { } interface Actions { - setMiningMetrics: (metrics: MinerMetrics, isNewBlock?: boolean) => void; - startMining: () => Promise; - stopMining: () => Promise; - pauseMining: () => Promise; restartMining: () => Promise; - changeMiningMode: (params: { - mode: modeType; - customGpuLevels?: GpuThreads[]; - customCpuLevels?: number; - }) => Promise; setMiningNetwork: () => Promise; setMiningControlsEnabled: (miningControlsEnabled: boolean) => void; setIsChangingMode: (isChangingMode: boolean) => void; setExcludedGpuDevice: (excludeGpuDevice: number[]) => Promise; setCustomLevelsDialogOpen: (customLevelsDialogOpen: boolean) => void; - setIsReplaying: (isReplaying: boolean) => void; getMaxAvailableThreads: () => void; } type MiningStoreState = State & Actions; const initialState: State = { customLevelsDialogOpen: false, - sha_network_hash_rate: 0, - randomx_network_hash_rate: 0, maxAvailableThreads: undefined, counter: 0, hashrateReady: false, miningInitiated: false, isChangingMode: false, miningControlsEnabled: true, - isReplaying: false, + network: 'unknown', excludedGpuDevices: [], - cpu: { - hardware: [], - mining: { - is_mining: false, - hash_rate: 0, - estimated_earnings: 0, - connection: { is_connected: false }, - }, - }, - gpu: { - hardware: [], - mining: { - is_mining: false, - hash_rate: 0, - estimated_earnings: 0, - is_available: true, - }, - }, - base_node: { - block_height: 0, - block_time: 0, - is_synced: false, - is_connected: false, - connected_peers: [], - }, }; -export const useMiningStore = create()((set, getState) => ({ +export const useMiningStore = create()((set) => ({ ...initialState, setCustomLevelsDialogOpen: (customLevelsDialogOpen) => set({ customLevelsDialogOpen }), - setMiningMetrics: (metrics) => set({ ...metrics }), setMiningNetwork: async () => { try { const network = (await invoke('get_network', {})) as string; @@ -98,47 +58,6 @@ export const useMiningStore = create()((set, getState) => ({ set({ excludedGpuDevices: undefined }); } }, - startMining: async () => { - console.info('Mining starting....'); - set({ miningInitiated: true }); - useBlockchainVisualisationStore - .getState() - .setDisplayBlockTime({ daysString: '', hoursString: '', minutes: '00', seconds: '00' }); - try { - await invoke('start_mining', {}); - console.info('Mining started.'); - } catch (e) { - const appStateStore = useAppStateStore.getState(); - console.error('Failed to start mining: ', e); - appStateStore.setError(e as string); - set({ miningInitiated: false }); - } - }, - stopMining: async () => { - console.info('Mining stopping...'); - set({ miningInitiated: false }); - try { - await invoke('stop_mining', {}); - console.info('Mining stopped.'); - } catch (e) { - const appStateStore = useAppStateStore.getState(); - console.error('Failed to stop mining: ', e); - appStateStore.setError(e as string); - set({ miningInitiated: true }); - } - }, - pauseMining: async () => { - console.info('Mining pausing...'); - try { - await invoke('stop_mining', {}); - console.info('Mining paused.'); - } catch (e) { - const appStateStore = useAppStateStore.getState(); - console.error('Failed to pause (stop) mining: ', e); - appStateStore.setError(e as string); - set({ miningInitiated: true }); - } - }, getMaxAvailableThreads: async () => { console.info('Getting max available threads...'); try { @@ -150,46 +69,19 @@ export const useMiningStore = create()((set, getState) => ({ appStateStore.setError(e as string); } }, - changeMiningMode: async (params) => { - const { mode, customGpuLevels, customCpuLevels } = params; - console.info(`Changing mode to ${mode}...`); - const state = getState(); - set({ isChangingMode: true }); - if (state.cpu.mining.is_mining || state.gpu.mining.is_mining) { - console.info('Pausing mining...'); - await state.pauseMining(); - } - try { - const appConfigState = useAppConfigStore.getState(); - await appConfigState.setMode({ - mode: mode as modeType, - customGpuLevels: customGpuLevels || [], - customCpuLevels, - }); - console.info(`Mode changed to ${mode}`); - if (state.miningInitiated) { - console.info('Restarting mining...'); - await state.startMining(); - } - } catch (e) { - console.error('Failed to change mode: ', e); - } finally { - set({ isChangingMode: false }); - } - }, restartMining: async () => { - const state = getState(); + const state = useMiningMetricsStore.getState(); if (state.cpu.mining.is_mining || state.gpu.mining.is_mining) { console.info('Restarting mining...'); try { - await state.pauseMining(); + await pauseMining(); } catch (e) { console.error('Failed to pause(restart) mining: ', e); } try { - await state.startMining(); + await startMining(); } catch (e) { console.error('Failed to start(restart) mining: ', e); } @@ -197,7 +89,6 @@ export const useMiningStore = create()((set, getState) => ({ }, setMiningControlsEnabled: (miningControlsEnabled) => set({ miningControlsEnabled }), setIsChangingMode: (isChangingMode) => set({ isChangingMode }), - setIsReplaying: (isReplaying) => set({ isReplaying }), setExcludedGpuDevice: async (excludedGpuDevices) => { set({ excludedGpuDevices }); try { diff --git a/src/store/useWalletStore.ts b/src/store/useWalletStore.ts index c62b9005a..f02c30eac 100644 --- a/src/store/useWalletStore.ts +++ b/src/store/useWalletStore.ts @@ -1,7 +1,8 @@ -import { ALREADY_FETCHING } from '@app/App/sentryIgnore'; import { create } from './create'; -import { TransactionInfo, WalletBalance } from '../types/app-status.ts'; +import { TariWalletDetails, TransactionInfo, WalletBalance } from '../types/app-status.ts'; import { invoke } from '@tauri-apps/api/core'; +import { ALREADY_FETCHING } from '@app/App/sentryIgnore.ts'; +import { useAppStateStore } from '@app/store/appStateStore.ts'; interface State extends WalletBalance { tari_address_base58: string; @@ -14,7 +15,7 @@ interface State extends WalletBalance { } interface Actions { - fetchWalletDetails: () => Promise; + setWalletDetails: (tari_wallet_details: TariWalletDetails) => void; setTransactionsLoading: (isTransactionLoading: boolean) => void; setTransactions: (transactions?: TransactionInfo[]) => void; importSeedWords: (seedWords: string[]) => Promise; @@ -37,28 +38,21 @@ const initialState: State = { export const useWalletStore = create()((set) => ({ ...initialState, - fetchWalletDetails: async () => { - try { - const tari_wallet_details = await invoke('get_tari_wallet_details'); - const { - available_balance = 0, - timelocked_balance = 0, - pending_incoming_balance = 0, - } = tari_wallet_details.wallet_balance || {}; - // Q: Should we subtract pending_outgoing_balance here? - const newBalance = available_balance + timelocked_balance + pending_incoming_balance; //TM + setWalletDetails: (tari_wallet_details) => { + const { + available_balance = 0, + timelocked_balance = 0, + pending_incoming_balance = 0, + } = tari_wallet_details.wallet_balance || {}; + // Q: Should we subtract pending_outgoing_balance here? + const newBalance = available_balance + timelocked_balance + pending_incoming_balance; //TM - set({ - ...tari_wallet_details.wallet_balance, - tari_address_base58: tari_wallet_details.tari_address_base58, - tari_address_emoji: tari_wallet_details.tari_address_emoji, - balance: tari_wallet_details?.wallet_balance ? newBalance : null, - }); - } catch (error) { - if (error !== ALREADY_FETCHING.BALANCE) { - console.error('Could not get tari wallet details: ', error); - } - } + set({ + ...tari_wallet_details.wallet_balance, + tari_address_base58: tari_wallet_details.tari_address_base58, + tari_address_emoji: tari_wallet_details.tari_address_emoji, + balance: tari_wallet_details?.wallet_balance ? newBalance : null, + }); }, setTransactions: (transactions) => set({ transactions }), setTransactionsLoading: (isTransactionLoading) => set({ isTransactionLoading }), @@ -71,3 +65,28 @@ export const useWalletStore = create()((set) => ({ } }, })); + +export const handleTransactions = async () => { + let transactions: TransactionInfo[] = []; + const setupProgress = useAppStateStore.getState().setupProgress; + if (useWalletStore.getState().isTransactionLoading || setupProgress < 0.75) { + return; + } + try { + useWalletStore.setState({ isTransactionLoading: true }); + const txs = await invoke('get_transaction_history'); + const sortedTransactions = txs.sort((a, b) => b.timestamp - a.timestamp); + if (sortedTransactions?.length) { + useWalletStore.setState({ transactions: sortedTransactions }); + transactions = sortedTransactions; + } + } catch (error) { + if (error !== ALREADY_FETCHING.HISTORY) { + console.error('Could not get transaction history: ', error); + } + } finally { + useWalletStore.setState({ isTransactionLoading: false }); + } + + return transactions; +}; diff --git a/src/utils/systray.ts b/src/utils/systray.ts index 7a2e0a317..4348c8814 100644 --- a/src/utils/systray.ts +++ b/src/utils/systray.ts @@ -1,6 +1,6 @@ import { Menu } from '@tauri-apps/api/menu'; import { TrayIcon } from '@tauri-apps/api/tray'; -import { MenuItemOptions } from '@tauri-apps/api/menu/menuItem'; + import { PredefinedMenuItemOptions } from '@tauri-apps/api/menu/predefinedMenuItem'; import { getCurrentWindow } from '@tauri-apps/api/window'; @@ -22,74 +22,63 @@ const separator = { const currentWindow = getCurrentWindow(); -async function handleMinimize(itemId: string): Promise { - if (itemId === UNMINIMIZE_ITEM_ID) { - await currentWindow.unminimize(); - } - - if (itemId === MINIMIZE_ITEM_ID) { - await currentWindow.minimize(); - } -} - -// TODO use translations -const dynamicItems = [ - { - id: CPU_HASH_ITEM_ID, - text: `CPU Hashrate: -`, - enabled: false, - }, - { - id: GPU_HASH_ITEM_ID, - text: `GPU Hashrate: -`, - enabled: false, - }, - separator, - { - id: EARNINGS_ITEM_ID, - text: `Est earning: -`, - enabled: false, - }, - separator, - { - id: UNMINIMIZE_ITEM_ID, - text: 'Uninimize', - enabled: false, - action: handleMinimize, - }, - { - id: MINIMIZE_ITEM_ID, - text: 'Minimize', - enabled: true, - action: handleMinimize, - }, -] as MenuItemOptions[]; - let tray: TrayIcon | null; let menu: Menu; export async function initSystray() { - try { - menu = await Menu.new({ - id: TRAY_MENU_ID, - items: [about, separator, ...dynamicItems], - }); - } catch (e) { - console.error('Menu error: ', e); - } - - try { - tray = await TrayIcon.getById(TRAY_ID); - } catch (e) { - console.error('TrayIcon error: ', e); - } + const newMenu = await Menu.new({ + id: TRAY_MENU_ID, + items: [ + about, + separator, + { + id: CPU_HASH_ITEM_ID, + text: `CPU Hashrate: -`, + enabled: false, + }, + { + id: GPU_HASH_ITEM_ID, + text: `GPU Hashrate: -`, + enabled: false, + }, + separator, + { + id: EARNINGS_ITEM_ID, + text: `Est earning: -`, + enabled: false, + }, + separator, + { + id: UNMINIMIZE_ITEM_ID, + text: 'Unminimize', + enabled: false, + action: () => { + currentWindow.unminimize(); + }, + }, + { + id: MINIMIZE_ITEM_ID, + text: 'Minimize', + enabled: true, + action: () => { + currentWindow.minimize(); + }, + }, + ], + }); + const configTray = await TrayIcon.getById(TRAY_ID); - try { - if (tray && menu) { - await tray?.setMenu(menu); - } - } catch (e) { - console.error('Set TrayIcon Menu error: ', e); + if (configTray && newMenu) { + configTray + ?.setMenu(newMenu) + .then(() => { + menu = newMenu; + tray = configTray; + }) + .catch((e) => { + console.error('TrayIcon error:', e); + configTray.close(); + }); } } diff --git a/src/visuals.ts b/src/visuals.ts index 1e1c09847..f785ab94b 100644 --- a/src/visuals.ts +++ b/src/visuals.ts @@ -26,8 +26,8 @@ export const animationDarkBg = [ { property: 'particlesSize', value: 0.02 }, ]; -export function setAnimationState(newState: GlAppState) { - window.glApp.setState(newState); +export function setAnimationState(newState: GlAppState, isReplay = false) { + window.glApp.setState(newState, isReplay); } interface Property {