shieldcortex 2.20.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -122
- package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +5 -5
- package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +4 -4
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/page/build-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/page/react-loadable-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_next_dist_esm_build_templates_app-page_f7d4354e.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_next_dist_fe6a9400._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__c95102dd._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_1cd9d700._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +11 -0
- package/dashboard/.next/standalone/dashboard/.next/server/middleware-build-manifest.js +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{d334b69bff7779be.js → 215ce64499260c25.js} +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{acf32ffeb20e4854.js → 39e59c45c12073c2.js} +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/3cc7e8d4f73cf5d2.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{da96df828f9a0188.js → 6ba7a5c1a80a6791.js} +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{fc4e920d4281c89e.js → 7d08316952ccdcef.js} +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/be6970da20a17c0b.js +9 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/da64d159c042f5ae.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/e63d2228780629dd.css +3 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/f69fd1c5e71fbbfd.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{26118d592a545e00.js → fa5217550a8ab9a6.js} +2 -2
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{turbopack-7cf1ece01d32a474.js → turbopack-c2d84e7d37269ac1.js} +1 -1
- package/dist/api/control.d.ts +0 -1
- package/dist/api/control.js +0 -1
- package/dist/api/events.d.ts +0 -1
- package/dist/api/events.js +0 -1
- package/dist/api/session-token.d.ts +0 -1
- package/dist/api/session-token.js +0 -1
- package/dist/api/version.d.ts +0 -1
- package/dist/api/version.js +0 -1
- package/dist/api/visualization-server.d.ts +0 -1
- package/dist/api/visualization-server.js +117 -3
- package/dist/audit/env-scanner.d.ts +0 -1
- package/dist/audit/env-scanner.js +0 -1
- package/dist/audit/index.d.ts +0 -1
- package/dist/audit/index.js +0 -1
- package/dist/audit/mcp-config-scanner.d.ts +0 -1
- package/dist/audit/mcp-config-scanner.js +0 -1
- package/dist/audit/memory-scanner.d.ts +0 -1
- package/dist/audit/memory-scanner.js +0 -1
- package/dist/audit/report-formatter.d.ts +0 -1
- package/dist/audit/report-formatter.js +0 -1
- package/dist/audit/rules-file-scanner.d.ts +0 -1
- package/dist/audit/rules-file-scanner.js +0 -1
- package/dist/audit/types.d.ts +0 -1
- package/dist/audit/types.js +0 -1
- package/dist/cli/audit.d.ts +0 -1
- package/dist/cli/audit.js +0 -1
- package/dist/cli/doctor.d.ts +0 -1
- package/dist/cli/doctor.js +0 -1
- package/dist/cli/iron-dome.d.ts +0 -1
- package/dist/cli/iron-dome.js +0 -1
- package/dist/cloud/cli.d.ts +0 -1
- package/dist/cloud/cli.js +0 -1
- package/dist/cloud/config.d.ts +0 -1
- package/dist/cloud/config.js +1 -2
- package/dist/cloud/iron-dome-sync.d.ts +0 -1
- package/dist/cloud/iron-dome-sync.js +0 -1
- package/dist/cloud/quarantine-sync.d.ts +0 -1
- package/dist/cloud/quarantine-sync.js +0 -1
- package/dist/cloud/sync-queue.d.ts +0 -1
- package/dist/cloud/sync-queue.js +0 -1
- package/dist/cloud/sync.d.ts +0 -1
- package/dist/cloud/sync.js +0 -1
- package/dist/cloud/verify.d.ts +0 -1
- package/dist/cloud/verify.js +0 -1
- package/dist/context/project-context.d.ts +0 -1
- package/dist/context/project-context.js +0 -1
- package/dist/database/init.d.ts +0 -1
- package/dist/database/init.js +0 -1
- package/dist/defence/audit/export.d.ts +0 -1
- package/dist/defence/audit/export.js +0 -1
- package/dist/defence/audit/index.d.ts +0 -1
- package/dist/defence/audit/index.js +0 -1
- package/dist/defence/audit/logger.d.ts +0 -1
- package/dist/defence/audit/logger.js +0 -1
- package/dist/defence/audit/queries.d.ts +22 -1
- package/dist/defence/audit/queries.js +179 -1
- package/dist/defence/credential-leak/entropy.d.ts +0 -1
- package/dist/defence/credential-leak/entropy.js +0 -1
- package/dist/defence/credential-leak/index.d.ts +0 -1
- package/dist/defence/credential-leak/index.js +0 -1
- package/dist/defence/credential-leak/patterns.d.ts +0 -1
- package/dist/defence/credential-leak/patterns.js +0 -1
- package/dist/defence/custom-patterns/store.d.ts +0 -1
- package/dist/defence/custom-patterns/store.js +0 -1
- package/dist/defence/custom-rules/store.d.ts +0 -1
- package/dist/defence/custom-rules/store.js +0 -1
- package/dist/defence/firewall/anomaly-scorer.d.ts +0 -1
- package/dist/defence/firewall/anomaly-scorer.js +0 -1
- package/dist/defence/firewall/encoding-detector.d.ts +0 -1
- package/dist/defence/firewall/encoding-detector.js +0 -1
- package/dist/defence/firewall/index.d.ts +0 -1
- package/dist/defence/firewall/index.js +0 -1
- package/dist/defence/firewall/instruction-detector.d.ts +0 -1
- package/dist/defence/firewall/instruction-detector.js +0 -1
- package/dist/defence/firewall/privilege-detector.d.ts +0 -1
- package/dist/defence/firewall/privilege-detector.js +0 -1
- package/dist/defence/fragmentation/assembly-detector.d.ts +0 -1
- package/dist/defence/fragmentation/assembly-detector.js +0 -1
- package/dist/defence/fragmentation/entity-extractor.d.ts +0 -1
- package/dist/defence/fragmentation/entity-extractor.js +0 -1
- package/dist/defence/fragmentation/index.d.ts +0 -1
- package/dist/defence/fragmentation/index.js +0 -1
- package/dist/defence/fragmentation/temporal-analyzer.d.ts +0 -1
- package/dist/defence/fragmentation/temporal-analyzer.js +0 -1
- package/dist/defence/index.d.ts +0 -1
- package/dist/defence/index.js +0 -1
- package/dist/defence/input-sanitisation/index.d.ts +0 -1
- package/dist/defence/input-sanitisation/index.js +0 -1
- package/dist/defence/iron-dome/action-gate.d.ts +0 -1
- package/dist/defence/iron-dome/action-gate.js +0 -1
- package/dist/defence/iron-dome/audit.d.ts +0 -1
- package/dist/defence/iron-dome/audit.js +0 -1
- package/dist/defence/iron-dome/config.d.ts +0 -1
- package/dist/defence/iron-dome/config.js +0 -1
- package/dist/defence/iron-dome/confirmation-gate.d.ts +0 -1
- package/dist/defence/iron-dome/confirmation-gate.js +0 -1
- package/dist/defence/iron-dome/custom-policies.d.ts +0 -1
- package/dist/defence/iron-dome/custom-policies.js +0 -1
- package/dist/defence/iron-dome/gateway.d.ts +0 -1
- package/dist/defence/iron-dome/gateway.js +0 -1
- package/dist/defence/iron-dome/index.d.ts +0 -1
- package/dist/defence/iron-dome/index.js +0 -1
- package/dist/defence/iron-dome/injection-scanner.d.ts +0 -1
- package/dist/defence/iron-dome/injection-scanner.js +0 -1
- package/dist/defence/iron-dome/kill-switch.d.ts +0 -1
- package/dist/defence/iron-dome/kill-switch.js +0 -1
- package/dist/defence/iron-dome/pii-guard.d.ts +0 -1
- package/dist/defence/iron-dome/pii-guard.js +0 -1
- package/dist/defence/pipeline.d.ts +0 -1
- package/dist/defence/pipeline.js +0 -1
- package/dist/defence/quarantine/auto-expire.d.ts +0 -1
- package/dist/defence/quarantine/auto-expire.js +0 -1
- package/dist/defence/scanner/index.d.ts +0 -1
- package/dist/defence/scanner/index.js +0 -1
- package/dist/defence/scanner/scan-existing.d.ts +0 -1
- package/dist/defence/scanner/scan-existing.js +0 -1
- package/dist/defence/sensitivity/classifier.d.ts +0 -1
- package/dist/defence/sensitivity/classifier.js +0 -1
- package/dist/defence/sensitivity/index.d.ts +0 -1
- package/dist/defence/sensitivity/index.js +0 -1
- package/dist/defence/sensitivity/patterns.d.ts +0 -1
- package/dist/defence/sensitivity/patterns.js +0 -1
- package/dist/defence/sensitivity/redaction.d.ts +0 -1
- package/dist/defence/sensitivity/redaction.js +0 -1
- package/dist/defence/skill-scanner/deep-scan.d.ts +0 -1
- package/dist/defence/skill-scanner/deep-scan.js +0 -1
- package/dist/defence/skill-scanner/discover.d.ts +0 -1
- package/dist/defence/skill-scanner/discover.js +0 -1
- package/dist/defence/skill-scanner/index.d.ts +0 -1
- package/dist/defence/skill-scanner/index.js +0 -1
- package/dist/defence/skill-scanner/parser.d.ts +0 -1
- package/dist/defence/skill-scanner/parser.js +0 -1
- package/dist/defence/skill-scanner/patterns.d.ts +0 -1
- package/dist/defence/skill-scanner/patterns.js +0 -1
- package/dist/defence/skill-scanner/scan-skill.d.ts +0 -1
- package/dist/defence/skill-scanner/scan-skill.js +0 -1
- package/dist/defence/tool-response-scanner.d.ts +0 -1
- package/dist/defence/tool-response-scanner.js +0 -1
- package/dist/defence/trust/access-control.d.ts +0 -1
- package/dist/defence/trust/access-control.js +0 -1
- package/dist/defence/trust/agent-scorer.d.ts +0 -1
- package/dist/defence/trust/agent-scorer.js +0 -1
- package/dist/defence/trust/env-detector.d.ts +0 -1
- package/dist/defence/trust/env-detector.js +0 -1
- package/dist/defence/trust/index.d.ts +0 -1
- package/dist/defence/trust/index.js +0 -1
- package/dist/defence/trust/recall-filter.d.ts +0 -1
- package/dist/defence/trust/recall-filter.js +0 -1
- package/dist/defence/trust/source-scorer.d.ts +0 -1
- package/dist/defence/trust/source-scorer.js +0 -1
- package/dist/defence/types.d.ts +0 -1
- package/dist/defence/types.js +0 -1
- package/dist/embeddings/generator.d.ts +0 -1
- package/dist/embeddings/generator.js +0 -1
- package/dist/embeddings/index.d.ts +0 -1
- package/dist/embeddings/index.js +0 -1
- package/dist/embeddings/worker.d.ts +0 -1
- package/dist/embeddings/worker.js +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/events/webhooks.d.ts +0 -1
- package/dist/events/webhooks.js +0 -1
- package/dist/graph/backfill.d.ts +0 -1
- package/dist/graph/backfill.js +0 -1
- package/dist/graph/extract.d.ts +0 -1
- package/dist/graph/extract.js +0 -1
- package/dist/graph/resolve.d.ts +0 -1
- package/dist/graph/resolve.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -2
- package/dist/integrations/index.d.ts +0 -1
- package/dist/integrations/index.js +0 -1
- package/dist/integrations/langchain.d.ts +0 -1
- package/dist/integrations/langchain.js +0 -1
- package/dist/integrations/openclaw.d.ts +0 -1
- package/dist/integrations/openclaw.js +0 -1
- package/dist/integrations/universal.d.ts +0 -1
- package/dist/integrations/universal.js +0 -1
- package/dist/lib.d.ts +0 -1
- package/dist/lib.js +0 -1
- package/dist/license/cli.d.ts +0 -1
- package/dist/license/cli.js +0 -1
- package/dist/license/gate.d.ts +0 -1
- package/dist/license/gate.js +0 -1
- package/dist/license/index.d.ts +0 -1
- package/dist/license/index.js +0 -1
- package/dist/license/keys.d.ts +0 -1
- package/dist/license/keys.js +0 -1
- package/dist/license/store.d.ts +0 -1
- package/dist/license/store.js +0 -1
- package/dist/license/types.d.ts +0 -1
- package/dist/license/types.js +0 -1
- package/dist/license/validate.d.ts +0 -1
- package/dist/license/validate.js +0 -1
- package/dist/license/verify.d.ts +0 -1
- package/dist/license/verify.js +0 -1
- package/dist/memory/activation.d.ts +0 -1
- package/dist/memory/activation.js +0 -1
- package/dist/memory/consolidate.d.ts +0 -1
- package/dist/memory/consolidate.js +0 -1
- package/dist/memory/contradiction.d.ts +0 -1
- package/dist/memory/contradiction.js +0 -1
- package/dist/memory/decay.d.ts +0 -1
- package/dist/memory/decay.js +0 -1
- package/dist/memory/embedding-cache.d.ts +0 -1
- package/dist/memory/embedding-cache.js +0 -1
- package/dist/memory/embedding.d.ts +7 -2
- package/dist/memory/embedding.js +68 -7
- package/dist/memory/expiry.d.ts +0 -1
- package/dist/memory/expiry.js +0 -1
- package/dist/memory/salience.d.ts +0 -1
- package/dist/memory/salience.js +0 -1
- package/dist/memory/similarity.d.ts +0 -1
- package/dist/memory/similarity.js +0 -1
- package/dist/memory/store.d.ts +3 -1
- package/dist/memory/store.js +204 -123
- package/dist/memory/types.d.ts +21 -1
- package/dist/memory/types.js +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -1
- package/dist/service/install.d.ts +0 -1
- package/dist/service/install.js +0 -1
- package/dist/service/templates.d.ts +0 -1
- package/dist/service/templates.js +0 -1
- package/dist/setup/claude-md.d.ts +0 -1
- package/dist/setup/claude-md.js +0 -1
- package/dist/setup/copilot.d.ts +0 -1
- package/dist/setup/copilot.js +0 -1
- package/dist/setup/doctor.d.ts +0 -1
- package/dist/setup/doctor.js +0 -1
- package/dist/setup/hooks.d.ts +0 -1
- package/dist/setup/hooks.js +0 -1
- package/dist/setup/migrate.d.ts +0 -1
- package/dist/setup/migrate.js +0 -1
- package/dist/setup/openclaw.d.ts +0 -1
- package/dist/setup/openclaw.js +0 -1
- package/dist/setup/quickstart.d.ts +8 -0
- package/dist/setup/quickstart.js +108 -0
- package/dist/setup/settings-hooks.d.ts +0 -1
- package/dist/setup/settings-hooks.js +0 -1
- package/dist/setup/status.d.ts +0 -1
- package/dist/setup/status.js +0 -1
- package/dist/setup/uninstall.d.ts +0 -1
- package/dist/setup/uninstall.js +0 -1
- package/dist/tools/context.d.ts +0 -1
- package/dist/tools/context.js +0 -1
- package/dist/tools/forget.d.ts +0 -1
- package/dist/tools/forget.js +0 -1
- package/dist/tools/graph.d.ts +0 -1
- package/dist/tools/graph.js +0 -1
- package/dist/tools/recall.d.ts +0 -1
- package/dist/tools/recall.js +1 -1
- package/dist/tools/remember.d.ts +0 -1
- package/dist/tools/remember.js +0 -1
- package/dist/worker/brain-worker.d.ts +1 -1
- package/dist/worker/brain-worker.js +9 -2
- package/dist/worker/link-discovery.d.ts +0 -1
- package/dist/worker/link-discovery.js +0 -1
- package/dist/worker/predictive-consolidation.d.ts +0 -1
- package/dist/worker/predictive-consolidation.js +0 -1
- package/dist/worker/types.d.ts +0 -1
- package/dist/worker/types.js +0 -1
- package/hooks/openclaw/cortex-memory/handler.ts +62 -8
- package/package.json +9 -8
- package/scripts/run-jest.mjs +45 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_25b1b286._.js +0 -11
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/364656baa57adaa7.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/6a6ccfb7834de00a.js +0 -9
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/6b11a7d29e9abffd.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/ab13d81ce0e121f2.css +0 -3
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/cf05262adfab5818.js +0 -1
- package/dist/__tests__/consolidation-merge.test.d.ts +0 -9
- package/dist/__tests__/consolidation-merge.test.d.ts.map +0 -1
- package/dist/__tests__/consolidation-merge.test.js +0 -137
- package/dist/__tests__/consolidation-merge.test.js.map +0 -1
- package/dist/__tests__/contradictions.test.d.ts +0 -8
- package/dist/__tests__/contradictions.test.d.ts.map +0 -1
- package/dist/__tests__/contradictions.test.js +0 -78
- package/dist/__tests__/contradictions.test.js.map +0 -1
- package/dist/__tests__/format-memory.test.d.ts +0 -11
- package/dist/__tests__/format-memory.test.d.ts.map +0 -1
- package/dist/__tests__/format-memory.test.js +0 -69
- package/dist/__tests__/format-memory.test.js.map +0 -1
- package/dist/__tests__/salience-evolution.test.d.ts +0 -7
- package/dist/__tests__/salience-evolution.test.d.ts.map +0 -1
- package/dist/__tests__/salience-evolution.test.js +0 -151
- package/dist/__tests__/salience-evolution.test.js.map +0 -1
- package/dist/__tests__/store.test.d.ts +0 -7
- package/dist/__tests__/store.test.d.ts.map +0 -1
- package/dist/__tests__/store.test.js +0 -583
- package/dist/__tests__/store.test.js.map +0 -1
- package/dist/api/control.d.ts.map +0 -1
- package/dist/api/control.js.map +0 -1
- package/dist/api/events.d.ts.map +0 -1
- package/dist/api/events.js.map +0 -1
- package/dist/api/session-token.d.ts.map +0 -1
- package/dist/api/session-token.js.map +0 -1
- package/dist/api/version.d.ts.map +0 -1
- package/dist/api/version.js.map +0 -1
- package/dist/api/visualization-server.d.ts.map +0 -1
- package/dist/api/visualization-server.js.map +0 -1
- package/dist/audit/env-scanner.d.ts.map +0 -1
- package/dist/audit/env-scanner.js.map +0 -1
- package/dist/audit/index.d.ts.map +0 -1
- package/dist/audit/index.js.map +0 -1
- package/dist/audit/mcp-config-scanner.d.ts.map +0 -1
- package/dist/audit/mcp-config-scanner.js.map +0 -1
- package/dist/audit/memory-scanner.d.ts.map +0 -1
- package/dist/audit/memory-scanner.js.map +0 -1
- package/dist/audit/report-formatter.d.ts.map +0 -1
- package/dist/audit/report-formatter.js.map +0 -1
- package/dist/audit/rules-file-scanner.d.ts.map +0 -1
- package/dist/audit/rules-file-scanner.js.map +0 -1
- package/dist/audit/types.d.ts.map +0 -1
- package/dist/audit/types.js.map +0 -1
- package/dist/cli/audit.d.ts.map +0 -1
- package/dist/cli/audit.js.map +0 -1
- package/dist/cli/doctor.d.ts.map +0 -1
- package/dist/cli/doctor.js.map +0 -1
- package/dist/cli/iron-dome.d.ts.map +0 -1
- package/dist/cli/iron-dome.js.map +0 -1
- package/dist/cloud/cli.d.ts.map +0 -1
- package/dist/cloud/cli.js.map +0 -1
- package/dist/cloud/config.d.ts.map +0 -1
- package/dist/cloud/config.js.map +0 -1
- package/dist/cloud/iron-dome-sync.d.ts.map +0 -1
- package/dist/cloud/iron-dome-sync.js.map +0 -1
- package/dist/cloud/quarantine-sync.d.ts.map +0 -1
- package/dist/cloud/quarantine-sync.js.map +0 -1
- package/dist/cloud/sync-queue.d.ts.map +0 -1
- package/dist/cloud/sync-queue.js.map +0 -1
- package/dist/cloud/sync.d.ts.map +0 -1
- package/dist/cloud/sync.js.map +0 -1
- package/dist/cloud/verify.d.ts.map +0 -1
- package/dist/cloud/verify.js.map +0 -1
- package/dist/context/project-context.d.ts.map +0 -1
- package/dist/context/project-context.js.map +0 -1
- package/dist/database/init.d.ts.map +0 -1
- package/dist/database/init.js.map +0 -1
- package/dist/defence/__tests__/access-control.test.d.ts +0 -5
- package/dist/defence/__tests__/access-control.test.d.ts.map +0 -1
- package/dist/defence/__tests__/access-control.test.js +0 -89
- package/dist/defence/__tests__/access-control.test.js.map +0 -1
- package/dist/defence/__tests__/agent-scorer.test.d.ts +0 -5
- package/dist/defence/__tests__/agent-scorer.test.d.ts.map +0 -1
- package/dist/defence/__tests__/agent-scorer.test.js +0 -75
- package/dist/defence/__tests__/agent-scorer.test.js.map +0 -1
- package/dist/defence/__tests__/credential-leak.test.d.ts +0 -8
- package/dist/defence/__tests__/credential-leak.test.d.ts.map +0 -1
- package/dist/defence/__tests__/credential-leak.test.js +0 -403
- package/dist/defence/__tests__/credential-leak.test.js.map +0 -1
- package/dist/defence/__tests__/env-detector.test.d.ts +0 -5
- package/dist/defence/__tests__/env-detector.test.d.ts.map +0 -1
- package/dist/defence/__tests__/env-detector.test.js +0 -100
- package/dist/defence/__tests__/env-detector.test.js.map +0 -1
- package/dist/defence/__tests__/firewall.test.d.ts +0 -8
- package/dist/defence/__tests__/firewall.test.d.ts.map +0 -1
- package/dist/defence/__tests__/firewall.test.js +0 -123
- package/dist/defence/__tests__/firewall.test.js.map +0 -1
- package/dist/defence/__tests__/fragmentation.test.d.ts +0 -7
- package/dist/defence/__tests__/fragmentation.test.d.ts.map +0 -1
- package/dist/defence/__tests__/fragmentation.test.js +0 -51
- package/dist/defence/__tests__/fragmentation.test.js.map +0 -1
- package/dist/defence/__tests__/pipeline.test.d.ts +0 -8
- package/dist/defence/__tests__/pipeline.test.d.ts.map +0 -1
- package/dist/defence/__tests__/pipeline.test.js +0 -106
- package/dist/defence/__tests__/pipeline.test.js.map +0 -1
- package/dist/defence/__tests__/sensitivity.test.d.ts +0 -7
- package/dist/defence/__tests__/sensitivity.test.d.ts.map +0 -1
- package/dist/defence/__tests__/sensitivity.test.js +0 -61
- package/dist/defence/__tests__/sensitivity.test.js.map +0 -1
- package/dist/defence/__tests__/tool-response-scanner.test.d.ts +0 -8
- package/dist/defence/__tests__/tool-response-scanner.test.d.ts.map +0 -1
- package/dist/defence/__tests__/tool-response-scanner.test.js +0 -106
- package/dist/defence/__tests__/tool-response-scanner.test.js.map +0 -1
- package/dist/defence/__tests__/trust.test.d.ts +0 -7
- package/dist/defence/__tests__/trust.test.d.ts.map +0 -1
- package/dist/defence/__tests__/trust.test.js +0 -50
- package/dist/defence/__tests__/trust.test.js.map +0 -1
- package/dist/defence/__tests__/verify.test.d.ts +0 -7
- package/dist/defence/__tests__/verify.test.d.ts.map +0 -1
- package/dist/defence/__tests__/verify.test.js +0 -143
- package/dist/defence/__tests__/verify.test.js.map +0 -1
- package/dist/defence/audit/export.d.ts.map +0 -1
- package/dist/defence/audit/export.js.map +0 -1
- package/dist/defence/audit/index.d.ts.map +0 -1
- package/dist/defence/audit/index.js.map +0 -1
- package/dist/defence/audit/logger.d.ts.map +0 -1
- package/dist/defence/audit/logger.js.map +0 -1
- package/dist/defence/audit/queries.d.ts.map +0 -1
- package/dist/defence/audit/queries.js.map +0 -1
- package/dist/defence/credential-leak/entropy.d.ts.map +0 -1
- package/dist/defence/credential-leak/entropy.js.map +0 -1
- package/dist/defence/credential-leak/index.d.ts.map +0 -1
- package/dist/defence/credential-leak/index.js.map +0 -1
- package/dist/defence/credential-leak/patterns.d.ts.map +0 -1
- package/dist/defence/credential-leak/patterns.js.map +0 -1
- package/dist/defence/custom-patterns/store.d.ts.map +0 -1
- package/dist/defence/custom-patterns/store.js.map +0 -1
- package/dist/defence/custom-rules/store.d.ts.map +0 -1
- package/dist/defence/custom-rules/store.js.map +0 -1
- package/dist/defence/firewall/anomaly-scorer.d.ts.map +0 -1
- package/dist/defence/firewall/anomaly-scorer.js.map +0 -1
- package/dist/defence/firewall/encoding-detector.d.ts.map +0 -1
- package/dist/defence/firewall/encoding-detector.js.map +0 -1
- package/dist/defence/firewall/index.d.ts.map +0 -1
- package/dist/defence/firewall/index.js.map +0 -1
- package/dist/defence/firewall/instruction-detector.d.ts.map +0 -1
- package/dist/defence/firewall/instruction-detector.js.map +0 -1
- package/dist/defence/firewall/privilege-detector.d.ts.map +0 -1
- package/dist/defence/firewall/privilege-detector.js.map +0 -1
- package/dist/defence/fragmentation/assembly-detector.d.ts.map +0 -1
- package/dist/defence/fragmentation/assembly-detector.js.map +0 -1
- package/dist/defence/fragmentation/entity-extractor.d.ts.map +0 -1
- package/dist/defence/fragmentation/entity-extractor.js.map +0 -1
- package/dist/defence/fragmentation/index.d.ts.map +0 -1
- package/dist/defence/fragmentation/index.js.map +0 -1
- package/dist/defence/fragmentation/temporal-analyzer.d.ts.map +0 -1
- package/dist/defence/fragmentation/temporal-analyzer.js.map +0 -1
- package/dist/defence/index.d.ts.map +0 -1
- package/dist/defence/index.js.map +0 -1
- package/dist/defence/input-sanitisation/index.d.ts.map +0 -1
- package/dist/defence/input-sanitisation/index.js.map +0 -1
- package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts +0 -5
- package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts.map +0 -1
- package/dist/defence/iron-dome/__tests__/action-gate.test.js +0 -71
- package/dist/defence/iron-dome/__tests__/action-gate.test.js.map +0 -1
- package/dist/defence/iron-dome/__tests__/confirmation-gate.test.d.ts +0 -5
- package/dist/defence/iron-dome/__tests__/confirmation-gate.test.d.ts.map +0 -1
- package/dist/defence/iron-dome/__tests__/confirmation-gate.test.js +0 -144
- package/dist/defence/iron-dome/__tests__/confirmation-gate.test.js.map +0 -1
- package/dist/defence/iron-dome/__tests__/gateway.test.d.ts +0 -5
- package/dist/defence/iron-dome/__tests__/gateway.test.d.ts.map +0 -1
- package/dist/defence/iron-dome/__tests__/gateway.test.js +0 -60
- package/dist/defence/iron-dome/__tests__/gateway.test.js.map +0 -1
- package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts +0 -7
- package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts.map +0 -1
- package/dist/defence/iron-dome/__tests__/injection-scanner.test.js +0 -230
- package/dist/defence/iron-dome/__tests__/injection-scanner.test.js.map +0 -1
- package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts +0 -5
- package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts.map +0 -1
- package/dist/defence/iron-dome/__tests__/pii-guard.test.js +0 -130
- package/dist/defence/iron-dome/__tests__/pii-guard.test.js.map +0 -1
- package/dist/defence/iron-dome/action-gate.d.ts.map +0 -1
- package/dist/defence/iron-dome/action-gate.js.map +0 -1
- package/dist/defence/iron-dome/audit.d.ts.map +0 -1
- package/dist/defence/iron-dome/audit.js.map +0 -1
- package/dist/defence/iron-dome/config.d.ts.map +0 -1
- package/dist/defence/iron-dome/config.js.map +0 -1
- package/dist/defence/iron-dome/confirmation-gate.d.ts.map +0 -1
- package/dist/defence/iron-dome/confirmation-gate.js.map +0 -1
- package/dist/defence/iron-dome/custom-policies.d.ts.map +0 -1
- package/dist/defence/iron-dome/custom-policies.js.map +0 -1
- package/dist/defence/iron-dome/gateway.d.ts.map +0 -1
- package/dist/defence/iron-dome/gateway.js.map +0 -1
- package/dist/defence/iron-dome/index.d.ts.map +0 -1
- package/dist/defence/iron-dome/index.js.map +0 -1
- package/dist/defence/iron-dome/injection-scanner.d.ts.map +0 -1
- package/dist/defence/iron-dome/injection-scanner.js.map +0 -1
- package/dist/defence/iron-dome/kill-switch.d.ts.map +0 -1
- package/dist/defence/iron-dome/kill-switch.js.map +0 -1
- package/dist/defence/iron-dome/pii-guard.d.ts.map +0 -1
- package/dist/defence/iron-dome/pii-guard.js.map +0 -1
- package/dist/defence/pipeline.d.ts.map +0 -1
- package/dist/defence/pipeline.js.map +0 -1
- package/dist/defence/quarantine/auto-expire.d.ts.map +0 -1
- package/dist/defence/quarantine/auto-expire.js.map +0 -1
- package/dist/defence/scanner/index.d.ts.map +0 -1
- package/dist/defence/scanner/index.js.map +0 -1
- package/dist/defence/scanner/scan-existing.d.ts.map +0 -1
- package/dist/defence/scanner/scan-existing.js.map +0 -1
- package/dist/defence/sensitivity/classifier.d.ts.map +0 -1
- package/dist/defence/sensitivity/classifier.js.map +0 -1
- package/dist/defence/sensitivity/index.d.ts.map +0 -1
- package/dist/defence/sensitivity/index.js.map +0 -1
- package/dist/defence/sensitivity/patterns.d.ts.map +0 -1
- package/dist/defence/sensitivity/patterns.js.map +0 -1
- package/dist/defence/sensitivity/redaction.d.ts.map +0 -1
- package/dist/defence/sensitivity/redaction.js.map +0 -1
- package/dist/defence/skill-scanner/__tests__/skill-scanner.test.d.ts +0 -12
- package/dist/defence/skill-scanner/__tests__/skill-scanner.test.d.ts.map +0 -1
- package/dist/defence/skill-scanner/__tests__/skill-scanner.test.js +0 -471
- package/dist/defence/skill-scanner/__tests__/skill-scanner.test.js.map +0 -1
- package/dist/defence/skill-scanner/deep-scan.d.ts.map +0 -1
- package/dist/defence/skill-scanner/deep-scan.js.map +0 -1
- package/dist/defence/skill-scanner/discover.d.ts.map +0 -1
- package/dist/defence/skill-scanner/discover.js.map +0 -1
- package/dist/defence/skill-scanner/index.d.ts.map +0 -1
- package/dist/defence/skill-scanner/index.js.map +0 -1
- package/dist/defence/skill-scanner/parser.d.ts.map +0 -1
- package/dist/defence/skill-scanner/parser.js.map +0 -1
- package/dist/defence/skill-scanner/patterns.d.ts.map +0 -1
- package/dist/defence/skill-scanner/patterns.js.map +0 -1
- package/dist/defence/skill-scanner/scan-skill.d.ts.map +0 -1
- package/dist/defence/skill-scanner/scan-skill.js.map +0 -1
- package/dist/defence/tool-response-scanner.d.ts.map +0 -1
- package/dist/defence/tool-response-scanner.js.map +0 -1
- package/dist/defence/trust/access-control.d.ts.map +0 -1
- package/dist/defence/trust/access-control.js.map +0 -1
- package/dist/defence/trust/agent-scorer.d.ts.map +0 -1
- package/dist/defence/trust/agent-scorer.js.map +0 -1
- package/dist/defence/trust/env-detector.d.ts.map +0 -1
- package/dist/defence/trust/env-detector.js.map +0 -1
- package/dist/defence/trust/index.d.ts.map +0 -1
- package/dist/defence/trust/index.js.map +0 -1
- package/dist/defence/trust/recall-filter.d.ts.map +0 -1
- package/dist/defence/trust/recall-filter.js.map +0 -1
- package/dist/defence/trust/source-scorer.d.ts.map +0 -1
- package/dist/defence/trust/source-scorer.js.map +0 -1
- package/dist/defence/types.d.ts.map +0 -1
- package/dist/defence/types.js.map +0 -1
- package/dist/embeddings/generator.d.ts.map +0 -1
- package/dist/embeddings/generator.js.map +0 -1
- package/dist/embeddings/index.d.ts.map +0 -1
- package/dist/embeddings/index.js.map +0 -1
- package/dist/embeddings/worker.d.ts.map +0 -1
- package/dist/embeddings/worker.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/events/webhooks.d.ts.map +0 -1
- package/dist/events/webhooks.js.map +0 -1
- package/dist/graph/backfill.d.ts.map +0 -1
- package/dist/graph/backfill.js.map +0 -1
- package/dist/graph/extract.d.ts.map +0 -1
- package/dist/graph/extract.js.map +0 -1
- package/dist/graph/resolve.d.ts.map +0 -1
- package/dist/graph/resolve.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/__tests__/openclaw.test.d.ts +0 -2
- package/dist/integrations/__tests__/openclaw.test.d.ts.map +0 -1
- package/dist/integrations/__tests__/openclaw.test.js +0 -72
- package/dist/integrations/__tests__/openclaw.test.js.map +0 -1
- package/dist/integrations/__tests__/universal.test.d.ts +0 -2
- package/dist/integrations/__tests__/universal.test.d.ts.map +0 -1
- package/dist/integrations/__tests__/universal.test.js +0 -144
- package/dist/integrations/__tests__/universal.test.js.map +0 -1
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/index.js.map +0 -1
- package/dist/integrations/langchain.d.ts.map +0 -1
- package/dist/integrations/langchain.js.map +0 -1
- package/dist/integrations/openclaw.d.ts.map +0 -1
- package/dist/integrations/openclaw.js.map +0 -1
- package/dist/integrations/universal.d.ts.map +0 -1
- package/dist/integrations/universal.js.map +0 -1
- package/dist/lib.d.ts.map +0 -1
- package/dist/lib.js.map +0 -1
- package/dist/license/__tests__/feature-gating.test.d.ts +0 -10
- package/dist/license/__tests__/feature-gating.test.d.ts.map +0 -1
- package/dist/license/__tests__/feature-gating.test.js +0 -188
- package/dist/license/__tests__/feature-gating.test.js.map +0 -1
- package/dist/license/cli.d.ts.map +0 -1
- package/dist/license/cli.js.map +0 -1
- package/dist/license/gate.d.ts.map +0 -1
- package/dist/license/gate.js.map +0 -1
- package/dist/license/index.d.ts.map +0 -1
- package/dist/license/index.js.map +0 -1
- package/dist/license/keys.d.ts.map +0 -1
- package/dist/license/keys.js.map +0 -1
- package/dist/license/store.d.ts.map +0 -1
- package/dist/license/store.js.map +0 -1
- package/dist/license/types.d.ts.map +0 -1
- package/dist/license/types.js.map +0 -1
- package/dist/license/validate.d.ts.map +0 -1
- package/dist/license/validate.js.map +0 -1
- package/dist/license/verify.d.ts.map +0 -1
- package/dist/license/verify.js.map +0 -1
- package/dist/memory/activation.d.ts.map +0 -1
- package/dist/memory/activation.js.map +0 -1
- package/dist/memory/consolidate.d.ts.map +0 -1
- package/dist/memory/consolidate.js.map +0 -1
- package/dist/memory/contradiction.d.ts.map +0 -1
- package/dist/memory/contradiction.js.map +0 -1
- package/dist/memory/decay.d.ts.map +0 -1
- package/dist/memory/decay.js.map +0 -1
- package/dist/memory/embedding-cache.d.ts.map +0 -1
- package/dist/memory/embedding-cache.js.map +0 -1
- package/dist/memory/embedding.d.ts.map +0 -1
- package/dist/memory/embedding.js.map +0 -1
- package/dist/memory/expiry.d.ts.map +0 -1
- package/dist/memory/expiry.js.map +0 -1
- package/dist/memory/salience.d.ts.map +0 -1
- package/dist/memory/salience.js.map +0 -1
- package/dist/memory/similarity.d.ts.map +0 -1
- package/dist/memory/similarity.js.map +0 -1
- package/dist/memory/store.d.ts.map +0 -1
- package/dist/memory/store.js.map +0 -1
- package/dist/memory/types.d.ts.map +0 -1
- package/dist/memory/types.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/service/install.d.ts.map +0 -1
- package/dist/service/install.js.map +0 -1
- package/dist/service/templates.d.ts.map +0 -1
- package/dist/service/templates.js.map +0 -1
- package/dist/setup/claude-md.d.ts.map +0 -1
- package/dist/setup/claude-md.js.map +0 -1
- package/dist/setup/copilot.d.ts.map +0 -1
- package/dist/setup/copilot.js.map +0 -1
- package/dist/setup/doctor.d.ts.map +0 -1
- package/dist/setup/doctor.js.map +0 -1
- package/dist/setup/hooks.d.ts.map +0 -1
- package/dist/setup/hooks.js.map +0 -1
- package/dist/setup/migrate.d.ts.map +0 -1
- package/dist/setup/migrate.js.map +0 -1
- package/dist/setup/openclaw.d.ts.map +0 -1
- package/dist/setup/openclaw.js.map +0 -1
- package/dist/setup/settings-hooks.d.ts.map +0 -1
- package/dist/setup/settings-hooks.js.map +0 -1
- package/dist/setup/status.d.ts.map +0 -1
- package/dist/setup/status.js.map +0 -1
- package/dist/setup/uninstall.d.ts.map +0 -1
- package/dist/setup/uninstall.js.map +0 -1
- package/dist/tools/context.d.ts.map +0 -1
- package/dist/tools/context.js.map +0 -1
- package/dist/tools/forget.d.ts.map +0 -1
- package/dist/tools/forget.js.map +0 -1
- package/dist/tools/graph.d.ts.map +0 -1
- package/dist/tools/graph.js.map +0 -1
- package/dist/tools/recall.d.ts.map +0 -1
- package/dist/tools/recall.js.map +0 -1
- package/dist/tools/remember.d.ts.map +0 -1
- package/dist/tools/remember.js.map +0 -1
- package/dist/worker/brain-worker.d.ts.map +0 -1
- package/dist/worker/brain-worker.js.map +0 -1
- package/dist/worker/link-discovery.d.ts.map +0 -1
- package/dist/worker/link-discovery.js.map +0 -1
- package/dist/worker/predictive-consolidation.d.ts.map +0 -1
- package/dist/worker/predictive-consolidation.js.map +0 -1
- package/dist/worker/types.d.ts.map +0 -1
- package/dist/worker/types.js.map +0 -1
- package/plugins/openclaw/README.md +0 -93
- package/plugins/openclaw/index.ts +0 -432
- package/plugins/openclaw/openclaw.plugin.json +0 -10
- /package/dashboard/.next/standalone/dashboard/.next/static/{3NPHem1lidYcerzR28Shs → ljjBNdtxDUABGiIMYNYT6}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{3NPHem1lidYcerzR28Shs → ljjBNdtxDUABGiIMYNYT6}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{3NPHem1lidYcerzR28Shs → ljjBNdtxDUABGiIMYNYT6}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5960,(e,t,n)=>{"use strict";var i=e.r(4),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,s=i.useEffect,o=i.useLayoutEffect,l=i.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=a({inst:{value:n,getSnapshot:t}}),r=i[0].inst,c=i[1];return o(function(){r.value=n,r.getSnapshot=t,u(r)&&c({inst:r})},[e,n,t]),s(function(){return u(r)&&c({inst:r}),e(function(){u(r)&&c({inst:r})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:c},89782,(e,t,n)=>{"use strict";t.exports=e.r(5960)},75812,(e,t,n)=>{"use strict";var i=e.r(4),r=e.r(89782),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useSyncExternalStore,o=i.useRef,l=i.useEffect,u=i.useMemo,c=i.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=i(e),void 0!==r&&d.hasValue){var t=d.value;if(r(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=i(e);return void 0!==r&&r(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,i,r]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},27688,(e,t,n)=>{"use strict";t.exports=e.r(75812)},54876,(e,t,n)=>{"use strict";function i(e,t){var n=e.length;for(e.push(t);0<n;){var i=n-1>>>1,r=e[i];if(0<s(r,t))e[i]=t,e[n]=r,n=i;else break}}function r(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var i=0,r=e.length,a=r>>>1;i<a;){var o=2*(i+1)-1,l=e[o],u=o+1,c=e[u];if(0>s(l,n))u<r&&0>s(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else if(u<r&&0>s(c,n))e[i]=c,e[u]=n,i=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,x=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,S="u">typeof setImmediate?setImmediate:null;function M(e){for(var t=r(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,i(h,t);else break;t=r(d)}}function w(e){if(x=!1,M(e),!v)if(null!==r(h))v=!0,T||(T=!0,o());else{var t=r(d);null!==t&&N(w,t.startTime-e)}}var T=!1,E=-1,A=5,C=-1;function R(){return!!y||!(n.unstable_now()-C<A)}function P(){if(y=!1,T){var e=n.unstable_now();C=e;var t=!0;try{e:{v=!1,x&&(x=!1,b(E),E=-1),g=!0;var i=m;try{t:{for(M(e),f=r(h);null!==f&&!(f.expirationTime>e&&R());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,M(e),t=!0;break t}f===r(h)&&a(h),M(e)}else a(h);f=r(h)}if(null!==f)t=!0;else{var u=r(d);null!==u&&N(w,u.startTime-e),t=!1}}break e}finally{f=null,m=i,g=!1}}}finally{t?o():T=!1}}}if("function"==typeof S)o=function(){S(P)};else if("u">typeof MessageChannel){var I=new MessageChannel,L=I.port2;I.port1.onmessage=P,o=function(){L.postMessage(null)}}else o=function(){_(P,0)};function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<e?Math.floor(1e3/e):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},n.unstable_requestPaint=function(){y=!0},n.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},n.unstable_scheduleCallback=function(e,t,a){var s=n.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=0x3fffffff;break;case 4:l=1e4;break;default:l=5e3}return l=a+l,e={id:p++,callback:t,priorityLevel:e,startTime:a,expirationTime:l,sortIndex:-1},a>s?(e.sortIndex=a,i(d,e),null===r(h)&&e===r(d)&&(x?(b(E),E=-1):x=!0,N(w,a-s))):(e.sortIndex=l,i(h,e),v||g||(v=!0,T||(T=!0,o()))),e},n.unstable_shouldYield=R,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},66241,(e,t,n)=>{"use strict";t.exports=e.r(54876)},28592,e=>{"use strict";let t,n,i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,x,y,_,b,S;var M,w,T,E,A,C,R=e.i(27493),P=e.i(4),I=e.i(42098),L=e.i(88069),N=e.i(87353);function D({stats:e,contradictionCount:t,quarantineCount:n,lastConsolidation:i,workerStatus:r,onClickContradictions:a,onClickQuarantine:s,onClickConsolidation:o}){let l=(e?.decayDistribution?.healthy??0)+(e?.decayDistribution?.fading??0)+(e?.decayDistribution?.critical??0),u=l>0?Math.round((e?.decayDistribution?.healthy??0)/l*100):100,c=u>70?"text-emerald-400":u>40?"text-amber-400":"text-red-400",h=e?.total??0,d=e?.totalLinks??e?.links??0;return(0,R.jsxs)("div",{className:"flex items-center h-10 px-4 bg-slate-900/80 backdrop-blur-sm border-b border-slate-800 text-sm",children:[(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Brain Health"}),(0,R.jsxs)("span",{className:`font-medium ${c}`,children:[u,"%"]})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Memories"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:h})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Links"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:d})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:a,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Contradictions"}),(0,R.jsx)("span",{className:`font-medium ${t>0?"text-amber-400 animate-pulse":"text-slate-200"}`,children:t})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:s,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Quarantine"}),(0,R.jsx)("span",{className:`font-medium ${n>0?"text-red-400 animate-pulse":"text-slate-200"}`,children:n})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:o,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Consolidated"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:function(e){if(!e)return"Never";let t=new Date(e),n=Math.floor((Date.now()-t.getTime())/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;let i=Math.floor(n/60);if(i<24)return`${i}h ago`;let r=Math.floor(i/24);return`${r}d ago`}(i)})]})]})}var U=e.i(97358);function O({percentage:e,size:t=80,strokeWidth:n=6}){let i=(t-n)/2,r=2*Math.PI*i,a=Math.max(0,Math.min(100,e)),s=a>70?"#10B981":a>=40?"#F59E0B":"#EF4444";return(0,R.jsxs)("div",{className:"relative inline-flex items-center justify-center",children:[(0,R.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:"-rotate-90",children:[(0,R.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:"currentColor",strokeWidth:n,className:"text-slate-700"}),(0,R.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:s,strokeWidth:n,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r-a/100*r,style:{transition:"stroke-dashoffset 0.6s ease, stroke 0.4s ease"}})]}),(0,R.jsxs)("span",{className:"absolute text-sm font-semibold",style:{color:s},children:[Math.round(a),"%"]})]})}function F({category:e,healthPct:t,count:n,color:i,isActive:r,onClick:a}){let s=Math.max(0,Math.min(100,t));return(0,R.jsxs)("button",{onClick:a,className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors ${r?"bg-slate-700/60 border border-slate-600":"bg-transparent border border-transparent hover:bg-slate-800/60"}`,children:[(0,R.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:i}}),(0,R.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,R.jsx)("span",{className:"text-[11px] text-slate-300 capitalize truncate",children:e}),(0,R.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 ml-1",children:[s<50&&(0,R.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 flex-shrink-0",title:"Health below 50%"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-500",children:n})]})]}),(0,R.jsx)("div",{className:"w-full h-1 rounded-full bg-slate-700 overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full",style:{width:`${s}%`,backgroundColor:s>70?"#10B981":s>40?"#F59E0B":"#EF4444",transition:"width 0.4s ease, background-color 0.4s ease"}})})]})]})}function z({stats:e,memories:t,onCategoryClick:n,activeCategory:i,onConsolidate:r,isConsolidating:a,onScanContradictions:s,workerStatus:o}){let l=(0,P.useMemo)(()=>{let t=(e?.decayDistribution?.healthy??0)+(e?.decayDistribution?.fading??0)+(e?.decayDistribution?.critical??0);return t>0?Math.round((e?.decayDistribution?.healthy??0)/t*100):100},[e?.decayDistribution]),u=(0,P.useMemo)(()=>{let n=e?.byCategory??{};return Object.keys(n).map(e=>{let i=t.filter(t=>t.category===e),r=n[e]??0,a=100;i.length>0&&(a=Math.round(i.reduce((e,t)=>e+(t.decayedScore??t.salience??.5),0)/i.length*100));let s=U.CATEGORY_COLORS[e]??U.CATEGORY_COLORS.custom;return{category:e,healthPct:a,count:r,color:s}})},[e?.byCategory,t]),c=o?.running?"Active":o?.lastRun?"Idle":"Stopped",h=o?.running?"bg-emerald-400":o?.lastRun?"bg-amber-400":"bg-slate-500";return(0,R.jsxs)("div",{className:"w-56 shrink-0 h-full flex flex-col bg-slate-900/80 backdrop-blur-sm border-r border-slate-800",children:[(0,R.jsxs)("div",{className:"flex flex-col items-center py-4 px-3 border-b border-slate-800",children:[(0,R.jsx)(O,{percentage:l,size:80,strokeWidth:6}),(0,R.jsx)("span",{className:"text-[11px] text-slate-400 mt-2",children:"Brain Health"})]}),(0,R.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider px-2 mb-1",children:"Categories"}),0===u.length&&(0,R.jsx)("div",{className:"text-[11px] text-slate-500 px-2 py-2",children:"No categories yet"}),u.map(({category:e,healthPct:t,count:r,color:a})=>(0,R.jsx)(F,{category:e,healthPct:t,count:r,color:a,isActive:i===e,onClick:()=>n(i===e?null:e)},e))]}),(0,R.jsxs)("div",{className:"px-3 py-3 border-t border-slate-800 space-y-2",children:[(0,R.jsx)("button",{onClick:r,disabled:a,className:`w-full px-2 py-1.5 text-[11px] rounded transition-colors ${a?"bg-slate-700 text-slate-500 cursor-not-allowed":"bg-blue-600/80 text-blue-100 hover:bg-blue-600"}`,children:a?"Consolidating...":"Consolidate Now"}),s&&(0,R.jsx)("button",{onClick:s,className:"w-full px-2 py-1.5 text-[11px] rounded bg-slate-700/60 text-slate-300 hover:bg-slate-700 transition-colors",children:"Scan Contradictions"}),(0,R.jsxs)("div",{className:"flex items-center gap-2 px-1 pt-1",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${h}`}),(0,R.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Worker: ",c]})]})]})]})}function k(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"Just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let i=Math.floor(n/24);return`${i}d ago`}let B={short_term:"STM",long_term:"LTM",episodic:"Episodic"},V={references:"bg-blue-500/20 text-blue-400 border-blue-500/30",extends:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",contradicts:"bg-red-500/20 text-red-400 border-red-500/30",related:"bg-slate-500/20 text-slate-400 border-slate-500/30"},H={references:"#3B82F6",extends:"#10B981",contradicts:"#EF4444",related:"#6B7280"};function j({memory:e,links:t,onClose:n,onBoost:i,onDemote:r,onPromote:a,onDelete:s,onQuarantine:o,onNavigateToMemory:l}){if(!e)return(0,R.jsxs)("div",{className:"w-80 shrink-0 h-full bg-slate-900/80 backdrop-blur-sm border-l border-slate-800 flex flex-col items-center justify-center",children:[(0,R.jsx)("div",{className:"text-slate-600 mb-3",children:(0,R.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 2.38-1.19 4.47-3 5.74V17a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1v-2.26C6.19 13.47 5 11.38 5 9a7 7 0 0 1 7-7z"}),(0,R.jsx)("path",{d:"M9 21h6"}),(0,R.jsx)("path",{d:"M10 21v1a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-1"})]})}),(0,R.jsx)("p",{className:"text-slate-500 text-sm",children:"Click a memory node to inspect it"})]});let u=e.salience??0,c=e.decayedScore??u,h=U.CATEGORY_COLORS[e.category]||U.CATEGORY_COLORS.custom,d=c>.7?"bg-emerald-400":c>=.4?"bg-amber-400":"bg-red-400",p=t.map(t=>{let n=t.source_id===e.id;return{link:t,targetId:n?t.target_id:t.source_id,targetTitle:n?t.target_title||`Memory #${t.target_id}`:t.source_title||`Memory #${t.source_id}`,targetCategory:n?t.target_category:t.source_category,relationship:t.relationship,strength:t.strength}});return(0,R.jsxs)("div",{className:"w-80 shrink-0 h-full bg-slate-900/80 backdrop-blur-sm border-l border-slate-800 flex flex-col",children:[(0,R.jsxs)("div",{className:"sticky top-0 z-10 bg-slate-900/95 backdrop-blur-sm border-b border-slate-800 p-4 flex-shrink-0",children:[(0,R.jsx)("button",{onClick:n,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors","aria-label":"Close inspector",children:(0,R.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,R.jsx)("path",{d:"M4 4l8 8M12 4l-8 8"})})}),(0,R.jsx)("h3",{className:"text-slate-200 font-medium text-sm pr-6 leading-tight mb-2",children:e.title}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5 mb-2.5",children:[(0,R.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full border",style:{color:h,borderColor:`${h}40`,backgroundColor:`${h}15`},children:e.category}),(0,R.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:B[e.type]||e.type})]}),(0,R.jsxs)("div",{className:"mb-1.5",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,R.jsx)("span",{className:"text-[10px] text-slate-500",children:"Salience"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-400 font-mono",children:u.toFixed(2)})]}),(0,R.jsx)("div",{className:"h-1 bg-slate-800 rounded-full overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100*u,100)}%`,backgroundColor:h}})})]}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("div",{className:`w-2 h-2 rounded-full ${d}`}),(0,R.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Health ",c.toFixed(2)]})]})]}),(0,R.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,R.jsxs)("div",{className:"p-4 border-b border-slate-800",children:[(0,R.jsxs)("div",{className:"mb-3",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"Content"}),(0,R.jsx)("div",{className:"max-h-48 overflow-y-auto rounded bg-slate-950/60 border border-slate-800 p-2",children:(0,R.jsx)("pre",{className:"text-xs text-slate-300 whitespace-pre-wrap break-words font-mono leading-relaxed",children:e.content})})]}),e.tags&&e.tags.length>0&&(0,R.jsxs)("div",{className:"mb-3",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"Tags"}),(0,R.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,R.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:e},e))})]}),(0,R.jsxs)("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Created"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:k(e.createdAt)})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Last Accessed"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:k(e.lastAccessed)})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Access Count"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:e.accessCount})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Project"}),(0,R.jsx)("div",{className:"text-xs text-slate-300 truncate",title:e.project||"Global",children:e.project||"Global"})]})]})]}),(0,R.jsxs)("div",{className:"p-4",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,R.jsx)("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Connections"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-600 font-mono",children:p.length})]}),0===p.length?(0,R.jsx)("p",{className:"text-xs text-slate-600 py-2",children:"No connections yet"}):(0,R.jsx)("div",{className:"space-y-2",children:p.map(e=>{let t=V[e.relationship]||V.related,n=H[e.relationship]||H.related,i=e.targetCategory?U.CATEGORY_COLORS[e.targetCategory]||U.CATEGORY_COLORS.custom:"#6B7280";return(0,R.jsxs)("button",{onClick:()=>l(e.targetId),className:"w-full text-left rounded bg-slate-800/40 hover:bg-slate-800/70 border border-slate-800 hover:border-slate-700 p-2 transition-colors group",children:[(0,R.jsxs)("div",{className:"flex items-start gap-1.5 mb-1",children:[(0,R.jsx)("div",{className:"w-1.5 h-1.5 rounded-full mt-1 flex-shrink-0",style:{backgroundColor:i}}),(0,R.jsx)("span",{className:"text-xs text-slate-300 group-hover:text-slate-200 leading-tight line-clamp-2",children:e.targetTitle})]}),(0,R.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,R.jsx)("span",{className:`text-[9px] px-1 py-0.5 rounded border ${t}`,children:e.relationship}),(0,R.jsx)("div",{className:"flex-1 h-0.5 bg-slate-800 rounded-full overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full",style:{width:`${Math.min(100*e.strength,100)}%`,backgroundColor:n}})}),(0,R.jsx)("span",{className:"text-[9px] text-slate-600 font-mono",children:e.strength.toFixed(1)})]})]},e.link.id)})})]})]}),(0,R.jsx)("div",{className:"sticky bottom-0 z-10 bg-slate-900/95 backdrop-blur-sm border-t border-slate-800 p-3 flex-shrink-0",children:(0,R.jsxs)("div",{className:"flex items-center gap-1",children:[(0,R.jsxs)("button",{onClick:()=>i(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-emerald-400 hover:bg-slate-800/60 transition-colors",title:"Boost salience",children:[(0,R.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,R.jsx)("path",{d:"M8 12V4M4 8l4-4 4 4"})}),(0,R.jsx)("span",{className:"text-[9px]",children:"Boost"})]}),(0,R.jsxs)("button",{onClick:()=>r(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-amber-400 hover:bg-slate-800/60 transition-colors",title:"Demote salience",children:[(0,R.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,R.jsx)("path",{d:"M8 4v8M4 8l4 4 4-4"})}),(0,R.jsx)("span",{className:"text-[9px]",children:"Demote"})]}),"short_term"===e.type&&(0,R.jsxs)("button",{onClick:()=>a(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-blue-400 hover:bg-slate-800/60 transition-colors",title:"Promote to LTM",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M4 12l4-8 4 8"}),(0,R.jsx)("path",{d:"M5.5 9h5"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Promote"})]}),(0,R.jsxs)("button",{onClick:()=>{window.confirm(`Delete memory "${e.title}"? This cannot be undone.`)&&s(e.id)},className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-red-400 hover:bg-slate-800/60 transition-colors",title:"Delete memory",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M2 4h12M5 4V3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1M6 7v5M10 7v5"}),(0,R.jsx)("path",{d:"M3 4l1 9a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1l1-9"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Delete"})]}),(0,R.jsxs)("button",{onClick:()=>{window.confirm(`Quarantine memory "${e.title}"? It will be flagged for review.`)&&o(e.id)},className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-violet-400 hover:bg-slate-800/60 transition-colors",title:"Quarantine memory",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M8 1.5L1.5 5v6L8 14.5 14.5 11V5L8 1.5z"}),(0,R.jsx)("path",{d:"M8 5v4M8 11h.01"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Quarantine"})]})]})})]})}let G=[{key:"all",label:"All",types:[]},{key:"creates",label:"Creates",types:["memory_created"]},{key:"updates",label:"Updates",types:["memory_updated","memory_accessed"]},{key:"deletes",label:"Deletes",types:["memory_deleted"]},{key:"consolidation",label:"Consolidation",types:["consolidation_complete"]},{key:"decay",label:"Decay",types:["decay_tick"]}],W={memory_created:"bg-emerald-400",memory_accessed:"bg-blue-400",memory_updated:"bg-amber-400",memory_deleted:"bg-red-400",consolidation_complete:"bg-purple-400",decay_tick:"bg-slate-400"},X={memory_created:"Created",memory_accessed:"Accessed",memory_updated:"Updated",memory_deleted:"Deleted",consolidation_complete:"Consolidated",decay_tick:"Decay Tick"};function q(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<5)return"Just now";if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Y(e){return e&&"object"==typeof e?"string"==typeof e.title&&e.title?e.title:"string"==typeof e.name&&e.name?e.name:"string"==typeof e.summary&&e.summary?e.summary:"string"==typeof e.message&&e.message?e.message:"number"==typeof e.id?`Memory #${e.id}`:"":""}function Z({events:e,onClickEvent:t,isCollapsed:n=!1,onToggleCollapse:i}){let[r,a]=(0,P.useState)(new Set(["all"])),s=(0,P.useCallback)(e=>{a(t=>{let n=new Set(t);if("all"===e)return new Set(["all"]);if(n.delete("all"),n.has(e)){if(n.delete(e),0===n.size)return new Set(["all"])}else n.add(e);return n})},[]),o=(0,P.useMemo)(()=>{if(r.has("all"))return e;let t=new Set;for(let e of r){let n=G.find(t=>t.key===e);if(n)for(let e of n.types)t.add(e)}return e.filter(e=>t.has(e.type))},[e,r]),l=e.length>0?e[0]:null;return(0,R.jsx)("div",{className:`bg-slate-900/80 backdrop-blur-sm border-t border-slate-800 transition-all duration-300 ease-in-out ${n?"h-8":"h-32"}`,children:n?(0,R.jsxs)("div",{className:"flex items-center h-8 px-3 gap-2",children:[(0,R.jsx)("button",{onClick:i,className:"flex items-center justify-center w-5 h-5 rounded hover:bg-slate-800 transition-colors text-slate-400 hover:text-slate-200 shrink-0","aria-label":"Expand activity feed",children:(0,R.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,R.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),l?(0,R.jsxs)("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${W[l.type]}`}),(0,R.jsx)("span",{className:"text-slate-500",children:q(l.timestamp)}),(0,R.jsx)("span",{className:"text-slate-300",children:X[l.type]}),(0,R.jsx)("span",{className:"text-slate-500 truncate",children:Y(l.data)})]}):(0,R.jsx)("span",{className:"text-xs text-slate-500",children:"No activity"})]}):(0,R.jsxs)("div",{className:"flex flex-col h-full",children:[(0,R.jsxs)("div",{className:"flex items-center h-7 px-3 gap-2 shrink-0 border-b border-slate-800/50",children:[(0,R.jsx)("button",{onClick:i,className:"flex items-center justify-center w-5 h-5 rounded hover:bg-slate-800 transition-colors text-slate-400 hover:text-slate-200 shrink-0","aria-label":"Collapse activity feed",children:(0,R.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,R.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),(0,R.jsx)("div",{className:"flex items-center gap-1",children:G.map(e=>(0,R.jsx)("button",{onClick:()=>s(e.key),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${r.has(e.key)?"bg-cyan-600 text-white":"bg-slate-800 text-slate-400 hover:bg-slate-700"}`,children:e.label},e.key))})]}),(0,R.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:0===o.length?(0,R.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,R.jsx)("span",{className:"text-xs text-slate-500",children:"No activity yet -- events will appear as the brain processes memories"})}):(0,R.jsx)("div",{className:"px-3 py-1",children:o.map((e,n)=>{let i=Y(e.data);return(0,R.jsxs)("button",{onClick:()=>t?.(e.data),className:"flex items-center gap-2 w-full text-left py-0.5 px-1 rounded hover:bg-slate-800/60 transition-colors group",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${W[e.type]}`}),(0,R.jsx)("span",{className:"text-[10px] text-slate-500 w-12 shrink-0 tabular-nums",children:q(e.timestamp)}),(0,R.jsx)("span",{className:"text-[10px] text-slate-300 w-16 shrink-0",children:X[e.type]}),i&&(0,R.jsx)("span",{className:"text-[10px] text-slate-500 truncate group-hover:text-slate-400 transition-colors",children:i})]},`${e.type}-${e.timestamp}-${n}`)})})})]})})}var J=e.i(22534),$=P;let K={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Q={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ee="attached",et="detached",en="srgb",ei="srgb-linear",er="linear",ea="srgb",es="300 es",eo={COMPUTE:"compute",RENDER:"render"},el={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},eu={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function ec(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let eh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ed(e,t){return new eh[e](t)}function ep(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ef(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function em(){let e=ef("canvas");return e.style.display="block",e}let eg={},ev=null;function ex(e){ev=e}function ey(){return ev}function e_(...e){let t="THREE."+e.shift();ev?ev("log",t,...e):console.log(t,...e)}function eb(...e){let t="THREE."+e.shift();ev?ev("warn",t,...e):console.warn(t,...e)}function eS(...e){let t="THREE."+e.shift();ev?ev("error",t,...e):console.error(t,...e)}function eM(...e){let t=e.join(" ");t in eg||(eg[t]=!0,eb(...e))}class ew{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let i=n[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,i=t.length;n<i;n++)t[n].call(this,e);e.target=null}}}let eT=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],eE=1234567,eA=Math.PI/180,eC=180/Math.PI;function eR(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0;return(eT[255&e]+eT[e>>8&255]+eT[e>>16&255]+eT[e>>24&255]+"-"+eT[255&t]+eT[t>>8&255]+"-"+eT[t>>16&15|64]+eT[t>>24&255]+"-"+eT[63&n|128]+eT[n>>8&255]+"-"+eT[n>>16&255]+eT[n>>24&255]+eT[255&i]+eT[i>>8&255]+eT[i>>16&255]+eT[i>>24&255]).toLowerCase()}function eP(e,t,n){return Math.max(t,Math.min(n,e))}function eI(e,t){return(e%t+t)%t}function eL(e,t,n){return(1-n)*e+n*t}function eN(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function eD(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let eU={DEG2RAD:eA,RAD2DEG:eC,generateUUID:eR,clamp:eP,euclideanModulo:eI,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:eL,damp:function(e,t,n,i){return eL(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(eI(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(eE=e);let t=eE+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*eA},radToDeg:function(e){return e*eC},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+i)/2),c=s((t+i)/2),h=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:eb("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:eD,denormalize:eN};class eO{constructor(e=0,t=0){eO.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 Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(eP(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class eF{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(s<=0){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(s>=1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=o*h+l*d+u*p+c*f;e<0&&(h=-h,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let n=Math.acos(e),i=Math.sin(n);o=o*(t=Math.sin(t*n)/i)+h*(s=Math.sin(s*n)/i),l=l*t+d*s,u=u*t+p*s,c=c*t+f*s}else{let e=1/Math.sqrt((o=o*t+h*s)*o+(l=l*t+d*s)*l+(u=u*t+p*s)*u+(c=c*t+f*s)*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,a){let s=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:eb("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(eP(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(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){let n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+i*l-r*o,this._y=i*u+a*o+r*s-n*l,this._z=r*u+a*l+n*o-i*s,this._w=a*u-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(n=-n,i=-i,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ez{constructor(e=0,t=0,n=0){ez.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eB.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eB.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),u=2*(s*t-r*i),c=2*(r*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-r*c,this.z=i+o*c+r*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this.z=eP(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this.z=eP(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ek.copy(this).projectOnVector(e),this.sub(ek)}reflect(e){return this.sub(ek.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(eP(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-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}}let ek=new ez,eB=new eF;class eV{constructor(e,t,n,i,r,a,s,o,l){eV.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],x=i[4],y=i[7],_=i[2],b=i[5],S=i[8];return r[0]=a*f+s*v+o*_,r[3]=a*m+s*x+o*b,r[6]=a*g+s*y+o*S,r[1]=l*f+u*v+c*_,r[4]=l*m+u*x+c*b,r[7]=l*g+u*y+c*S,r[2]=h*f+d*v+p*_,r[5]=h*m+d*x+p*b,r[8]=h*g+d*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*r*u+n*s*o+i*r*l-i*a*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*r,d=l*r-a*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(i*l-u*n)*f,e[2]=(s*n-i*a)*f,e[3]=h*f,e[4]=(u*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(eH.makeScale(e,t)),this}rotate(e){return this.premultiply(eH.makeRotation(-e)),this}translate(e,t){return this.premultiply(eH.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let eH=new eV,ej=new eV().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eG=new eV().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),eW=(f=[.64,.33,.3,.6,.15,.06],m=[.2126,.7152,.0722],g=[.3127,.329],(p={enabled:!0,workingColorSpace:ei,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===ea&&(e.r=eX(e.r),e.g=eX(e.g),e.b=eX(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===ea&&(e.r=eq(e.r),e.g=eq(e.g),e.b=eq(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?er:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return eM("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),p.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return eM("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),p.colorSpaceToWorking(e,t)}}).define({[ei]:{primaries:f,whitePoint:g,transfer:er,toXYZ:ej,fromXYZ:eG,luminanceCoefficients:m,workingColorSpaceConfig:{unpackColorSpace:en},outputColorSpaceConfig:{drawingBufferColorSpace:en}},[en]:{primaries:f,whitePoint:g,transfer:ea,toXYZ:ej,fromXYZ:eG,luminanceCoefficients:m,outputColorSpaceConfig:{drawingBufferColorSpace:en}}}),p);function eX(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function eq(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eY{static getDataURL(e,n="image/png"){let i;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=ef("canvas")),t.width=e.width,t.height=e.height;let n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=t}return i.toDataURL(n)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=ef("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*eX(r[e]/255);return n.putImageData(i,0,0),t}if(!e.data)return eb("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*eX(t[e]/255)):t[e]=eX(t[e]);return{data:t,width:e.width,height:e.height}}}}let eZ=0;class eJ{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eZ++}),this.uuid=eR(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(e$(i[t].image)):e.push(e$(i[t]))}else e=e$(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function e$(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?eY.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(eb("Texture: Unable to serialize Texture."),{})}let eK=0,eQ=new ez;class e0 extends ew{constructor(e=e0.DEFAULT_IMAGE,t=e0.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,s=1023,o=1009,l=e0.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eK++}),this.uuid=eR(),this.name="",this.source=new eJ(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new eO(0,0),this.repeat=new eO(1,1),this.center=new eO(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eV,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(eQ).x}get height(){return this.source.getSize(eQ).y}get depth(){return this.source.getSize(eQ).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){eb(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){eb(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}e0.DEFAULT_IMAGE=null,e0.DEFAULT_MAPPING=300,e0.DEFAULT_ANISOTROPY=1;class e1{constructor(e=0,t=0,n=0,i=1){e1.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);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,i,r,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,x=(h+p)/4;return e>a&&e>m?e<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(e)),r=v/n):a>m?a<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(a)),r=x/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=v/(r=Math.sqrt(m)),i=x/r),this.set(n,i,r,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this.z=eP(this.z,e.z,t.z),this.w=eP(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this.z=eP(this.z,e,t),this.w=eP(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(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 e2 extends ew{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new e1(0,0,e,t),this.scissorTest=!1,this.viewport=new e1(0,0,e,t);const i=new e0({width:e,height:t,depth:n.depth});this.textures=[];const r=n.count;for(let e=0;e<r;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new eJ(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class e3 extends e2{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class e4 extends e0{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class e5 extends e3{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new e4(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class e6 extends e0{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e8 extends e3{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new e6(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class e9{constructor(e=new ez(Infinity,Infinity,Infinity),t=new ez(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(te.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(te.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=te.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,te):te.fromBufferAttribute(i,t),te.applyMatrix4(e.matrixWorld),this.expandByPoint(te);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),tt.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),tt.copy(n.boundingBox)),tt.applyMatrix4(e.matrixWorld),this.union(tt)}let i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,te),te.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(tl),tu.subVectors(this.max,tl),tn.subVectors(e.a,tl),ti.subVectors(e.b,tl),tr.subVectors(e.c,tl),ta.subVectors(ti,tn),ts.subVectors(tr,ti),to.subVectors(tn,tr);let t=[0,-ta.z,ta.y,0,-ts.z,ts.y,0,-to.z,to.y,ta.z,0,-ta.x,ts.z,0,-ts.x,to.z,0,-to.x,-ta.y,ta.x,0,-ts.y,ts.x,0,-to.y,to.x,0];return!!td(t,tn,ti,tr,tu)&&!!td(t=[1,0,0,0,1,0,0,0,1],tn,ti,tr,tu)&&(tc.crossVectors(ta,ts),td(t=[tc.x,tc.y,tc.z],tn,ti,tr,tu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,te).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(te).length()),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()||(e7[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),e7[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),e7[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),e7[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),e7[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),e7[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),e7[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),e7[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(e7)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let e7=[new ez,new ez,new ez,new ez,new ez,new ez,new ez,new ez],te=new ez,tt=new e9,tn=new ez,ti=new ez,tr=new ez,ta=new ez,ts=new ez,to=new ez,tl=new ez,tu=new ez,tc=new ez,th=new ez;function td(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){th.fromArray(e,a);let s=r.x*Math.abs(th.x)+r.y*Math.abs(th.y)+r.z*Math.abs(th.z),o=t.dot(th),l=n.dot(th),u=i.dot(th);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let tp=new e9,tf=new ez,tm=new ez;class tg{constructor(e=new ez,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):tp.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.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;tf.subVectors(e,this.center);let t=tf.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(tf,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(tm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(tf.copy(e.center).add(tm)),this.expandByPoint(tf.copy(e.center).sub(tm)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tv=new ez,tx=new ez,ty=new ez,t_=new ez,tb=new ez,tS=new ez,tM=new ez;class tw{constructor(e=new ez,t=new ez(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,tv)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=tv.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tv.copy(this.origin).addScaledVector(this.direction,t),tv.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){let r,a,s,o;tx.copy(e).add(t).multiplyScalar(.5),ty.copy(t).sub(e).normalize(),t_.copy(this.origin).sub(tx);let l=.5*e.distanceTo(t),u=-this.direction.dot(ty),c=t_.dot(this.direction),h=-t_.dot(ty),d=t_.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(r=u*h-c,a=u*c-h,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+u*a+2*c)+a*(u*r+a+2*h)+d}else s=-(r=Math.max(0,-(u*(a=l)+c)))*r+a*(a+2*h)+d;else s=-(r=Math.max(0,-(u*(a=-l)+c)))*r+a*(a+2*h)+d;else a<=-o?(a=(r=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(r=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d);else a=u>0?-l:l,s=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(tx).addScaledVector(ty,a),s}intersectSphere(e,t){tv.subVectors(e.center,this.origin);let n=tv.dot(this.direction),i=tv.dot(tv)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,i,r,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>i||((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0)))?null:this.at(n>=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,tv)}intersectTriangle(e,t,n,i,r){let a;tb.subVectors(t,e),tS.subVectors(n,e),tM.crossVectors(tb,tS);let s=this.direction.dot(tM);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}t_.subVectors(this.origin,e);let o=a*this.direction.dot(tS.crossVectors(t_,tS));if(o<0)return null;let l=a*this.direction.dot(tb.cross(t_));if(l<0||o+l>s)return null;let u=-a*t_.dot(tM);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tT{constructor(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){tT.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new tT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2)),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,n=e.elements,i=1/tE.setFromMatrixColumn(e,0).length(),r=1/tE.setFromMatrixColumn(e,1).length(),a=1/tE.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*u,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=a*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=s*u,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(tC,e,tR)}lookAt(e,t,n){let i=this.elements;return tL.subVectors(e,t),0===tL.lengthSq()&&(tL.z=1),tL.normalize(),tP.crossVectors(n,tL),0===tP.lengthSq()&&(1===Math.abs(n.z)?tL.x+=1e-4:tL.z+=1e-4,tL.normalize(),tP.crossVectors(n,tL)),tP.normalize(),tI.crossVectors(tL,tP),i[0]=tP.x,i[4]=tI.x,i[8]=tL.x,i[1]=tP.y,i[5]=tI.y,i[9]=tL.y,i[2]=tP.z,i[6]=tI.z,i[10]=tL.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],x=n[7],y=n[11],_=n[15],b=i[0],S=i[4],M=i[8],w=i[12],T=i[1],E=i[5],A=i[9],C=i[13],R=i[2],P=i[6],I=i[10],L=i[14],N=i[3],D=i[7],U=i[11],O=i[15];return r[0]=a*b+s*T+o*R+l*N,r[4]=a*S+s*E+o*P+l*D,r[8]=a*M+s*A+o*I+l*U,r[12]=a*w+s*C+o*L+l*O,r[1]=u*b+c*T+h*R+d*N,r[5]=u*S+c*E+h*P+d*D,r[9]=u*M+c*A+h*I+d*U,r[13]=u*w+c*C+h*L+d*O,r[2]=p*b+f*T+m*R+g*N,r[6]=p*S+f*E+m*P+g*D,r[10]=p*M+f*A+m*I+g*U,r[14]=p*w+f*C+m*L+g*O,r[3]=v*b+x*T+y*R+_*N,r[7]=v*S+x*E+y*P+_*D,r[11]=v*M+x*A+y*I+_*U,r[15]=v*w+x*C+y*L+_*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*d-l*h,x=s*d-l*c,y=s*h-o*c,_=a*d-l*u,b=a*h-o*u,S=a*c-s*u;return t*(f*v-m*x+g*y)-n*(p*v-m*_+g*b)+i*(p*x-f*_+g*S)-r*(p*y-f*b+m*S)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,x=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,y=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,_=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*x+i*y+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return e[0]=v*S,e[1]=(f*h*r-c*m*r-f*i*d+n*m*d+c*i*g-n*h*g)*S,e[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*S,e[3]=(c*o*r-s*h*r-c*i*l+n*h*l+s*i*d-n*o*d)*S,e[4]=x*S,e[5]=(u*m*r-p*h*r+p*i*d-t*m*d-u*i*g+t*h*g)*S,e[6]=(p*o*r-a*m*r-p*i*l+t*m*l+a*i*g-t*o*g)*S,e[7]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*d+t*o*d)*S,e[8]=y*S,e[9]=(p*c*r-u*f*r-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*r-p*s*r+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*r-a*c*r-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=_*S,e[13]=(u*f*i-p*c*i+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*i-a*f*i-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*i-u*s*i+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,u=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+n,u*o-i*a,0,l*o-i*s,u*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,u=a+a,c=s+s,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,g=s*c,v=o*l,x=o*u,y=o*c,_=n.x,b=n.y,S=n.z;return i[0]=(1-(f+g))*_,i[1]=(d+y)*_,i[2]=(p-x)*_,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+x)*S,i[9]=(m-v)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],0===this.determinant())return n.set(1,1,1),t.identity(),this;let r=tE.set(i[0],i[1],i[2]).length(),a=tE.set(i[4],i[5],i[6]).length(),s=tE.set(i[8],i[9],i[10]).length();0>this.determinant()&&(r=-r),tA.copy(this);let o=1/r,l=1/a,u=1/s;return tA.elements[0]*=o,tA.elements[1]*=o,tA.elements[2]*=o,tA.elements[4]*=l,tA.elements[5]*=l,tA.elements[6]*=l,tA.elements[8]*=u,tA.elements[9]*=u,tA.elements[10]*=u,t.setFromRotationMatrix(tA),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=r/(a-r),u=a*r/(a-r);else if(2e3===s)l=-(a+r)/(a-r),u=-2*a*r/(a-r);else if(2001===s)l=-a/(a-r),u=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(n-i),c[9]=(n+i)/(n-i),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=1/(a-r),u=a/(a-r);else if(2e3===s)l=-2/(a-r),u=-(a+r)/(a-r);else if(2001===s)l=-1/(a-r),u=-r/(a-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-i),c[9]=0,c[13]=-(n+i)/(n-i),c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}let tE=new ez,tA=new tT,tC=new ez(0,0,0),tR=new ez(1,1,1),tP=new ez,tI=new ez,tL=new ez,tN=new tT,tD=new eF;class tU{constructor(e=0,t=0,n=0,i=tU.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(eP(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-eP(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(eP(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-eP(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(eP(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-eP(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:eb("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return tN.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tN,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tD.setFromEuler(this),this.setFromQuaternion(tD,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],void 0!==e[3]&&(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}}tU.DEFAULT_ORDER="XYZ";class tO{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let tF=0,tz=new ez,tk=new eF,tB=new tT,tV=new ez,tH=new ez,tj=new ez,tG=new eF,tW=new ez(1,0,0),tX=new ez(0,1,0),tq=new ez(0,0,1),tY={type:"added"},tZ={type:"removed"},tJ={type:"childadded",child:null},t$={type:"childremoved",child:null};class tK extends ew{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tF++}),this.uuid=eR(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tK.DEFAULT_UP.clone();const e=new ez,t=new tU,n=new eF,i=new ez(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new tT},normalMatrix:{value:new eV}}),this.matrix=new tT,this.matrixWorld=new tT,this.matrixAutoUpdate=tK.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=tK.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new tO,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return tk.setFromAxisAngle(e,t),this.quaternion.multiply(tk),this}rotateOnWorldAxis(e,t){return tk.setFromAxisAngle(e,t),this.quaternion.premultiply(tk),this}rotateX(e){return this.rotateOnAxis(tW,e)}rotateY(e){return this.rotateOnAxis(tX,e)}rotateZ(e){return this.rotateOnAxis(tq,e)}translateOnAxis(e,t){return tz.copy(e).applyQuaternion(this.quaternion),this.position.add(tz.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(tW,e)}translateY(e){return this.translateOnAxis(tX,e)}translateZ(e){return this.translateOnAxis(tq,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tB.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?tV.copy(e):tV.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),tH.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tB.lookAt(tH,tV,this.up):tB.lookAt(tV,tH,this.up),this.quaternion.setFromRotationMatrix(tB),i&&(tB.extractRotation(i.matrixWorld),tk.setFromRotationMatrix(tB),this.quaternion.premultiply(tk.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?eS("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(tY),tJ.child=e,this.dispatchEvent(tJ),tJ.child=null):eS("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tZ),t$.child=e,this.dispatchEvent(t$),t$.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),tB.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),tB.multiply(e.parent.matrixWorld)),e.applyMatrix4(tB),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(tY),tJ.child=e,this.dispatchEvent(tJ),tJ.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tH,e,tj),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tH,tG,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){let t=a(e.geometries),i=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),u=a(e.animations),c=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function a(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),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)),!0===t)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}}tK.DEFAULT_UP=new ez(0,1,0),tK.DEFAULT_MATRIX_AUTO_UPDATE=!0,tK.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let tQ=new ez,t0=new ez,t1=new ez,t2=new ez,t3=new ez,t4=new ez,t5=new ez,t6=new ez,t8=new ez,t9=new ez,t7=new e1,ne=new e1,nt=new e1;class nn{constructor(e=new ez,t=new ez,n=new ez){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),tQ.subVectors(e,t),i.cross(tQ);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){tQ.subVectors(i,t),t0.subVectors(n,t),t1.subVectors(e,t);let a=tQ.dot(tQ),s=tQ.dot(t0),o=tQ.dot(t1),l=t0.dot(t0),u=t0.dot(t1),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,t2)&&t2.x>=0&&t2.y>=0&&t2.x+t2.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,t2)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,t2.x),o.addScaledVector(a,t2.y),o.addScaledVector(s,t2.z),o)}static getInterpolatedAttribute(e,t,n,i,r,a){return t7.setScalar(0),ne.setScalar(0),nt.setScalar(0),t7.fromBufferAttribute(e,t),ne.fromBufferAttribute(e,n),nt.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(t7,r.x),a.addScaledVector(ne,r.y),a.addScaledVector(nt,r.z),a}static isFrontFacing(e,t,n,i){return tQ.subVectors(n,t),t0.subVectors(e,t),0>tQ.cross(t0).dot(i)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return tQ.subVectors(this.c,this.b),t0.subVectors(this.a,this.b),.5*tQ.cross(t0).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,i,r=this.a,a=this.b,s=this.c;t3.subVectors(a,r),t4.subVectors(s,r),t6.subVectors(e,r);let o=t3.dot(t6),l=t4.dot(t6);if(o<=0&&l<=0)return t.copy(r);t8.subVectors(e,a);let u=t3.dot(t8),c=t4.dot(t8);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(r).addScaledVector(t3,n);t9.subVectors(e,s);let d=t3.dot(t9),p=t4.dot(t9);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(t4,i);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return t5.subVectors(s,a),i=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(t5,i);let g=1/(m+f+h);return n=f*g,i=h*g,t.copy(r).addScaledVector(t3,n).addScaledVector(t4,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let ni={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},nr={h:0,s:0,l:0},na={h:0,s:0,l:0};function ns(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class no{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){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=en){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,eW.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=eW.workingColorSpace){return this.r=e,this.g=t,this.b=n,eW.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=eW.workingColorSpace){if(e=eI(e,1),t=eP(t,0,1),n=eP(n,0,1),0===t)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=ns(r,i,e+1/3),this.g=ns(r,i,e),this.b=ns(r,i,e-1/3)}return eW.colorSpaceToWorking(this,i),this}setStyle(e,t=en){let n;function i(t){void 0!==t&&1>parseFloat(t)&&eb("Color: Alpha component of "+e+" will be ignored.")}if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:eb("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(i,16),t);eb("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=en){let n=ni[e.toLowerCase()];return void 0!==n?this.setHex(n,t):eb("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=eX(e.r),this.g=eX(e.g),this.b=eX(e.b),this}copyLinearToSRGB(e){return this.r=eq(e.r),this.g=eq(e.g),this.b=eq(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=en){return eW.workingToColorSpace(nl.copy(this),e),65536*Math.round(eP(255*nl.r,0,255))+256*Math.round(eP(255*nl.g,0,255))+Math.round(eP(255*nl.b,0,255))}getHexString(e=en){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=eW.workingColorSpace){let n,i;eW.workingToColorSpace(nl.copy(this),t);let r=nl.r,a=nl.g,s=nl.b,o=Math.max(r,a,s),l=Math.min(r,a,s),u=(l+o)/2;if(l===o)n=0,i=0;else{let e=o-l;switch(i=u<=.5?e/(o+l):e/(2-o-l),o){case r:n=(a-s)/e+6*(a<s);break;case a:n=(s-r)/e+2;break;case s:n=(r-a)/e+4}n/=6}return e.h=n,e.s=i,e.l=u,e}getRGB(e,t=eW.workingColorSpace){return eW.workingToColorSpace(nl.copy(this),t),e.r=nl.r,e.g=nl.g,e.b=nl.b,e}getStyle(e=en){eW.workingToColorSpace(nl.copy(this),e);let t=nl.r,n=nl.g,i=nl.b;return e!==en?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(nr),this.setHSL(nr.h+e,nr.s+t,nr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(nr),e.getHSL(na);let n=eL(nr.h,na.h,t),i=eL(nr.s,na.s,t),r=eL(nr.l,na.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let nl=new no;no.NAMES=ni;let nu=0;class nc extends ew{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nu++}),this.uuid=eR(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new no(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){eb(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){eb(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(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,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),100!==this.blendEquation&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(n.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(n.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class nh extends nc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new no(0xffffff),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 tU,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let nd=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();function np(e){Math.abs(e)>65504&&eb("DataUtils.toHalfFloat(): Value out of range."),e=eP(e,-65504,65504),nd.floatView[0]=e;let t=nd.uint32View[0],n=t>>23&511;return nd.baseTable[n]+((8388607&t)>>nd.shiftTable[n])}function nf(e){let t=e>>10;return nd.uint32View[0]=nd.mantissaTable[nd.offsetTable[t]+(1023&e)]+nd.exponentTable[t],nd.floatView[0]}class nm{static toHalfFloat(e){return np(e)}static fromHalfFloat(e){return nf(e)}}let ng=new ez,nv=new eO,nx=0;class ny{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:nx++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)nv.fromBufferAttribute(this,t),nv.applyMatrix3(e),this.setXY(t,nv.x,nv.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyMatrix3(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyMatrix4(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyNormalMatrix(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.transformDirection(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=eN(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=eD(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=eN(t,this.array)),t}setX(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=eN(t,this.array)),t}setY(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=eN(t,this.array)),t}setZ(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=eN(t,this.array)),t}setW(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array),r=eD(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class n_ extends ny{constructor(e,t,n){super(new Int8Array(e),t,n)}}class nb extends ny{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class nS extends ny{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class nM extends ny{constructor(e,t,n){super(new Int16Array(e),t,n)}}class nw extends ny{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class nT extends ny{constructor(e,t,n){super(new Int32Array(e),t,n)}}class nE extends ny{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nA extends ny{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=nf(this.array[e*this.itemSize]);return this.normalized&&(t=eN(t,this.array)),t}setX(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize]=np(t),this}getY(e){let t=nf(this.array[e*this.itemSize+1]);return this.normalized&&(t=eN(t,this.array)),t}setY(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+1]=np(t),this}getZ(e){let t=nf(this.array[e*this.itemSize+2]);return this.normalized&&(t=eN(t,this.array)),t}setZ(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+2]=np(t),this}getW(e){let t=nf(this.array[e*this.itemSize+3]);return this.normalized&&(t=eN(t,this.array)),t}setW(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+3]=np(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this.array[e+2]=np(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array),r=eD(r,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this.array[e+2]=np(i),this.array[e+3]=np(r),this}}class nC extends ny{constructor(e,t,n){super(new Float32Array(e),t,n)}}let nR=0,nP=new tT,nI=new tK,nL=new ez,nN=new e9,nD=new e9,nU=new ez;class nO extends ew{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nR++}),this.uuid=eR(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ec(e)?nE:nw)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new eV().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return nP.makeRotationFromQuaternion(e),this.applyMatrix4(nP),this}rotateX(e){return nP.makeRotationX(e),this.applyMatrix4(nP),this}rotateY(e){return nP.makeRotationY(e),this.applyMatrix4(nP),this}rotateZ(e){return nP.makeRotationZ(e),this.applyMatrix4(nP),this}translate(e,t,n){return nP.makeTranslation(e,t,n),this.applyMatrix4(nP),this}scale(e,t,n){return nP.makeScale(e,t,n),this.applyMatrix4(nP),this}lookAt(e){return nI.lookAt(e),nI.updateMatrix(),this.applyMatrix4(nI.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(nL).negate(),this.translate(nL.x,nL.y,nL.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,i=e.length;n<i;n++){let i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new nC(t,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&eb("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new e9);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){eS("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ez(-1/0,-1/0,-1/0),new ez(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nN.setFromBufferAttribute(n),this.morphTargetsRelative?(nU.addVectors(this.boundingBox.min,nN.min),this.boundingBox.expandByPoint(nU),nU.addVectors(this.boundingBox.max,nN.max),this.boundingBox.expandByPoint(nU)):(this.boundingBox.expandByPoint(nN.min),this.boundingBox.expandByPoint(nN.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&eS('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new tg);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){eS("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ez,1/0);return}if(e){let n=this.boundingSphere.center;if(nN.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nD.setFromBufferAttribute(n),this.morphTargetsRelative?(nU.addVectors(nN.min,nD.min),nN.expandByPoint(nU),nU.addVectors(nN.max,nD.max),nN.expandByPoint(nU)):(nN.expandByPoint(nD.min),nN.expandByPoint(nD.max))}nN.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)nU.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(nU));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)nU.fromBufferAttribute(a,t),s&&(nL.fromBufferAttribute(e,t),nU.add(nL)),i=Math.max(i,n.distanceToSquared(nU))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&eS('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void eS("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new ny(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new ez,o[e]=new ez;let l=new ez,u=new ez,c=new ez,h=new eO,d=new eO,p=new eO,f=new ez,m=new ez,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,i=g.length;t<i;++t){let i=g[t],a=i.start,v=i.count;for(let t=a,i=a+v;t<i;t+=3)!function(e,t,i){l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),c.fromBufferAttribute(n,i),h.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),u.sub(l),c.sub(l),d.sub(h),p.sub(h);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(u).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),m.copy(c).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[i].add(f),o[e].add(m),o[t].add(m),o[i].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new ez,x=new ez,y=new ez,_=new ez;function b(e){y.fromBufferAttribute(i,e),_.copy(y);let t=s[e];v.copy(t),v.sub(y.multiplyScalar(y.dot(t))).normalize(),x.crossVectors(_,t);let n=x.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,n<0?-1:1)}for(let t=0,n=g.length;t<n;++t){let n=g[t],i=n.start,r=n.count;for(let t=i,n=i+r;t<n;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new ny(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let i=new ez,r=new ez,a=new ez,s=new ez,o=new ez,l=new ez,u=new ez,c=new ez;if(e)for(let h=0,d=e.count;h<d;h+=3){let d=e.getX(h+0),p=e.getX(h+1),f=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),o.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),n.setXYZ(e+0,u.x,u.y,u.z),n.setXYZ(e+1,u.x,u.y,u.z),n.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)nU.fromBufferAttribute(e,t),nU.normalize(),e.setXYZ(t,nU.x,nU.y,nU.z)}toNonIndexed(){function e(e,t){let n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[o++]=n[s++]}return new ny(a,i,r)}if(null===this.index)return eb("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new nO,n=this.index.array,i=this.attributes;for(let r in i){let a=e(i[r],n);t.setAttribute(r,a)}let r=this.morphAttributes;for(let i in r){let a=[],s=r[i];for(let t=0,i=s.length;t<i;t++){let i=e(s[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,n=a.length;e<n;e++){let n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let i=n[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},r=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){let i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let i=e.attributes;for(let e in i){let n=i[e];this.setAttribute(e,n.clone(t))}let r=e.morphAttributes;for(let e in r){let n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let nF=new tT,nz=new tw,nk=new tg,nB=new ez,nV=new ez,nH=new ez,nj=new ez,nG=new ez,nW=new ez,nX=new ez,nq=new ez;class nY extends tK{constructor(e=new nO,t=new nh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let s=this.morphTargetInfluences;if(r&&s){nW.set(0,0,0);for(let n=0,i=r.length;n<i;n++){let i=s[n],o=r[n];0!==i&&(nG.fromBufferAttribute(o,e),a?nW.addScaledVector(nG,i):nW.addScaledVector(nG.sub(t),i))}t.add(nW)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;void 0===i||(null===n.boundingSphere&&n.computeBoundingSphere(),nk.copy(n.boundingSphere),nk.applyMatrix4(r),nz.copy(e.ray).recast(e.near),!1===nk.containsPoint(nz.origin)&&(null===nz.intersectSphere(nk,nB)||nz.origin.distanceToSquared(nB)>(e.far-e.near)**2)||(nF.copy(r).invert(),nz.copy(e.ray).applyMatrix4(nF),(null===n.boundingBox||!1!==nz.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,nz)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=h.length;r<o;r++){let o=h[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=nZ(this,p,e,n,l,u,c,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let h=r;h<o;h+=3)(i=nZ(this,a,e,n,l,u,c,s.getX(h),s.getX(h+1),s.getX(h+2)))&&(i.faceIndex=Math.floor(h/3),t.push(i))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=h.length;r<s;r++){let s=h[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=nZ(this,p,e,n,l,u,c,r,r+1,r+2))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(i=nZ(this,a,e,n,l,u,c,o,o+1,o+2))&&(i.faceIndex=Math.floor(o/3),t.push(i))}}}function nZ(e,t,n,i,r,a,s,o,l,u){e.getVertexPosition(o,nV),e.getVertexPosition(l,nH),e.getVertexPosition(u,nj);let c=function(e,t,n,i,r,a,s,o){if(null===(1===t.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===t.side,o)))return null;nq.copy(o),nq.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(nq);return l<n.near||l>n.far?null:{distance:l,point:nq.clone(),object:e}}(e,t,n,i,nV,nH,nj,nX);if(c){let e=new ez;nn.getBarycoord(nX,nV,nH,nj,e),r&&(c.uv=nn.getInterpolatedAttribute(r,o,l,u,e,new eO)),a&&(c.uv1=nn.getInterpolatedAttribute(a,o,l,u,e,new eO)),s&&(c.normal=nn.getInterpolatedAttribute(s,o,l,u,e,new ez),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new ez,materialIndex:0};nn.getNormal(nV,nH,nj,t.normal),c.face=t,c.barycoord=e}return c}class nJ extends nO{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){let x=a/m,y=p/g,_=a/2,b=p/2,S=f/2,M=m+1,w=g+1,T=0,E=0,A=new ez;for(let a=0;a<w;a++){let s=a*y-b;for(let o=0;o<M;o++){let h=o*x-_;A[e]=h*i,A[t]=s*r,A[n]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let n=h+t+M*e,i=h+t+M*(e+1),r=h+(t+1)+M*(e+1),a=h+(t+1)+M*e;o.push(n,i,a),o.push(i,r,a),E+=6}s.addGroup(d,E,v),d+=E,h+=T}p("z","y","x",-1,-1,n,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new nC(l,3)),this.setAttribute("normal",new nC(u,3)),this.setAttribute("uv",new nC(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nJ(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function n$(e){let t={};for(let n in e)for(let i in t[n]={},e[n]){let r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(eb("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function nK(e){let t={};for(let n=0;n<e.length;n++){let i=n$(e[n]);for(let e in i)t[e]=i[e]}return t}function nQ(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:eW.workingColorSpace}let n0={clone:n$,merge:nK};class n1 extends nc{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=n$(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let n in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class n2 extends tK{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tT,this.projectionMatrix=new tT,this.projectionMatrixInverse=new tT,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.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)}}let n3=new ez,n4=new eO,n5=new eO;class n6 extends n2{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*eC*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*eA*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*eC*Math.atan(Math.tan(.5*eA*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){n3.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(n3.x,n3.y).multiplyScalar(-e/n3.z),n3.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(n3.x,n3.y).multiplyScalar(-e/n3.z)}getViewSize(e,t){return this.getViewBounds(e,n4,n5),t.subVectors(n5,n4)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*eA*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class n8 extends tK{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new n6(-90,1,e,t);i.layers=this.layers,this.add(i);const r=new n6(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new n6(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new n6(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new n6(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new n6(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class n9 extends e0{constructor(e=[],t=301,n,i,r,a,s,o,l,u){super(e,t,n,i,r,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class n7 extends e3{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1};this.texture=new n9([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54876,(e,t,n)=>{"use strict";function i(e,t){var n=e.length;for(e.push(t);0<n;){var i=n-1>>>1,r=e[i];if(0<s(r,t))e[i]=t,e[n]=r,n=i;else break}}function r(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var i=0,r=e.length,a=r>>>1;i<a;){var o=2*(i+1)-1,l=e[o],u=o+1,c=e[u];if(0>s(l,n))u<r&&0>s(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else if(u<r&&0>s(c,n))e[i]=c,e[u]=n,i=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,x=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,S="u">typeof setImmediate?setImmediate:null;function M(e){for(var t=r(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,i(h,t);else break;t=r(d)}}function w(e){if(x=!1,M(e),!v)if(null!==r(h))v=!0,T||(T=!0,o());else{var t=r(d);null!==t&&N(w,t.startTime-e)}}var T=!1,E=-1,A=5,C=-1;function R(){return!!y||!(n.unstable_now()-C<A)}function P(){if(y=!1,T){var e=n.unstable_now();C=e;var t=!0;try{e:{v=!1,x&&(x=!1,b(E),E=-1),g=!0;var i=m;try{t:{for(M(e),f=r(h);null!==f&&!(f.expirationTime>e&&R());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,M(e),t=!0;break t}f===r(h)&&a(h),M(e)}else a(h);f=r(h)}if(null!==f)t=!0;else{var u=r(d);null!==u&&N(w,u.startTime-e),t=!1}}break e}finally{f=null,m=i,g=!1}}}finally{t?o():T=!1}}}if("function"==typeof S)o=function(){S(P)};else if("u">typeof MessageChannel){var I=new MessageChannel,L=I.port2;I.port1.onmessage=P,o=function(){L.postMessage(null)}}else o=function(){_(P,0)};function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<e?Math.floor(1e3/e):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},n.unstable_requestPaint=function(){y=!0},n.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},n.unstable_scheduleCallback=function(e,t,a){var s=n.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=0x3fffffff;break;case 4:l=1e4;break;default:l=5e3}return l=a+l,e={id:p++,callback:t,priorityLevel:e,startTime:a,expirationTime:l,sortIndex:-1},a>s?(e.sortIndex=a,i(d,e),null===r(h)&&e===r(d)&&(x?(b(E),E=-1):x=!0,N(w,a-s))):(e.sortIndex=l,i(h,e),v||g||(v=!0,T||(T=!0,o()))),e},n.unstable_shouldYield=R,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},66241,(e,t,n)=>{"use strict";t.exports=e.r(54876)},28592,e=>{"use strict";let t,n,i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,x,y,_,b,S;var M,w,T,E,A,C,R=e.i(27493),P=e.i(4),I=e.i(42098),L=e.i(88069),N=e.i(87353);function D({stats:e,contradictionCount:t,quarantineCount:n,lastConsolidation:i,workerStatus:r,onClickContradictions:a,onClickQuarantine:s,onClickConsolidation:o}){let l=(e?.decayDistribution?.healthy??0)+(e?.decayDistribution?.fading??0)+(e?.decayDistribution?.critical??0),u=l>0?Math.round((e?.decayDistribution?.healthy??0)/l*100):100,c=u>70?"text-emerald-400":u>40?"text-amber-400":"text-red-400",h=e?.total??0,d=e?.totalLinks??e?.links??0;return(0,R.jsxs)("div",{className:"flex items-center h-10 px-4 bg-slate-900/80 backdrop-blur-sm border-b border-slate-800 text-sm",children:[(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Brain Health"}),(0,R.jsxs)("span",{className:`font-medium ${c}`,children:[u,"%"]})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Memories"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:h})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Links"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:d})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:a,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Contradictions"}),(0,R.jsx)("span",{className:`font-medium ${t>0?"text-amber-400 animate-pulse":"text-slate-200"}`,children:t})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:s,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Quarantine"}),(0,R.jsx)("span",{className:`font-medium ${n>0?"text-red-400 animate-pulse":"text-slate-200"}`,children:n})]}),(0,R.jsx)("div",{className:"w-px h-4 bg-slate-700 mx-3"}),(0,R.jsxs)("button",{onClick:o,className:"flex items-center gap-1.5 hover:bg-slate-800/60 rounded px-1.5 py-0.5 transition-colors",children:[(0,R.jsx)("span",{className:"text-slate-400",children:"Consolidated"}),(0,R.jsx)("span",{className:"text-slate-200 font-medium",children:function(e){if(!e)return"Never";let t=new Date(e),n=Math.floor((Date.now()-t.getTime())/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;let i=Math.floor(n/60);if(i<24)return`${i}h ago`;let r=Math.floor(i/24);return`${r}d ago`}(i)})]})]})}var U=e.i(97358);function O({percentage:e,size:t=80,strokeWidth:n=6}){let i=(t-n)/2,r=2*Math.PI*i,a=Math.max(0,Math.min(100,e)),s=a>70?"#10B981":a>=40?"#F59E0B":"#EF4444";return(0,R.jsxs)("div",{className:"relative inline-flex items-center justify-center",children:[(0,R.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:"-rotate-90",children:[(0,R.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:"currentColor",strokeWidth:n,className:"text-slate-700"}),(0,R.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:s,strokeWidth:n,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r-a/100*r,style:{transition:"stroke-dashoffset 0.6s ease, stroke 0.4s ease"}})]}),(0,R.jsxs)("span",{className:"absolute text-sm font-semibold",style:{color:s},children:[Math.round(a),"%"]})]})}function F({category:e,healthPct:t,count:n,color:i,isActive:r,onClick:a}){let s=Math.max(0,Math.min(100,t));return(0,R.jsxs)("button",{onClick:a,className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors ${r?"bg-slate-700/60 border border-slate-600":"bg-transparent border border-transparent hover:bg-slate-800/60"}`,children:[(0,R.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:i}}),(0,R.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,R.jsx)("span",{className:"text-[11px] text-slate-300 capitalize truncate",children:e}),(0,R.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 ml-1",children:[s<50&&(0,R.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 flex-shrink-0",title:"Health below 50%"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-500",children:n})]})]}),(0,R.jsx)("div",{className:"w-full h-1 rounded-full bg-slate-700 overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full",style:{width:`${s}%`,backgroundColor:s>70?"#10B981":s>40?"#F59E0B":"#EF4444",transition:"width 0.4s ease, background-color 0.4s ease"}})})]})]})}function z({stats:e,memories:t,onCategoryClick:n,activeCategory:i,onConsolidate:r,isConsolidating:a,onScanContradictions:s,workerStatus:o}){let l=(0,P.useMemo)(()=>{let t=(e?.decayDistribution?.healthy??0)+(e?.decayDistribution?.fading??0)+(e?.decayDistribution?.critical??0);return t>0?Math.round((e?.decayDistribution?.healthy??0)/t*100):100},[e?.decayDistribution]),u=(0,P.useMemo)(()=>{let n=e?.byCategory??{};return Object.keys(n).map(e=>{let i=t.filter(t=>t.category===e),r=n[e]??0,a=100;i.length>0&&(a=Math.round(i.reduce((e,t)=>e+(t.decayedScore??t.salience??.5),0)/i.length*100));let s=U.CATEGORY_COLORS[e]??U.CATEGORY_COLORS.custom;return{category:e,healthPct:a,count:r,color:s}})},[e?.byCategory,t]),c=o?.running?"Active":o?.lastRun?"Idle":"Stopped",h=o?.running?"bg-emerald-400":o?.lastRun?"bg-amber-400":"bg-slate-500";return(0,R.jsxs)("div",{className:"w-56 shrink-0 h-full flex flex-col bg-slate-900/80 backdrop-blur-sm border-r border-slate-800",children:[(0,R.jsxs)("div",{className:"flex flex-col items-center py-4 px-3 border-b border-slate-800",children:[(0,R.jsx)(O,{percentage:l,size:80,strokeWidth:6}),(0,R.jsx)("span",{className:"text-[11px] text-slate-400 mt-2",children:"Brain Health"})]}),(0,R.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider px-2 mb-1",children:"Categories"}),0===u.length&&(0,R.jsx)("div",{className:"text-[11px] text-slate-500 px-2 py-2",children:"No categories yet"}),u.map(({category:e,healthPct:t,count:r,color:a})=>(0,R.jsx)(F,{category:e,healthPct:t,count:r,color:a,isActive:i===e,onClick:()=>n(i===e?null:e)},e))]}),(0,R.jsxs)("div",{className:"px-3 py-3 border-t border-slate-800 space-y-2",children:[(0,R.jsx)("button",{onClick:r,disabled:a,className:`w-full px-2 py-1.5 text-[11px] rounded transition-colors ${a?"bg-slate-700 text-slate-500 cursor-not-allowed":"bg-blue-600/80 text-blue-100 hover:bg-blue-600"}`,children:a?"Consolidating...":"Consolidate Now"}),s&&(0,R.jsx)("button",{onClick:s,className:"w-full px-2 py-1.5 text-[11px] rounded bg-slate-700/60 text-slate-300 hover:bg-slate-700 transition-colors",children:"Scan Contradictions"}),(0,R.jsxs)("div",{className:"flex items-center gap-2 px-1 pt-1",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${h}`}),(0,R.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Worker: ",c]})]})]})]})}function k(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"Just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let i=Math.floor(n/24);return`${i}d ago`}let B={short_term:"STM",long_term:"LTM",episodic:"Episodic"},V={references:"bg-blue-500/20 text-blue-400 border-blue-500/30",extends:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",contradicts:"bg-red-500/20 text-red-400 border-red-500/30",related:"bg-slate-500/20 text-slate-400 border-slate-500/30"},H={references:"#3B82F6",extends:"#10B981",contradicts:"#EF4444",related:"#6B7280"};function j({memory:e,links:t,onClose:n,onBoost:i,onDemote:r,onPromote:a,onDelete:s,onQuarantine:o,onNavigateToMemory:l}){if(!e)return(0,R.jsxs)("div",{className:"w-80 shrink-0 h-full bg-slate-900/80 backdrop-blur-sm border-l border-slate-800 flex flex-col items-center justify-center",children:[(0,R.jsx)("div",{className:"text-slate-600 mb-3",children:(0,R.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 2.38-1.19 4.47-3 5.74V17a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1v-2.26C6.19 13.47 5 11.38 5 9a7 7 0 0 1 7-7z"}),(0,R.jsx)("path",{d:"M9 21h6"}),(0,R.jsx)("path",{d:"M10 21v1a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-1"})]})}),(0,R.jsx)("p",{className:"text-slate-500 text-sm",children:"Click a memory node to inspect it"})]});let u=e.salience??0,c=e.decayedScore??u,h=U.CATEGORY_COLORS[e.category]||U.CATEGORY_COLORS.custom,d=c>.7?"bg-emerald-400":c>=.4?"bg-amber-400":"bg-red-400",p=t.map(t=>{let n=t.source_id===e.id;return{link:t,targetId:n?t.target_id:t.source_id,targetTitle:n?t.target_title||`Memory #${t.target_id}`:t.source_title||`Memory #${t.source_id}`,targetCategory:n?t.target_category:t.source_category,relationship:t.relationship,strength:t.strength}});return(0,R.jsxs)("div",{className:"w-80 shrink-0 h-full bg-slate-900/80 backdrop-blur-sm border-l border-slate-800 flex flex-col",children:[(0,R.jsxs)("div",{className:"sticky top-0 z-10 bg-slate-900/95 backdrop-blur-sm border-b border-slate-800 p-4 flex-shrink-0",children:[(0,R.jsx)("button",{onClick:n,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors","aria-label":"Close inspector",children:(0,R.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,R.jsx)("path",{d:"M4 4l8 8M12 4l-8 8"})})}),(0,R.jsx)("h3",{className:"text-slate-200 font-medium text-sm pr-6 leading-tight mb-2",children:e.title}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5 mb-2.5",children:[(0,R.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full border",style:{color:h,borderColor:`${h}40`,backgroundColor:`${h}15`},children:e.category}),(0,R.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:B[e.type]||e.type})]}),(0,R.jsxs)("div",{className:"mb-1.5",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,R.jsx)("span",{className:"text-[10px] text-slate-500",children:"Salience"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-400 font-mono",children:u.toFixed(2)})]}),(0,R.jsx)("div",{className:"h-1 bg-slate-800 rounded-full overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100*u,100)}%`,backgroundColor:h}})})]}),(0,R.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,R.jsx)("div",{className:`w-2 h-2 rounded-full ${d}`}),(0,R.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Health ",c.toFixed(2)]})]})]}),(0,R.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,R.jsxs)("div",{className:"p-4 border-b border-slate-800",children:[(0,R.jsxs)("div",{className:"mb-3",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"Content"}),(0,R.jsx)("div",{className:"max-h-48 overflow-y-auto rounded bg-slate-950/60 border border-slate-800 p-2",children:(0,R.jsx)("pre",{className:"text-xs text-slate-300 whitespace-pre-wrap break-words font-mono leading-relaxed",children:e.content})})]}),e.tags&&e.tags.length>0&&(0,R.jsxs)("div",{className:"mb-3",children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"Tags"}),(0,R.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,R.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:e},e))})]}),(0,R.jsxs)("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Created"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:k(e.createdAt)})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Last Accessed"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:k(e.lastAccessed)})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Access Count"}),(0,R.jsx)("div",{className:"text-xs text-slate-300",children:e.accessCount})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{className:"text-[10px] text-slate-500",children:"Project"}),(0,R.jsx)("div",{className:"text-xs text-slate-300 truncate",title:e.project||"Global",children:e.project||"Global"})]})]})]}),(0,R.jsxs)("div",{className:"p-4",children:[(0,R.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,R.jsx)("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Connections"}),(0,R.jsx)("span",{className:"text-[10px] text-slate-600 font-mono",children:p.length})]}),0===p.length?(0,R.jsx)("p",{className:"text-xs text-slate-600 py-2",children:"No connections yet"}):(0,R.jsx)("div",{className:"space-y-2",children:p.map(e=>{let t=V[e.relationship]||V.related,n=H[e.relationship]||H.related,i=e.targetCategory?U.CATEGORY_COLORS[e.targetCategory]||U.CATEGORY_COLORS.custom:"#6B7280";return(0,R.jsxs)("button",{onClick:()=>l(e.targetId),className:"w-full text-left rounded bg-slate-800/40 hover:bg-slate-800/70 border border-slate-800 hover:border-slate-700 p-2 transition-colors group",children:[(0,R.jsxs)("div",{className:"flex items-start gap-1.5 mb-1",children:[(0,R.jsx)("div",{className:"w-1.5 h-1.5 rounded-full mt-1 flex-shrink-0",style:{backgroundColor:i}}),(0,R.jsx)("span",{className:"text-xs text-slate-300 group-hover:text-slate-200 leading-tight line-clamp-2",children:e.targetTitle})]}),(0,R.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,R.jsx)("span",{className:`text-[9px] px-1 py-0.5 rounded border ${t}`,children:e.relationship}),(0,R.jsx)("div",{className:"flex-1 h-0.5 bg-slate-800 rounded-full overflow-hidden",children:(0,R.jsx)("div",{className:"h-full rounded-full",style:{width:`${Math.min(100*e.strength,100)}%`,backgroundColor:n}})}),(0,R.jsx)("span",{className:"text-[9px] text-slate-600 font-mono",children:e.strength.toFixed(1)})]})]},e.link.id)})})]})]}),(0,R.jsx)("div",{className:"sticky bottom-0 z-10 bg-slate-900/95 backdrop-blur-sm border-t border-slate-800 p-3 flex-shrink-0",children:(0,R.jsxs)("div",{className:"flex items-center gap-1",children:[(0,R.jsxs)("button",{onClick:()=>i(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-emerald-400 hover:bg-slate-800/60 transition-colors",title:"Boost salience",children:[(0,R.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,R.jsx)("path",{d:"M8 12V4M4 8l4-4 4 4"})}),(0,R.jsx)("span",{className:"text-[9px]",children:"Boost"})]}),(0,R.jsxs)("button",{onClick:()=>r(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-amber-400 hover:bg-slate-800/60 transition-colors",title:"Demote salience",children:[(0,R.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,R.jsx)("path",{d:"M8 4v8M4 8l4 4 4-4"})}),(0,R.jsx)("span",{className:"text-[9px]",children:"Demote"})]}),"short_term"===e.type&&(0,R.jsxs)("button",{onClick:()=>a(e.id),className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-blue-400 hover:bg-slate-800/60 transition-colors",title:"Promote to LTM",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M4 12l4-8 4 8"}),(0,R.jsx)("path",{d:"M5.5 9h5"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Promote"})]}),(0,R.jsxs)("button",{onClick:()=>{window.confirm(`Delete memory "${e.title}"? This cannot be undone.`)&&s(e.id)},className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-red-400 hover:bg-slate-800/60 transition-colors",title:"Delete memory",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M2 4h12M5 4V3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1M6 7v5M10 7v5"}),(0,R.jsx)("path",{d:"M3 4l1 9a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1l1-9"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Delete"})]}),(0,R.jsxs)("button",{onClick:()=>{window.confirm(`Quarantine memory "${e.title}"? It will be flagged for review.`)&&o(e.id)},className:"flex-1 flex flex-col items-center gap-0.5 py-1.5 px-1 rounded text-slate-400 hover:text-violet-400 hover:bg-slate-800/60 transition-colors",title:"Quarantine memory",children:[(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M8 1.5L1.5 5v6L8 14.5 14.5 11V5L8 1.5z"}),(0,R.jsx)("path",{d:"M8 5v4M8 11h.01"})]}),(0,R.jsx)("span",{className:"text-[9px]",children:"Quarantine"})]})]})})]})}let G=[{key:"all",label:"All",types:[]},{key:"creates",label:"Creates",types:["memory_created"]},{key:"updates",label:"Updates",types:["memory_updated","memory_accessed"]},{key:"deletes",label:"Deletes",types:["memory_deleted"]},{key:"consolidation",label:"Consolidation",types:["consolidation_complete"]},{key:"decay",label:"Decay",types:["decay_tick"]}],W={memory_created:"bg-emerald-400",memory_accessed:"bg-blue-400",memory_updated:"bg-amber-400",memory_deleted:"bg-red-400",consolidation_complete:"bg-purple-400",decay_tick:"bg-slate-400"},X={memory_created:"Created",memory_accessed:"Accessed",memory_updated:"Updated",memory_deleted:"Deleted",consolidation_complete:"Consolidated",decay_tick:"Decay Tick"};function q(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<5)return"Just now";if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Y(e){return e&&"object"==typeof e?"string"==typeof e.title&&e.title?e.title:"string"==typeof e.name&&e.name?e.name:"string"==typeof e.summary&&e.summary?e.summary:"string"==typeof e.message&&e.message?e.message:"number"==typeof e.id?`Memory #${e.id}`:"":""}function Z({events:e,onClickEvent:t,isCollapsed:n=!1,onToggleCollapse:i}){let[r,a]=(0,P.useState)(new Set(["all"])),s=(0,P.useCallback)(e=>{a(t=>{let n=new Set(t);if("all"===e)return new Set(["all"]);if(n.delete("all"),n.has(e)){if(n.delete(e),0===n.size)return new Set(["all"])}else n.add(e);return n})},[]),o=(0,P.useMemo)(()=>{if(r.has("all"))return e;let t=new Set;for(let e of r){let n=G.find(t=>t.key===e);if(n)for(let e of n.types)t.add(e)}return e.filter(e=>t.has(e.type))},[e,r]),l=e.length>0?e[0]:null;return(0,R.jsx)("div",{className:`bg-slate-900/80 backdrop-blur-sm border-t border-slate-800 transition-all duration-300 ease-in-out ${n?"h-8":"h-32"}`,children:n?(0,R.jsxs)("div",{className:"flex items-center h-8 px-3 gap-2",children:[(0,R.jsx)("button",{onClick:i,className:"flex items-center justify-center w-5 h-5 rounded hover:bg-slate-800 transition-colors text-slate-400 hover:text-slate-200 shrink-0","aria-label":"Expand activity feed",children:(0,R.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,R.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),l?(0,R.jsxs)("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${W[l.type]}`}),(0,R.jsx)("span",{className:"text-slate-500",children:q(l.timestamp)}),(0,R.jsx)("span",{className:"text-slate-300",children:X[l.type]}),(0,R.jsx)("span",{className:"text-slate-500 truncate",children:Y(l.data)})]}):(0,R.jsx)("span",{className:"text-xs text-slate-500",children:"No activity"})]}):(0,R.jsxs)("div",{className:"flex flex-col h-full",children:[(0,R.jsxs)("div",{className:"flex items-center h-7 px-3 gap-2 shrink-0 border-b border-slate-800/50",children:[(0,R.jsx)("button",{onClick:i,className:"flex items-center justify-center w-5 h-5 rounded hover:bg-slate-800 transition-colors text-slate-400 hover:text-slate-200 shrink-0","aria-label":"Collapse activity feed",children:(0,R.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,R.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),(0,R.jsx)("div",{className:"flex items-center gap-1",children:G.map(e=>(0,R.jsx)("button",{onClick:()=>s(e.key),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${r.has(e.key)?"bg-cyan-600 text-white":"bg-slate-800 text-slate-400 hover:bg-slate-700"}`,children:e.label},e.key))})]}),(0,R.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:0===o.length?(0,R.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,R.jsx)("span",{className:"text-xs text-slate-500",children:"No activity yet -- events will appear as the brain processes memories"})}):(0,R.jsx)("div",{className:"px-3 py-1",children:o.map((e,n)=>{let i=Y(e.data);return(0,R.jsxs)("button",{onClick:()=>t?.(e.data),className:"flex items-center gap-2 w-full text-left py-0.5 px-1 rounded hover:bg-slate-800/60 transition-colors group",children:[(0,R.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${W[e.type]}`}),(0,R.jsx)("span",{className:"text-[10px] text-slate-500 w-12 shrink-0 tabular-nums",children:q(e.timestamp)}),(0,R.jsx)("span",{className:"text-[10px] text-slate-300 w-16 shrink-0",children:X[e.type]}),i&&(0,R.jsx)("span",{className:"text-[10px] text-slate-500 truncate group-hover:text-slate-400 transition-colors",children:i})]},`${e.type}-${e.timestamp}-${n}`)})})})]})})}var J=e.i(22534),$=P;let K={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Q={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ee="attached",et="detached",en="srgb",ei="srgb-linear",er="linear",ea="srgb",es="300 es",eo={COMPUTE:"compute",RENDER:"render"},el={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},eu={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function ec(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let eh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ed(e,t){return new eh[e](t)}function ep(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ef(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function em(){let e=ef("canvas");return e.style.display="block",e}let eg={},ev=null;function ex(e){ev=e}function ey(){return ev}function e_(...e){let t="THREE."+e.shift();ev?ev("log",t,...e):console.log(t,...e)}function eb(...e){let t="THREE."+e.shift();ev?ev("warn",t,...e):console.warn(t,...e)}function eS(...e){let t="THREE."+e.shift();ev?ev("error",t,...e):console.error(t,...e)}function eM(...e){let t=e.join(" ");t in eg||(eg[t]=!0,eb(...e))}class ew{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let i=n[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,i=t.length;n<i;n++)t[n].call(this,e);e.target=null}}}let eT=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],eE=1234567,eA=Math.PI/180,eC=180/Math.PI;function eR(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0;return(eT[255&e]+eT[e>>8&255]+eT[e>>16&255]+eT[e>>24&255]+"-"+eT[255&t]+eT[t>>8&255]+"-"+eT[t>>16&15|64]+eT[t>>24&255]+"-"+eT[63&n|128]+eT[n>>8&255]+"-"+eT[n>>16&255]+eT[n>>24&255]+eT[255&i]+eT[i>>8&255]+eT[i>>16&255]+eT[i>>24&255]).toLowerCase()}function eP(e,t,n){return Math.max(t,Math.min(n,e))}function eI(e,t){return(e%t+t)%t}function eL(e,t,n){return(1-n)*e+n*t}function eN(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function eD(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let eU={DEG2RAD:eA,RAD2DEG:eC,generateUUID:eR,clamp:eP,euclideanModulo:eI,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:eL,damp:function(e,t,n,i){return eL(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(eI(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(eE=e);let t=eE+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*eA},radToDeg:function(e){return e*eC},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+i)/2),c=s((t+i)/2),h=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:eb("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:eD,denormalize:eN};class eO{constructor(e=0,t=0){eO.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 Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(eP(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class eF{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(s<=0){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(s>=1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=o*h+l*d+u*p+c*f;e<0&&(h=-h,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let n=Math.acos(e),i=Math.sin(n);o=o*(t=Math.sin(t*n)/i)+h*(s=Math.sin(s*n)/i),l=l*t+d*s,u=u*t+p*s,c=c*t+f*s}else{let e=1/Math.sqrt((o=o*t+h*s)*o+(l=l*t+d*s)*l+(u=u*t+p*s)*u+(c=c*t+f*s)*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,a){let s=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:eb("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(eP(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(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){let n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+i*l-r*o,this._y=i*u+a*o+r*s-n*l,this._z=r*u+a*l+n*o-i*s,this._w=a*u-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(n=-n,i=-i,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ez{constructor(e=0,t=0,n=0){ez.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eB.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eB.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),u=2*(s*t-r*i),c=2*(r*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-r*c,this.z=i+o*c+r*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this.z=eP(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this.z=eP(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ek.copy(this).projectOnVector(e),this.sub(ek)}reflect(e){return this.sub(ek.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(eP(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-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}}let ek=new ez,eB=new eF;class eV{constructor(e,t,n,i,r,a,s,o,l){eV.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],x=i[4],y=i[7],_=i[2],b=i[5],S=i[8];return r[0]=a*f+s*v+o*_,r[3]=a*m+s*x+o*b,r[6]=a*g+s*y+o*S,r[1]=l*f+u*v+c*_,r[4]=l*m+u*x+c*b,r[7]=l*g+u*y+c*S,r[2]=h*f+d*v+p*_,r[5]=h*m+d*x+p*b,r[8]=h*g+d*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*r*u+n*s*o+i*r*l-i*a*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*r,d=l*r-a*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(i*l-u*n)*f,e[2]=(s*n-i*a)*f,e[3]=h*f,e[4]=(u*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(eH.makeScale(e,t)),this}rotate(e){return this.premultiply(eH.makeRotation(-e)),this}translate(e,t){return this.premultiply(eH.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let eH=new eV,ej=new eV().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eG=new eV().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),eW=(f=[.64,.33,.3,.6,.15,.06],m=[.2126,.7152,.0722],g=[.3127,.329],(p={enabled:!0,workingColorSpace:ei,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===ea&&(e.r=eX(e.r),e.g=eX(e.g),e.b=eX(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===ea&&(e.r=eq(e.r),e.g=eq(e.g),e.b=eq(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?er:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return eM("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),p.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return eM("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),p.colorSpaceToWorking(e,t)}}).define({[ei]:{primaries:f,whitePoint:g,transfer:er,toXYZ:ej,fromXYZ:eG,luminanceCoefficients:m,workingColorSpaceConfig:{unpackColorSpace:en},outputColorSpaceConfig:{drawingBufferColorSpace:en}},[en]:{primaries:f,whitePoint:g,transfer:ea,toXYZ:ej,fromXYZ:eG,luminanceCoefficients:m,outputColorSpaceConfig:{drawingBufferColorSpace:en}}}),p);function eX(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function eq(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eY{static getDataURL(e,n="image/png"){let i;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=ef("canvas")),t.width=e.width,t.height=e.height;let n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=t}return i.toDataURL(n)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=ef("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*eX(r[e]/255);return n.putImageData(i,0,0),t}if(!e.data)return eb("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*eX(t[e]/255)):t[e]=eX(t[e]);return{data:t,width:e.width,height:e.height}}}}let eZ=0;class eJ{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eZ++}),this.uuid=eR(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(e$(i[t].image)):e.push(e$(i[t]))}else e=e$(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function e$(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?eY.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(eb("Texture: Unable to serialize Texture."),{})}let eK=0,eQ=new ez;class e0 extends ew{constructor(e=e0.DEFAULT_IMAGE,t=e0.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,s=1023,o=1009,l=e0.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eK++}),this.uuid=eR(),this.name="",this.source=new eJ(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new eO(0,0),this.repeat=new eO(1,1),this.center=new eO(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eV,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(eQ).x}get height(){return this.source.getSize(eQ).y}get depth(){return this.source.getSize(eQ).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){eb(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){eb(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}e0.DEFAULT_IMAGE=null,e0.DEFAULT_MAPPING=300,e0.DEFAULT_ANISOTROPY=1;class e1{constructor(e=0,t=0,n=0,i=1){e1.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);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,i,r,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,x=(h+p)/4;return e>a&&e>m?e<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(e)),r=v/n):a>m?a<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(a)),r=x/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=v/(r=Math.sqrt(m)),i=x/r),this.set(n,i,r,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=eP(this.x,e.x,t.x),this.y=eP(this.y,e.y,t.y),this.z=eP(this.z,e.z,t.z),this.w=eP(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=eP(this.x,e,t),this.y=eP(this.y,e,t),this.z=eP(this.z,e,t),this.w=eP(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(eP(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 e2 extends ew{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new e1(0,0,e,t),this.scissorTest=!1,this.viewport=new e1(0,0,e,t);const i=new e0({width:e,height:t,depth:n.depth});this.textures=[];const r=n.count;for(let e=0;e<r;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new eJ(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class e3 extends e2{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class e4 extends e0{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class e5 extends e3{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new e4(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class e6 extends e0{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e8 extends e3{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new e6(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class e9{constructor(e=new ez(Infinity,Infinity,Infinity),t=new ez(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(te.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(te.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=te.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,te):te.fromBufferAttribute(i,t),te.applyMatrix4(e.matrixWorld),this.expandByPoint(te);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),tt.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),tt.copy(n.boundingBox)),tt.applyMatrix4(e.matrixWorld),this.union(tt)}let i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,te),te.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(tl),tu.subVectors(this.max,tl),tn.subVectors(e.a,tl),ti.subVectors(e.b,tl),tr.subVectors(e.c,tl),ta.subVectors(ti,tn),ts.subVectors(tr,ti),to.subVectors(tn,tr);let t=[0,-ta.z,ta.y,0,-ts.z,ts.y,0,-to.z,to.y,ta.z,0,-ta.x,ts.z,0,-ts.x,to.z,0,-to.x,-ta.y,ta.x,0,-ts.y,ts.x,0,-to.y,to.x,0];return!!td(t,tn,ti,tr,tu)&&!!td(t=[1,0,0,0,1,0,0,0,1],tn,ti,tr,tu)&&(tc.crossVectors(ta,ts),td(t=[tc.x,tc.y,tc.z],tn,ti,tr,tu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,te).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(te).length()),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()||(e7[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),e7[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),e7[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),e7[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),e7[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),e7[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),e7[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),e7[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(e7)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let e7=[new ez,new ez,new ez,new ez,new ez,new ez,new ez,new ez],te=new ez,tt=new e9,tn=new ez,ti=new ez,tr=new ez,ta=new ez,ts=new ez,to=new ez,tl=new ez,tu=new ez,tc=new ez,th=new ez;function td(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){th.fromArray(e,a);let s=r.x*Math.abs(th.x)+r.y*Math.abs(th.y)+r.z*Math.abs(th.z),o=t.dot(th),l=n.dot(th),u=i.dot(th);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let tp=new e9,tf=new ez,tm=new ez;class tg{constructor(e=new ez,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):tp.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.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;tf.subVectors(e,this.center);let t=tf.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(tf,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(tm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(tf.copy(e.center).add(tm)),this.expandByPoint(tf.copy(e.center).sub(tm)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tv=new ez,tx=new ez,ty=new ez,t_=new ez,tb=new ez,tS=new ez,tM=new ez;class tw{constructor(e=new ez,t=new ez(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,tv)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=tv.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tv.copy(this.origin).addScaledVector(this.direction,t),tv.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){let r,a,s,o;tx.copy(e).add(t).multiplyScalar(.5),ty.copy(t).sub(e).normalize(),t_.copy(this.origin).sub(tx);let l=.5*e.distanceTo(t),u=-this.direction.dot(ty),c=t_.dot(this.direction),h=-t_.dot(ty),d=t_.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(r=u*h-c,a=u*c-h,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+u*a+2*c)+a*(u*r+a+2*h)+d}else s=-(r=Math.max(0,-(u*(a=l)+c)))*r+a*(a+2*h)+d;else s=-(r=Math.max(0,-(u*(a=-l)+c)))*r+a*(a+2*h)+d;else a<=-o?(a=(r=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(r=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d);else a=u>0?-l:l,s=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(tx).addScaledVector(ty,a),s}intersectSphere(e,t){tv.subVectors(e.center,this.origin);let n=tv.dot(this.direction),i=tv.dot(tv)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,i,r,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>i||((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0)))?null:this.at(n>=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,tv)}intersectTriangle(e,t,n,i,r){let a;tb.subVectors(t,e),tS.subVectors(n,e),tM.crossVectors(tb,tS);let s=this.direction.dot(tM);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}t_.subVectors(this.origin,e);let o=a*this.direction.dot(tS.crossVectors(t_,tS));if(o<0)return null;let l=a*this.direction.dot(tb.cross(t_));if(l<0||o+l>s)return null;let u=-a*t_.dot(tM);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tT{constructor(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){tT.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new tT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2)),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,n=e.elements,i=1/tE.setFromMatrixColumn(e,0).length(),r=1/tE.setFromMatrixColumn(e,1).length(),a=1/tE.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*u,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=a*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=s*u,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(tC,e,tR)}lookAt(e,t,n){let i=this.elements;return tL.subVectors(e,t),0===tL.lengthSq()&&(tL.z=1),tL.normalize(),tP.crossVectors(n,tL),0===tP.lengthSq()&&(1===Math.abs(n.z)?tL.x+=1e-4:tL.z+=1e-4,tL.normalize(),tP.crossVectors(n,tL)),tP.normalize(),tI.crossVectors(tL,tP),i[0]=tP.x,i[4]=tI.x,i[8]=tL.x,i[1]=tP.y,i[5]=tI.y,i[9]=tL.y,i[2]=tP.z,i[6]=tI.z,i[10]=tL.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],x=n[7],y=n[11],_=n[15],b=i[0],S=i[4],M=i[8],w=i[12],T=i[1],E=i[5],A=i[9],C=i[13],R=i[2],P=i[6],I=i[10],L=i[14],N=i[3],D=i[7],U=i[11],O=i[15];return r[0]=a*b+s*T+o*R+l*N,r[4]=a*S+s*E+o*P+l*D,r[8]=a*M+s*A+o*I+l*U,r[12]=a*w+s*C+o*L+l*O,r[1]=u*b+c*T+h*R+d*N,r[5]=u*S+c*E+h*P+d*D,r[9]=u*M+c*A+h*I+d*U,r[13]=u*w+c*C+h*L+d*O,r[2]=p*b+f*T+m*R+g*N,r[6]=p*S+f*E+m*P+g*D,r[10]=p*M+f*A+m*I+g*U,r[14]=p*w+f*C+m*L+g*O,r[3]=v*b+x*T+y*R+_*N,r[7]=v*S+x*E+y*P+_*D,r[11]=v*M+x*A+y*I+_*U,r[15]=v*w+x*C+y*L+_*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*d-l*h,x=s*d-l*c,y=s*h-o*c,_=a*d-l*u,b=a*h-o*u,S=a*c-s*u;return t*(f*v-m*x+g*y)-n*(p*v-m*_+g*b)+i*(p*x-f*_+g*S)-r*(p*y-f*b+m*S)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,x=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,y=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,_=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*x+i*y+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return e[0]=v*S,e[1]=(f*h*r-c*m*r-f*i*d+n*m*d+c*i*g-n*h*g)*S,e[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*S,e[3]=(c*o*r-s*h*r-c*i*l+n*h*l+s*i*d-n*o*d)*S,e[4]=x*S,e[5]=(u*m*r-p*h*r+p*i*d-t*m*d-u*i*g+t*h*g)*S,e[6]=(p*o*r-a*m*r-p*i*l+t*m*l+a*i*g-t*o*g)*S,e[7]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*d+t*o*d)*S,e[8]=y*S,e[9]=(p*c*r-u*f*r-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*r-p*s*r+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*r-a*c*r-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=_*S,e[13]=(u*f*i-p*c*i+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*i-a*f*i-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*i-u*s*i+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,u=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+n,u*o-i*a,0,l*o-i*s,u*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,u=a+a,c=s+s,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,g=s*c,v=o*l,x=o*u,y=o*c,_=n.x,b=n.y,S=n.z;return i[0]=(1-(f+g))*_,i[1]=(d+y)*_,i[2]=(p-x)*_,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+x)*S,i[9]=(m-v)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],0===this.determinant())return n.set(1,1,1),t.identity(),this;let r=tE.set(i[0],i[1],i[2]).length(),a=tE.set(i[4],i[5],i[6]).length(),s=tE.set(i[8],i[9],i[10]).length();0>this.determinant()&&(r=-r),tA.copy(this);let o=1/r,l=1/a,u=1/s;return tA.elements[0]*=o,tA.elements[1]*=o,tA.elements[2]*=o,tA.elements[4]*=l,tA.elements[5]*=l,tA.elements[6]*=l,tA.elements[8]*=u,tA.elements[9]*=u,tA.elements[10]*=u,t.setFromRotationMatrix(tA),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=r/(a-r),u=a*r/(a-r);else if(2e3===s)l=-(a+r)/(a-r),u=-2*a*r/(a-r);else if(2001===s)l=-a/(a-r),u=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(n-i),c[9]=(n+i)/(n-i),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=1/(a-r),u=a/(a-r);else if(2e3===s)l=-2/(a-r),u=-(a+r)/(a-r);else if(2001===s)l=-1/(a-r),u=-r/(a-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-i),c[9]=0,c[13]=-(n+i)/(n-i),c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}let tE=new ez,tA=new tT,tC=new ez(0,0,0),tR=new ez(1,1,1),tP=new ez,tI=new ez,tL=new ez,tN=new tT,tD=new eF;class tU{constructor(e=0,t=0,n=0,i=tU.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(eP(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-eP(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(eP(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-eP(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(eP(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-eP(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:eb("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return tN.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tN,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tD.setFromEuler(this),this.setFromQuaternion(tD,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],void 0!==e[3]&&(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}}tU.DEFAULT_ORDER="XYZ";class tO{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let tF=0,tz=new ez,tk=new eF,tB=new tT,tV=new ez,tH=new ez,tj=new ez,tG=new eF,tW=new ez(1,0,0),tX=new ez(0,1,0),tq=new ez(0,0,1),tY={type:"added"},tZ={type:"removed"},tJ={type:"childadded",child:null},t$={type:"childremoved",child:null};class tK extends ew{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tF++}),this.uuid=eR(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tK.DEFAULT_UP.clone();const e=new ez,t=new tU,n=new eF,i=new ez(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new tT},normalMatrix:{value:new eV}}),this.matrix=new tT,this.matrixWorld=new tT,this.matrixAutoUpdate=tK.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=tK.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new tO,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return tk.setFromAxisAngle(e,t),this.quaternion.multiply(tk),this}rotateOnWorldAxis(e,t){return tk.setFromAxisAngle(e,t),this.quaternion.premultiply(tk),this}rotateX(e){return this.rotateOnAxis(tW,e)}rotateY(e){return this.rotateOnAxis(tX,e)}rotateZ(e){return this.rotateOnAxis(tq,e)}translateOnAxis(e,t){return tz.copy(e).applyQuaternion(this.quaternion),this.position.add(tz.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(tW,e)}translateY(e){return this.translateOnAxis(tX,e)}translateZ(e){return this.translateOnAxis(tq,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tB.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?tV.copy(e):tV.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),tH.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tB.lookAt(tH,tV,this.up):tB.lookAt(tV,tH,this.up),this.quaternion.setFromRotationMatrix(tB),i&&(tB.extractRotation(i.matrixWorld),tk.setFromRotationMatrix(tB),this.quaternion.premultiply(tk.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?eS("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(tY),tJ.child=e,this.dispatchEvent(tJ),tJ.child=null):eS("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tZ),t$.child=e,this.dispatchEvent(t$),t$.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),tB.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),tB.multiply(e.parent.matrixWorld)),e.applyMatrix4(tB),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(tY),tJ.child=e,this.dispatchEvent(tJ),tJ.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tH,e,tj),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tH,tG,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){let t=a(e.geometries),i=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),u=a(e.animations),c=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function a(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),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)),!0===t)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}}tK.DEFAULT_UP=new ez(0,1,0),tK.DEFAULT_MATRIX_AUTO_UPDATE=!0,tK.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let tQ=new ez,t0=new ez,t1=new ez,t2=new ez,t3=new ez,t4=new ez,t5=new ez,t6=new ez,t8=new ez,t9=new ez,t7=new e1,ne=new e1,nt=new e1;class nn{constructor(e=new ez,t=new ez,n=new ez){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),tQ.subVectors(e,t),i.cross(tQ);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){tQ.subVectors(i,t),t0.subVectors(n,t),t1.subVectors(e,t);let a=tQ.dot(tQ),s=tQ.dot(t0),o=tQ.dot(t1),l=t0.dot(t0),u=t0.dot(t1),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,t2)&&t2.x>=0&&t2.y>=0&&t2.x+t2.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,t2)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,t2.x),o.addScaledVector(a,t2.y),o.addScaledVector(s,t2.z),o)}static getInterpolatedAttribute(e,t,n,i,r,a){return t7.setScalar(0),ne.setScalar(0),nt.setScalar(0),t7.fromBufferAttribute(e,t),ne.fromBufferAttribute(e,n),nt.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(t7,r.x),a.addScaledVector(ne,r.y),a.addScaledVector(nt,r.z),a}static isFrontFacing(e,t,n,i){return tQ.subVectors(n,t),t0.subVectors(e,t),0>tQ.cross(t0).dot(i)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return tQ.subVectors(this.c,this.b),t0.subVectors(this.a,this.b),.5*tQ.cross(t0).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,i,r=this.a,a=this.b,s=this.c;t3.subVectors(a,r),t4.subVectors(s,r),t6.subVectors(e,r);let o=t3.dot(t6),l=t4.dot(t6);if(o<=0&&l<=0)return t.copy(r);t8.subVectors(e,a);let u=t3.dot(t8),c=t4.dot(t8);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(r).addScaledVector(t3,n);t9.subVectors(e,s);let d=t3.dot(t9),p=t4.dot(t9);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(t4,i);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return t5.subVectors(s,a),i=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(t5,i);let g=1/(m+f+h);return n=f*g,i=h*g,t.copy(r).addScaledVector(t3,n).addScaledVector(t4,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let ni={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},nr={h:0,s:0,l:0},na={h:0,s:0,l:0};function ns(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class no{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){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=en){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,eW.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=eW.workingColorSpace){return this.r=e,this.g=t,this.b=n,eW.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=eW.workingColorSpace){if(e=eI(e,1),t=eP(t,0,1),n=eP(n,0,1),0===t)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=ns(r,i,e+1/3),this.g=ns(r,i,e),this.b=ns(r,i,e-1/3)}return eW.colorSpaceToWorking(this,i),this}setStyle(e,t=en){let n;function i(t){void 0!==t&&1>parseFloat(t)&&eb("Color: Alpha component of "+e+" will be ignored.")}if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:eb("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(i,16),t);eb("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=en){let n=ni[e.toLowerCase()];return void 0!==n?this.setHex(n,t):eb("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=eX(e.r),this.g=eX(e.g),this.b=eX(e.b),this}copyLinearToSRGB(e){return this.r=eq(e.r),this.g=eq(e.g),this.b=eq(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=en){return eW.workingToColorSpace(nl.copy(this),e),65536*Math.round(eP(255*nl.r,0,255))+256*Math.round(eP(255*nl.g,0,255))+Math.round(eP(255*nl.b,0,255))}getHexString(e=en){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=eW.workingColorSpace){let n,i;eW.workingToColorSpace(nl.copy(this),t);let r=nl.r,a=nl.g,s=nl.b,o=Math.max(r,a,s),l=Math.min(r,a,s),u=(l+o)/2;if(l===o)n=0,i=0;else{let e=o-l;switch(i=u<=.5?e/(o+l):e/(2-o-l),o){case r:n=(a-s)/e+6*(a<s);break;case a:n=(s-r)/e+2;break;case s:n=(r-a)/e+4}n/=6}return e.h=n,e.s=i,e.l=u,e}getRGB(e,t=eW.workingColorSpace){return eW.workingToColorSpace(nl.copy(this),t),e.r=nl.r,e.g=nl.g,e.b=nl.b,e}getStyle(e=en){eW.workingToColorSpace(nl.copy(this),e);let t=nl.r,n=nl.g,i=nl.b;return e!==en?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(nr),this.setHSL(nr.h+e,nr.s+t,nr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(nr),e.getHSL(na);let n=eL(nr.h,na.h,t),i=eL(nr.s,na.s,t),r=eL(nr.l,na.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let nl=new no;no.NAMES=ni;let nu=0;class nc extends ew{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nu++}),this.uuid=eR(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new no(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){eb(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){eb(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(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,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),100!==this.blendEquation&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(n.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(n.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class nh extends nc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new no(0xffffff),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 tU,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let nd=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();function np(e){Math.abs(e)>65504&&eb("DataUtils.toHalfFloat(): Value out of range."),e=eP(e,-65504,65504),nd.floatView[0]=e;let t=nd.uint32View[0],n=t>>23&511;return nd.baseTable[n]+((8388607&t)>>nd.shiftTable[n])}function nf(e){let t=e>>10;return nd.uint32View[0]=nd.mantissaTable[nd.offsetTable[t]+(1023&e)]+nd.exponentTable[t],nd.floatView[0]}class nm{static toHalfFloat(e){return np(e)}static fromHalfFloat(e){return nf(e)}}let ng=new ez,nv=new eO,nx=0;class ny{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:nx++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)nv.fromBufferAttribute(this,t),nv.applyMatrix3(e),this.setXY(t,nv.x,nv.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyMatrix3(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyMatrix4(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.applyNormalMatrix(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ng.fromBufferAttribute(this,t),ng.transformDirection(e),this.setXYZ(t,ng.x,ng.y,ng.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=eN(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=eD(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=eN(t,this.array)),t}setX(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=eN(t,this.array)),t}setY(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=eN(t,this.array)),t}setZ(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=eN(t,this.array)),t}setW(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array),r=eD(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class n_ extends ny{constructor(e,t,n){super(new Int8Array(e),t,n)}}class nb extends ny{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class nS extends ny{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class nM extends ny{constructor(e,t,n){super(new Int16Array(e),t,n)}}class nw extends ny{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class nT extends ny{constructor(e,t,n){super(new Int32Array(e),t,n)}}class nE extends ny{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nA extends ny{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=nf(this.array[e*this.itemSize]);return this.normalized&&(t=eN(t,this.array)),t}setX(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize]=np(t),this}getY(e){let t=nf(this.array[e*this.itemSize+1]);return this.normalized&&(t=eN(t,this.array)),t}setY(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+1]=np(t),this}getZ(e){let t=nf(this.array[e*this.itemSize+2]);return this.normalized&&(t=eN(t,this.array)),t}setZ(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+2]=np(t),this}getW(e){let t=nf(this.array[e*this.itemSize+3]);return this.normalized&&(t=eN(t,this.array)),t}setW(e,t){return this.normalized&&(t=eD(t,this.array)),this.array[e*this.itemSize+3]=np(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this.array[e+2]=np(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=eD(t,this.array),n=eD(n,this.array),i=eD(i,this.array),r=eD(r,this.array)),this.array[e+0]=np(t),this.array[e+1]=np(n),this.array[e+2]=np(i),this.array[e+3]=np(r),this}}class nC extends ny{constructor(e,t,n){super(new Float32Array(e),t,n)}}let nR=0,nP=new tT,nI=new tK,nL=new ez,nN=new e9,nD=new e9,nU=new ez;class nO extends ew{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nR++}),this.uuid=eR(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ec(e)?nE:nw)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new eV().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return nP.makeRotationFromQuaternion(e),this.applyMatrix4(nP),this}rotateX(e){return nP.makeRotationX(e),this.applyMatrix4(nP),this}rotateY(e){return nP.makeRotationY(e),this.applyMatrix4(nP),this}rotateZ(e){return nP.makeRotationZ(e),this.applyMatrix4(nP),this}translate(e,t,n){return nP.makeTranslation(e,t,n),this.applyMatrix4(nP),this}scale(e,t,n){return nP.makeScale(e,t,n),this.applyMatrix4(nP),this}lookAt(e){return nI.lookAt(e),nI.updateMatrix(),this.applyMatrix4(nI.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(nL).negate(),this.translate(nL.x,nL.y,nL.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,i=e.length;n<i;n++){let i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new nC(t,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&eb("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new e9);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){eS("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ez(-1/0,-1/0,-1/0),new ez(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nN.setFromBufferAttribute(n),this.morphTargetsRelative?(nU.addVectors(this.boundingBox.min,nN.min),this.boundingBox.expandByPoint(nU),nU.addVectors(this.boundingBox.max,nN.max),this.boundingBox.expandByPoint(nU)):(this.boundingBox.expandByPoint(nN.min),this.boundingBox.expandByPoint(nN.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&eS('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new tg);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){eS("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ez,1/0);return}if(e){let n=this.boundingSphere.center;if(nN.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nD.setFromBufferAttribute(n),this.morphTargetsRelative?(nU.addVectors(nN.min,nD.min),nN.expandByPoint(nU),nU.addVectors(nN.max,nD.max),nN.expandByPoint(nU)):(nN.expandByPoint(nD.min),nN.expandByPoint(nD.max))}nN.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)nU.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(nU));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)nU.fromBufferAttribute(a,t),s&&(nL.fromBufferAttribute(e,t),nU.add(nL)),i=Math.max(i,n.distanceToSquared(nU))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&eS('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void eS("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new ny(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new ez,o[e]=new ez;let l=new ez,u=new ez,c=new ez,h=new eO,d=new eO,p=new eO,f=new ez,m=new ez,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,i=g.length;t<i;++t){let i=g[t],a=i.start,v=i.count;for(let t=a,i=a+v;t<i;t+=3)!function(e,t,i){l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),c.fromBufferAttribute(n,i),h.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),u.sub(l),c.sub(l),d.sub(h),p.sub(h);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(u).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),m.copy(c).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[i].add(f),o[e].add(m),o[t].add(m),o[i].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new ez,x=new ez,y=new ez,_=new ez;function b(e){y.fromBufferAttribute(i,e),_.copy(y);let t=s[e];v.copy(t),v.sub(y.multiplyScalar(y.dot(t))).normalize(),x.crossVectors(_,t);let n=x.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,n<0?-1:1)}for(let t=0,n=g.length;t<n;++t){let n=g[t],i=n.start,r=n.count;for(let t=i,n=i+r;t<n;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new ny(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let i=new ez,r=new ez,a=new ez,s=new ez,o=new ez,l=new ez,u=new ez,c=new ez;if(e)for(let h=0,d=e.count;h<d;h+=3){let d=e.getX(h+0),p=e.getX(h+1),f=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),o.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),n.setXYZ(e+0,u.x,u.y,u.z),n.setXYZ(e+1,u.x,u.y,u.z),n.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)nU.fromBufferAttribute(e,t),nU.normalize(),e.setXYZ(t,nU.x,nU.y,nU.z)}toNonIndexed(){function e(e,t){let n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[o++]=n[s++]}return new ny(a,i,r)}if(null===this.index)return eb("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new nO,n=this.index.array,i=this.attributes;for(let r in i){let a=e(i[r],n);t.setAttribute(r,a)}let r=this.morphAttributes;for(let i in r){let a=[],s=r[i];for(let t=0,i=s.length;t<i;t++){let i=e(s[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,n=a.length;e<n;e++){let n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let i=n[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},r=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){let i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let i=e.attributes;for(let e in i){let n=i[e];this.setAttribute(e,n.clone(t))}let r=e.morphAttributes;for(let e in r){let n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let nF=new tT,nz=new tw,nk=new tg,nB=new ez,nV=new ez,nH=new ez,nj=new ez,nG=new ez,nW=new ez,nX=new ez,nq=new ez;class nY extends tK{constructor(e=new nO,t=new nh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let s=this.morphTargetInfluences;if(r&&s){nW.set(0,0,0);for(let n=0,i=r.length;n<i;n++){let i=s[n],o=r[n];0!==i&&(nG.fromBufferAttribute(o,e),a?nW.addScaledVector(nG,i):nW.addScaledVector(nG.sub(t),i))}t.add(nW)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;void 0===i||(null===n.boundingSphere&&n.computeBoundingSphere(),nk.copy(n.boundingSphere),nk.applyMatrix4(r),nz.copy(e.ray).recast(e.near),!1===nk.containsPoint(nz.origin)&&(null===nz.intersectSphere(nk,nB)||nz.origin.distanceToSquared(nB)>(e.far-e.near)**2)||(nF.copy(r).invert(),nz.copy(e.ray).applyMatrix4(nF),(null===n.boundingBox||!1!==nz.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,nz)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=h.length;r<o;r++){let o=h[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=nZ(this,p,e,n,l,u,c,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let h=r;h<o;h+=3)(i=nZ(this,a,e,n,l,u,c,s.getX(h),s.getX(h+1),s.getX(h+2)))&&(i.faceIndex=Math.floor(h/3),t.push(i))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=h.length;r<s;r++){let s=h[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=nZ(this,p,e,n,l,u,c,r,r+1,r+2))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(i=nZ(this,a,e,n,l,u,c,o,o+1,o+2))&&(i.faceIndex=Math.floor(o/3),t.push(i))}}}function nZ(e,t,n,i,r,a,s,o,l,u){e.getVertexPosition(o,nV),e.getVertexPosition(l,nH),e.getVertexPosition(u,nj);let c=function(e,t,n,i,r,a,s,o){if(null===(1===t.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===t.side,o)))return null;nq.copy(o),nq.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(nq);return l<n.near||l>n.far?null:{distance:l,point:nq.clone(),object:e}}(e,t,n,i,nV,nH,nj,nX);if(c){let e=new ez;nn.getBarycoord(nX,nV,nH,nj,e),r&&(c.uv=nn.getInterpolatedAttribute(r,o,l,u,e,new eO)),a&&(c.uv1=nn.getInterpolatedAttribute(a,o,l,u,e,new eO)),s&&(c.normal=nn.getInterpolatedAttribute(s,o,l,u,e,new ez),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new ez,materialIndex:0};nn.getNormal(nV,nH,nj,t.normal),c.face=t,c.barycoord=e}return c}class nJ extends nO{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){let x=a/m,y=p/g,_=a/2,b=p/2,S=f/2,M=m+1,w=g+1,T=0,E=0,A=new ez;for(let a=0;a<w;a++){let s=a*y-b;for(let o=0;o<M;o++){let h=o*x-_;A[e]=h*i,A[t]=s*r,A[n]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let n=h+t+M*e,i=h+t+M*(e+1),r=h+(t+1)+M*(e+1),a=h+(t+1)+M*e;o.push(n,i,a),o.push(i,r,a),E+=6}s.addGroup(d,E,v),d+=E,h+=T}p("z","y","x",-1,-1,n,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new nC(l,3)),this.setAttribute("normal",new nC(u,3)),this.setAttribute("uv",new nC(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nJ(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function n$(e){let t={};for(let n in e)for(let i in t[n]={},e[n]){let r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(eb("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function nK(e){let t={};for(let n=0;n<e.length;n++){let i=n$(e[n]);for(let e in i)t[e]=i[e]}return t}function nQ(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:eW.workingColorSpace}let n0={clone:n$,merge:nK};class n1 extends nc{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=n$(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let n in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class n2 extends tK{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tT,this.projectionMatrix=new tT,this.projectionMatrixInverse=new tT,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.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)}}let n3=new ez,n4=new eO,n5=new eO;class n6 extends n2{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*eC*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*eA*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*eC*Math.atan(Math.tan(.5*eA*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){n3.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(n3.x,n3.y).multiplyScalar(-e/n3.z),n3.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(n3.x,n3.y).multiplyScalar(-e/n3.z)}getViewSize(e,t){return this.getViewBounds(e,n4,n5),t.subVectors(n5,n4)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*eA*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class n8 extends tK{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new n6(-90,1,e,t);i.layers=this.layers,this.add(i);const r=new n6(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new n6(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new n6(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new n6(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new n6(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class n9 extends e0{constructor(e=[],t=301,n,i,r,a,s,o,l,u){super(e,t,n,i,r,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class n7 extends e3{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1};this.texture=new n9([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
2
2
|
|
|
3
3
|
varying vec3 vWorldDirection;
|
|
4
4
|
|