Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: add assistant builder page and API tests

nirholas8c3429f1e113
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 882cfc89d..d6a37b51d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-07-18
+- **Concierge: AI Chat Widget** (`/concierge`) — Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.
+- **Concierge: We Gave the Site Chatbot a Face** (`/blog/concierge-3d-chat-widget`) — Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.
- **Docs · Agent Galaxy** (`/docs/galaxy`) — Every published agent embedded by IBM Granite on watsonx.ai, projected into a navigable 3D constellation with natural-language semantic search.
- **Docs · Agent Genome** (`/docs/genome`) — Breed two agents into a provably-inherited child: recombined brain, voice, body, and on-chain skill licenses, each breeding event seed-recorded with a verifiable family tree.
- **Docs · Agent Studio** (`/docs/agent-studio`) — Author an agent's brain, memory, body, money, and skills in one place, beside a persistent live 3D avatar that updates everywhere as you edit.
@@ -46,6 +48,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Docs · x402 Studio** (`/docs/x402-studio`) — The merchant console for running a paid x402 business: products and pricing, payout and agent wallets, real USDC send and receive with .sol resolution, a storefront and pay-button builder, giving, and security.
- **36 new in-depth feature guides in the docs** — The docs now carry a dedicated, in-depth guide for every major studio and surface that was missing one: the 3D creation studios (Forge, Image to 3D, Diorama, Cosmos, Splat viewer, Scene Capture, Restyle, Scene Studio, Scene Composer, Animation Studio, Avatar Studio, Mocap Studio, Selfie to Avatar, Daily Forge, AR Studio), voice and video (Voice Lab, Lipsync, Talking Avatar Video), agent building (Instant Agent Genesis, Agent Genome, Agent Studio, Multi-LLM Brain, Agent Galaxy, Integrations), and the trading and markets surfaces (Coin Autopilot, Signal Marketplace, the AGI, Alpha Co-pilot, Guardian, Strategy Objects, Mission Control, Smart Money Radar, Coin Radar, Coin Clash, x402 Studio, Fact Check). Each guide explains why the feature exists, how it actually works, a first-time walkthrough, runnable examples, its states and limits, and links to related surfaces. Browse them from the docs sidebar. (`/docs/forge`) `[docs]`
- **Image understanding is more reliable across every image host** — The vision endpoint (used to describe and check 3D renders and avatars) now fetches your image itself and hands it straight to the free model, instead of asking the model's server to go fetch the link. Some image hosts block that server-side fetch, which used to push the request onto a paid fallback and, when that fallback was unavailable, fail outright. Now the free lane serves the request regardless of how the image is hosted, so describe/critique calls stop returning errors on perfectly good images. (`/pulse`) `[fix, improvement]`
+- **New: a 3D avatar assistant widget for any website** — One script tag now puts a three.ws avatar on any site as a floating assistant. Click the launcher and a real animated 3D character pops up, standing directly on the page (transparent), or against a color or gradient you pick. It has two modes: a chatbot that answers visitors' questions using the free model chain, with the option to bring your own Groq or OpenRouter key that never leaves the browser, and a speak mode where the avatar says exactly what you type, out loud, with a speech bubble. Configure everything and copy your snippet at three.ws/assistant. (`/assistant`) `[feature]`
- **On-chain reads stay smooth when a data provider hits its daily cap** — The platform reads Solana through a prioritized chain of RPC providers and automatically fails over the instant one is throttled. It now recognizes the specific 'daily request limit reached' signal that metered providers return when a plan's daily quota is spent, and parks that provider for the rest of the day instead of re-checking it every few minutes. On-chain data (balances, prices, live trades) keeps flowing through a healthy provider without a stumble, and the failover leaves the retry chatter behind. A dedicated reserve endpoint was also wired in as deep insurance for the rare case the whole free provider pool is down at once. `[infra, improvement]`
- **Solana price and trade reads now ride a dedicated premium connection** — Every live Solana read the platform depends on (the $THREE price and bonding-curve, wallet balances, agent trades, and on-chain activity) now goes first through a dedicated premium RPC endpoint that absorbs the load ahead of the shared public providers, then falls back automatically down the full free-provider chain if that endpoint is ever unavailable. In practice that means fewer rate-limit stalls and fewer degraded or stale reads when Solana is busy, without adding a single point of failure: if the premium lane blinks, the free chain still answers. (`/pulse`) `[infra, improvement]`
- **The docs got a full accuracy pass against the live platform** — Every page under three.ws/docs was cross-checked line by line against the code that actually runs in production. Around 180 outdated or wrong statements were corrected: dead links and sample URLs, endpoints and prices that had changed, code examples that no longer worked, and descriptions of features that had since evolved. Twenty-two existing guides that were previously unreachable from the sidebar (including the 3D Viewer, Editor, Crypto Data API, Trading Copilot, and Premium pass docs) are now listed in the navigation, and every wallet ability deep-dive gained a copy-pasteable Try It section. If you read something in the docs today, it matches what the platform actually does. (`/docs`) `[docs, improvement]`
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 8992b3e38..ab757e5aa 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -20,6 +20,8 @@ bottom.
| React avatar creator | [avatar-sdk/](avatar-sdk) `→ /react` `/creator` | Published as `@three-ws/avatar` | Same package, React subpath |
| Talking page guide | [page-agent-sdk/](page-agent-sdk) | Published as `@three-ws/page-agent` | Drop-in rigged 3D agent that narrates any page + visitor avatar picker. `<page-agent>` web component. Rigged-only catalog. `preset="…"` resolves one of 5 personas (greeting/role/suggested-prompt chips/tool allowlist) — see [page-agent-sdk/README.md#persona-presets](page-agent-sdk/README.md#persona-presets). See [page-agent-sdk/PUBLISHING.md](page-agent-sdk/PUBLISHING.md) |
| Guided site tour | [tour-sdk/](tour-sdk) | Published as `@three-ws/tour` | 3D guide walks a live site, spotlights sections, narrates each. One-tag CDN build + free roam |
+| Concierge (embeddable AI support chat) | [concierge-sdk/](concierge-sdk), backend [api/concierge.js](api/concierge.js) `→ /api/concierge`, landing [pages/concierge.html](pages/concierge.html) `→ /concierge`, first-party CDN copy `→ /concierge/concierge.global.js` (mirrored by [concierge-sdk/build.mjs](concierge-sdk/build.mjs)) | In-repo, npm publish pending | An AI concierge for ANY website: floating launcher, chat panel with a rigged 3D avatar bust (blink/idle/viseme lipsync via the page-agent stage lineage), SSE-streamed answers grounded in the live page (ask-time DOM harvest + host `knowledge`, no crawler), speaks while streaming (sentence-level TTS handoff), push-to-talk mic, themes/accent/position, avatar picker or custom GLB. Backend is anonymous + CORS-`*` (third-party origins by design) with its own rate buckets (`limits.conciergeIp`/`conciergeGlobal`), fail-open moderation, and streaming failover over the shared free-first chain (api/_lib/llm.js). `<three-concierge>` element, `data-concierge` one-tag auto-init, or `new Concierge({...})`. Docs: [docs/concierge.md](docs/concierge.md), tutorial [docs/tutorials/build-a-site-concierge.md](docs/tutorials/build-a-site-concierge.md). Tests: [concierge-sdk/test/](concierge-sdk/test), [tests/api-concierge.test.js](tests/api-concierge.test.js) |
+| Assistant widget (3D avatar assistant for any website) | Loader [public/assistant/v1.js](public/assistant/v1.js) `-> /assistant/v1.js`, iframe app [pages/assistant-frame.html](pages/assistant-frame.html) + [src/assistant-frame.js](src/assistant-frame.js) `-> /assistant-frame`, builder [pages/assistant.html](pages/assistant.html) + [src/assistant-page.js](src/assistant-page.js) `-> /assistant`, shared validators [src/assistant-widget-core.js](src/assistant-widget-core.js) | In-repo | One script tag adds a floating launcher to any site; clicking it pops up a full-body animated avatar against the host page (transparent) or a color/gradient. Two modes: chatbot (free chain via POST /api/chat, or the visitor's own Groq/OpenRouter key sent browser-to-provider, stored in the frame's localStorage only) and speak mode (avatar repeats typed text out loud via Web Speech + head-anchored speech bubble + talking clip). All params re-validated in-frame (CSS/URL injection safe). Sibling of Concierge (chat panel) - this one is the full-body, avatar-first widget. Docs: [docs/assistant-widget.md](docs/assistant-widget.md). Tests: [tests/assistant-widget.test.js](tests/assistant-widget.test.js) |
| three.ws's own guided tour + onboarding | [src/feature-tour/](src/feature-tour) `→ /feature-tour.js`, entry [src/feature-tour.js](src/feature-tour.js), curriculum [public/tour/curriculum.json](public/tour/curriculum.json) generated by [scripts/build-tour.mjs](scripts/build-tour.mjs), landing [pages/tour.html](pages/tour.html) `→ /tour` | Live | A hardened, site-native fork of the [tour-sdk/](tour-sdk) engine (same curriculum schema — stops/sections/tracks/highlight/narration/targets), lazy-injected only when a tour is starting/active (`feature-tour-boot` Vite plugin) so pages that never tour pay no Three.js cost. Three tracks share one curriculum: `full` (every feature, chapter by chapter), `quick` (highlighted heroes), and `onboarding` (added 2026-07-12) — a 6-stop, hand-authored new-account walkthrough chaining `/start` → make an avatar (`/create/selfie`) → build a world (`/diorama`) → live `/markets` data → an optional coin launch (`/create-agent`, clearly skippable) → the new creator's own `/profile`. Auto-offered once to a signed-in account with zero creations across avatars/agents/forged models/worlds (`GET /api/me` → `show_onboarding_tour`, backed by `users.onboarding_tour_seen_at`/`onboarding_tour_completed_at`, migration [api/_lib/migrations/20260712030000_onboarding_tour_state.sql](api/_lib/migrations/20260712030000_onboarding_tour_state.sql)); always reachable afterward via "🎬 Replay guided tour" in the [public/getting-started.js](public/getting-started.js) checklist panel. Tests: [tests/feature-tour-curriculum.test.js](tests/feature-tour-curriculum.test.js), [tests/api-me-onboarding-tour.test.js](tests/api-me-onboarding-tour.test.js) |
| Tour Builder (no-code playground) | [pages/tour-builder.html](pages/tour-builder.html) `→ /tour-builder` | Live | Point-and-click editor over a demo storefront: pick avatar, add stops, preview the real tour, export curriculum + Shopify snippets. Also ships **Templates** — ready-made tours (Sperax's DeFi protocol tour is the first) that load straight into the editor. Logic: [public/tour-builder/builder.js](public/tour-builder/builder.js), presets: [public/tour-builder/presets/](public/tour-builder/presets). Sperax template doc: [docs/tutorials/sperax-tour.md](docs/tutorials/sperax-tour.md) |
| Avatar builder (full app) | [character-studio/](character-studio) | Fork of [m3-org/CharacterStudio](https://github.com/M3-org/CharacterStudio), MIT, see [character-studio/LICENSE](character-studio/LICENSE) | Web-first character creator |
@@ -181,6 +183,7 @@ packages/tutor-mcp/ → @three-ws/tutor-mcp (MCP server — it
packages/loom-mcp/ → @three-ws/loom-mcp (MCP server — Loom 3D-creation gallery: browse, fetch, submit)
packages/agent-sniper/ → @three-ws/agent-sniper (engine + CLI + MCP server + x402 paid API — autonomous, self-custodial pump.fun sniper)
walk-sdk/ → @three-ws/walk (page walking companion + playground + avatar picker)
+concierge-sdk/ → @three-ws/concierge (embeddable AI support chat with a lipsyncing 3D avatar)
```
`packages/*` is the home for clean, publishable spec/schema/preset packages
diff --git a/api/concierge.js b/api/concierge.js
index 616226409..ded9d7efa 100644
--- a/api/concierge.js
+++ b/api/concierge.js
@@ -1,10 +1,10 @@
-// POST /api/concierge — the answer engine behind @three-ws/concierge.
+// POST /api/concierge, the answer engine behind @three-ws/concierge.
//
// The embeddable site-concierge widget (concierge-sdk/) posts the visitor's
// question, the running conversation, and a bounded snapshot of the HOST page
// (title/description/headings/nav/main text + optional curated `knowledge`).
// This handler grounds a system prompt in that snapshot and streams the answer
-// back as SSE — the same { chunk → done } event shape /api/chat uses:
+// back as SSE, the same { chunk → done } event shape /api/chat uses:
//
// Body: { message, history[], site{...}, persona?, lang? }
// Response: SSE data: { type: 'chunk', text }
@@ -16,7 +16,7 @@
// the /api/chat allowlist forbids. No cookies/credentials cross this lane.
// - Anonymous-only, with its own IP + global rate buckets (limits.conciergeIp
// / conciergeGlobal) so widget traffic can't starve signed-in chat.
-// - No tool calls, no persona store, no BYOK: one job — grounded answers.
+// - No tool calls, no persona store, no BYOK: one job, grounded answers.
// - Providers come from the shared free-first chain (api/_lib/llm.js
// providerChain), streamed. Anthropic-shaped rungs are skipped: their SSE
// wire format differs and every OpenAI-compatible rung (incl. the
@@ -115,7 +115,7 @@ async function pumpOpenAIStream(upstream, onText) {
try {
evt = JSON.parse(payload);
} catch {
- continue; // partial/malformed frame — never fatal
+ continue; // partial/malformed frame, never fatal
}
const delta = evt.choices?.[0]?.delta?.content;
if (typeof delta === 'string' && delta) {
@@ -131,7 +131,7 @@ function isBillingAuthStatus(status) {
return status === 401 || status === 402 || status === 403;
}
-// Hostname only, for usage telemetry — never the full URL (query strings from
+// Hostname only, for usage telemetry, never the full URL (query strings from
// third-party pages are not ours to store). Malformed input → null.
function siteHostname(url) {
if (!url) return null;
@@ -219,7 +219,7 @@ export default wrap(async (req, res) => {
}).finally(() => clearTimeout(timer));
} catch (err) {
lastFailure = err;
- continue; // transport/timeout — next rung
+ continue; // transport/timeout, next rung
}
if (!upstream.ok) {
@@ -233,7 +233,7 @@ export default wrap(async (req, res) => {
continue;
}
- // Connected — stream the answer through.
+ // Connected, stream the answer through.
sseHead();
let reply = '';
try {
@@ -263,7 +263,7 @@ export default wrap(async (req, res) => {
return;
}
- // Every rung failed before a byte streamed — a plain HTTP error the widget
+ // Every rung failed before a byte streamed, a plain HTTP error the widget
// renders as its friendly retry bubble.
captureException(lastFailure || new Error('concierge: no provider reachable'), {
route: 'concierge',
diff --git a/blog/concierge-3d-chat-widget.html b/blog/concierge-3d-chat-widget.html
new file mode 100644
index 000000000..4aff152f0
--- /dev/null
+++ b/blog/concierge-3d-chat-widget.html
@@ -0,0 +1,112 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Concierge: We Gave the Site Chatbot a Face</title>
+ <meta name="description" content="Every website has the same faceless chat bubble. We shipped one with a rigged 3D avatar that blinks, lipsyncs, and speaks streaming answers grounded in your live page. One tag, free, open wire format. Here is how we built it by remixing our own stack.">
+ <meta name="keywords" content="three.ws, concierge, chat widget, chatbot, 3D avatar, lipsync, web component, support chat, intercom alternative, streaming, SSE">
+ <link rel="canonical" href="https://three.ws/blog/concierge-3d-chat-widget">
+
+ <meta property="og:title" content="Concierge: We Gave the Site Chatbot a Face">
+ <meta property="og:description" content="A support chat where a rigged 3D avatar lipsyncs streaming answers grounded in your live page. One tag on any site. Free.">
+ <meta property="og:url" content="https://three.ws/blog/concierge-3d-chat-widget">
+ <meta property="og:type" content="article">
+
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="Concierge: We Gave the Site Chatbot a Face">
+ <meta name="twitter:description" content="A support chat where a rigged 3D avatar lipsyncs streaming answers grounded in your live page. One tag on any site. Free.">
+
+ <link rel="shortcut icon" href="/favicon.ico">
+ <link rel="stylesheet" href="/nav.css">
+ <link rel="stylesheet" href="/footer.css">
+ <style>
+ :root { color-scheme: dark; }
+ body { margin: 0; background: #060611; color: #e7e7f5; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
+ .post-wrap { max-width: 720px; margin: 0 auto; padding: 96px 24px 80px; }
+ .post-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #7a85a8; font-size: 13px; margin-bottom: 28px; }
+ .post-date { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
+ .post-tag { padding: 2px 8px; border-radius: 999px; background: rgba(154,212,255,.08); color: #9ad4ff; font-size: 11px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
+ h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 20px; }
+ h2 { font-size: 20px; font-weight: 600; margin: 40px 0 12px; letter-spacing: -0.01em; }
+ p { color: #c8c8e0; line-height: 1.7; margin: 0 0 18px; font-size: 16px; }
+ ul, ol { color: #c8c8e0; line-height: 1.7; margin: 0 0 18px; padding-left: 24px; font-size: 16px; }
+ li { margin-bottom: 6px; }
+ a { color: #9ad4ff; text-decoration: none; }
+ a:hover { text-decoration: underline; }
+ code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: rgba(154,212,255,.07); color: #9ad4ff; padding: 2px 6px; border-radius: 4px; }
+ pre { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 16px 20px; overflow-x: auto; margin: 0 0 20px; }
+ pre code { background: none; padding: 0; font-size: 14px; }
+ strong { color: #e7e7f5; }
+ .post-back { display: inline-flex; align-items: center; gap: 6px; color: #7a85a8; font-size: 14px; margin-bottom: 40px; text-decoration: none; }
+ .post-back:hover { color: #9ad4ff; }
+ hr { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 40px 0; }
+ </style>
+</head>
+<body>
+ <div id="nav-container"></div>
+ <main class="post-wrap">
+ <a class="post-back" href="/blog">&larr; Blog</a>
+ <div class="post-meta">
+ <span class="post-date">2026-07-18</span>
+ <span class="post-tag">Launch</span>
+ <span class="post-tag">SDK</span>
+ <span class="post-tag">Avatars</span>
+ </div>
+ <h1>Concierge: We Gave the Site Chatbot a Face</h1>
+
+ <p>Every website has the same widget in the corner: a colored circle, a text box, a logo pretending to be a person. The AI behind those boxes got dramatically better in the last two years. The boxes did not.</p>
+
+ <p>So we shipped <a href="/concierge">Concierge</a>: a support chat where a rigged 3D avatar blinks, idles, turns to face the conversation, and <strong>lipsyncs the answer while it speaks it aloud</strong>. Answers stream token by token, are grounded in whatever your page actually says, and the whole thing installs with one tag:</p>
+
+ <pre><code>&lt;script type="module"
+ src="https://three.ws/concierge/concierge.global.js"
+ data-concierge
+ data-site-name="Acme"
+ data-accent="#f97316"&gt;&lt;/script&gt;</code></pre>
+
+ <p>It is free, the widget is on <a href="https://www.npmjs.com/package/@three-ws/concierge">npm as <code>@three-ws/concierge</code></a>, the wire format is open, and the <a href="/concierge">landing page</a> runs it live, where the widget's job is answering questions about itself.</p>
+
+ <h2>Built by remixing our own stack</h2>
+
+ <p>We did not start from zero, and that is the story worth telling. three.ws already had a walking corner companion (<a href="https://www.npmjs.com/package/@three-ws/walk"><code>@three-ws/walk</code></a>), a narrating page guide (<code>@three-ws/page-agent</code>), and a battle-tested free-first LLM chain behind <code>/api/chat</code>. Concierge is those three things recombined and pointed at support:</p>
+
+ <ul>
+ <li><strong>The face</strong> comes from the page-agent lineage: a transparent WebGL stage that loads a rigged GLB, frames it as a bust, plays a real idle clip when the model ships one and a procedural breathing-and-blink loop when it does not. The avatar catalog is the same diverse, rigged-only, viseme-capable roster.</li>
+ <li><strong>The mouth</strong> is text-to-viseme lipsync, not audio analysis: the sentence is tokenized into a timed phoneme sequence and the matching morph targets are lerped every frame, synced to the browser's own speech engine. No audio backend, no API key, works offline.</li>
+ <li><strong>The brain</strong> is the platform's free-first provider chain with automatic failover: if one free lane is throttled, the next takes over mid-conversation, and a billing-dead lane gets cooled down instead of re-probed on every request.</li>
+ </ul>
+
+ <h2>No crawler, no index, no onboarding call</h2>
+
+ <p>Products in this category ask you to connect a knowledge base, wait for a crawl, and keep it synced. We inverted the whole thing: the visitor is already on your page, so the widget reads it <em>at the moment of the question</em>. Title, meta description, headings, nav labels, the main content, all capped to a strict budget, plus an optional <code>knowledge</code> attribute where you paste the facts that matter (pricing, policies, contact).</p>
+
+ <p>The server folds that snapshot into a grounded system prompt with one non-negotiable rule: if the answer is not in the site information, say so and point at the closest real link. Never invent a price. Edit your pricing page and the very next answer reflects it. Nothing to re-index, ever.</p>
+
+ <h2>It speaks while it streams</h2>
+
+ <p>The detail we are proudest of: answers arrive over SSE, and the widget splits the stream into sentences as they complete, handing each one to the speech engine while the rest is still generating. The avatar starts talking about your refund policy before the model has finished writing about it. Muted, or on a browser without speech synthesis? The captions and the lipsync timeline still play, so the experience never silently stalls.</p>
+
+ <h2>The boring parts, done properly</h2>
+
+ <ul>
+ <li>A closed widget costs your page <strong>zero GPU and no GLB download</strong>; the 3D stage initializes on first open.</li>
+ <li>Every state is designed: empty state with suggestion chips, skeleton shimmer while the rig loads, typing dots, a streaming caret, and an error bubble with a retry that rewinds the failed turn.</li>
+ <li>Model output renders through a strict markdown-lite renderer: escaped first, markup second, <code>javascript:</code> links never survive.</li>
+ <li>Light and dark themes follow the visitor's system, one accent color restyles everything, and <code>prefers-reduced-motion</code> is respected throughout.</li>
+ <li>The backend is anonymous, CORS-open by design, rate-limited per IP and globally, and pre-moderated fail-open.</li>
+ </ul>
+
+ <h2>Bring your own backend</h2>
+
+ <p>The hosted endpoint is free, but nothing locks you to it. The wire format is three SSE event types (<code>chunk</code>, <code>done</code>, <code>error</code>) over one POST; point the <code>endpoint</code> attribute at any server that speaks it. The production reference implementation, failover and all, is <a href="https://github.com/nirholas/three.ws/blob/main/api/concierge.js">open in the repo</a>.</p>
+
+ <hr>
+
+ <p>Try it on the <a href="/concierge">landing page</a>, read the <a href="/docs/concierge">docs</a>, or go deep with the <a href="/docs/tutorials/build-a-site-concierge">build tutorial</a> that walks through every module. And if you ship it on your site, tell <a href="https://x.com/trythreews">@trythreews</a>, we collect screenshots of our avatars working other people's front desks.</p>
+ </main>
+ <div id="footer-container"></div>
+ <script src="/nav.js"></script>
+ <script src="/footer.js"></script>
+</body>
+</html>
diff --git a/blog/index.html b/blog/index.html
index af41dcb97..8f0b6b83a 100644
--- a/blog/index.html
+++ b/blog/index.html
@@ -66,6 +66,19 @@
<ul class="bl-list">
+ <li class="bl-item">
+ <a href="/blog/concierge-3d-chat-widget">
+ <div class="bl-meta">
+ <span class="bl-date">2026-07-18</span>
+ <span class="bl-tag">Launch</span>
+ <span class="bl-tag">SDK</span>
+ <span class="bl-tag">Avatars</span>
+ </div>
+ <h2 class="bl-title">Concierge: We Gave the Site Chatbot a Face</h2>
+ <p class="bl-summary">Every site has the same faceless chat bubble, so we shipped one with a rigged 3D avatar that blinks, lipsyncs, and speaks streaming answers grounded in your live page. One tag on any website, free, open wire format, and built by remixing the Walk and page-agent stack we already had.</p>
+ </a>
+ </li>
+
<li class="bl-item">
<a href="/blog/inside-the-forge">
<div class="bl-meta">
diff --git a/concierge-sdk/README.md b/concierge-sdk/README.md
new file mode 100644
index 000000000..e4e8872d2
--- /dev/null
+++ b/concierge-sdk/README.md
@@ -0,0 +1,150 @@
+# @three-ws/concierge
+
+An AI concierge for any website, with a face.
+
+One tag adds a floating chat widget where a **rigged 3D avatar** blinks, idles, and **lipsyncs** while it answers visitors. Answers **stream** in over SSE, are **grounded in the live page** (no crawler, no vector DB, no setup), and speak aloud with browser-native TTS. Push-to-talk voice input included where the browser supports it.
+
+Live demo: [three.ws/concierge](https://three.ws/concierge) (the widget on that page is this package answering questions about itself).
+
+- Docs: [three.ws/docs/concierge](https://three.ws/docs/concierge)
+- Tutorial (how it is built): [three.ws/docs/tutorials/build-a-site-concierge](https://three.ws/docs/tutorials/build-a-site-concierge)
+- Sibling packages: [`@three-ws/walk`](https://www.npmjs.com/package/@three-ws/walk) (walking page companion), [`@three-ws/page-agent`](https://www.npmjs.com/package/@three-ws/page-agent) (narrating page guide), [`@three-ws/tour`](https://www.npmjs.com/package/@three-ws/tour) (guided site tours)
+
+## Install
+
+### 1. One tag (no build, no account)
+
+```html
+<script type="module"
+ src="https://three.ws/concierge/concierge.global.js"
+ data-concierge
+ data-site-name="Acme"
+ data-accent="#f97316"
+ data-suggestions="What is Acme?|What does it cost?"></script>
+```
+
+Also served from npm CDNs after install: `https://unpkg.com/@three-ws/concierge/dist/concierge.global.js`.
+
+### 2. npm
+
+```bash
+npm install @three-ws/concierge three
+```
+
+`three` is a peer dependency for the module build; the `.global.js` build inlines it.
+
+### 3. Web component
+
+```html
+<script type="module">import '@three-ws/concierge';</script>
+
+<three-concierge
+ site-name="Acme"
+ accent="#f97316"
+ knowledge="Pro plan is $20/month. Support: [email protected]."
+ suggestions="What is Acme?|What does it cost?">
+</three-concierge>
+```
+
+### 4. Imperative
+
+```js
+import { Concierge } from '@three-ws/concierge';
+
+const concierge = new Concierge({
+ siteName: 'Acme',
+ accent: '#f97316',
+ knowledge: FAQ_TEXT,
+ persona: 'warm, playful, concise',
+});
+
+concierge.on('message', ({ role, content }) => analytics.track('concierge', { role }));
+await concierge.ask('What does the Pro plan cost?');
+```
+
+## How answers stay accurate
+
+There is no crawler and no index to keep fresh. At **ask-time** the widget snapshots the live DOM (title, meta description, headings, nav labels, main content, all capped) and merges in your curated `knowledge` string. The backend builds a grounded system prompt from that snapshot and instructs the model to refuse to invent anything it cannot see. Whatever your page says today is what the concierge knows today.
+
+Add `data-concierge-ignore` to any element you never want harvested.
+
+## Options
+
+Constructor config / element attributes / `data-*` script attributes are the same set:
+
+| Config (`camelCase`) | Attribute (`kebab-case`) | Default | What it does |
+| --- | --- | --- | --- |
+| `endpoint` | `endpoint` | `https://three.ws/api/concierge` | Answer API. Any server speaking the same wire format works. |
+| `avatar` | `avatar` | visitor's saved pick, else `sol` | Initial catalog avatar: `sol`, `nova`, `vera`, `atlas`, `echo`. |
+| `avatars` | `avatars` | all | Comma-separated allow-list for the picker. |
+| `customAvatar` | `custom-avatar` | none | URL of your own rigged GLB (replaces the catalog + picker). |
+| `assetBase` | `asset-base` | `https://three.ws/avatars/` | Self-host the catalog GLBs. |
+| `name` | `name` | avatar's name | Display name in the header. |
+| `siteName` | `site-name` | `og:site_name` else hostname | Used in the greeting and grounding. |
+| `greeting` | `greeting` | generated | Empty-state + teaser line. |
+| `suggestions` | `suggestions` | generated | Prompt chips. Pipe-separated in attributes, max 4. |
+| `knowledge` | `knowledge` | none | Curated facts (FAQ, policies, pricing). Leads the grounding. |
+| `persona` | `persona` | none | One-line tone instruction for the model. |
+| `accent` | `accent` | indigo | Any CSS color; restyles the whole widget. |
+| `position` | `position` | `bottom-right` | Or `bottom-left`. |
+| `theme` | `theme` | `auto` | `auto` follows `prefers-color-scheme`; or pin `dark` / `light`. |
+| `open` | `open` | `false` | Start with the panel open. |
+| `muted` | `muted` | `false` | Start with voice off (remembered per visitor). |
+| `picker` | `no-picker` | on | Avatar picker. |
+| `teaser` | `no-teaser` | on | Proactive greeting bubble (once per session, dismissable). |
+| `zIndex` | `z-index` | `2147482800` | Stacking override. |
+| `lang` | `lang` | browser language | BCP-47 hint for voice in/out and replies. |
+
+## API
+
+```js
+const c = new Concierge(config);
+c.ask(text) // Promise<string>: renders, streams, speaks; resolves to the answer
+c.setOpen(true|false) // open/close the panel
+c.toggle()
+c.setAvatar('nova') // hot-swap the rig
+c.setMuted(true)
+c.reset() // clear the conversation
+c.dispose()
+c.on(event, fn) // 'ready' | 'open' | 'close' | 'message' | 'agentchange' | 'error'
+```
+
+`<three-concierge>` proxies the same methods and re-dispatches events as DOM CustomEvents (`three-concierge:message` etc., bubbling + composed).
+
+Lower-level building blocks are exported too: `AvatarStage` (the 3D bust renderer), `SpeechNarrator` (TTS + viseme sync), `createLipsync` / `buildMorphMap`, `harvestSiteContext` / `buildSitePayload`, `askConcierge` (the SSE client), `renderMarkdown` / `stripMarkdown`, and `createMic`.
+
+## The wire format (bring your own backend)
+
+The default endpoint is free and anonymous, hosted by three.ws. To run your own, accept this POST and stream this SSE:
+
+```
+→ POST { message, history: [{role, content}], site: {url, name, title,
+ description, headings[], nav[], knowledge, content}, persona?, lang? }
+
+← data: { "type": "chunk", "text": "..." } (repeated)
+← data: { "type": "done", "provider": "...", "model": "..." }
+← data: { "type": "error", "code": "...", "message": "..." }
+```
+
+Point the widget at it with `endpoint` / `data-endpoint`. The reference implementation is [`api/concierge.js`](https://github.com/nirholas/three.ws/blob/main/api/concierge.js) in the three.ws repo.
+
+## Behavior details worth knowing
+
+- **Zero cost while closed.** The WebGL stage, GLB download, and speech engines initialize on first open, not on page load.
+- **Speaks while streaming.** Completed sentences are handed to the speech engine as they arrive; the mouth morphs are driven by a text-to-viseme timeline synced to the utterance.
+- **Degrades deliberately.** No WebGL → the avatar stage hides, chat keeps working. No `SpeechRecognition` → the mic button never renders. TTS missing or muted → captions + lipsync still play. Endpoint down → a friendly error bubble with a working retry.
+- **Persists sensibly.** Conversation per tab session (`sessionStorage`), avatar choice + mute per visitor (`localStorage`).
+- **Accessible.** Dialog semantics, focus management, `aria-live` streaming region, Escape to close, full keyboard path, `prefers-reduced-motion` respected.
+- **Safe rendering.** Model output renders through a strict markdown-lite renderer: everything is escaped first, links are restricted to http(s)/mailto and hardened with `rel="noopener noreferrer"`.
+
+## Develop
+
+```bash
+npm install # in this directory, or use the monorepo root
+npm test # node --test, no browser needed
+npm run build # dist/concierge.mjs + dist/concierge.global.js + dist/concierge.css
+```
+
+## License
+
+Proprietary. See [LICENSE](./LICENSE). Free to embed on any site via the published builds.
diff --git a/concierge-sdk/build.mjs b/concierge-sdk/build.mjs
index 2f7da1dca..888104d62 100644
--- a/concierge-sdk/build.mjs
+++ b/concierge-sdk/build.mjs
@@ -3,14 +3,14 @@
* Build @three-ws/concierge.
*
* Three artifacts:
- * dist/concierge.mjs — ESM, `three` left external. For bundler / npm
+ * dist/concierge.mjs: ESM, `three` left external. For bundler / npm
* consumers who already depend on three.
- * dist/concierge.global.js — self-contained ESM with three + addons inlined,
+ * dist/concierge.global.js: self-contained ESM with three + addons inlined,
* registers <three-concierge>, runs the
* data-concierge auto-init, and exposes
* window.ThreeWsConcierge. For a one-tag CDN
* <script type="module"> embed.
- * dist/concierge.css — the injected stylesheet, materialised for the
+ * dist/concierge.css: the injected stylesheet, materialised for the
* "@three-ws/concierge/style.css" subpath.
*/
@@ -40,7 +40,7 @@ await build({
outfile: resolve(outDir, 'concierge.mjs'),
});
-// 2) Self-contained build for a plain CDN <script type="module"> — ESM (not
+// 2) Self-contained build for a plain CDN <script type="module">, ESM (not
// IIFE) because the stage lazy-imports the meshopt decoder module.
await build({
...common,
@@ -48,10 +48,24 @@ await build({
format: 'esm',
minify: true,
outfile: resolve(outDir, 'concierge.global.js'),
- banner: { js: '/* @three-ws/concierge — https://three.ws/concierge */' },
+ banner: { js: '/* @three-ws/concierge, https://three.ws/concierge */' },
});
// 3) Stylesheet for the ./style.css subpath import.
writeFileSync(resolve(outDir, 'concierge.css'), CSS.trimStart());
+// 4) Mirror the one-tag build into the app's web root so three.ws serves it
+// first-party at https://three.ws/concierge/concierge.global.js (the URL the
+// docs and the /concierge landing page hand out). Skipped gracefully when
+// the SDK is built outside the monorepo (standalone checkout).
+import { existsSync, copyFileSync } from 'node:fs';
+const webRoot = resolve(here, '../public');
+if (existsSync(webRoot)) {
+ const cdnDir = resolve(webRoot, 'concierge');
+ mkdirSync(cdnDir, { recursive: true });
+ copyFileSync(resolve(outDir, 'concierge.global.js'), resolve(cdnDir, 'concierge.global.js'));
+ copyFileSync(resolve(outDir, 'concierge.global.js.map'), resolve(cdnDir, 'concierge.global.js.map'));
+ console.log('[concierge] mirrored one-tag build → public/concierge/');
+}
+
console.log('[concierge] built dist/concierge.mjs, dist/concierge.global.js, dist/concierge.css');
diff --git a/concierge-sdk/examples/index.html b/concierge-sdk/examples/index.html
new file mode 100644
index 000000000..e2dd93389
--- /dev/null
+++ b/concierge-sdk/examples/index.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Acme Rocket Skates, concierge demo</title>
+ <meta
+ name="description"
+ content="Acme sells rocket skates with same-day shipping. Pro skates reach 300 mph."
+ />
+ <style>
+ body { margin: 0; font-family: system-ui, sans-serif; color: #171923; }
+ header { padding: 16px 24px; border-bottom: 1px solid #eee; display: flex; gap: 24px; align-items: center; }
+ nav a { margin-right: 16px; color: #444; text-decoration: none; }
+ main { max-width: 720px; margin: 0 auto; padding: 48px 24px; line-height: 1.65; }
+ </style>
+ </head>
+ <body>
+ <header>
+ <strong>Acme</strong>
+ <nav><a href="#">Home</a><a href="#">Pricing</a><a href="#">Shipping</a><a href="#">Contact</a></nav>
+ </header>
+ <main>
+ <h1>Rocket Skates</h1>
+ <h2>Fast. Very fast.</h2>
+ <p>Acme rocket skates reach 300 mph in under two seconds. The Standard pair is $99, the Pro pair is $199, and every order placed before 2pm ships the same day.</p>
+ <p>Returns are accepted within 30 days, no questions asked (singed eyebrows excepted).</p>
+ </main>
+
+ <!--
+ The demo widget. Serve this folder next to a build of the SDK, e.g.
+ npm run build && npx serve .
+ from the concierge-sdk directory, then open /examples/.
+ Swap the src for https://three.ws/concierge/concierge.global.js (or the
+ unpkg URL from the README) to run against the published build instead.
+ -->
+ <script
+ type="module"
+ src="../dist/concierge.global.js"
+ data-concierge
+ data-site-name="Acme"
+ data-accent="#e11d48"
+ data-knowledge="Standard skates $99. Pro skates $199, reach 300 mph. Same-day shipping before 2pm. 30-day returns. Support: [email protected]."
+ data-suggestions="How fast are the Pro skates?|What does shipping cost?|Can I return them?"
+ ></script>
+ </body>
+</html>
diff --git a/concierge-sdk/src/catalog.js b/concierge-sdk/src/catalog.js
index 875dd7745..978e07b18 100644
--- a/concierge-sdk/src/catalog.js
+++ b/concierge-sdk/src/catalog.js
@@ -1,17 +1,17 @@
/**
- * Concierge catalog — @three-ws/concierge
+ * Concierge catalog: @three-ws/concierge
* =======================================
*
* Every entry is a skeleton-rigged humanoid GLB with verified face morphs or a
* talk animation, served from the three.ws origin (the repo's public/ web
* root). The concierge frames the avatar as a bust inside the chat panel and
* drives blink + viseme lipsync, so an unrigged mesh would read as a dead
- * statue — those are excluded by rule, same as @three-ws/page-agent.
+ * statue, those are excluded by rule, same as @three-ws/page-agent.
*
* Override `assetBase` (or an entry's `url`) to self-host the GLBs.
*/
-/** Default CDN base. Real, public three.ws assets — `public/avatars/*.glb`. */
+/** Default CDN base. Real, public three.ws assets, `public/avatars/*.glb`. */
export const DEFAULT_ASSET_BASE = 'https://three.ws/avatars/';
/**
diff --git a/concierge-sdk/src/client.js b/concierge-sdk/src/client.js
index a3f498712..7a919f02d 100644
--- a/concierge-sdk/src/client.js
+++ b/concierge-sdk/src/client.js
@@ -1,5 +1,5 @@
/**
- * Streaming answer client — @three-ws/concierge
+ * Streaming answer client: @three-ws/concierge
* =============================================
*
* POSTs the visitor's question + conversation history + the harvested site
@@ -13,7 +13,7 @@
* data: { type: 'error', error }
*
* Any OpenAI-compatible endpoint can be substituted by hosts that run their
- * own backend — set `endpoint` and keep the same request/SSE contract.
+ * own backend, set `endpoint` and keep the same request/SSE contract.
*/
export const DEFAULT_ENDPOINT = 'https://three.ws/api/concierge';
@@ -23,7 +23,7 @@ export const MAX_MESSAGE_CHARS = 2000;
/**
* Parse one SSE frame body (the text after `data: `) into an event object.
- * Returns null for keep-alives / malformed frames — the stream must survive
+ * Returns null for keep-alives / malformed frames, the stream must survive
* both without surfacing an error to the visitor.
*/
export function parseSseEvent(raw) {
diff --git a/concierge-sdk/src/context.js b/concierge-sdk/src/context.js
index ac6e1bb53..cad70deaf 100644
--- a/concierge-sdk/src/context.js
+++ b/concierge-sdk/src/context.js
@@ -1,10 +1,10 @@
/**
- * Site-context harvester — @three-ws/concierge
+ * Site-context harvester: @three-ws/concierge
* ============================================
*
* The concierge grounds its answers in the page it is embedded on, with no
* crawler, no index, and no server-side setup: at ask-time it reads the live
- * DOM — title, meta description, headings, nav labels, and the main content —
+ * DOM, title, meta description, headings, nav labels, and the main content ,
* and ships a bounded snapshot to the answer endpoint. A host can top this up
* with a `knowledge` string (FAQ, policies, product facts) that is always
* included ahead of the harvested page text.
diff --git a/concierge-sdk/src/element.js b/concierge-sdk/src/element.js
index 88bd9152a..bf885a753 100644
--- a/concierge-sdk/src/element.js
+++ b/concierge-sdk/src/element.js
@@ -1,5 +1,5 @@
/**
- * <three-concierge> custom element — @three-ws/concierge
+ * <three-concierge> custom element: @three-ws/concierge
* ======================================================
*
* Declarative wrapper around Concierge. The element itself is invisible (the
diff --git a/concierge-sdk/src/global.js b/concierge-sdk/src/global.js
index 49e1351fe..d505da07e 100644
--- a/concierge-sdk/src/global.js
+++ b/concierge-sdk/src/global.js
@@ -1,5 +1,5 @@
/**
- * CDN entry — @three-ws/concierge
+ * CDN entry: @three-ws/concierge
* ===============================
*
* The one-tag build: bundles the whole widget (three inlined), registers
diff --git a/concierge-sdk/src/index.js b/concierge-sdk/src/index.js
index e48ac7c9e..5435b3285 100644
--- a/concierge-sdk/src/index.js
+++ b/concierge-sdk/src/index.js
@@ -1,5 +1,5 @@
/**
- * @three-ws/concierge — public entry
+ * @three-ws/concierge, public entry
* ==================================
*
* An AI concierge for any website: floating launcher, chat panel with a
@@ -50,7 +50,7 @@ if (typeof window !== 'undefined') {
}
/**
- * Convenience factory — mount a concierge and return the controller.
+ * Convenience factory, mount a concierge and return the controller.
* @param {ConstructorParameters<typeof Concierge>[0]} [config]
*/
export function mount(config) {
@@ -59,7 +59,7 @@ export function mount(config) {
/**
* Auto-init from a `<script data-concierge>` tag so a site can install the
- * widget with no JS at all — the script's `data-*` attributes become config.
+ * widget with no JS at all, the script's `data-*` attributes become config.
* Idempotent: only the first tagged script mounts an instance.
*/
function autoInit() {
diff --git a/concierge-sdk/src/lipsync.js b/concierge-sdk/src/lipsync.js
index be7c5b18e..89d537345 100644
--- a/concierge-sdk/src/lipsync.js
+++ b/concierge-sdk/src/lipsync.js
@@ -1,5 +1,5 @@
/**
- * Lipsync driver — @three-ws/concierge (shared lineage: page-agent-sdk/src/lipsync.js)
+ * Lipsync driver: @three-ws/concierge (shared lineage: page-agent-sdk/src/lipsync.js)
* =====================================
*
* Text → viseme heuristic. No audio analysis, no microphone, no network. We
@@ -11,7 +11,7 @@
*
* Three mouth drivers, chosen from the discovered morph targets:
* - 'arkit': full Oculus/ARKit viseme set (best).
- * - 'jaw': only jawOpen/mouthOpen — amplitude-style open/close.
+ * - 'jaw': only jawOpen/mouthOpen, amplitude-style open/close.
* - none: no morphs → returns a no-op timeline; the stage carries the
* talk visually through body animation instead.
*/
@@ -140,7 +140,7 @@ export function createLipsync(text, morph, opts = {}) {
}
}
- // In jaw mode there's no per-viseme shape — any active phoneme opens the
+ // In jaw mode there's no per-viseme shape, any active phoneme opens the
// jaw on an envelope; silence closes it.
for (const name of current.keys()) {
let target = 0;
diff --git a/concierge-sdk/src/markdown.js b/concierge-sdk/src/markdown.js
index e30883815..01f3250a9 100644
--- a/concierge-sdk/src/markdown.js
+++ b/concierge-sdk/src/markdown.js
@@ -1,5 +1,5 @@
/**
- * Markdown-lite renderer — @three-ws/concierge
+ * Markdown-lite renderer: @three-ws/concierge
* ============================================
*
* Answers stream back as plain text with light markdown (bold, code, links,
@@ -28,7 +28,7 @@ function inline(md) {
// **bold** then *italic*
out = out.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
out = out.replace(/(^|[\s(])\*([^*\n]+)\*(?=[\s).,!?:;]|$)/g, '$1<em>$2</em>');
- // [label](url) — href is validated; the label is already escaped
+ // [label](url), href is validated; the label is already escaped
out = out.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (m, label, url) => {
const href = safeHref(url);
return href
@@ -97,7 +97,7 @@ export function renderMarkdown(text) {
}
/**
- * Strip markdown for the voice channel — what the narrator speaks should be
+ * Strip markdown for the voice channel, what the narrator speaks should be
* the words, not the syntax.
*/
export function stripMarkdown(text) {
diff --git a/concierge-sdk/src/mic.js b/concierge-sdk/src/mic.js
index 787435ad4..94b276609 100644
--- a/concierge-sdk/src/mic.js
+++ b/concierge-sdk/src/mic.js
@@ -1,5 +1,5 @@
/**
- * Voice input — @three-ws/concierge
+ * Voice input: @three-ws/concierge
* =================================
*
* Thin wrapper over the Web Speech API's SpeechRecognition (webkit-prefixed on
diff --git a/concierge-sdk/src/narrator.js b/concierge-sdk/src/narrator.js
index e8381def6..35b95c680 100644
--- a/concierge-sdk/src/narrator.js
+++ b/concierge-sdk/src/narrator.js
@@ -1,5 +1,5 @@
/**
- * SpeechNarrator — @three-ws/concierge (shared lineage: page-agent-sdk/src/narrator.js)
+ * SpeechNarrator: @three-ws/concierge (shared lineage: page-agent-sdk/src/narrator.js)
* =====================================
*
* Speaks queued text aloud with the Web Speech API and keeps the avatar's mouth
@@ -10,7 +10,7 @@
* Graceful by design:
* - No speechSynthesis (or muted): we still run the lipsync timeline for the
* text's estimated duration so the avatar visibly "talks" and captions
- * show — the page narration never silently stalls.
+ * show, the page narration never silently stalls.
* - Voice list loads async on some platforms; we wait for `voiceschanged`.
*/
@@ -107,7 +107,7 @@ export class SpeechNarrator {
utter.rate = clamp(this.agent?.voice?.rate ?? 1, 0.1, 3);
utter.onend = () => this._finishActive(false);
utter.onerror = (e) => {
- // Some engines fire 'interrupted'/'canceled' as errors on cancel —
+ // Some engines fire 'interrupted'/'canceled' as errors on cancel ,
// only surface genuine synthesis failures, then fall back visually.
if (e?.error && !/interrupt|cancel/i.test(e.error)) {
this.onError(new Error('speech-synthesis: ' + e.error));
diff --git a/concierge-sdk/src/stage.js b/concierge-sdk/src/stage.js
index 27c3e3c8c..36bb68769 100644
--- a/concierge-sdk/src/stage.js
+++ b/concierge-sdk/src/stage.js
@@ -1,10 +1,10 @@
/**
- * AvatarStage — @three-ws/concierge (shared lineage: page-agent-sdk/src/stage.js)
+ * AvatarStage: @three-ws/concierge (shared lineage: page-agent-sdk/src/stage.js)
* ==================================
*
* The 3D surface: a transparent WebGL canvas that loads a rigged glTF agent,
* frames it (bust / upper / full), and keeps it alive with skeletal idle motion
- * — a played idle clip when the GLB ships one, otherwise a procedural breathing
+ *, a played idle clip when the GLB ships one, otherwise a procedural breathing
* + sway + blink loop so the agent never looks like a frozen statue (the whole
* reason we require rigged avatars). It exposes the morph map + a per-frame hook
* so the lipsync driver and speech narrator can drive the mouth in sync.
@@ -105,7 +105,7 @@ export class AvatarStage {
this._resizeObs.observe(container);
// Pause the render loop when the tab is backgrounded or the agent scrolls
- // offscreen — a docked WebGL canvas should never burn GPU it can't be seen on.
+ // offscreen, a docked WebGL canvas should never burn GPU it can't be seen on.
this._visible = !document.hidden;
this._onscreen = true;
this._render = this._render.bind(this);
diff --git a/concierge-sdk/src/styles.js b/concierge-sdk/src/styles.js
index 285357ed1..cf4f54443 100644
--- a/concierge-sdk/src/styles.js
+++ b/concierge-sdk/src/styles.js
@@ -1,12 +1,12 @@
/**
- * Styles — @three-ws/concierge
+ * Styles: @three-ws/concierge
* ============================
*
* One injected stylesheet, scoped under .tc- prefixes and namespaced CSS
* variables so host pages are never polluted. Themes: dark and light, chosen
* by `data-tc-theme` on the root (the widget resolves 'auto' from
* prefers-color-scheme and live-updates). Accent is one variable hosts set
- * from config — every tint derives via color-mix so a single hex restyles the
+ * from config, every tint derives via color-mix so a single hex restyles the
* whole widget.
*/
diff --git a/concierge-sdk/src/widget.js b/concierge-sdk/src/widget.js
index 6811a0a28..66242f579 100644
--- a/concierge-sdk/src/widget.js
+++ b/concierge-sdk/src/widget.js
@@ -1,5 +1,5 @@
/**
- * Concierge — @three-ws/concierge
+ * Concierge: @three-ws/concierge
* ===============================
*
* The embeddable AI concierge: a floating launcher that opens a chat panel
@@ -61,7 +61,7 @@ function storageSet(store, key, value) {
try {
window[store].setItem(key, value);
} catch {
- /* storage unavailable (private mode / blocked) — degrade to in-memory */
+ /* storage unavailable (private mode / blocked), degrade to in-memory */
}
}
@@ -167,7 +167,7 @@ export class Concierge {
const name = this.config.name || this.avatar.name;
root.innerHTML = `
- <section class="tc-panel" role="dialog" aria-modal="false" aria-label="${escapeHtml(name)} — site assistant" hidden>
+ <section class="tc-panel" role="dialog" aria-modal="false" aria-label="${escapeHtml(name)}, site assistant" hidden>
<header class="tc-head">
<div class="tc-head-id">
<span class="tc-head-dot" aria-hidden="true"></span>
@@ -369,7 +369,7 @@ export class Concierge {
muted: this.muted,
onCaption: (text) => this._setCaption(text),
onError: () => {
- /* voice is an enhancement — a TTS engine fault must stay silent */
+ /* voice is an enhancement, a TTS engine fault must stay silent */
},
});
this._narrator.setAgent(this.avatar);
@@ -651,7 +651,7 @@ export class Concierge {
if (err?.name !== 'AbortError') {
const friendly =
err?.status === 429
- ? 'I am getting a lot of questions right now — give me a few seconds and try again.'
+ ? 'I am getting a lot of questions right now, give me a few seconds and try again.'
: 'Something went wrong reaching my brain. Check your connection and try again.';
this._renderErrorBubble(question, friendly);
this._emit('error', err instanceof Error ? err : new Error(String(err)));
diff --git a/concierge-sdk/test/client.test.js b/concierge-sdk/test/client.test.js
index 862ccc612..bdd969e71 100644
--- a/concierge-sdk/test/client.test.js
+++ b/concierge-sdk/test/client.test.js
@@ -15,7 +15,7 @@ test('createSseBuffer reassembles frames across arbitrary chunk splits', () => {
const events = [];
const buf = createSseBuffer((e) => events.push(e));
const wire = 'data: {"type":"chunk","text":"Hel"}\n\ndata: {"type":"chunk","text":"lo"}\n\ndata: {"type":"done","provider":"groq"}\n\n';
- // Feed one byte at a time — worst-case network fragmentation.
+ // Feed one byte at a time, worst-case network fragmentation.
for (const ch of wire) buf.push(ch);
assert.equal(events.length, 3);
assert.equal(events[0].text, 'Hel');
diff --git a/concierge-sdk/test/context.test.js b/concierge-sdk/test/context.test.js
index 0fecd316c..a745eaf0f 100644
--- a/concierge-sdk/test/context.test.js
+++ b/concierge-sdk/test/context.test.js
@@ -4,7 +4,7 @@ import { JSDOM } from 'jsdom';
import { harvestSiteContext, buildSitePayload, MAX_CONTENT_CHARS } from '../src/context.js';
const PAGE = `<!doctype html><html><head>
- <title>Acme — Rocket Skates</title>
+ <title>Acme, Rocket Skates</title>
<meta name="description" content="Acme sells rocket skates to discerning coyotes.">
<meta property="og:site_name" content="Acme">
</head><body>
@@ -25,7 +25,7 @@ function doc() {
test('harvests title, description, headings, deduped nav, site name', () => {
const ctx = harvestSiteContext(doc());
- assert.equal(ctx.title, 'Acme — Rocket Skates');
+ assert.equal(ctx.title, 'Acme, Rocket Skates');
assert.match(ctx.description, /rocket skates/i);
assert.deepEqual(ctx.headings, ['Rocket Skates', 'Fast. Very fast.']);
assert.deepEqual(ctx.nav, ['Home', 'Pricing']);
diff --git a/concierge-sdk/test/markdown.test.js b/concierge-sdk/test/markdown.test.js
index a00ee177e..f0fe145db 100644
--- a/concierge-sdk/test/markdown.test.js
+++ b/concierge-sdk/test/markdown.test.js
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import { renderMarkdown, stripMarkdown, escapeHtml } from '../src/markdown.js';
-test('escapes raw HTML — no injection from model output', () => {
+test('escapes raw HTML, no injection from model output', () => {
const html = renderMarkdown('<img src=x onerror=alert(1)> & <b>bold</b>');
assert.ok(!html.includes('<img'));
assert.ok(html.includes('&lt;img'));
diff --git a/data/changelog.json b/data/changelog.json
index 656d762fd..957771dc5 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-18",
+ "title": "New: a 3D avatar assistant widget for any website",
+ "summary": "One script tag now puts a three.ws avatar on any site as a floating assistant. Click the launcher and a real animated 3D character pops up, standing directly on the page (transparent), or against a color or gradient you pick. It has two modes: a chatbot that answers visitors' questions using the free model chain, with the option to bring your own Groq or OpenRouter key that never leaves the browser, and a speak mode where the avatar says exactly what you type, out loud, with a speech bubble. Configure everything and copy your snippet at three.ws/assistant.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/assistant"
+ },
{
"date": "2026-07-18",
"title": "The x402-server SDK now attaches the payment receipt on every paid response",
diff --git a/data/pages.json b/data/pages.json
index c782d29ba..a11928777 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -235,6 +235,14 @@
"changefreq": "weekly",
"added": "2026-06-21"
},
+ {
+ "path": "/concierge",
+ "title": "Concierge: AI Chat Widget",
+ "description": "Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.",
+ "priority": 0.8,
+ "changefreq": "weekly",
+ "added": "2026-07-18"
+ },
{
"path": "/feed",
"title": "Feed",
@@ -2817,6 +2825,14 @@
"lastmod": "2026-05-17",
"added": "2026-05-17"
},
+ {
+ "path": "/blog/concierge-3d-chat-widget",
+ "title": "Concierge: We Gave the Site Chatbot a Face",
+ "description": "Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.",
+ "priority": 0.6,
+ "changefreq": "monthly",
+ "added": "2026-07-18"
+ },
{
"path": "/blog/inside-the-forge",
"title": "Inside the Forge: How a Prompt Becomes a 3D Model",
diff --git a/docs/assistant-widget.md b/docs/assistant-widget.md
new file mode 100644
index 000000000..958758cd3
--- /dev/null
+++ b/docs/assistant-widget.md
@@ -0,0 +1,86 @@
+# Assistant widget: a 3D avatar assistant on any website
+
+The assistant widget puts a full-body, animated three.ws avatar on any website behind a floating launcher button. Click it and the avatar pops up, standing directly on the page (transparent background) or against a color or gradient, with a message box underneath. It has two modes:
+
+- **Chat**: a real chatbot. Messages go to an LLM and the reply streams into a speech bubble above the avatar's head, optionally spoken aloud. By default answers come from the platform's free model chain (Groq, then OpenRouter, then NVIDIA, no key and no account needed). Visitors can instead bring their own Groq or OpenRouter API key in the widget's settings; the key is stored only in their browser and calls go straight from the browser to the provider.
+- **Speak**: the avatar repeats exactly what you type, out loud, with a speech bubble and a talking animation. No model involved; speech uses the browser's built-in text-to-speech voices at zero cost.
+
+Configure everything and copy your snippet at [three.ws/assistant](https://three.ws/assistant). The builder page runs the real widget, so what you see in the corner is exactly what your visitors get.
+
+Looking for a support-chat panel grounded in your page's content instead of a full-body avatar? That is the sibling [Concierge widget](./concierge.md). Use Concierge for "answer questions about this page"; use the assistant widget when you want a character who stands on your site, speaks, and can run on a visitor's own model key.
+
+## Install
+
+One script tag before `</body>`:
+
+```html
+<script src="https://three.ws/assistant/v1.js" async></script>
+```
+
+That alone gives you the launcher with the default avatar, transparent background, both modes, and the free chat lane. Everything is configurable with data attributes:
+
+```html
+<script src="https://three.ws/assistant/v1.js" async
+ data-avatar="/avatars/selfie-girl.glb"
+ data-bg="transparent"
+ data-mode="both"
+ data-name="Atelier AI"
+ data-greeting="Ask anything about Atelier."
+ data-context="Atelier is a design studio for 3D artists."
+ data-accent="#f97316"
+ data-position="right"></script>
+```
+
+| Attribute | Values | Default | What it does |
+| --- | --- | --- | --- |
+| `data-avatar` | avatar id, `/avatars/*.glb`, or a GLB URL | default mannequin | Which body to load. three.ws avatar ids resolve through the public GLB proxy; external URLs must be GLB/GLTF/VRM on an allow-listed host (three.ws, R2, Ready Player Me). |
+| `data-agent` | a three.ws agent id | none | Load that agent's avatar instead (alternative to `data-avatar`). |
+| `data-bg` | `transparent`, `#hex`, a preset (`ember`, `ocean`, `violet`, `forest`, `dusk`, `slate`), or `gradient:#a,#b,angle` | `transparent` | `transparent` floats the avatar directly over your page. Anything else paints the panel. Values are strictly validated inside the frame; invalid input falls back to transparent. |
+| `data-mode` | `chat`, `speak`, `both` | `both` | `both` shows a Chat / Speak toggle in the widget. |
+| `data-name` | text (60 chars) | `Assistant` | Header title and the chatbot's persona name. |
+| `data-greeting` | text (200 chars) | mode-aware default | First speech bubble when the widget opens. |
+| `data-context` | text (500 chars) | none | What the chatbot should know about your site; injected into the system prompt. |
+| `data-accent` | `#hex` | `#f97316` | Launcher button, send button, focus rings. |
+| `data-position` | `right`, `left` | `right` | Which corner the launcher sits in. |
+| `data-voice` | `false` | on | Start with voice muted (the visitor can toggle it). |
+| `data-badge` | `false` | on | Hide the three.ws attribution badge. |
+| `data-open` | present | closed | Start with the panel open. |
+| `data-manual` | present | auto | Don't auto-mount; call `ThreeAssistant.init()` yourself. |
+
+## JavaScript API
+
+The loader exposes `window.ThreeAssistant`:
+
+```js
+ThreeAssistant.init({ avatar: '/avatars/michelle.glb', name: 'Atelier AI' }); // replaces any existing instance
+ThreeAssistant.open();
+ThreeAssistant.close();
+ThreeAssistant.toggle();
+ThreeAssistant.say('Welcome to the spring sale!'); // opens the widget and speaks the line aloud
+ThreeAssistant.setMode('speak'); // or 'chat' (only when the widget was mounted with mode "both")
+ThreeAssistant.destroy();
+```
+
+Host pages can observe the widget through a single DOM event:
+
+```js
+window.addEventListener('three-assistant', (e) => {
+ // e.detail.type: 'ready' | 'open' | 'close' | 'message' | 'speak:start' | 'speak:end' | 'error'
+ if (e.detail.type === 'message') console.log(e.detail.payload.role, e.detail.payload.content);
+});
+```
+
+## How it works
+
+- The launcher and panel are plain DOM injected by [`public/assistant/v1.js`](https://github.com/nirholas/three.ws/blob/main/public/assistant/v1.js) (~9 KB, no dependencies, idempotent). The avatar, chat, and speech run inside an iframe on `https://three.ws/assistant-frame`, so your page never sees model keys and the frame never sees your DOM.
+- The frame ([`src/assistant-frame.js`](https://github.com/nirholas/three.ws/blob/main/src/assistant-frame.js)) renders the avatar with Three.js, retargets the platform's canonical animation clips onto it (idle, wave greeting, a talking loop while speaking), and anchors the speech bubble to the avatar's head projection every frame.
+- Free-lane chat posts to `POST /api/chat` (SSE stream, anonymous access, server-side rate limits and moderation). BYOK chat streams directly from the visitor's browser to Groq or OpenRouter with their key; the key lives in `localStorage` on the three.ws origin and is never sent to three.ws servers or the host page.
+- Speak mode and spoken chat replies use the Web Speech API (`speechSynthesis`). Voice pick persists per browser. When the browser has no TTS or voice is muted, the bubble and talking animation still run for the estimated duration, so the widget never silently stalls.
+- Every config param is re-validated inside the frame by [`src/assistant-widget-core.js`](https://github.com/nirholas/three.ws/blob/main/src/assistant-widget-core.js) (strict background/color grammars, length clamps, avatar host allow-list), so a hostile embedding page cannot inject CSS or URLs into the frame.
+
+## Related surfaces
+
+- [Concierge](./concierge.md), the page-grounded support-chat widget with a lipsyncing face
+- [Share and embed](./share-and-embed.md), the `<three-d>` model embeds
+- [/walk-embed](https://three.ws/walk-embed), the walking-avatar iframe embed
+- [/forge](https://three.ws/forge), generate an avatar to use in the widget
diff --git a/docs/concierge.md b/docs/concierge.md
new file mode 100644
index 000000000..187598af7
--- /dev/null
+++ b/docs/concierge.md
@@ -0,0 +1,76 @@
+# Concierge: an AI chat widget with a 3D face, for any website
+
+Concierge is the three.ws support-chat widget: a floating launcher that opens a chat panel where a rigged 3D avatar blinks, idles, and lipsyncs while it answers visitors. Answers stream in live, are grounded in the page the widget sits on, and speak aloud with the browser's own speech engine. It installs on any site with one tag and costs nothing.
+
+- Live demo and landing: [/concierge](/concierge) (the widget there answers questions about itself)
+- Package: [`@three-ws/concierge`](https://www.npmjs.com/package/@three-ws/concierge), source in [`concierge-sdk/`](https://github.com/nirholas/three.ws/tree/main/concierge-sdk)
+- Backend: `POST /api/concierge` ([reference implementation](https://github.com/nirholas/three.ws/blob/main/api/concierge.js))
+- Tutorial on how it is built: [Build a site concierge](/docs/tutorials/build-a-site-concierge)
+
+---
+
+## Install
+
+The one-tag embed:
+
+```html
+<script type="module"
+ src="https://three.ws/concierge/concierge.global.js"
+ data-concierge
+ data-site-name="Acme"
+ data-accent="#f97316"
+ data-suggestions="What is Acme?|What does it cost?"></script>
+```
+
+Or from npm (`npm install @three-ws/concierge three`) as a web component or an imperative API:
+
+```html
+<three-concierge site-name="Acme" accent="#f97316"
+ knowledge="Pro plan is $20/month. Support: [email protected]."></three-concierge>
+```
+
+```js
+import { Concierge } from '@three-ws/concierge';
+const c = new Concierge({ siteName: 'Acme', knowledge: FAQ_TEXT });
+await c.ask('What does the Pro plan cost?');
+```
+
+The full option table (avatars, themes, position, voice, persona, custom GLB avatars, self-hosted assets) lives in the [package README](https://github.com/nirholas/three.ws/tree/main/concierge-sdk#options).
+
+## How it answers accurately with zero setup
+
+Most site chatbots need a crawler, an index, and an onboarding flow. Concierge skips all three:
+
+1. **Harvest at ask-time.** When the visitor asks something, the widget snapshots the live DOM: title, meta description, headings, nav labels, and the main content, each capped to a strict budget. Your curated `knowledge` string (FAQ, pricing, policies) is merged in ahead of the harvested text. Mark any element `data-concierge-ignore` to keep it out.
+2. **Ground and stream.** The snapshot, the running conversation, and the question go to `/api/concierge`. The server builds a grounded system prompt that forbids inventing facts, then streams the answer back as SSE from the platform's free-first LLM chain (Groq → Cerebras → OpenRouter → NVIDIA → OVH → Gemini → Vertex, with cooldown-aware failover). The route is anonymous, CORS-open (it must run on third-party origins), rate-limited per IP and globally, and pre-moderated fail-open.
+3. **Speak while streaming.** The widget splits the stream into sentences and hands each completed sentence to the Web Speech engine while the rest is still arriving; a text-to-viseme timeline drives the avatar's mouth morphs in sync. Muted or unsupported? Captions and lipsync still play.
+
+Because the page itself is the knowledge source, the concierge is never stale: edit your pricing page and the very next answer reflects it.
+
+## The avatar
+
+The catalog (`sol`, `nova`, `vera`, `atlas`, `echo`) is the same rigged, viseme-capable roster the [page-agent](https://www.npmjs.com/package/@three-ws/page-agent) ships, served from `https://three.ws/avatars/`. Visitors pick their concierge from the built-in picker (their choice persists), or the host pins a single custom rigged GLB with `custom-avatar`. The 3D stage initializes on first open only, so a closed widget costs the host page zero GPU and no GLB download.
+
+## Bring your own backend
+
+The hosted endpoint is free, but the wire format is open. Any server that accepts the POST body and streams the same three SSE event types can be swapped in via the `endpoint` option:
+
+```
+→ POST { message, history[], site{url,name,title,description,headings,nav,knowledge,content}, persona?, lang? }
+← data: {"type":"chunk","text":"..."}
+← data: {"type":"done","provider":"...","model":"..."}
+← data: {"type":"error","code":"...","message":"..."}
+```
+
+## Limits and safeguards
+
+- Messages are capped at 2,000 characters, history at 20 turns, page content at 6,000 characters, curated knowledge at 8,000.
+- The hosted endpoint rate-limits per IP (20/min) and globally (600/min across all embeds), and cools down failing providers so a billing-dead lane is skipped, not re-probed.
+- Model output renders through a strict markdown-lite renderer: all text is escaped before markup applies, and links are restricted to http(s)/mailto.
+- Only the embedding page's hostname (never the full URL) is recorded in usage telemetry.
+
+## Related surfaces
+
+- [/walk](/walk): the walking page companion the avatar engine grew from
+- [Share and embed](./share-and-embed.md): every other way to put a three.ws creation on your site
+- [MCP](./mcp.md): drive avatars and generation from agent tooling
diff --git a/docs/start-here.md b/docs/start-here.md
index 1bc392704..75ea76085 100644
--- a/docs/start-here.md
+++ b/docs/start-here.md
@@ -76,6 +76,8 @@ Curious what happens between the prompt and the model? [How the Forge works](./h
- **Placing agents in the real world?** → [IRL](./irl.md): pin an agent at a real GPS spot from your phone, and anyone who physically walks up can see it, talk to it, and pay it. Real crypto can be escrowed at places ([Money Drops](./irl.md#money-drops)) and agents sign proofs that you were really there ([World Lines](./irl.md#world-lines))
- **Making 3D models?** → [The free 3D Studio MCP](./mcp-studio.md) turns a prompt into a model, avatar, or rigged character — and lets you refine it by talking to it (*"make it metallic"*) with a revertable version history. Publish a model as remixable and earn on-chain royalties when others build on it: [the remix economy](./remix.md). Vote on the best community models and win the weekly board: [Forge-Off](./forge-off.md)
- **Using ChatGPT?** → [AR in ChatGPT](./chatgpt-ar.md) is how a sentence typed into ChatGPT becomes a 3D model standing in your room, from the free generation lane to the one-tap AR link; [your first prompt to 3D](/tutorials/first-prompt-to-3d) walks you through it in five minutes
+- **Want a support chat with a face on your own site?** → [Concierge](./concierge.md) — a one-tag chat widget where a rigged 3D avatar lipsyncs streaming answers grounded in your live page, with voice in and out; [the build tutorial](./tutorials/build-a-site-concierge.md) shows how every part works
+- **Want a full-body avatar assistant on your site instead?** → [Assistant widget](./assistant-widget.md) — a launcher button opens an animated 3D character standing directly on your page (or a color/gradient), with a free-lane or bring-your-own-key chatbot and a speak mode that says whatever you type, out loud, in a speech bubble
- **Trading?** → [The trading surfaces](./trading-surfaces.md) maps the solo stack (Radar, Coin Intelligence, Live Trade Feed, Watchlist, Mission Control); [trading arenas](./trading-arenas.md) covers tournaments, the theater, vaults, and swarms; [Oracle](./oracle.md) is the conviction engine underneath all of it
- **Trusting an agent with money?** → [Custody you can verify](./custody.md) — spend limits, freeze, Merkle proof-of-custody, and social recovery; [claim your wallet](./trader-card.md) turns any pump.fun track record into a public, provable Trader Card. Every real-funds feature sits behind the [risk acknowledgment](./risk-acknowledgment.md) — read the [Risk Disclosure](https://three.ws/legal/risk) before committing anything
- **Vetting a counterparty before you pay it?** → [Trust primitives](./trust-primitives.md) — the cross-chain Agent Reputation endpoint scores ANY wallet, mint, or agent id (Solana or EVM) 0–100 from real on-chain evidence, in one paid call, before your agent transacts
diff --git a/docs/tutorials/build-a-site-concierge.md b/docs/tutorials/build-a-site-concierge.md
new file mode 100644
index 000000000..8ca658177
--- /dev/null
+++ b/docs/tutorials/build-a-site-concierge.md
@@ -0,0 +1,111 @@
+# Build a site concierge: how the three.ws chat widget works, end to end
+
+This tutorial walks through how we built [Concierge](/concierge), the embeddable chat widget with a talking 3D avatar, and how to assemble the same thing from the exported building blocks. By the end you will understand every moving part well enough to customize it, extend it, or point it at your own backend.
+
+What you need: a browser with WebGL, any static page to test on, and (only for the custom-backend section) a server that can stream Server-Sent Events.
+
+---
+
+## The shape of the problem
+
+A site chatbot has four jobs, and each maps to one module in [`concierge-sdk/`](https://github.com/nirholas/three.ws/tree/main/concierge-sdk):
+
+| Job | Module | What it does |
+| --- | --- | --- |
+| Know the site | `src/context.js` | Snapshot the live DOM at ask-time |
+| Get an answer | `src/client.js` + `api/concierge.js` | Stream SSE from a grounded LLM prompt |
+| Have a face | `src/stage.js` + `src/lipsync.js` + `src/narrator.js` | Rigged GLB bust, blink/idle, viseme lipsync, TTS |
+| Be a widget | `src/widget.js` + `src/styles.js` + `src/element.js` | Launcher, panel, thread, mic, themes, persistence |
+
+The 3D pieces are shared lineage with `@three-ws/page-agent` and the rig conventions of `@three-ws/walk`; nothing here was invented twice.
+
+## Step 1: know the site without a crawler
+
+The classic approach (crawl the site, chunk it, embed it, retrieve at query time) needs infrastructure and goes stale. The concierge inverts it: the visitor is already *on* the page, so harvest the DOM at the moment of the question.
+
+```js
+import { buildSitePayload } from '@three-ws/concierge';
+
+const site = buildSitePayload(document, {
+ knowledge: 'Pro plan is $20/month.', // curated facts lead
+ siteName: 'Acme',
+});
+// → { url, name, title, description, headings[], nav[], knowledge, content }
+```
+
+Three details make this reliable:
+
+- **Noise is stripped before text is read**: `script`, `style`, `[aria-hidden]`, `[hidden]`, iframes, and anything marked `data-concierge-ignore`. The widget's own DOM is excluded too, or it would feed its answers back into its questions.
+- **Everything is budgeted.** Page content caps at 6,000 characters, and curated `knowledge` (which is authoritative) eats into that budget first, so the payload can never bloat past what a small prompt affords.
+- **It is pure DOM-in / JSON-out**, so it unit-tests with jsdom and no browser.
+
+## Step 2: a grounded, streaming answer
+
+The widget posts `{ message, history, site }` to `/api/concierge`. The server folds the snapshot into a system prompt whose key line is the honesty rule: *ground every claim in the site information; if it is not there, say so and point at the closest nav item instead. Never invent prices, features, or policies.*
+
+The response is Server-Sent Events, one JSON object per frame:
+
+```
+data: {"type":"chunk","text":"The Pro plan "}
+data: {"type":"chunk","text":"costs $20/month."}
+data: {"type":"done","provider":"groq","model":"llama-3.3-70b-versatile"}
+```
+
+On the server, the provider list comes from the shared free-first chain (`api/_lib/llm.js`). The handler walks the chain in order, skips lanes in cooldown, marks a lane that answers 401/402/403 with a long auth cooldown (a billing-dead account should not be re-probed on every request), and streams from the first lane that connects. If every lane fails before a byte is sent, the client gets a plain 503 with `Retry-After` and the widget shows a retry bubble.
+
+The client side is ~100 lines (`src/client.js`): a `fetch`, a spec-correct SSE reassembly buffer (frames split on blank lines, tested against one-byte-at-a-time delivery), and an `onChunk` callback.
+
+## Step 3: the face
+
+`AvatarStage` renders a rigged GLB into a transparent canvas, framed as a bust, with three layers of life:
+
+1. **Clip-driven idle** when the GLB ships an idle animation, plus a talk clip crossfaded in while speaking.
+2. **Procedural fallback** (breathing, head sway, nod) when it does not, so no avatar is ever a frozen statue.
+3. **Blinks**, driven through the standard blink morph targets on a randomized timer.
+
+Lipsync is deliberately *not* audio analysis. `createLipsync` tokenizes the sentence into a timed viseme sequence (`th` → `viseme_TH`, vowels → their shapes, ~80ms per phoneme) and lerps the matching morph-target influences every frame. It is synced to the Web Speech utterance by starting the timeline when the utterance starts. Cheap, dependency-free, and convincing at conversational pace. Rigs with only a `jawOpen` morph get an amplitude envelope instead; rigs with no face morphs carry the talk with body animation.
+
+`SpeechNarrator` queues sentences, picks a voice per avatar profile (name matches first, then language, then any local voice), and always runs the visual timeline even when muted or when the platform has no TTS, so the answer never silently stalls.
+
+The trick that makes the whole thing feel fast: **the widget speaks while the answer still streams**. A small sentence-splitter (`drainSentences`) watches the chunk stream and hands each completed sentence to the narrator immediately.
+
+## Step 4: the widget shell
+
+`Concierge` (in `src/widget.js`) owns the lifecycle. The decisions that matter:
+
+- **Lazy everything.** The WebGL context, GLB download, and speech engines initialize on first open. A closed widget is one button and one stylesheet.
+- **Design every state.** Empty state (greeting + suggestion chips), loading (skeleton shimmer behind the stage, typing dots in the thread), streaming (live markdown with a caret), error (friendly bubble + retry that rewinds the failed turn), no-WebGL (stage hides, chat survives), no-mic (button never renders).
+- **Persistence with the right scopes.** Conversation per tab (`sessionStorage`), avatar + mute per visitor (`localStorage`), teaser once per session.
+- **Safety at the render boundary.** Model output goes through a markdown-lite renderer that escapes first and only then applies markup; `javascript:` URLs never become links.
+
+`<three-concierge>` (`src/element.js`) is a thin attribute-to-config wrapper, and `src/index.js` adds the `data-concierge` script auto-init, which is why the one-tag install needs no JavaScript at all.
+
+## Point it at your own backend
+
+Everything above the wire format is replaceable. Implement one route:
+
+```js
+// POST /my/concierge (Express-flavored sketch)
+app.post('/my/concierge', async (req, res) => {
+ const { message, history, site } = req.body;
+ res.writeHead(200, { 'Content-Type': 'text/event-stream' });
+ const send = (o) => res.write(`data: ${JSON.stringify(o)}\n\n`);
+
+ const stream = await yourLlm.stream({
+ system: `Answer questions about ${site.name} using only:\n${site.knowledge}\n${site.content}`,
+ messages: [...history, { role: 'user', content: message }],
+ });
+ for await (const text of stream) send({ type: 'chunk', text });
+ send({ type: 'done', provider: 'yours', model: 'your-model' });
+ res.end();
+});
+```
+
+Then: `<three-concierge endpoint="/my/concierge">`. The production reference, with rate limits, moderation, provider failover, and cooldowns, is [`api/concierge.js`](https://github.com/nirholas/three.ws/blob/main/api/concierge.js).
+
+## Where to go next
+
+- Ship it: the [install options](/concierge#install) on the landing page
+- Every attribute and event: the [package README](https://github.com/nirholas/three.ws/tree/main/concierge-sdk#options)
+- The launch story: [blog post](/blog/concierge-3d-chat-widget)
+- The rig conventions the avatars follow: [`@three-ws/walk`](https://www.npmjs.com/package/@three-ws/walk) and `src/glb-canonicalize.js` in the repo
diff --git a/pages/assistant-frame.html b/pages/assistant-frame.html
new file mode 100644
index 000000000..fc2c99811
--- /dev/null
+++ b/pages/assistant-frame.html
@@ -0,0 +1,560 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <title>Assistant Frame · three.ws</title>
+ <meta name="robots" content="noindex" />
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
+ <meta name="author" content="nirholas" />
+ <meta
+ name="description"
+ content="Embeddable 3D avatar assistant — chat and text-to-speech in one iframe."
+ />
+ <meta name="theme-color" content="#000000" />
+
+ <!--
+ Chrome-less iframe surface for the assistant widget. Loaded by
+ public/assistant/v1.js inside a floating panel on third-party sites.
+ Background is transparent by default so the avatar stands directly on
+ the host page; ?bg= paints a solid color or gradient instead
+ (validated in src/assistant-widget-core.js — never raw CSS).
+ -->
+ <meta name="assistant-frame" content="1" />
+
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+
+ <style>
+ :root {
+ --accent: #f97316;
+ --ink: #fafafa;
+ --ink-dim: #a1a1aa;
+ --shell: rgba(12, 12, 14, 0.86);
+ --shell-border: rgba(255, 255, 255, 0.1);
+ }
+
+ html,
+ body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background: transparent;
+ color: var(--ink);
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ overscroll-behavior: none;
+ }
+
+ #assistant-root {
+ position: fixed;
+ inset: 0;
+ display: flex;
+ flex-direction: column;
+ }
+
+ /* ── Header ─────────────────────────────────────────────────────── */
+ #assistant-header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 10px 10px 0;
+ padding: 8px 10px;
+ border-radius: 14px;
+ background: var(--shell);
+ border: 1px solid var(--shell-border);
+ backdrop-filter: blur(14px);
+ -webkit-backdrop-filter: blur(14px);
+ z-index: 20;
+ }
+ #assistant-title {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 13.5px;
+ font-weight: 700;
+ letter-spacing: 0.01em;
+ min-width: 0;
+ }
+ #assistant-title .spark {
+ width: 18px;
+ height: 18px;
+ flex: 0 0 auto;
+ color: var(--accent);
+ }
+ #assistant-title .label {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ #assistant-header .spacer { flex: 1; }
+ .icon-btn {
+ width: 30px;
+ height: 30px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 9px;
+ border: 1px solid transparent;
+ background: transparent;
+ color: var(--ink-dim);
+ cursor: pointer;
+ padding: 0;
+ transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
+ }
+ .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
+ .icon-btn:active { transform: scale(0.94); }
+ .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
+ .icon-btn[aria-pressed='true'] { color: var(--accent); border-color: var(--shell-border); background: rgba(255, 255, 255, 0.05); }
+ .icon-btn svg { width: 16px; height: 16px; }
+ #assistant-voice-btn[aria-pressed='false'] .voice-waves { opacity: 0.2; }
+
+ /* ── Stage ──────────────────────────────────────────────────────── */
+ #assistant-stage {
+ position: relative;
+ flex: 1;
+ min-height: 0;
+ }
+ #assistant-canvas {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ display: block;
+ }
+
+ /* Loading poster — silhouette until the first avatar frame. */
+ #assistant-poster {
+ position: absolute;
+ inset: 0;
+ z-index: 4;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ pointer-events: none;
+ transition: opacity 0.45s ease;
+ }
+ #assistant-poster.is-hidden { opacity: 0; }
+ #assistant-poster svg { width: 30%; max-width: 130px; height: auto; opacity: 0.45; }
+ #assistant-poster .poster-shimmer { fill: rgba(255, 255, 255, 0.16); }
+ @media (prefers-reduced-motion: no-preference) {
+ #assistant-poster .poster-shimmer { animation: assistant-pulse 1.6s ease-in-out infinite; }
+ }
+ @keyframes assistant-pulse {
+ 0%, 100% { opacity: 0.35; }
+ 50% { opacity: 0.85; }
+ }
+
+ /* ── Speech bubble (look.png style) ─────────────────────────────── */
+ #assistant-bubble {
+ position: absolute;
+ z-index: 10;
+ max-width: min(320px, calc(100% - 32px));
+ background: rgba(10, 10, 10, 0.9);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 16px;
+ padding: 11px 14px;
+ font-size: 13px;
+ line-height: 1.5;
+ color: var(--ink);
+ backdrop-filter: blur(12px);
+ -webkit-backdrop-filter: blur(12px);
+ pointer-events: none;
+ opacity: 0;
+ /* Position is driven per-frame from the avatar's head projection
+ (src/assistant-frame.js), so only opacity transitions. */
+ transform: translate(-50%, -100%);
+ transition: opacity 0.22s ease;
+ will-change: opacity;
+ }
+ #assistant-bubble.is-visible { opacity: 1; }
+ #assistant-bubble.is-error { border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }
+ #assistant-bubble .bubble-text {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 6;
+ line-clamp: 6;
+ overflow: hidden;
+ word-break: break-word;
+ white-space: pre-wrap;
+ }
+ #assistant-bubble .bubble-tail {
+ position: absolute;
+ bottom: -7px;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 0;
+ height: 0;
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-top: 7px solid rgba(10, 10, 10, 0.9);
+ }
+ /* Streaming caret while a chat reply is arriving. */
+ #assistant-bubble.is-streaming .bubble-text::after {
+ content: '▍';
+ color: var(--accent);
+ animation: assistant-caret 1s steps(1) infinite;
+ }
+ @keyframes assistant-caret { 50% { opacity: 0; } }
+
+ /* Thinking dots while waiting for the first token. */
+ #assistant-bubble.is-thinking .bubble-text::after {
+ content: '···';
+ letter-spacing: 2px;
+ color: var(--ink-dim);
+ animation: assistant-caret 1s steps(1) infinite;
+ }
+
+ /* ── Composer ───────────────────────────────────────────────────── */
+ #assistant-composer {
+ margin: 0 10px calc(10px + env(safe-area-inset-bottom, 0));
+ padding: 10px;
+ border-radius: 16px;
+ background: var(--shell);
+ border: 1px solid var(--shell-border);
+ backdrop-filter: blur(14px);
+ -webkit-backdrop-filter: blur(14px);
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ z-index: 20;
+ }
+
+ #assistant-modes {
+ display: none;
+ align-self: flex-start;
+ gap: 2px;
+ padding: 2px;
+ border-radius: 10px;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.07);
+ }
+ #assistant-root[data-mode-switch='true'] #assistant-modes { display: inline-flex; }
+ .mode-btn {
+ appearance: none;
+ border: 0;
+ background: transparent;
+ color: var(--ink-dim);
+ font: 600 11.5px/1 'Inter', system-ui, sans-serif;
+ letter-spacing: 0.02em;
+ padding: 6px 12px;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: background 0.15s ease, color 0.15s ease;
+ }
+ .mode-btn:hover { color: var(--ink); }
+ .mode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
+ .mode-btn[aria-pressed='true'] { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
+
+ #assistant-input-row {
+ display: flex;
+ align-items: flex-end;
+ gap: 8px;
+ }
+ #assistant-input {
+ flex: 1;
+ min-width: 0;
+ resize: none;
+ border: 0;
+ outline: 0;
+ background: transparent;
+ color: var(--ink);
+ font: 400 13.5px/1.45 'Inter', system-ui, sans-serif;
+ max-height: 96px;
+ padding: 8px 2px;
+ caret-color: var(--accent);
+ }
+ #assistant-input::placeholder { color: rgba(255, 255, 255, 0.35); }
+
+ #assistant-send {
+ flex: 0 0 auto;
+ width: 38px;
+ height: 38px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 12px;
+ border: 0;
+ background: var(--accent);
+ color: #fff;
+ cursor: pointer;
+ transition: filter 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
+ }
+ #assistant-send:hover { filter: brightness(1.1); }
+ #assistant-send:active { transform: scale(0.94); }
+ #assistant-send:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
+ #assistant-send:disabled { opacity: 0.45; cursor: default; filter: none; transform: none; }
+ #assistant-send svg { width: 16px; height: 16px; }
+
+ #assistant-hint {
+ font-size: 10.5px;
+ color: rgba(255, 255, 255, 0.38);
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-height: 13px;
+ }
+ #assistant-hint a {
+ color: rgba(255, 255, 255, 0.55);
+ text-decoration: none;
+ font-weight: 600;
+ }
+ #assistant-hint a:hover { color: var(--ink); }
+ #assistant-hint a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
+ #assistant-hint .lane-pill {
+ margin-left: auto;
+ padding: 2px 7px;
+ border-radius: 999px;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ color: rgba(255, 255, 255, 0.5);
+ font-weight: 600;
+ letter-spacing: 0.03em;
+ text-transform: uppercase;
+ font-size: 9px;
+ }
+
+ /* ── Settings sheet ─────────────────────────────────────────────── */
+ #assistant-settings {
+ position: absolute;
+ left: 10px;
+ right: 10px;
+ bottom: 10px;
+ z-index: 30;
+ border-radius: 16px;
+ background: rgba(12, 12, 14, 0.96);
+ border: 1px solid var(--shell-border);
+ backdrop-filter: blur(16px);
+ -webkit-backdrop-filter: blur(16px);
+ padding: 14px;
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ opacity: 0;
+ transform: translateY(8px);
+ pointer-events: none;
+ transition: opacity 0.2s ease, transform 0.2s ease;
+ }
+ #assistant-settings.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
+ #assistant-settings h2 {
+ margin: 0;
+ font-size: 12px;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--ink-dim);
+ display: flex;
+ align-items: center;
+ }
+ #assistant-settings h2 .icon-btn { margin-left: auto; }
+ .settings-group { display: flex; flex-direction: column; gap: 6px; }
+ .settings-group > label { font-size: 11.5px; font-weight: 600; color: var(--ink-dim); }
+ .lane-options { display: flex; flex-direction: column; gap: 4px; }
+ .lane-option {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 10px;
+ border-radius: 10px;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ background: rgba(255, 255, 255, 0.03);
+ cursor: pointer;
+ font-size: 12.5px;
+ transition: border-color 0.15s ease, background 0.15s ease;
+ }
+ .lane-option:hover { background: rgba(255, 255, 255, 0.06); }
+ .lane-option input { accent-color: var(--accent); margin: 0; }
+ .lane-option .lane-desc { color: var(--ink-dim); font-size: 11px; margin-left: auto; text-align: right; }
+ .settings-field {
+ width: 100%;
+ box-sizing: border-box;
+ border-radius: 10px;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ background: rgba(255, 255, 255, 0.04);
+ color: var(--ink);
+ font: 400 12.5px/1.3 'Inter', system-ui, sans-serif;
+ padding: 8px 10px;
+ outline: 0;
+ transition: border-color 0.15s ease;
+ }
+ .settings-field:focus { border-color: var(--accent); }
+ .settings-note { font-size: 10.5px; color: rgba(255, 255, 255, 0.4); line-height: 1.5; margin: 0; }
+ #assistant-byok-fields { display: none; flex-direction: column; gap: 6px; }
+ #assistant-byok-fields.is-visible { display: flex; }
+
+ /* ── Attribution badge ──────────────────────────────────────────── */
+ #assistant-badge {
+ position: absolute;
+ z-index: 8;
+ right: 14px;
+ top: 62px;
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 4px 9px 4px 7px;
+ font-size: 10px;
+ font-weight: 600;
+ color: #d4d4d8;
+ text-decoration: none;
+ background: rgba(10, 10, 10, 0.5);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 999px;
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ opacity: 0.6;
+ transition: opacity 0.18s ease;
+ }
+ #assistant-badge:hover { opacity: 1; }
+ #assistant-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
+ #assistant-badge .badge-dot {
+ width: 12px;
+ height: 12px;
+ border-radius: 4px;
+ background: linear-gradient(135deg, #6366f1, #8b5cf6);
+ }
+
+ #assistant-status {
+ position: absolute;
+ z-index: 9;
+ left: 50%;
+ bottom: 8px;
+ transform: translateX(-50%);
+ background: rgba(17, 17, 17, 0.75);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 999px;
+ padding: 5px 11px;
+ font-size: 11px;
+ color: var(--ink-dim);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ pointer-events: none;
+ transition: opacity 0.2s ease;
+ white-space: nowrap;
+ max-width: calc(100% - 32px);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ #assistant-status.is-error { color: #f87171; border-color: rgba(248, 113, 113, 0.5); }
+ #assistant-status.is-hidden { opacity: 0; }
+
+ @media (prefers-reduced-motion: reduce) {
+ #assistant-bubble,
+ #assistant-settings,
+ .icon-btn,
+ #assistant-send { transition: none; }
+ }
+ </style>
+ </head>
+ <body>
+ <div id="assistant-root" data-mode-switch="true">
+ <header id="assistant-header">
+ <span id="assistant-title">
+ <svg class="spark" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
+ <path d="M12 2l1.9 6.1L20 10l-6.1 1.9L12 18l-1.9-6.1L4 10l6.1-1.9L12 2z" />
+ <path d="M19 15l.9 2.6L22.5 18.5l-2.6.9L19 22l-.9-2.6-2.6-.9 2.6-.9L19 15z" opacity="0.7" />
+ </svg>
+ <span class="label">Assistant</span>
+ </span>
+ <span class="spacer"></span>
+ <button type="button" class="icon-btn" id="assistant-voice-btn" aria-pressed="true" title="Voice on" aria-label="Toggle voice">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" fill="currentColor" stroke="none"/><path class="voice-waves" d="M15.5 8.5a5 5 0 0 1 0 7M18.4 5.6a9 9 0 0 1 0 12.8"/></svg>
+ </button>
+ <button type="button" class="icon-btn" id="assistant-settings-btn" title="Settings" aria-label="Open settings" aria-expanded="false">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.01a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.01a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.01a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
+ </button>
+ <button type="button" class="icon-btn" id="assistant-close-btn" title="Close" aria-label="Close assistant">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18M6 6l12 12"/></svg>
+ </button>
+ </header>
+
+ <div id="assistant-stage">
+ <canvas id="assistant-canvas" role="img" aria-label="3D avatar assistant"></canvas>
+
+ <div id="assistant-poster" aria-hidden="true">
+ <svg viewBox="0 0 64 96" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle class="poster-shimmer" cx="32" cy="16" r="11" />
+ <rect class="poster-shimmer" x="18" y="31" width="28" height="42" rx="13" />
+ <rect class="poster-shimmer" x="22" y="68" width="8" height="26" rx="4" />
+ <rect class="poster-shimmer" x="34" y="68" width="8" height="26" rx="4" />
+ </svg>
+ </div>
+
+ <div id="assistant-bubble" role="status" aria-live="polite">
+ <div class="bubble-text"></div>
+ <div class="bubble-tail" aria-hidden="true"></div>
+ </div>
+
+ <a id="assistant-badge" href="https://three.ws/assistant?ref=assistant-widget" target="_blank" rel="noopener" title="Make your own — three.ws">
+ <span class="badge-dot" aria-hidden="true"></span>
+ <span>three.ws</span>
+ </a>
+
+ <div id="assistant-status" class="is-hidden"></div>
+ </div>
+
+ <div id="assistant-composer">
+ <div id="assistant-modes" role="tablist" aria-label="Assistant mode">
+ <button type="button" class="mode-btn" data-mode="chat" role="tab" aria-pressed="true">Chat</button>
+ <button type="button" class="mode-btn" data-mode="speak" role="tab" aria-pressed="false">Speak</button>
+ </div>
+ <div id="assistant-input-row">
+ <textarea id="assistant-input" rows="1" placeholder="Type a question..." aria-label="Message the assistant" maxlength="4000"></textarea>
+ <button type="button" id="assistant-send" title="Send" aria-label="Send message">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/></svg>
+ </button>
+ </div>
+ <div id="assistant-hint">
+ <span id="assistant-hint-text">Ask anything.</span>
+ <span class="lane-pill" id="assistant-lane-pill" title="Which model lane answers your messages">free</span>
+ </div>
+ </div>
+
+ <div id="assistant-settings" role="dialog" aria-modal="false" aria-label="Assistant settings">
+ <h2>
+ Settings
+ <button type="button" class="icon-btn" id="assistant-settings-close" title="Close settings" aria-label="Close settings">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18M6 6l12 12"/></svg>
+ </button>
+ </h2>
+
+ <div class="settings-group">
+ <label id="assistant-lane-label">Chat brain</label>
+ <div class="lane-options" role="radiogroup" aria-labelledby="assistant-lane-label">
+ <label class="lane-option">
+ <input type="radio" name="assistant-lane" value="free" checked />
+ <span>Free lane</span>
+ <span class="lane-desc">Groq → OpenRouter → NVIDIA, no key</span>
+ </label>
+ <label class="lane-option">
+ <input type="radio" name="assistant-lane" value="groq" />
+ <span>My Groq key</span>
+ <span class="lane-desc">runs in your browser</span>
+ </label>
+ <label class="lane-option">
+ <input type="radio" name="assistant-lane" value="openrouter" />
+ <span>My OpenRouter key</span>
+ <span class="lane-desc">runs in your browser</span>
+ </label>
+ </div>
+ <div id="assistant-byok-fields">
+ <input type="password" class="settings-field" id="assistant-byok-key" placeholder="API key" autocomplete="off" spellcheck="false" aria-label="Provider API key" />
+ <input type="text" class="settings-field" id="assistant-byok-model" placeholder="Model" autocomplete="off" spellcheck="false" aria-label="Model id" />
+ <p class="settings-note">Your key is stored only in this browser (localStorage on three.ws) and sent directly to the provider — it never touches three.ws servers or the page embedding this widget.</p>
+ </div>
+ </div>
+
+ <div class="settings-group">
+ <label for="assistant-voice-select">Voice</label>
+ <select class="settings-field" id="assistant-voice-select" aria-label="Speech voice">
+ <option value="">System default</option>
+ </select>
+ <p class="settings-note">Speech uses your browser's built-in voices — nothing is uploaded.</p>
+ </div>
+ </div>
+ </div>
+
+ <script type="module" src="/src/assistant-frame.js"></script>
+ </body>
+</html>
diff --git a/pages/assistant.html b/pages/assistant.html
new file mode 100644
index 000000000..8b20861ad
--- /dev/null
+++ b/pages/assistant.html
@@ -0,0 +1,357 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
+ <meta charset="utf-8" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/manifest.webmanifest" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Assistant widget — three.ws</title>
+ <meta name="description" content="Put a 3D avatar assistant on any website with one script tag. Chatbot mode (free models or your own Groq/OpenRouter key) and speak mode — the avatar says whatever you type, out loud, with a speech bubble." />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/assistant" />
+ <meta property="og:title" content="Assistant widget — three.ws" />
+ <meta property="og:description" content="Put a 3D avatar assistant on any website with one script tag. Chat mode and speak mode, transparent or gradient backgrounds, free models or bring your own key." />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Assistant widget — three.ws" />
+ <meta name="twitter:description" content="Put a 3D avatar assistant on any website with one script tag. Chat mode and speak mode, transparent or gradient backgrounds, free models or bring your own key." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <style>
+ :root {
+ --bg: #09090b;
+ --panel: #111114;
+ --border: rgba(255, 255, 255, 0.09);
+ --ink: #fafafa;
+ --dim: #a1a1aa;
+ --accent: #f97316;
+ }
+ * { box-sizing: border-box; }
+ html, body {
+ margin: 0;
+ padding: 0;
+ background: var(--bg);
+ color: var(--ink);
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ }
+ main {
+ max-width: 1080px;
+ margin: 0 auto;
+ padding: 56px 20px 120px;
+ }
+ .hero h1 {
+ margin: 0 0 12px;
+ font-size: clamp(30px, 5vw, 44px);
+ letter-spacing: -0.02em;
+ line-height: 1.1;
+ }
+ .hero h1 .accent { color: var(--accent); }
+ .hero p.lede {
+ margin: 0 0 8px;
+ max-width: 640px;
+ color: var(--dim);
+ font-size: 16px;
+ line-height: 1.6;
+ }
+ .hero .hint {
+ font-size: 13px;
+ color: var(--dim);
+ background: rgba(249, 115, 22, 0.08);
+ border: 1px solid rgba(249, 115, 22, 0.25);
+ border-radius: 10px;
+ padding: 9px 12px;
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ margin-top: 14px;
+ }
+
+ .builder {
+ display: grid;
+ grid-template-columns: 1fr;
+ gap: 24px;
+ margin-top: 44px;
+ }
+ @media (min-width: 860px) {
+ .builder { grid-template-columns: 420px 1fr; align-items: start; }
+ }
+
+ .card {
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 16px;
+ padding: 20px;
+ }
+ .card h2 {
+ margin: 0 0 16px;
+ font-size: 13px;
+ font-weight: 700;
+ letter-spacing: 0.07em;
+ text-transform: uppercase;
+ color: var(--dim);
+ }
+ .field { margin-bottom: 16px; }
+ .field > label {
+ display: block;
+ font-size: 12.5px;
+ font-weight: 600;
+ color: var(--dim);
+ margin-bottom: 6px;
+ }
+ .field input[type='text'],
+ .field select,
+ .field textarea {
+ width: 100%;
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ color: var(--ink);
+ font: 400 13.5px/1.4 'Inter', system-ui, sans-serif;
+ padding: 9px 11px;
+ outline: 0;
+ transition: border-color 0.15s ease;
+ }
+ .field textarea { resize: vertical; min-height: 56px; }
+ .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
+ .field .row { display: flex; gap: 8px; }
+ .field .row > * { flex: 1; }
+ .seg {
+ display: inline-flex;
+ gap: 2px;
+ padding: 2px;
+ border-radius: 10px;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid var(--border);
+ }
+ .seg button {
+ appearance: none;
+ border: 0;
+ background: transparent;
+ color: var(--dim);
+ font: 600 12px/1 'Inter', system-ui, sans-serif;
+ padding: 7px 13px;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: background 0.15s ease, color 0.15s ease;
+ }
+ .seg button:hover { color: var(--ink); }
+ .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
+ .seg button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
+ input[type='color'] {
+ width: 42px;
+ height: 34px;
+ padding: 2px;
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ background: rgba(255, 255, 255, 0.04);
+ cursor: pointer;
+ }
+ .swatches { display: flex; gap: 6px; flex-wrap: wrap; }
+ .swatch {
+ width: 34px;
+ height: 34px;
+ border-radius: 9px;
+ border: 2px solid transparent;
+ cursor: pointer;
+ padding: 0;
+ transition: transform 0.12s ease, border-color 0.15s ease;
+ }
+ .swatch:hover { transform: translateY(-1px); }
+ .swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
+ .swatch[aria-pressed='true'] { border-color: #fff; }
+ .swatch.transparent {
+ background:
+ linear-gradient(45deg, #2a2a2e 25%, transparent 25%, transparent 75%, #2a2a2e 75%),
+ linear-gradient(45deg, #2a2a2e 25%, #18181b 25%, #18181b 75%, #2a2a2e 75%);
+ background-size: 10px 10px;
+ background-position: 0 0, 5px 5px;
+ }
+
+ .snippet-card { position: sticky; top: 20px; }
+ .snippet {
+ position: relative;
+ background: #0a0a0c;
+ border: 1px solid var(--border);
+ border-radius: 12px;
+ padding: 16px;
+ font: 400 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ color: #d4d4d8;
+ overflow-x: auto;
+ white-space: pre;
+ }
+ .snippet .tag { color: #7dd3fc; }
+ .snippet .attr { color: #fbbf24; }
+ .snippet .val { color: #86efac; }
+ .copy-btn {
+ margin-top: 12px;
+ appearance: none;
+ border: 0;
+ border-radius: 10px;
+ background: var(--accent);
+ color: #fff;
+ font: 700 13.5px/1 'Inter', system-ui, sans-serif;
+ padding: 11px 18px;
+ cursor: pointer;
+ transition: filter 0.15s ease, transform 0.1s ease;
+ }
+ .copy-btn:hover { filter: brightness(1.1); }
+ .copy-btn:active { transform: scale(0.97); }
+ .copy-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
+ .snippet-note { font-size: 12px; color: var(--dim); line-height: 1.6; margin-top: 12px; }
+ .snippet-note a { color: var(--ink); }
+
+ .features {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
+ gap: 16px;
+ margin-top: 56px;
+ }
+ .feature h3 { margin: 0 0 6px; font-size: 15px; }
+ .feature p { margin: 0; color: var(--dim); font-size: 13.5px; line-height: 1.6; }
+
+ .docs-link { margin-top: 40px; font-size: 14px; color: var(--dim); }
+ .docs-link a { color: var(--ink); }
+ </style>
+ </head>
+ <body>
+ <main>
+ <section class="hero">
+ <h1>A 3D avatar assistant<br /><span class="accent">on any website.</span></h1>
+ <p class="lede">
+ One script tag adds a floating launcher to your site. Click it and a real,
+ animated 3D avatar pops up — against your page, a color, or a gradient — with
+ two modes: a chatbot that answers questions (free models, or bring your own
+ Groq / OpenRouter key), and a speak mode where the avatar says exactly what you
+ type, out loud, in a speech bubble.
+ </p>
+ <span class="hint">
+ <svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l1.9 6.1L20 10l-6.1 1.9L12 18l-1.9-6.1L4 10l6.1-1.9L12 2z" /></svg>
+ This page runs the real widget — try the launcher in the corner. Your builder choices update it live.
+ </span>
+ </section>
+
+ <div class="builder">
+ <div class="card" id="builder-controls">
+ <h2>Configure</h2>
+
+ <div class="field">
+ <label for="cfg-avatar">Avatar</label>
+ <select id="cfg-avatar">
+ <option value="">Default mannequin</option>
+ <option value="/avatars/selfie-girl.glb">Selfie girl</option>
+ <option value="/avatars/realistic-male.glb">Realistic male</option>
+ <option value="/avatars/realistic-female.glb">Realistic female</option>
+ <option value="/avatars/michelle.glb">Michelle</option>
+ <option value="/avatars/xbot.glb">X Bot</option>
+ <option value="custom">Custom GLB URL…</option>
+ </select>
+ <input type="text" id="cfg-avatar-url" placeholder="https://… .glb (or a three.ws avatar id)" hidden style="margin-top: 8px" />
+ </div>
+
+ <div class="field">
+ <label id="cfg-bg-label">Background</label>
+ <div class="swatches" role="group" aria-labelledby="cfg-bg-label">
+ <button type="button" class="swatch transparent" data-bg="" aria-pressed="true" title="Transparent — avatar floats on your page" aria-label="Transparent background"></button>
+ <button type="button" class="swatch" data-bg="#0a0a0c" style="background:#0a0a0c" title="Solid dark" aria-label="Solid dark background"></button>
+ <button type="button" class="swatch" data-bg="ember" style="background:linear-gradient(160deg,#1a0b05,#7c2d12)" title="Ember gradient" aria-label="Ember gradient background"></button>
+ <button type="button" class="swatch" data-bg="ocean" style="background:linear-gradient(160deg,#020617,#0c4a6e)" title="Ocean gradient" aria-label="Ocean gradient background"></button>
+ <button type="button" class="swatch" data-bg="violet" style="background:linear-gradient(160deg,#0f0518,#5b21b6)" title="Violet gradient" aria-label="Violet gradient background"></button>
+ <button type="button" class="swatch" data-bg="dusk" style="background:linear-gradient(200deg,#0b0714,#9d174d)" title="Dusk gradient" aria-label="Dusk gradient background"></button>
+ <button type="button" class="swatch" data-bg="custom-color" id="cfg-bg-custom" title="Pick a solid color" aria-label="Custom solid color" style="background:conic-gradient(red,yellow,lime,cyan,blue,magenta,red)"></button>
+ </div>
+ <input type="color" id="cfg-bg-color" value="#101820" hidden style="margin-top: 8px" aria-label="Custom background color" />
+ </div>
+
+ <div class="field">
+ <label id="cfg-mode-label">Mode</label>
+ <div class="seg" role="group" aria-labelledby="cfg-mode-label">
+ <button type="button" data-mode="both" aria-pressed="true">Chat + Speak</button>
+ <button type="button" data-mode="chat" aria-pressed="false">Chat only</button>
+ <button type="button" data-mode="speak" aria-pressed="false">Speak only</button>
+ </div>
+ </div>
+
+ <div class="field">
+ <label for="cfg-name">Assistant name</label>
+ <input type="text" id="cfg-name" placeholder="Atelier AI" maxlength="60" />
+ </div>
+
+ <div class="field">
+ <label for="cfg-greeting">Greeting</label>
+ <input type="text" id="cfg-greeting" placeholder="Ask anything about Atelier." maxlength="200" />
+ </div>
+
+ <div class="field">
+ <label for="cfg-context">What should the chatbot know about your site?</label>
+ <textarea id="cfg-context" placeholder="Atelier is a design studio that…" maxlength="500"></textarea>
+ </div>
+
+ <div class="field">
+ <label for="cfg-accent">Accent color</label>
+ <div class="row" style="align-items: center">
+ <input type="color" id="cfg-accent" value="#f97316" style="flex: 0 0 auto" />
+ <span style="font-size: 12px; color: var(--dim)">Launcher button, send button, focus rings.</span>
+ </div>
+ </div>
+
+ <div class="field">
+ <label id="cfg-pos-label">Position</label>
+ <div class="seg" role="group" aria-labelledby="cfg-pos-label">
+ <button type="button" data-pos="right" aria-pressed="true">Bottom right</button>
+ <button type="button" data-pos="left" aria-pressed="false">Bottom left</button>
+ </div>
+ </div>
+ </div>
+
+ <div class="card snippet-card">
+ <h2>Your snippet</h2>
+ <div class="snippet" id="snippet" tabindex="0" aria-label="Embed code"></div>
+ <button type="button" class="copy-btn" id="copy-btn">Copy snippet</button>
+ <p class="snippet-note">
+ Paste it before <code>&lt;/body&gt;</code> on any site. Chat answers come from the
+ free model chain (Groq → OpenRouter → NVIDIA) by default; visitors can switch to
+ their own Groq or OpenRouter key in the widget's settings — keys stay in their
+ browser. Speak mode uses the browser's built-in voices. Full docs:
+ <a href="/docs">/docs</a>.
+ </p>
+ </div>
+ </div>
+
+ <section class="features">
+ <div class="card feature">
+ <h3>Not a render. Not a video.</h3>
+ <p>A real animated 3D character with idle, wave, and talking animations — standing directly on your page when the background is transparent.</p>
+ </div>
+ <div class="card feature">
+ <h3>Chatbot with real brains</h3>
+ <p>Free lane needs no key and no account. Or visitors bring their own Groq / OpenRouter key — it never leaves their browser and never touches your site's code.</p>
+ </div>
+ <div class="card feature">
+ <h3>Speak mode</h3>
+ <p>Type anything and the avatar says it out loud with a speech bubble — browser text-to-speech, pickable voices, zero cost.</p>
+ </div>
+ <div class="card feature">
+ <h3>Any avatar</h3>
+ <p>Use a built-in body, any three.ws avatar id (make one in <a href="/forge" style="color: var(--ink)">Forge</a>), a GLB URL, or an agent's body via <code>data-agent</code>.</p>
+ </div>
+ </section>
+
+ <p class="docs-link">
+ Docs: <a href="/docs">developer docs</a> · Related: <a href="/embed">3D embeds</a> ·
+ <a href="/walk-embed">walking avatar embed</a> · <a href="/widget">creator widgets</a>
+ </p>
+ </main>
+
+ <script type="module" src="/src/assistant-page.js"></script>
+ <script src="/nav.js"></script>
+ </body>
+</html>
diff --git a/pages/concierge.html b/pages/concierge.html
new file mode 100644
index 000000000..f1bb3a6aa
--- /dev/null
+++ b/pages/concierge.html
@@ -0,0 +1,453 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <script>/* three.ws theme boot, no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <title>Concierge, an AI chat widget with a 3D face, for any website · three.ws</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
+ <meta name="author" content="nirholas" />
+ <meta
+ name="description"
+ content="Drop an AI concierge on any website with one tag: a rigged 3D avatar that blinks and lipsyncs, streaming answers grounded in your live page, and browser-native voice in and out. Free, open embed by three.ws."
+ />
+ <meta name="theme-color" content="#000000" />
+
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/concierge" />
+ <meta property="og:title" content="Concierge, an AI chat widget with a 3D face, for any website" />
+ <meta
+ property="og:description"
+ content="One tag gives your site an AI concierge with a talking 3D avatar: streaming answers grounded in your page, voice in and out, themes, and an avatar picker."
+ />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta property="og:locale" content="en_US" />
+
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Concierge, an AI chat widget with a 3D face, for any website" />
+ <meta
+ name="twitter:description"
+ content="One tag gives your site an AI concierge with a talking 3D avatar: streaming answers grounded in your page, voice in and out, themes, and an avatar picker."
+ />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />
+
+ <link rel="canonical" href="https://three.ws/concierge" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/manifest.webmanifest" />
+
+ <link rel="preconnect" href="https://three.ws" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/mobile.css" />
+ <script defer src="/footer-newsletter.js"></script>
+
+ <script type="application/ld+json">
+ {
+ "@context": "https://schema.org",
+ "@type": "SoftwareApplication",
+ "name": "three.ws Concierge",
+ "url": "https://three.ws/concierge",
+ "applicationCategory": "DeveloperApplication",
+ "operatingSystem": "Any (web browser)",
+ "browserRequirements": "Requires a WebGL-capable browser",
+ "description": "An embeddable AI concierge for any website: a rigged 3D avatar that blinks and lipsyncs, streaming answers grounded in the live page, and browser-native voice in and out.",
+ "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
+ "isPartOf": { "@type": "WebSite", "name": "three.ws", "url": "https://three.ws" }
+ }
+ </script>
+
+ <style>
+ /* ────────────────────────────────────────────────────────────────
+ Concierge landing, page-scoped styles. Token vars only; mirrors
+ the marketing rhythm of /walk (eyebrow → display headline → sub
+ → CTAs → proof sections).
+ ──────────────────────────────────────────────────────────────── */
+ .cl-main {
+ max-width: 1080px;
+ margin: 0 auto;
+ padding: 0 var(--space-md);
+ }
+ .cl-hero {
+ padding: calc(var(--space-xl) * 2) 0 var(--space-xl);
+ text-align: center;
+ }
+ .cl-eyebrow {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-2);
+ font-family: var(--font-mono);
+ font-size: var(--text-sm);
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-tertiary);
+ }
+ .cl-hero h1 {
+ font-size: clamp(2rem, 5.5vw, 3.4rem);
+ line-height: 1.08;
+ letter-spacing: -0.02em;
+ margin: var(--space-md) auto var(--space-sm);
+ max-width: 17ch;
+ }
+ .cl-hero .cl-sub {
+ color: var(--text-secondary);
+ font-size: var(--text-lg);
+ max-width: 56ch;
+ margin: 0 auto var(--space-lg);
+ line-height: 1.6;
+ }
+ .cl-ctas {
+ display: flex;
+ gap: var(--space-sm);
+ justify-content: center;
+ flex-wrap: wrap;
+ }
+ .cl-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-2);
+ padding: 0.7rem 1.15rem;
+ border-radius: var(--radius-md);
+ font-weight: 600;
+ font-size: var(--text-base);
+ text-decoration: none;
+ transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
+ }
+ .cl-btn:hover { transform: translateY(-1px); }
+ .cl-btn-primary { background: var(--accent); color: var(--accent-contrast, #fff); }
+ .cl-btn-primary:hover { filter: brightness(1.08); }
+ .cl-btn-ghost { border: 1px solid var(--border-primary); color: var(--text-primary); }
+ .cl-btn-ghost:hover { border-color: var(--accent); }
+
+ .cl-hint {
+ margin-top: var(--space-lg);
+ font-family: var(--font-mono);
+ font-size: var(--text-sm);
+ color: var(--text-tertiary);
+ }
+ .cl-hint .cl-arrow { display: inline-block; animation: cl-nudge 1.6s ease-in-out infinite; }
+ @keyframes cl-nudge { 50% { transform: translate(4px, 4px); } }
+ @media (prefers-reduced-motion: reduce) { .cl-hint .cl-arrow { animation: none; } }
+
+ .cl-section { padding: var(--space-xl) 0; }
+ .cl-section h2 {
+ font-size: clamp(1.4rem, 3vw, 2rem);
+ letter-spacing: -0.01em;
+ margin: 0 0 var(--space-xs);
+ }
+ .cl-section .cl-lede {
+ color: var(--text-secondary);
+ max-width: 62ch;
+ margin: 0 0 var(--space-lg);
+ line-height: 1.65;
+ }
+
+ .cl-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
+ gap: var(--space-md);
+ }
+ .cl-card {
+ border: 1px solid var(--border-primary);
+ border-radius: var(--radius-lg);
+ padding: var(--space-md);
+ background: var(--bg-secondary);
+ transition: border-color 0.2s ease, transform 0.2s ease;
+ }
+ .cl-card:hover { border-color: var(--accent); transform: translateY(-2px); }
+ .cl-card h3 { margin: 0 0 var(--space-2); font-size: var(--text-base); }
+ .cl-card p { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.6; }
+ .cl-card .cl-k {
+ font-family: var(--font-mono);
+ font-size: var(--text-xs);
+ color: var(--text-tertiary);
+ display: block;
+ margin-bottom: var(--space-2);
+ }
+
+ .cl-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-sm); }
+ .cl-tab {
+ font-family: var(--font-mono);
+ font-size: var(--text-sm);
+ padding: 0.4rem 0.85rem;
+ border-radius: 999px;
+ border: 1px solid var(--border-primary);
+ background: none;
+ color: var(--text-secondary);
+ cursor: pointer;
+ transition: border-color 0.15s ease, color 0.15s ease;
+ }
+ .cl-tab:hover { border-color: var(--accent); }
+ .cl-tab[aria-selected='true'] { border-color: var(--accent); color: var(--text-primary); background: var(--bg-secondary); }
+ .cl-code {
+ position: relative;
+ border: 1px solid var(--border-primary);
+ border-radius: var(--radius-lg);
+ background: var(--bg-secondary);
+ overflow: hidden;
+ }
+ .cl-code pre {
+ margin: 0;
+ padding: var(--space-md);
+ overflow-x: auto;
+ font-family: var(--font-mono);
+ font-size: 0.82rem;
+ line-height: 1.6;
+ color: var(--text-primary);
+ }
+ .cl-copy {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ font-family: var(--font-mono);
+ font-size: var(--text-xs);
+ padding: 0.3rem 0.65rem;
+ border-radius: var(--radius-sm);
+ border: 1px solid var(--border-primary);
+ background: var(--bg-primary);
+ color: var(--text-secondary);
+ cursor: pointer;
+ transition: color 0.15s ease, border-color 0.15s ease;
+ }
+ .cl-copy:hover { color: var(--text-primary); border-color: var(--accent); }
+ .cl-panel[hidden] { display: none; }
+
+ .cl-steps { counter-reset: step; display: grid; gap: var(--space-md); }
+ .cl-step { display: flex; gap: var(--space-md); align-items: flex-start; }
+ .cl-step::before {
+ counter-increment: step;
+ content: counter(step, decimal-leading-zero);
+ font-family: var(--font-mono);
+ font-size: var(--text-sm);
+ color: var(--accent);
+ padding-top: 0.15rem;
+ }
+ .cl-step h3 { margin: 0 0 var(--space-1); font-size: var(--text-base); }
+ .cl-step p { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.65; max-width: 68ch; }
+ .cl-step code { font-family: var(--font-mono); font-size: 0.82em; background: var(--bg-secondary); padding: 0.1em 0.4em; border-radius: var(--radius-sm); }
+
+ .cl-links { display: flex; gap: var(--space-md); flex-wrap: wrap; }
+ .cl-links a { color: var(--accent); text-decoration: none; font-size: var(--text-sm); }
+ .cl-links a:hover { text-decoration: underline; }
+ </style>
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cl-main">
+ <section class="cl-hero">
+ <span class="cl-eyebrow">// concierge</span>
+ <h1>An AI concierge with a face, for any website.</h1>
+ <p class="cl-sub">
+ One tag gives your site a support chat that visitors actually enjoy: a rigged 3D avatar that
+ blinks, talks, and lipsyncs; streaming answers grounded in your live page; and voice in and
+ out, straight from the browser. No account, no crawler setup, no per-seat pricing.
+ </p>
+ <div class="cl-ctas">
+ <a class="cl-btn cl-btn-primary" href="#install">Get the embed</a>
+ <a class="cl-btn cl-btn-ghost" href="/docs/concierge">Read the docs</a>
+ <a class="cl-btn cl-btn-ghost" href="https://github.com/nirholas/three.ws/tree/main/concierge-sdk" target="_blank" rel="noopener">Source ↗</a>
+ </div>
+ <p class="cl-hint">This page runs it live, try the bubble in the corner <span class="cl-arrow">↘</span></p>
+ </section>
+
+ <section class="cl-section" aria-labelledby="cl-why">
+ <h2 id="cl-why">Why it beats a faceless chat bubble</h2>
+ <p class="cl-lede">
+ Most site chatbots are a text box with a logo. This one is a presence: the same rigged-avatar
+ engine that powers <a href="/walk">Walk</a> and the
+ <a href="https://www.npmjs.com/package/@three-ws/page-agent" target="_blank" rel="noopener">page guide</a>, pointed at support.
+ </p>
+ <div class="cl-grid">
+ <div class="cl-card">
+ <span class="cl-k">// presence</span>
+ <h3>A real 3D avatar</h3>
+ <p>Skeleton-rigged, blinking, idling, viseme-lipsyncing while it speaks. Visitors pick their concierge from a diverse catalog, or you supply your own GLB.</p>
+ </div>
+ <div class="cl-card">
+ <span class="cl-k">// grounded</span>
+ <h3>Answers from your page</h3>
+ <p>At ask-time it reads the live page (title, headings, nav, content) plus your curated knowledge, and refuses to invent prices or policies it can't see.</p>
+ </div>
+ <div class="cl-card">
+ <span class="cl-k">// streaming</span>
+ <h3>Tokens, not spinners</h3>
+ <p>Answers stream in over SSE and the avatar starts speaking the first sentence while the rest is still arriving.</p>
+ </div>
+ <div class="cl-card">
+ <span class="cl-k">// voice</span>
+ <h3>Talk to it, hear it</h3>
+ <p>Push-to-talk speech input and browser-native speech output, no audio backend and no API key. Mute is one click and remembered.</p>
+ </div>
+ <div class="cl-card">
+ <span class="cl-k">// yours</span>
+ <h3>Your brand, both themes</h3>
+ <p>One accent color restyles the whole widget. Light and dark follow the visitor's system, or pin either. Bottom-left or bottom-right.</p>
+ </div>
+ <div class="cl-card">
+ <span class="cl-k">// free</span>
+ <h3>Free and open</h3>
+ <p>The widget is open source and the hosted answer engine runs on the three.ws free inference chain. Bring your own endpoint any time, same wire format.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="cl-section" id="install" aria-labelledby="cl-install">
+ <h2 id="cl-install">Install in under a minute</h2>
+ <p class="cl-lede">Pick your flavor. Every option ships the same widget.</p>
+ <div class="cl-tabs" role="tablist" aria-label="Install methods">
+ <button class="cl-tab" role="tab" aria-selected="true" data-panel="cdn">one tag</button>
+ <button class="cl-tab" role="tab" aria-selected="false" data-panel="element">web component</button>
+ <button class="cl-tab" role="tab" aria-selected="false" data-panel="npm">npm</button>
+ <button class="cl-tab" role="tab" aria-selected="false" data-panel="js">imperative</button>
+ </div>
+ <div class="cl-panel" data-panel="cdn">
+ <div class="cl-code">
+ <button class="cl-copy" type="button" data-copy>copy</button>
+ <pre><code>&lt;script type="module"
+ src="https://three.ws/concierge/concierge.global.js"
+ data-concierge
+ data-site-name="Acme"
+ data-accent="#f97316"
+ data-suggestions="What is Acme?|What does it cost?"&gt;&lt;/script&gt;</code></pre>
+ </div>
+ </div>
+ <div class="cl-panel" data-panel="element" hidden>
+ <div class="cl-code">
+ <button class="cl-copy" type="button" data-copy>copy</button>
+ <pre><code>import '@three-ws/concierge';
+
+&lt;three-concierge
+ site-name="Acme"
+ accent="#f97316"
+ knowledge="Pro plan is $20/month. Support: [email protected]."
+ suggestions="What is Acme?|What does it cost?"&gt;
+&lt;/three-concierge&gt;</code></pre>
+ </div>
+ </div>
+ <div class="cl-panel" data-panel="npm" hidden>
+ <div class="cl-code">
+ <button class="cl-copy" type="button" data-copy>copy</button>
+ <pre><code>npm install @three-ws/concierge three</code></pre>
+ </div>
+ </div>
+ <div class="cl-panel" data-panel="js" hidden>
+ <div class="cl-code">
+ <button class="cl-copy" type="button" data-copy>copy</button>
+ <pre><code>import { Concierge } from '@three-ws/concierge';
+
+const concierge = new Concierge({
+ siteName: 'Acme',
+ accent: '#f97316',
+ knowledge: FAQ_TEXT, // your curated facts, optional
+ persona: 'warm, playful, concise',
+});
+
+concierge.on('message', ({ role, content }) =&gt; track(role, content));
+concierge.ask('What does the Pro plan cost?');</code></pre>
+ </div>
+ </div>
+ </section>
+
+ <section class="cl-section" aria-labelledby="cl-how">
+ <h2 id="cl-how">How it works</h2>
+ <p class="cl-lede">No crawler, no vector database, no onboarding call. Three moving parts.</p>
+ <div class="cl-steps">
+ <div class="cl-step">
+ <div>
+ <h3>Harvest at ask-time</h3>
+ <p>When a visitor asks something, the widget snapshots the live DOM, title, meta description, headings, nav labels, and the main content, capped to a strict budget, and merges in the <code>knowledge</code> you curated. Whatever your page says today is what the concierge knows today.</p>
+ </div>
+ </div>
+ <div class="cl-step">
+ <div>
+ <h3>Ground and stream</h3>
+ <p>The snapshot, the running conversation, and the question go to <code>/api/concierge</code>, which builds a grounded system prompt and streams the answer back over SSE from the three.ws free-first inference chain, with automatic failover across providers, so the widget stays up when any one lane is throttled.</p>
+ </div>
+ </div>
+ <div class="cl-step">
+ <div>
+ <h3>Speak while streaming</h3>
+ <p>Completed sentences are handed to the browser's speech engine as they arrive, and a text-to-viseme timeline drives the avatar's mouth morphs in sync. Muted? The captions and lipsync still play, so the answer never stalls.</p>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section class="cl-section" aria-labelledby="cl-more">
+ <h2 id="cl-more">Go deeper</h2>
+ <div class="cl-links">
+ <a href="/docs/concierge">Docs: every attribute and event</a>
+ <a href="/docs/tutorials/build-a-site-concierge">Tutorial: how we built it</a>
+ <a href="/blog/concierge-3d-chat-widget">Blog: the launch post</a>
+ <a href="/walk">Walk, the engine it grew from</a>
+ </div>
+ </section>
+ </main>
+
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ <script src="/brand.js" defer></script>
+
+ <script type="module">
+ // Install-tab switcher + copy buttons (no framework, matches site style).
+ const tabs = [...document.querySelectorAll('.cl-tab')];
+ const panels = [...document.querySelectorAll('.cl-panel')];
+ for (const tab of tabs) {
+ tab.addEventListener('click', () => {
+ for (const t of tabs) t.setAttribute('aria-selected', String(t === tab));
+ for (const p of panels) p.hidden = p.dataset.panel !== tab.dataset.panel;
+ });
+ }
+ for (const btn of document.querySelectorAll('[data-copy]')) {
+ btn.addEventListener('click', async () => {
+ const code = btn.parentElement.querySelector('code')?.textContent || '';
+ try {
+ await navigator.clipboard.writeText(code);
+ btn.textContent = 'copied';
+ setTimeout(() => (btn.textContent = 'copy'), 1400);
+ } catch {
+ btn.textContent = 'select + copy';
+ setTimeout(() => (btn.textContent = 'copy'), 1800);
+ }
+ });
+ }
+
+ // The live demo: this page eats its own dog food. The widget answers
+ // questions about Concierge itself, grounded in this page + curated facts.
+ import { Concierge } from '../concierge-sdk/src/index.js';
+ window.__threeWsConcierge = new Concierge({
+ endpoint: '/api/concierge',
+ name: 'three.ws Concierge',
+ siteName: 'three.ws Concierge',
+ greeting: 'Hi! I am the widget this page is about. Ask me anything about installing or customizing me.',
+ suggestions: [
+ 'How do I install you?',
+ 'How do answers stay accurate?',
+ 'Can I use my own avatar?',
+ 'What does it cost?',
+ ],
+ knowledge: [
+ 'three.ws Concierge is a free, open-source embeddable AI chat widget with a rigged 3D avatar (blinks, idles, viseme lipsync), streaming answers, and browser-native voice in/out.',
+ 'Install: one CDN tag (https://three.ws/concierge/concierge.global.js with data-concierge), or npm install @three-ws/concierge (peer dependency: three), or the <three-concierge> web component, or new Concierge({...}) imperatively.',
+ 'Grounding: at ask-time the widget snapshots the live page (title, meta description, headings, nav, main content, capped) plus the host-curated knowledge attribute; the backend builds a grounded system prompt and refuses to invent facts.',
+ 'Backend: POST /api/concierge on three.ws, anonymous, CORS-open, rate-limited, streams SSE {type:chunk|done|error} from a free-first LLM chain with provider failover. Hosts can point the endpoint attribute at their own server using the same wire format.',
+ 'Customization: accent (any CSS color), theme auto/dark/light, position bottom-right/bottom-left, name, greeting, suggestions (pipe-separated), persona tone instruction, avatars allow-list, custom-avatar URL for any rigged GLB, no-picker, no-teaser, muted, z-index, lang.',
+ 'Voice: speech output uses the Web Speech API (no audio backend, no key); push-to-talk input uses SpeechRecognition where the browser supports it (the mic button hides elsewhere).',
+ 'Docs: https://three.ws/docs/concierge. Tutorial: https://three.ws/docs/tutorials/build-a-site-concierge. Source: https://github.com/nirholas/three.ws/tree/main/concierge-sdk. Related: https://three.ws/walk (the Walk companion the avatar engine grew from).',
+ 'Pricing: the widget and the hosted answer engine are free. No account required.',
+ ].join('\n'),
+ persona: 'friendly, precise, a little playful',
+ });
+ </script>
+ </body>
+</html>
diff --git a/public/assistant/v1.js b/public/assistant/v1.js
new file mode 100644
index 000000000..53d3624fc
--- /dev/null
+++ b/public/assistant/v1.js
@@ -0,0 +1,309 @@
+/**
+ * three.ws — assistant widget v1
+ *
+ * A 3D avatar assistant on any website, in one script tag:
+ *
+ * <script src="https://three.ws/assistant/v1.js" async></script>
+ *
+ * Configured entirely via data attributes:
+ *
+ * <script src="https://three.ws/assistant/v1.js" async
+ * data-avatar="selfie-girl" (avatar id or GLB URL)
+ * data-bg="transparent" (transparent | #hex | ember|ocean|violet|forest|dusk|slate | gradient:#a,#b,angle)
+ * data-mode="both" (chat | speak | both)
+ * data-accent="#f97316"
+ * data-name="Atelier AI"
+ * data-greeting="Ask anything about Atelier."
+ * data-context="Atelier is a design studio for ..."
+ * data-position="right" (right | left)
+ * data-open (start open)
+ * ></script>
+ *
+ * Or programmatic:
+ *
+ * ThreeAssistant.init({ avatar: 'selfie-girl', name: 'Atelier AI' });
+ * ThreeAssistant.open(); ThreeAssistant.close(); ThreeAssistant.toggle();
+ * ThreeAssistant.say('Welcome!'); // avatar speaks it out loud
+ * ThreeAssistant.setMode('speak');
+ * ThreeAssistant.destroy();
+ *
+ * The launcher button + panel live on the host page; the avatar, chat, and
+ * speech run inside an iframe on three.ws (/assistant-frame), so the host
+ * page never sees API keys and the frame never sees the host DOM. All config
+ * params are re-validated inside the frame — this loader just forwards them.
+ *
+ * Events (host side): window.addEventListener('three-assistant', (e) => ...)
+ * e.detail = { type: 'ready'|'open'|'close'|'message'|'speak:start'|'speak:end'|'error', payload }
+ */
+
+(function () {
+ 'use strict';
+
+ if (window.__threeWsAssistantV1) return; // idempotent — multiple includes are safe
+ window.__threeWsAssistantV1 = true;
+
+ var ORIGIN = (function () {
+ try {
+ return new URL(document.currentScript.src).origin;
+ } catch (_) {
+ return 'https://three.ws';
+ }
+ })();
+
+ var CHANNEL = 'three-assistant';
+ var PARAM_KEYS = [
+ 'avatar', 'agent', 'bg', 'mode', 'accent', 'name',
+ 'greeting', 'context', 'voice', 'badge', 'targetOrigin',
+ ];
+
+ var Z = 2147483000; // near-max, below common cookie banners' max int
+
+ var instance = null;
+
+ function isHex(v) {
+ return typeof v === 'string' && /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(v);
+ }
+
+ function frameUrl(config) {
+ var params = new URLSearchParams();
+ for (var i = 0; i < PARAM_KEYS.length; i++) {
+ var key = PARAM_KEYS[i];
+ var value = config[key];
+ if (value === undefined || value === null || value === '') continue;
+ params.set(key, typeof value === 'boolean' ? String(value) : String(value));
+ }
+ // Pin outbound frame messages to this page unless the caller overrode it.
+ if (!params.has('targetOrigin')) params.set('targetOrigin', location.origin);
+ var qs = params.toString();
+ return ORIGIN + '/assistant-frame' + (qs ? '?' + qs : '');
+ }
+
+ function emit(type, payload) {
+ try {
+ window.dispatchEvent(new CustomEvent(CHANNEL, { detail: { type: type, payload: payload || {} } }));
+ } catch (_) {}
+ }
+
+ // ── Styles (injected once) ─────────────────────────────────────────────
+ function injectStyles(accent) {
+ if (document.getElementById('three-assistant-style')) return;
+ var css = ''
+ + '.three-assistant-launcher{position:fixed;bottom:20px;width:56px;height:56px;'
+ + 'border-radius:50%;border:0;cursor:pointer;z-index:' + Z + ';'
+ + 'background:' + accent + ';color:#fff;display:flex;align-items:center;justify-content:center;'
+ + 'box-shadow:0 6px 24px rgba(0,0,0,.32),0 2px 6px rgba(0,0,0,.24);padding:0;'
+ + 'transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;}'
+ + '.three-assistant-launcher:hover{transform:translateY(-2px);filter:brightness(1.08);'
+ + 'box-shadow:0 10px 30px rgba(0,0,0,.38),0 3px 8px rgba(0,0,0,.26);}'
+ + '.three-assistant-launcher:active{transform:scale(.94);}'
+ + '.three-assistant-launcher:focus-visible{outline:3px solid #fff;outline-offset:2px;}'
+ + '.three-assistant-launcher svg{width:24px;height:24px;transition:transform .22s ease,opacity .18s ease;position:absolute;}'
+ + '.three-assistant-launcher .ta-icon-close{opacity:0;transform:rotate(-45deg) scale(.6);}'
+ + '.three-assistant-launcher[data-open="true"] .ta-icon-spark{opacity:0;transform:rotate(45deg) scale(.6);}'
+ + '.three-assistant-launcher[data-open="true"] .ta-icon-close{opacity:1;transform:rotate(0) scale(1);}'
+ + '.three-assistant-panel{position:fixed;bottom:90px;width:380px;max-width:calc(100vw - 24px);'
+ + 'height:640px;max-height:calc(100dvh - 110px);z-index:' + Z + ';'
+ + 'border-radius:20px;overflow:hidden;'
+ + 'opacity:0;transform:translateY(14px) scale(.98);pointer-events:none;'
+ + 'transition:opacity .22s ease,transform .22s ease;transform-origin:bottom right;}'
+ + '.three-assistant-panel[data-pos="left"]{transform-origin:bottom left;}'
+ + '.three-assistant-panel[data-open="true"]{opacity:1;transform:translateY(0) scale(1);pointer-events:auto;}'
+ + '.three-assistant-panel[data-chrome="solid"]{background:#0a0a0c;'
+ + 'border:1px solid rgba(255,255,255,.1);box-shadow:0 24px 64px rgba(0,0,0,.5);}'
+ + '.three-assistant-panel iframe{width:100%;height:100%;border:0;display:block;background:transparent;color-scheme:normal;}'
+ + '@media (max-width:480px){.three-assistant-panel{width:calc(100vw - 24px);height:calc(100dvh - 110px);}}'
+ + '@media (prefers-reduced-motion:reduce){.three-assistant-launcher,.three-assistant-panel,'
+ + '.three-assistant-launcher svg{transition:none;}}';
+ var style = document.createElement('style');
+ style.id = 'three-assistant-style';
+ style.textContent = css;
+ document.head.appendChild(style);
+ }
+
+ var SPARK_SVG =
+ '<svg class="ta-icon-spark" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">'
+ + '<path d="M12 2l1.9 6.1L20 10l-6.1 1.9L12 18l-1.9-6.1L4 10l6.1-1.9L12 2z"/>'
+ + '<path d="M19 15l.9 2.6 2.6.9-2.6.9L19 22l-.9-2.6-2.6-.9 2.6-.9L19 15z" opacity=".7"/></svg>';
+ var CLOSE_SVG =
+ '<svg class="ta-icon-close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" '
+ + 'stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18M6 6l12 12"/></svg>';
+
+ // ── Instance ───────────────────────────────────────────────────────────
+ function Assistant(config) {
+ this.config = config;
+ this.isOpen = false;
+ this._queuedSays = [];
+ this._ready = false;
+
+ var accent = isHex(config.accent) ? config.accent : '#f97316';
+ var pos = config.position === 'left' ? 'left' : 'right';
+ injectStyles(accent);
+
+ var launcher = document.createElement('button');
+ launcher.type = 'button';
+ launcher.className = 'three-assistant-launcher';
+ launcher.style[pos] = '20px';
+ launcher.dataset.open = 'false';
+ launcher.setAttribute('aria-label', 'Open ' + (config.name || 'assistant'));
+ launcher.setAttribute('aria-expanded', 'false');
+ launcher.setAttribute('aria-haspopup', 'dialog');
+ launcher.innerHTML = SPARK_SVG + CLOSE_SVG;
+
+ var panel = document.createElement('div');
+ panel.className = 'three-assistant-panel';
+ panel.style[pos] = '12px';
+ panel.dataset.open = 'false';
+ panel.dataset.pos = pos;
+ // Transparent background → the avatar floats straight over the page;
+ // any solid/gradient bg gets a real panel chrome around the frame.
+ var bg = String(config.bg == null ? '' : config.bg).toLowerCase();
+ panel.dataset.chrome = !bg || bg === 'transparent' ? 'clear' : 'solid';
+ panel.setAttribute('role', 'dialog');
+ panel.setAttribute('aria-label', config.name || 'Assistant');
+
+ var iframe = document.createElement('iframe');
+ iframe.title = (config.name || 'Assistant') + ' — 3D avatar assistant';
+ iframe.allow = 'autoplay';
+ iframe.setAttribute('allowtransparency', 'true');
+ iframe.loading = 'lazy';
+ iframe.src = frameUrl(config);
+ panel.appendChild(iframe);
+
+ var self = this;
+ launcher.addEventListener('click', function () {
+ self.toggle();
+ });
+
+ this._onMessage = function (event) {
+ if (event.origin !== ORIGIN) return;
+ if (event.source !== iframe.contentWindow) return;
+ var msg = event.data;
+ if (!msg || typeof msg !== 'object' || msg.channel !== CHANNEL) return;
+ if (msg.type === 'close') {
+ self.close();
+ return;
+ }
+ if (msg.type === 'ready') {
+ self._ready = true;
+ for (var i = 0; i < self._queuedSays.length; i++) self._post('say', self._queuedSays[i]);
+ self._queuedSays.length = 0;
+ }
+ emit(msg.type, msg.payload);
+ };
+ window.addEventListener('message', this._onMessage);
+
+ this._onKeydown = function (e) {
+ if (e.key === 'Escape' && self.isOpen) self.close();
+ };
+ window.addEventListener('keydown', this._onKeydown);
+
+ this.launcher = launcher;
+ this.panel = panel;
+ this.iframe = iframe;
+
+ document.body.appendChild(panel);
+ document.body.appendChild(launcher);
+
+ if (config.open) this.open();
+ }
+
+ Assistant.prototype._post = function (type, payload) {
+ try {
+ this.iframe.contentWindow.postMessage(
+ { channel: CHANNEL, v: 1, type: type, payload: payload || {} },
+ ORIGIN,
+ );
+ } catch (_) {}
+ };
+
+ Assistant.prototype.open = function () {
+ if (this.isOpen) return;
+ this.isOpen = true;
+ this.panel.dataset.open = 'true';
+ this.launcher.dataset.open = 'true';
+ this.launcher.setAttribute('aria-expanded', 'true');
+ this.launcher.setAttribute('aria-label', 'Close ' + (this.config.name || 'assistant'));
+ var iframe = this.iframe;
+ setTimeout(function () {
+ try {
+ iframe.focus();
+ } catch (_) {}
+ }, 240);
+ emit('open', {});
+ };
+
+ Assistant.prototype.close = function () {
+ if (!this.isOpen) return;
+ this.isOpen = false;
+ this.panel.dataset.open = 'false';
+ this.launcher.dataset.open = 'false';
+ this.launcher.setAttribute('aria-expanded', 'false');
+ this.launcher.setAttribute('aria-label', 'Open ' + (this.config.name || 'assistant'));
+ try {
+ this.launcher.focus();
+ } catch (_) {}
+ emit('close', {});
+ };
+
+ Assistant.prototype.toggle = function () {
+ if (this.isOpen) this.close();
+ else this.open();
+ };
+
+ Assistant.prototype.say = function (text) {
+ text = String(text == null ? '' : text).slice(0, 600);
+ if (!text) return;
+ this.open();
+ if (this._ready) this._post('say', { text: text });
+ else this._queuedSays.push({ text: text });
+ };
+
+ Assistant.prototype.setMode = function (mode) {
+ this._post('setMode', { mode: mode });
+ };
+
+ Assistant.prototype.destroy = function () {
+ window.removeEventListener('message', this._onMessage);
+ window.removeEventListener('keydown', this._onKeydown);
+ this.panel.remove();
+ this.launcher.remove();
+ if (instance === this) instance = null;
+ };
+
+ // ── Public API ─────────────────────────────────────────────────────────
+ var api = {
+ version: '1.0.0',
+ origin: ORIGIN,
+ init: function (config) {
+ if (instance) instance.destroy();
+ instance = new Assistant(config || {});
+ return instance;
+ },
+ open: function () { if (instance) instance.open(); },
+ close: function () { if (instance) instance.close(); },
+ toggle: function () { if (instance) instance.toggle(); },
+ say: function (text) { if (instance) instance.say(text); },
+ setMode: function (mode) { if (instance) instance.setMode(mode); },
+ destroy: function () { if (instance) instance.destroy(); },
+ get instance() { return instance; },
+ };
+ window.ThreeAssistant = api;
+
+ // ── Script-tag auto-mount ──────────────────────────────────────────────
+ (function autoMount() {
+ var s = document.currentScript;
+ if (!s) return;
+ if (s.hasAttribute('data-manual')) return; // opt out: call ThreeAssistant.init() yourself
+ var config = {};
+ for (var i = 0; i < PARAM_KEYS.length; i++) {
+ var v = s.getAttribute('data-' + PARAM_KEYS[i].toLowerCase());
+ if (v !== null) config[PARAM_KEYS[i]] = v;
+ }
+ var position = s.getAttribute('data-position');
+ if (position) config.position = position;
+ if (s.hasAttribute('data-open')) config.open = true;
+ var boot = function () { api.init(config); };
+ if (document.body) boot();
+ else document.addEventListener('DOMContentLoaded', boot);
+ })();
+})();
diff --git a/public/changelog.json b/public/changelog.json
index 53d2cb71e..8ebfb72f4 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,11 +1,31 @@
{
- "generated_at": "2026-07-18T21:09:18.386Z",
+ "generated_at": "2026-07-18T22:36:12.074Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
"url": "https://three.ws"
},
"entries": [
+ {
+ "date": "2026-07-18",
+ "type": "launch",
+ "title": "Concierge: AI Chat Widget",
+ "summary": "Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.",
+ "link": "/concierge",
+ "tags": [
+ "launch"
+ ]
+ },
+ {
+ "date": "2026-07-18",
+ "type": "launch",
+ "title": "Concierge: We Gave the Site Chatbot a Face",
+ "summary": "Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.",
+ "link": "/blog/concierge-3d-chat-widget",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-07-18",
"type": "launch",
@@ -407,6 +427,16 @@
"improvement"
]
},
+ {
+ "date": "2026-07-18",
+ "type": "update",
+ "title": "New: a 3D avatar assistant widget for any website",
+ "summary": "One script tag now puts a three.ws avatar on any site as a floating assistant. Click the launcher and a real animated 3D character pops up, standing directly on the page (transparent), or against a color or gradient you pick. It has two modes: a chatbot that answers visitors' questions using the free model chain, with the option to bring your own Groq or OpenRouter key that never leaves the browser, and a speak mode where the avatar says exactly what you type, out loud, with a speech bubble. Configure everything and copy your snippet at three.ws/assistant.",
+ "link": "/assistant",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-07-18",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 86c0b3b2a..fa4651c9a 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -6,6 +6,22 @@
<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/>
<description>What's new on three.ws — features, improvements, and releases, newest first.</description>
<language>en</language>
+ <item>
+ <title>Concierge: AI Chat Widget</title>
+ <link>https://three.ws/concierge</link>
+ <guid isPermaLink="false">2026-07-18:Concierge: AI Chat Widget</guid>
+ <pubDate>Sat, 18 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.</description>
+ </item>
+ <item>
+ <title>Concierge: We Gave the Site Chatbot a Face</title>
+ <link>https://three.ws/blog/concierge-3d-chat-widget</link>
+ <guid isPermaLink="false">2026-07-18:Concierge: We Gave the Site Chatbot a Face</guid>
+ <pubDate>Sat, 18 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.</description>
+ </item>
<item>
<title>Docs · Agent Galaxy</title>
<link>https://three.ws/docs/galaxy</link>
@@ -326,6 +342,14 @@
<category>fix</category>
<description>The vision endpoint (used to describe and check 3D renders and avatars) now fetches your image itself and hands it straight to the free model, instead of asking the model's server to go fetch the link. Some image hosts block that server-side fetch, which used to push the request onto a paid fallback and, when that fallback was unavailable, fail outright. Now the free lane serves the request regardless of how the image is hosted, so describe/critique calls stop returning errors on perfectly good images.</description>
</item>
+ <item>
+ <title>New: a 3D avatar assistant widget for any website</title>
+ <link>https://three.ws/assistant</link>
+ <guid isPermaLink="false">2026-07-18:New: a 3D avatar assistant widget for any website</guid>
+ <pubDate>Sat, 18 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>One script tag now puts a three.ws avatar on any site as a floating assistant. Click the launcher and a real animated 3D character pops up, standing directly on the page (transparent), or against a color or gradient you pick. It has two modes: a chatbot that answers visitors' questions using the free model chain, with the option to bring your own Groq or OpenRouter key that never leaves the browser, and a speak mode where the avatar says exactly what you type, out loud, with a speech bubble. Configure everything and copy your snippet at three.ws/assistant.</description>
+ </item>
<item>
<title>On-chain reads stay smooth when a data provider hits its daily cap</title>
<link>https://three.ws/changelog</link>
diff --git a/public/concierge/concierge.global.js b/public/concierge/concierge.global.js
new file mode 100644
index 000000000..1ff7aa641
--- /dev/null
+++ b/public/concierge/concierge.global.js
@@ -0,0 +1,4337 @@
+/* @three-ws/concierge, https://three.ws/concierge */
+var ff=Object.defineProperty;var pf=(s,e,t)=>()=>{if(t)throw t[0];try{return s&&(e=s(s=0)),e}catch(n){throw t=[n],n}};var Lh=(s,e)=>{for(var t in e)ff(s,t,{get:e[t],enumerable:!0})};var Hd={};Lh(Hd,{MeshoptDecoder:()=>_x});var _x,Wd=pf(()=>{_x=(function(){var s="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssss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aa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?o(e):o(s),r,a=WebAssembly.instantiate(i,{}).then(function(p){r=p.instance,r.exports.__wasm_call_ctors()});function o(p){for(var v=new Uint8Array(p.length),S=0;S<p.length;++S){var M=p.charCodeAt(S);v[S]=M>96?M-97:M>64?M-39:M+4}for(var E=0,S=0;S<p.length;++S)v[E++]=v[S]<60?n[v[S]]:(v[S]-60)*64+v[++S];return v.buffer.slice(0,E)}function c(p,v,S,M,E,T,C){var x=p.exports.sbrk,w=M+3&-4,L=x(w*E),R=x(T.length),O=new Uint8Array(p.exports.memory.buffer);O.set(T,R);var H=v(L,M,E,R,T.length);if(H==0&&C&&C(L,w,E),S.set(O.subarray(L,L+M*E)),x(L-x(0)),H!=0)throw new Error("Malformed buffer data: "+H)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(p){var v={object:new Worker(p),pending:0,requests:{}};return v.object.onmessage=function(S){var M=S.data;v.pending-=M.count,v.requests[M.id][M.action](M.value),delete v.requests[M.id]},v}function g(p){for(var v="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(i)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+m.name+";"+c.toString()+m.toString(),S=new Blob([v],{type:"text/javascript"}),M=URL.createObjectURL(S),E=u.length;E<p;++E)u[E]=f(M);for(var E=p;E<u.length;++E)u[E].object.postMessage({});u.length=p,URL.revokeObjectURL(M)}function _(p,v,S,M,E){for(var T=u[0],C=1;C<u.length;++C)u[C].pending<T.pending&&(T=u[C]);return new Promise(function(x,w){var L=new Uint8Array(S),R=++d;T.pending+=p,T.requests[R]={resolve:x,reject:w},T.object.postMessage({id:R,count:p,size:v,source:L,mode:M,filter:E},[L.buffer])})}function m(p){var v=p.data;self.ready.then(function(S){if(!v.id)return self.close();try{var M=new Uint8Array(v.count*v.size);c(S,S.exports[v.mode],M,v.count,v.size,v.source,S.exports[v.filter]),self.postMessage({id:v.id,count:v.count,action:"resolve",value:M},[M.buffer])}catch(E){self.postMessage({id:v.id,count:v.count,action:"reject",value:E})}})}return{ready:a,supported:!0,useWorkers:function(p){g(p)},decodeVertexBuffer:function(p,v,S,M,E){c(r,r.exports.meshopt_decodeVertexBuffer,p,v,S,M,r.exports[l[E]])},decodeIndexBuffer:function(p,v,S,M){c(r,r.exports.meshopt_decodeIndexBuffer,p,v,S,M)},decodeIndexSequence:function(p,v,S,M){c(r,r.exports.meshopt_decodeIndexSequence,p,v,S,M)},decodeGltfBuffer:function(p,v,S,M,E,T){c(r,r.exports[h[E]],p,v,S,M,r.exports[l[T]])},decodeGltfBufferAsync:function(p,v,S,M,E){return u.length>0?_(p,v,S,h[M],l[E]):a.then(function(){var T=new Uint8Array(p*v);return c(r,r.exports[h[M]],T,p,v,S,r.exports[l[E]]),T})}}})()});var Sh={};Lh(Sh,{AVATARS:()=>qi,AvatarStage:()=>Ns,CSS:()=>yh,Concierge:()=>an,DEFAULT_ASSET_BASE:()=>zr,DEFAULT_AVATAR_ID:()=>ks,DEFAULT_ENDPOINT:()=>Hr,MAX_CONTENT_CHARS:()=>Kd,MAX_HISTORY_TURNS:()=>sc,MAX_KNOWLEDGE_CHARS:()=>Jd,SpeechNarrator:()=>Os,ThreeConciergeElement:()=>qr,VERSION:()=>Ex,askConcierge:()=>rc,avatarUrl:()=>Vr,buildMorphMap:()=>ec,buildSitePayload:()=>ic,createLipsync:()=>tc,createMic:()=>oc,createSseBuffer:()=>_h,customAvatarEntry:()=>nc,default:()=>Cx,drainSentences:()=>Mh,ensureStyles:()=>cc,escapeHtml:()=>Xi,estimateDurationMs:()=>Br,getAvatar:()=>Gr,harvestSiteContext:()=>bh,micSupported:()=>ac,mount:()=>Rx,parseSseEvent:()=>xh,registerElement:()=>dc,renderMarkdown:()=>Bs,stripMarkdown:()=>Wr});var mu=0,Zc=1,gu=2;var Mr=1,bu=2,As=3,pn=0,Pt=1,sn=2,Dn=0,Ri=1,$c=2,Qc=3,el=4,xu=5;var ci=100,_u=101,vu=102,yu=103,Mu=104,Su=200,Au=201,Tu=202,wu=203,ya=204,Ma=205,Eu=206,Ru=207,Cu=208,Pu=209,Iu=210,Lu=211,Du=212,Fu=213,Nu=214,Sa=0,Aa=1,Ta=2,Ci=3,wa=4,Ea=5,Ra=6,Ca=7,$a=0,Uu=1,Ou=2,bn=0,tl=1,nl=2,il=3,Sr=4,sl=5,rl=6,al=7,Gc="attached",ku="detached",ol=300,pi=301,zi=302,Qa=303,eo=304,Ar=306,li=1e3,nn=1001,hs=1002,xt=1003,to=1004;var Gi=1005;var _t=1006,Ts=1007;var xn=1008;var qt=1009,cl=1010,ll=1011,ws=1012,no=1013,_n=1014,$t=1015,Fn=1016,io=1017,so=1018,Es=1020,hl=35902,ul=35899,dl=1021,fl=1022,Qt=1023,Tn=1026,mi=1027,ro=1028,ao=1029,gi=1030,oo=1031;var co=1033,Tr=33776,wr=33777,Er=33778,Rr=33779,lo=35840,ho=35841,uo=35842,fo=35843,po=36196,mo=37492,go=37496,bo=37488,xo=37489,Cr=37490,_o=37491,vo=37808,yo=37809,Mo=37810,So=37811,Ao=37812,To=37813,wo=37814,Eo=37815,Ro=37816,Co=37817,Po=37818,Io=37819,Lo=37820,Do=37821,Fo=36492,No=36494,Uo=36495,Oo=36283,ko=36284,Pr=36285,Bo=36286,Bu=2200,Ir=2201,zu=2202,Pi=2300,Ii=2301,va=2302,Vc=2303,wi=2400,Ei=2401,Ys=2402,zo=2500,Gu=2501,pl=0,Lr=1,Rs=2,Vu=3200;var Dr=0,Hu=1,Zn="",bt="srgb",kt="srgb-linear",Zs="linear",Je="srgb";var Ti=7680;var Hc=519,Wu=512,qu=513,Xu=514,Go=515,ju=516,Ku=517,Vo=518,Ju=519,Pa=35044;var ml="300 es",un=2e3,us=2001;function mf(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function gf(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function ds(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Yu(){let s=ds("canvas");return s.style.display="block",s}var Dh={},fs=null;function $s(...s){let e="THREE."+s.shift();fs?fs("log",e,...s):console.log(e,...s)}function Zu(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function _e(...s){s=Zu(s);let e="THREE."+s.shift();if(fs)fs("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function we(...s){s=Zu(s);let e="THREE."+s.shift();if(fs)fs("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function Ia(...s){let e=s.join(" ");e in Dh||(Dh[e]=!0,_e(...s))}function $u(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Qu={[Sa]:Aa,[Ta]:Ra,[wa]:Ca,[Ci]:Ea,[Aa]:Sa,[Ra]:Ta,[Ca]:wa,[Ea]:Ci},mn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}},Lt=["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"],Fh=1234567,Ks=Math.PI/180,Li=180/Math.PI;function fn(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Lt[s&255]+Lt[s>>8&255]+Lt[s>>16&255]+Lt[s>>24&255]+"-"+Lt[e&255]+Lt[e>>8&255]+"-"+Lt[e>>16&15|64]+Lt[e>>24&255]+"-"+Lt[t&63|128]+Lt[t>>8&255]+"-"+Lt[t>>16&255]+Lt[t>>24&255]+Lt[n&255]+Lt[n>>8&255]+Lt[n>>16&255]+Lt[n>>24&255]).toLowerCase()}function Ve(s,e,t){return Math.max(e,Math.min(t,s))}function gl(s,e){return(s%e+e)%e}function bf(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function xf(s,e,t){return s!==e?(t-s)/(e-s):0}function Js(s,e,t){return(1-t)*s+t*e}function _f(s,e,t,n){return Js(s,e,1-Math.exp(-t*n))}function vf(s,e=1){return e-Math.abs(gl(s,e*2)-e)}function yf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Mf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Sf(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Af(s,e){return s+Math.random()*(e-s)}function Tf(s){return s*(.5-Math.random())}function wf(s){s!==void 0&&(Fh=s);let e=Fh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ef(s){return s*Ks}function Rf(s){return s*Li}function Cf(s){return(s&s-1)===0&&s!==0}function Pf(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function If(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Lf(s,e,t,n,i){let r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),f=r((n-e)/2),g=a((n-e)/2);switch(i){case"XYX":s.set(o*h,c*u,c*d,o*l);break;case"YZY":s.set(c*d,o*h,c*u,o*l);break;case"ZXZ":s.set(c*u,c*d,o*h,o*l);break;case"XZX":s.set(o*h,c*g,c*f,o*l);break;case"YXY":s.set(c*f,o*h,c*g,o*l);break;case"ZYZ":s.set(c*g,c*f,o*h,o*l);break;default:_e("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function hn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function Ye(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}var Fr={DEG2RAD:Ks,RAD2DEG:Li,generateUUID:fn,clamp:Ve,euclideanModulo:gl,mapLinear:bf,inverseLerp:xf,lerp:Js,damp:_f,pingpong:vf,smoothstep:yf,smootherstep:Mf,randInt:Sf,randFloat:Af,randFloatSpread:Tf,seededRandom:wf,degToRad:Ef,radToDeg:Rf,isPowerOfTwo:Cf,ceilPowerOfTwo:Pf,floorPowerOfTwo:If,setQuaternionFromProperEuler:Lf,normalize:Ye,denormalize:hn},yl=class yl{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,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}};yl.prototype.isVector2=!0;var He=yl,Ft=class{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,o){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],d=r[a+0],f=r[a+1],g=r[a+2],_=r[a+3];if(u!==_||c!==d||l!==f||h!==g){let m=c*d+l*f+h*g+u*_;m<0&&(d=-d,f=-f,g=-g,_=-_,m=-m);let p=1-o;if(m<.9995){let v=Math.acos(m),S=Math.sin(v);p=Math.sin(p*v)/S,o=Math.sin(o*v)/S,c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+_*o}else{c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+_*o;let v=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=v,l*=v,h*=v,u*=v}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){let o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a],d=r[a+1],f=r[a+2],g=r[a+3];return e[t]=o*g+h*u+c*f-l*d,e[t+1]=c*g+h*d+l*u-o*f,e[t+2]=l*g+h*f+o*d-c*u,e[t+3]=h*g-o*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(r/2),d=c(n/2),f=c(i/2),g=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"YXZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"ZXY":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"ZYX":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"YZX":this._x=d*h*u+l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u-d*f*g;break;case"XZY":this._x=d*h*u-l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u+d*f*g;break;default:_e("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&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],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(a-i)*f}else if(n>o&&n>u){let f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>u){let f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+h)/f}else{let f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(r+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ve(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+i*l-r*c,this._y=i*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,r=-r,a=-a,o=-o);let c=1-t;if(o<.9995){let l=Math.acos(o),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+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}},Ml=class Ml{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Nh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nh.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,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+c*l+a*u-o*h,this.y=n+c*h+o*l-r*u,this.z=i+c*u+r*h-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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return mc.copy(this).projectOnVector(e),this.sub(mc)}reflect(e){return this.sub(mc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Ml.prototype.isVector3=!0;var F=Ml,mc=new F,Nh=new Ft,Sl=class Sl{constructor(e,t,n,i,r,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[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],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],g=n[8],_=i[0],m=i[3],p=i[6],v=i[1],S=i[4],M=i[7],E=i[2],T=i[5],C=i[8];return r[0]=a*_+o*v+c*E,r[3]=a*m+o*S+c*T,r[6]=a*p+o*M+c*C,r[1]=l*_+h*v+u*E,r[4]=l*m+h*S+u*T,r[7]=l*p+h*M+u*C,r[2]=d*_+f*v+g*E,r[5]=d*m+f*S+g*T,r[8]=d*p+f*M+g*C,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],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,f=l*r-a*c,g=t*u+n*d+i*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/g;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*c)*_,e[5]=(i*r-o*t)*_,e[6]=f*_,e[7]=(n*c-l*t)*_,e[8]=(a*t-n*r)*_,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,o){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(gc.makeScale(e,t)),this}rotate(e){return this.premultiply(gc.makeRotation(-e)),this}translate(e,t){return this.premultiply(gc.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 i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Sl.prototype.isMatrix3=!0;var Pe=Sl,gc=new Pe,Uh=new Pe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Oh=new Pe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Df(){let s={enabled:!0,workingColorSpace:kt,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Je&&(i.r=Xn(i.r),i.g=Xn(i.g),i.b=Xn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Je&&(i.r=ls(i.r),i.g=ls(i.g),i.b=ls(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Zn?Zs:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Ia("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Ia("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[kt]:{primaries:e,whitePoint:n,transfer:Zs,toXYZ:Uh,fromXYZ:Oh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:bt},outputColorSpaceConfig:{drawingBufferColorSpace:bt}},[bt]:{primaries:e,whitePoint:n,transfer:Je,toXYZ:Uh,fromXYZ:Oh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:bt}}}),s}var Be=Df();function Xn(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function ls(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Ji,La=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ji===void 0&&(Ji=ds("canvas")),Ji.width=e.width,Ji.height=e.height;let i=Ji.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=ds("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 a=0;a<r.length;a++)r[a]=Xn(r[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Xn(t[n]/255)*255):t[n]=Xn(t[n]);return{data:t,width:e.width,height:e.height}}else return _e("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Ff=0,ps=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ff++}),this.uuid=fn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(bc(i[a].image)):r.push(bc(i[a]))}else r=bc(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function bc(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?La.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(_e("Texture: Unable to serialize Texture."),{})}var Nf=0,xc=new F,Ct=class s extends mn{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=nn,i=nn,r=_t,a=xn,o=Qt,c=qt,l=s.DEFAULT_ANISOTROPY,h=Zn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nf++}),this.uuid=fn(),this.name="",this.source=new ps(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=o,this.internalFormat=null,this.type=c,this.offset=new He(0,0),this.repeat=new He(1,1),this.center=new He(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,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,this.normalized=!1}get width(){return this.source.getSize(xc).x}get height(){return this.source.getSize(xc).y}get depth(){return this.source.getSize(xc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){_e(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`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=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ol)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case li:e.x=e.x-Math.floor(e.x);break;case nn:e.x=e.x<0?0:1;break;case hs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case li:e.y=e.y-Math.floor(e.y);break;case nn:e.y=e.y<0?0:1;break;case hs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=ol;Ct.DEFAULT_ANISOTROPY=1;var Al=class Al{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){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,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],g=c[9],_=c[2],m=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let S=(l+1)/2,M=(f+1)/2,E=(p+1)/2,T=(h+d)/4,C=(u+_)/4,x=(g+m)/4;return S>M&&S>E?S<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(S),i=T/n,r=C/n):M>E?M<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(M),n=T/i,r=x/i):E<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(E),n=C/r,i=x/r),this.set(n,i,r,t),this}let v=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(m-g)/v,this.y=(u-_)/v,this.z=(d-h)/v,this.w=Math.acos((l+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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}};Al.prototype.isVector4=!0;var nt=Al,Da=class extends mn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_t,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 nt(0,0,e,t),this.scissorTest=!1,this.viewport=new nt(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new Ct(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:_t,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let 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,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ps(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}},Yt=class extends Da{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Qs=class extends Ct{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=xt,this.minFilter=xt,this.wrapR=nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var Fa=class extends Ct{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=xt,this.minFilter=xt,this.wrapR=nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Za=class Za{constructor(e,t,n,i,r,a,o,c,l,h,u,d,f,g,_,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l,h,u,d,f,g,_,m)}set(e,t,n,i,r,a,o,c,l,h,u,d,f,g,_,m){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=g,p[11]=_,p[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 Za().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Yi.setFromMatrixColumn(e,0).length(),r=1/Yi.setFromMatrixColumn(e,1).length(),a=1/Yi.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),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=a*h,f=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+g*l,t[5]=d-_*l,t[9]=-o*c,t[2]=_-d*l,t[6]=g+f*l,t[10]=a*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,g=l*h,_=l*u;t[0]=d+_*o,t[4]=g*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-g,t[6]=_+d*o,t[10]=a*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,g=l*h,_=l*u;t[0]=d-_*o,t[4]=-a*u,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){let d=a*h,f=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=g*l-f,t[8]=d*l+_,t[1]=c*u,t[5]=_*l+d,t[9]=f*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){let d=a*c,f=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=_-d*u,t[8]=g*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+g,t[10]=d-_*u}else if(e.order==="XZY"){let d=a*c,f=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+_,t[5]=a*h,t[9]=f*u-g,t[2]=g*u-f,t[6]=o*h,t[10]=_*u+d}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(Uf,e,Of)}lookAt(e,t,n){let i=this.elements;return Kt.subVectors(e,t),Kt.lengthSq()===0&&(Kt.z=1),Kt.normalize(),ti.crossVectors(n,Kt),ti.lengthSq()===0&&(Math.abs(n.z)===1?Kt.x+=1e-4:Kt.z+=1e-4,Kt.normalize(),ti.crossVectors(n,Kt)),ti.normalize(),Kr.crossVectors(Kt,ti),i[0]=ti.x,i[4]=Kr.x,i[8]=Kt.x,i[1]=ti.y,i[5]=Kr.y,i[9]=Kt.y,i[2]=ti.z,i[6]=Kr.z,i[10]=Kt.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],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],g=n[2],_=n[6],m=n[10],p=n[14],v=n[3],S=n[7],M=n[11],E=n[15],T=i[0],C=i[4],x=i[8],w=i[12],L=i[1],R=i[5],O=i[9],H=i[13],q=i[2],N=i[6],z=i[10],V=i[14],$=i[3],Q=i[7],le=i[11],xe=i[15];return r[0]=a*T+o*L+c*q+l*$,r[4]=a*C+o*R+c*N+l*Q,r[8]=a*x+o*O+c*z+l*le,r[12]=a*w+o*H+c*V+l*xe,r[1]=h*T+u*L+d*q+f*$,r[5]=h*C+u*R+d*N+f*Q,r[9]=h*x+u*O+d*z+f*le,r[13]=h*w+u*H+d*V+f*xe,r[2]=g*T+_*L+m*q+p*$,r[6]=g*C+_*R+m*N+p*Q,r[10]=g*x+_*O+m*z+p*le,r[14]=g*w+_*H+m*V+p*xe,r[3]=v*T+S*L+M*q+E*$,r[7]=v*C+S*R+M*N+E*Q,r[11]=v*x+S*O+M*z+E*le,r[15]=v*w+S*H+M*V+E*xe,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],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],g=e[3],_=e[7],m=e[11],p=e[15],v=c*f-l*d,S=o*f-l*u,M=o*d-c*u,E=a*f-l*h,T=a*d-c*h,C=a*u-o*h;return t*(_*v-m*S+p*M)-n*(g*v-m*E+p*T)+i*(g*S-_*E+p*C)-r*(g*M-_*T+m*C)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;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],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],v=t*o-n*a,S=t*c-i*a,M=t*l-r*a,E=n*c-i*o,T=n*l-r*o,C=i*l-r*c,x=h*_-u*g,w=h*m-d*g,L=h*p-f*g,R=u*m-d*_,O=u*p-f*_,H=d*p-f*m,q=v*H-S*O+M*R+E*L-T*w+C*x;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let N=1/q;return e[0]=(o*H-c*O+l*R)*N,e[1]=(i*O-n*H-r*R)*N,e[2]=(_*C-m*T+p*E)*N,e[3]=(d*T-u*C-f*E)*N,e[4]=(c*L-a*H-l*w)*N,e[5]=(t*H-i*L+r*w)*N,e[6]=(m*M-g*C-p*S)*N,e[7]=(h*C-d*M+f*S)*N,e[8]=(a*O-o*L+l*x)*N,e[9]=(n*L-t*O-r*x)*N,e[10]=(g*T-_*M+p*v)*N,e[11]=(u*M-h*T-f*v)*N,e[12]=(o*w-a*R-c*x)*N,e[13]=(t*R-n*w+i*x)*N,e[14]=(_*S-g*E-m*v)*N,e[15]=(h*E-u*S+d*v)*N,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,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){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,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+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,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,f=r*h,g=r*u,_=a*h,m=a*u,p=o*u,v=c*l,S=c*h,M=c*u,E=n.x,T=n.y,C=n.z;return i[0]=(1-(_+p))*E,i[1]=(f+M)*E,i[2]=(g-S)*E,i[3]=0,i[4]=(f-M)*T,i[5]=(1-(d+p))*T,i[6]=(m+v)*T,i[7]=0,i[8]=(g+S)*C,i[9]=(m-v)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinant();if(r===0)return n.set(1,1,1),t.identity(),this;let a=Yi.set(i[0],i[1],i[2]).length(),o=Yi.set(i[4],i[5],i[6]).length(),c=Yi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),on.copy(this);let l=1/a,h=1/o,u=1/c;return on.elements[0]*=l,on.elements[1]*=l,on.elements[2]*=l,on.elements[4]*=h,on.elements[5]*=h,on.elements[6]*=h,on.elements[8]*=u,on.elements[9]*=u,on.elements[10]*=u,t.setFromRotationMatrix(on),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,i,r,a,o=un,c=!1){let l=this.elements,h=2*r/(t-e),u=2*r/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i),g,_;if(c)g=r/(a-r),_=a*r/(a-r);else if(o===un)g=-(a+r)/(a-r),_=-2*a*r/(a-r);else if(o===us)g=-a/(a-r),_=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=un,c=!1){let l=this.elements,h=2/(t-e),u=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i),g,_;if(c)g=1/(a-r),_=a/(a-r);else if(o===un)g=-2/(a-r),_=-(a+r)/(a-r);else if(o===us)g=-1/(a-r),_=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Za.prototype.isMatrix4=!0;var Ue=Za,Yi=new F,on=new Ue,Uf=new F(0,0,0),Of=new F(1,1,1),ti=new F,Kr=new F,Kt=new F,kh=new Ue,Bh=new Ft,wn=class s{constructor(e=0,t=0,n=0,i=s.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],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ve(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ve(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ve(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Ve(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Ve(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Ve(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:_e("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return kh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Bh.setFromEuler(this),this.setFromQuaternion(Bh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};wn.DEFAULT_ORDER="XYZ";var er=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},kf=0,zh=new F,Zi=new Ft,zn=new Ue,Jr=new F,zs=new F,Bf=new F,zf=new Ft,Gh=new F(1,0,0),Vh=new F(0,1,0),Hh=new F(0,0,1),Wh={type:"added"},Gf={type:"removed"},$i={type:"childadded",child:null},_c={type:"childremoved",child:null},ct=class s extends mn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kf++}),this.uuid=fn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new F,t=new wn,n=new Ft,i=new F(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),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 Ue},normalMatrix:{value:new Pe}}),this.matrix=new Ue,this.matrixWorld=new Ue,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new er,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Zi.setFromAxisAngle(e,t),this.quaternion.multiply(Zi),this}rotateOnWorldAxis(e,t){return Zi.setFromAxisAngle(e,t),this.quaternion.premultiply(Zi),this}rotateX(e){return this.rotateOnAxis(Gh,e)}rotateY(e){return this.rotateOnAxis(Vh,e)}rotateZ(e){return this.rotateOnAxis(Hh,e)}translateOnAxis(e,t){return zh.copy(e).applyQuaternion(this.quaternion),this.position.add(zh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Gh,e)}translateY(e){return this.translateOnAxis(Vh,e)}translateZ(e){return this.translateOnAxis(Hh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(zn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Jr.copy(e):Jr.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),zs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?zn.lookAt(zs,Jr,this.up):zn.lookAt(Jr,zs,this.up),this.quaternion.setFromRotationMatrix(zn),i&&(zn.extractRotation(i.matrixWorld),Zi.setFromRotationMatrix(zn),this.quaternion.premultiply(Zi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(we("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Wh),$i.child=e,this.dispatchEvent($i),$i.child=null):we("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Gf),_c.child=e,this.dispatchEvent(_c),_c.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),zn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),zn.multiply(e.parent.matrixWorld)),e.applyMatrix4(zn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Wh),$i.child=e,this.dispatchEvent($i),$i.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 a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}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(zs,e,Bf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(zs,zf,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),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(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(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(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(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&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];i.animations.push(r(e.animations,c))}}if(t){let o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){let c=[];for(let l in o){let h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};ct.DEFAULT_UP=new F(0,1,0);ct.DEFAULT_MATRIX_AUTO_UPDATE=!0;ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var dn=class extends ct{constructor(){super(),this.isGroup=!0,this.type="Group"}},Vf={type:"move"},ms=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new dn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new dn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new dn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(let _ of e.hand.values()){let m=t.getJointPose(_,n),p=this._getHandJoint(l,_);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}let h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,g=.005;l.inputState.pinching&&d>f+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Vf)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new dn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},ed={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ni={h:0,s:0,l:0},Yr={h:0,s:0,l:0};function vc(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var Te=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=bt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Be.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Be.workingColorSpace){return this.r=e,this.g=t,this.b=n,Be.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Be.workingColorSpace){if(e=gl(e,1),t=Ve(t,0,1),n=Ve(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=vc(a,r,e+1/3),this.g=vc(a,r,e),this.b=vc(a,r,e-1/3)}return Be.colorSpaceToWorking(this,i),this}setStyle(e,t=bt){function n(r){r!==void 0&&parseFloat(r)<1&&_e("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:_e("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);_e("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=bt){let n=ed[e.toLowerCase()];return n!==void 0?this.setHex(n,t):_e("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=Xn(e.r),this.g=Xn(e.g),this.b=Xn(e.b),this}copyLinearToSRGB(e){return this.r=ls(e.r),this.g=ls(e.g),this.b=ls(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=bt){return Be.workingToColorSpace(Dt.copy(this),e),Math.round(Ve(Dt.r*255,0,255))*65536+Math.round(Ve(Dt.g*255,0,255))*256+Math.round(Ve(Dt.b*255,0,255))}getHexString(e=bt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Be.workingColorSpace){Be.workingToColorSpace(Dt.copy(this),t);let n=Dt.r,i=Dt.g,r=Dt.b,a=Math.max(n,i,r),o=Math.min(n,i,r),c,l,h=(o+a)/2;if(o===a)c=0,l=0;else{let u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-n)/u+2;break;case r:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=Be.workingColorSpace){return Be.workingToColorSpace(Dt.copy(this),t),e.r=Dt.r,e.g=Dt.g,e.b=Dt.b,e}getStyle(e=bt){Be.workingToColorSpace(Dt.copy(this),e);let t=Dt.r,n=Dt.g,i=Dt.b;return e!==bt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ni),this.setHSL(ni.h+e,ni.s+t,ni.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(ni),e.getHSL(Yr);let n=Js(ni.h,Yr.h,t),i=Js(ni.s,Yr.s,t),r=Js(ni.l,Yr.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}},Dt=new Te;Te.NAMES=ed;var Di=class extends ct{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new wn,this.environmentIntensity=1,this.environmentRotation=new wn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},cn=new F,Gn=new F,yc=new F,Vn=new F,Qi=new F,es=new F,qh=new F,Mc=new F,Sc=new F,Ac=new F,Tc=new nt,wc=new nt,Ec=new nt,oi=class s{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),cn.subVectors(e,t),i.cross(cn);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){cn.subVectors(i,t),Gn.subVectors(n,t),yc.subVectors(e,t);let a=cn.dot(cn),o=cn.dot(Gn),c=cn.dot(yc),l=Gn.dot(Gn),h=Gn.dot(yc),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;let d=1/u,f=(l*c-o*h)*d,g=(a*h-o*c)*d;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Vn)===null?!1:Vn.x>=0&&Vn.y>=0&&Vn.x+Vn.y<=1}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,Vn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Vn.x),c.addScaledVector(a,Vn.y),c.addScaledVector(o,Vn.z),c)}static getInterpolatedAttribute(e,t,n,i,r,a){return Tc.setScalar(0),wc.setScalar(0),Ec.setScalar(0),Tc.fromBufferAttribute(e,t),wc.fromBufferAttribute(e,n),Ec.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Tc,r.x),a.addScaledVector(wc,r.y),a.addScaledVector(Ec,r.z),a}static isFrontFacing(e,t,n,i){return cn.subVectors(n,t),Gn.subVectors(e,t),cn.cross(Gn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return cn.subVectors(this.c,this.b),Gn.subVectors(this.a,this.b),cn.cross(Gn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return s.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return s.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return s.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return s.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return s.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,a,o;Qi.subVectors(i,n),es.subVectors(r,n),Mc.subVectors(e,n);let c=Qi.dot(Mc),l=es.dot(Mc);if(c<=0&&l<=0)return t.copy(n);Sc.subVectors(e,i);let h=Qi.dot(Sc),u=es.dot(Sc);if(h>=0&&u<=h)return t.copy(i);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(Qi,a);Ac.subVectors(e,r);let f=Qi.dot(Ac),g=es.dot(Ac);if(g>=0&&f<=g)return t.copy(r);let _=f*l-c*g;if(_<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(es,o);let m=h*g-f*u;if(m<=0&&u-h>=0&&f-g>=0)return qh.subVectors(r,i),o=(u-h)/(u-h+(f-g)),t.copy(i).addScaledVector(qh,o);let p=1/(m+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(Qi,a).addScaledVector(es,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Bt=class{constructor(e=new F(1/0,1/0,1/0),t=new F(-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(ln.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ln.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=ln.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,ln):ln.fromBufferAttribute(r,a),ln.applyMatrix4(e.matrixWorld),this.expandByPoint(ln);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Zr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Zr.copy(n.boundingBox)),Zr.applyMatrix4(e.matrixWorld),this.union(Zr)}let i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ln),ln.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(Gs),$r.subVectors(this.max,Gs),ts.subVectors(e.a,Gs),ns.subVectors(e.b,Gs),is.subVectors(e.c,Gs),ii.subVectors(ns,ts),si.subVectors(is,ns),yi.subVectors(ts,is);let t=[0,-ii.z,ii.y,0,-si.z,si.y,0,-yi.z,yi.y,ii.z,0,-ii.x,si.z,0,-si.x,yi.z,0,-yi.x,-ii.y,ii.x,0,-si.y,si.x,0,-yi.y,yi.x,0];return!Rc(t,ts,ns,is,$r)||(t=[1,0,0,0,1,0,0,0,1],!Rc(t,ts,ns,is,$r))?!1:(Qr.crossVectors(ii,si),t=[Qr.x,Qr.y,Qr.z],Rc(t,ts,ns,is,$r))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ln).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ln).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Hn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hn),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}},Hn=[new F,new F,new F,new F,new F,new F,new F,new F],ln=new F,Zr=new Bt,ts=new F,ns=new F,is=new F,ii=new F,si=new F,yi=new F,Gs=new F,$r=new F,Qr=new F,Mi=new F;function Rc(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Mi.fromArray(s,r);let o=i.x*Math.abs(Mi.x)+i.y*Math.abs(Mi.y)+i.z*Math.abs(Mi.z),c=e.dot(Mi),l=t.dot(Mi),h=n.dot(Mi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var yt=new F,ea=new He,Hf=0,St=class extends mn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Hf++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Pa,this.updateRanges=[],this.gpuType=$t,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ea.fromBufferAttribute(this,t),ea.applyMatrix3(e),this.setXY(t,ea.x,ea.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyMatrix3(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyMatrix4(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.applyNormalMatrix(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)yt.fromBufferAttribute(this,t),yt.transformDirection(e),this.setXYZ(t,yt.x,yt.y,yt.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=hn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ye(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=hn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ye(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=hn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ye(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=hn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ye(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=hn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ye(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ye(t,this.array),n=Ye(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=Ye(t,this.array),n=Ye(n,this.array),i=Ye(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=Ye(t,this.array),n=Ye(n,this.array),i=Ye(i,this.array),r=Ye(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),this.usage!==Pa&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var tr=class extends St{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var nr=class extends St{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var Ot=class extends St{constructor(e,t,n){super(new Float32Array(e),t,n)}},Wf=new Bt,Vs=new F,Cc=new F,Vt=class{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Wf.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=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;Vs.subVectors(e,this.center);let t=Vs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Vs,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Cc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Vs.copy(e.center).add(Cc)),this.expandByPoint(Vs.copy(e.center).sub(Cc))),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}},qf=0,tn=new Ue,Pc=new ct,ss=new F,Jt=new Bt,Hs=new Bt,Rt=new F,zt=class s extends mn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:qf++}),this.uuid=fn(),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(mf(e)?nr:tr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Pe().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return tn.makeRotationFromQuaternion(e),this.applyMatrix4(tn),this}rotateX(e){return tn.makeRotationX(e),this.applyMatrix4(tn),this}rotateY(e){return tn.makeRotationY(e),this.applyMatrix4(tn),this}rotateZ(e){return tn.makeRotationZ(e),this.applyMatrix4(tn),this}translate(e,t,n){return tn.makeTranslation(e,t,n),this.applyMatrix4(tn),this}scale(e,t,n){return tn.makeScale(e,t,n),this.applyMatrix4(tn),this}lookAt(e){return Pc.lookAt(e),Pc.updateMatrix(),this.applyMatrix4(Pc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ss).negate(),this.translate(ss.x,ss.y,ss.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ot(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&_e("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];Jt.setFromBufferAttribute(r),this.morphTargetsRelative?(Rt.addVectors(this.boundingBox.min,Jt.min),this.boundingBox.expandByPoint(Rt),Rt.addVectors(this.boundingBox.max,Jt.max),this.boundingBox.expandByPoint(Rt)):(this.boundingBox.expandByPoint(Jt.min),this.boundingBox.expandByPoint(Jt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&we('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Vt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){let n=this.boundingSphere.center;if(Jt.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){let o=t[r];Hs.setFromBufferAttribute(o),this.morphTargetsRelative?(Rt.addVectors(Jt.min,Hs.min),Jt.expandByPoint(Rt),Rt.addVectors(Jt.max,Hs.max),Jt.expandByPoint(Rt)):(Jt.expandByPoint(Hs.min),Jt.expandByPoint(Hs.max))}Jt.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)Rt.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Rt));if(t)for(let r=0,a=t.length;r<a;r++){let o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)Rt.fromBufferAttribute(o,l),c&&(ss.fromBufferAttribute(e,l),Rt.add(ss)),i=Math.max(i,n.distanceToSquared(Rt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&we('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){we("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new St(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),o=[],c=[];for(let x=0;x<n.count;x++)o[x]=new F,c[x]=new F;let l=new F,h=new F,u=new F,d=new He,f=new He,g=new He,_=new F,m=new F;function p(x,w,L){l.fromBufferAttribute(n,x),h.fromBufferAttribute(n,w),u.fromBufferAttribute(n,L),d.fromBufferAttribute(r,x),f.fromBufferAttribute(r,w),g.fromBufferAttribute(r,L),h.sub(l),u.sub(l),f.sub(d),g.sub(d);let R=1/(f.x*g.y-g.x*f.y);isFinite(R)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(R),m.copy(u).multiplyScalar(f.x).addScaledVector(h,-g.x).multiplyScalar(R),o[x].add(_),o[w].add(_),o[L].add(_),c[x].add(m),c[w].add(m),c[L].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let x=0,w=v.length;x<w;++x){let L=v[x],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)p(e.getX(H+0),e.getX(H+1),e.getX(H+2))}let S=new F,M=new F,E=new F,T=new F;function C(x){E.fromBufferAttribute(i,x),T.copy(E);let w=o[x];S.copy(w),S.sub(E.multiplyScalar(E.dot(w))).normalize(),M.crossVectors(T,w);let R=M.dot(c[x])<0?-1:1;a.setXYZW(x,S.x,S.y,S.z,R)}for(let x=0,w=v.length;x<w;++x){let L=v[x],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)C(e.getX(H+0)),C(e.getX(H+1)),C(e.getX(H+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new St(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);let i=new F,r=new F,a=new F,o=new F,c=new F,l=new F,h=new F,u=new F;if(e)for(let d=0,f=e.count;d<f;d+=3){let g=e.getX(d+0),_=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,g),r.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Rt.fromBufferAttribute(e,t),Rt.normalize(),e.setXYZ(t,Rt.x,Rt.y,Rt.z)}toNonIndexed(){function e(o,c){let l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h),f=0,g=0;for(let _=0,m=c.length;_<m;_++){o.isInterleavedBufferAttribute?f=c[_]*o.data.stride+o.offset:f=c[_]*h;for(let p=0;p<h;p++)d[g++]=l[f++]}return new St(d,h,u)}if(this.index===null)return _e("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new s,n=this.index.array,i=this.attributes;for(let o in i){let c=i[o],l=e(c,n);t.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){let d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,c=a.length;o<c;o++){let l=a[o];t.addGroup(l.start,l.count,l.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),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){let f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(i[c]=h,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 o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let i=e.attributes;for(let l in i){let h=i[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let l=0,h=a.length;l<h;l++){let u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},gs=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Pa,this.updateRanges=[],this.version=0,this.uuid=fn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Ut=new F,bs=class s{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix4(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyNormalMatrix(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.transformDirection(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=hn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ye(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ye(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ye(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ye(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ye(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=hn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=hn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=hn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=hn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ye(t,this.array),n=Ye(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ye(t,this.array),n=Ye(n,this.array),i=Ye(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ye(t,this.array),n=Ye(n,this.array),i=Ye(i,this.array),r=Ye(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){$s("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new St(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new s(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){$s("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Xf=0,Gt=class extends mn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Xf++}),this.uuid=fn(),this.name="",this.type="Material",this.blending=Ri,this.side=pn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ya,this.blendDst=Ma,this.blendEquation=ci,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Te(0,0,0),this.blendAlpha=0,this.depthFunc=Ci,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Hc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ti,this.stencilZFail=Ti,this.stencilZPass=Ti,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){_e(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`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=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ri&&(n.blending=this.blending),this.side!==pn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ya&&(n.blendSrc=this.blendSrc),this.blendDst!==Ma&&(n.blendDst=this.blendDst),this.blendEquation!==ci&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ci&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Hc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ti&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ti&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ti&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(t){let r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var Wn=new F,Ic=new F,ta=new F,ri=new F,Lc=new F,na=new F,Dc=new F,Fi=class{constructor(e=new F,t=new F(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,Wn)),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=Wn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Wn.copy(this.origin).addScaledVector(this.direction,t),Wn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ic.copy(e).add(t).multiplyScalar(.5),ta.copy(t).sub(e).normalize(),ri.copy(this.origin).sub(Ic);let r=e.distanceTo(t)*.5,a=-this.direction.dot(ta),o=ri.dot(this.direction),c=-ri.dot(ta),l=ri.lengthSq(),h=Math.abs(1-a*a),u,d,f,g;if(h>0)if(u=a*c-o,d=a*o-c,g=r*h,u>=0)if(d>=-g)if(d<=g){let _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Ic).addScaledVector(ta,d),f}intersectSphere(e,t){Wn.subVectors(e.center,this.origin);let n=Wn.dot(this.direction),i=Wn.dot(Wn)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Wn)!==null}intersectTriangle(e,t,n,i,r){Lc.subVectors(t,e),na.subVectors(n,e),Dc.crossVectors(Lc,na);let a=this.direction.dot(Dc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ri.subVectors(this.origin,e);let c=o*this.direction.dot(na.crossVectors(ri,na));if(c<0)return null;let l=o*this.direction.dot(Lc.cross(ri));if(l<0||c+l>a)return null;let h=-o*ri.dot(Dc);return h<0?null:this.at(h/a,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)}},gn=class extends Gt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wn,this.combine=$a,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}},Xh=new Ue,Si=new Fi,ia=new Vt,jh=new F,sa=new F,ra=new F,aa=new F,Fc=new F,oa=new F,Kh=new F,ca=new F,lt=class extends ct{constructor(e=new zt,t=new gn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){oa.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=o[c],u=r[c];h!==0&&(Fc.fromBufferAttribute(u,e),a?oa.addScaledVector(Fc,h):oa.addScaledVector(Fc.sub(t),h))}t.add(oa)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(r),Si.copy(e.ray).recast(e.near),!(ia.containsPoint(Si.origin)===!1&&(Si.intersectSphere(ia,jh)===null||Si.origin.distanceToSquared(jh)>(e.far-e.near)**2))&&(Xh.copy(r).invert(),Si.copy(e.ray).applyMatrix4(Xh),!(n.boundingBox!==null&&Si.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Si)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){let m=d[g],p=a[m.materialIndex],v=Math.max(m.start,f.start),S=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let M=v,E=S;M<E;M+=3){let T=o.getX(M),C=o.getX(M+1),x=o.getX(M+2);i=la(this,p,e,n,l,h,u,T,C,x),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){let v=o.getX(m),S=o.getX(m+1),M=o.getX(m+2);i=la(this,a,e,n,l,h,u,v,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){let m=d[g],p=a[m.materialIndex],v=Math.max(m.start,f.start),S=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let M=v,E=S;M<E;M+=3){let T=M,C=M+1,x=M+2;i=la(this,p,e,n,l,h,u,T,C,x),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),_=Math.min(c.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){let v=m,S=m+1,M=m+2;i=la(this,a,e,n,l,h,u,v,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}};function jf(s,e,t,n,i,r,a,o){let c;if(e.side===Pt?c=n.intersectTriangle(a,r,i,!0,o):c=n.intersectTriangle(i,r,a,e.side===pn,o),c===null)return null;ca.copy(o),ca.applyMatrix4(s.matrixWorld);let l=t.ray.origin.distanceTo(ca);return l<t.near||l>t.far?null:{distance:l,point:ca.clone(),object:s}}function la(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,sa),s.getVertexPosition(c,ra),s.getVertexPosition(l,aa);let h=jf(s,e,t,n,sa,ra,aa,Kh);if(h){let u=new F;oi.getBarycoord(Kh,sa,ra,aa,u),i&&(h.uv=oi.getInterpolatedAttribute(i,o,c,l,u,new He)),r&&(h.uv1=oi.getInterpolatedAttribute(r,o,c,l,u,new He)),a&&(h.normal=oi.getInterpolatedAttribute(a,o,c,l,u,new F),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let d={a:o,b:c,c:l,normal:new F,materialIndex:0};oi.getNormal(sa,ra,aa,d.normal),h.face=d,h.barycoord=u}return h}var Ws=new nt,Jh=new nt,Yh=new nt,Kf=new nt,Zh=new Ue,ha=new F,Nc=new Vt,$h=new Ue,Uc=new Fi,ir=class extends lt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Gc,this.bindMatrix=new Ue,this.bindMatrixInverse=new Ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Bt),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ha),this.boundingBox.expandByPoint(ha)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Vt),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ha),this.boundingSphere.expandByPoint(ha)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Nc.copy(this.boundingSphere),Nc.applyMatrix4(i),e.ray.intersectsSphere(Nc)!==!1&&($h.copy(i).invert(),Uc.copy(e.ray).applyMatrix4($h),!(this.boundingBox!==null&&Uc.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Uc)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new nt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Gc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ku?this.bindMatrixInverse.copy(this.bindMatrix).invert():_e("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;Jh.fromBufferAttribute(i.attributes.skinIndex,e),Yh.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(Ws.copy(t),t.set(0,0,0,0)):(Ws.set(...t,1),t.set(0,0,0)),Ws.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let a=Yh.getComponent(r);if(a!==0){let o=Jh.getComponent(r);Zh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Kf.copy(Ws).applyMatrix4(Zh),a)}}return t.isVector4&&(t.w=Ws.w),t.applyMatrix4(this.bindMatrixInverse)}},xs=class extends ct{constructor(){super(),this.isBone=!0,this.type="Bone"}},_s=class extends Ct{constructor(e=null,t=1,n=1,i,r,a,o,c,l=xt,h=xt,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Qh=new Ue,Jf=new Ue,sr=class s{constructor(e=[],t=[]){this.uuid=fn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){_e("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ue)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Ue;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){let o=e[r]?e[r].matrixWorld:Jf;Qh.multiplyMatrices(o,t[r]),Qh.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new s(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new _s(t,e,e,Qt,$t);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],a=t[r];a===void 0&&(_e("Skeleton: No bone found with UUID:",r),a=new xs),this.bones.push(a),this.boneInverses.push(new Ue().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let a=t[i];e.bones.push(a.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}},hi=class extends St{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},rs=new Ue,eu=new Ue,ua=[],tu=new Bt,Yf=new Ue,qs=new lt,Xs=new Vt,Ni=class extends lt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new hi(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Yf)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Bt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,rs),tu.copy(e.boundingBox).applyMatrix4(rs),this.boundingBox.union(tu)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Vt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,rs),Xs.copy(e.boundingSphere).applyMatrix4(rs),this.boundingSphere.union(Xs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(qs.geometry=this.geometry,qs.material=this.material,qs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Xs.copy(this.boundingSphere),Xs.applyMatrix4(n),e.ray.intersectsSphere(Xs)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,rs),eu.multiplyMatrices(n,rs),qs.matrixWorld=eu,qs.raycast(e,ua);for(let a=0,o=ua.length;a<o;a++){let c=ua[a];c.instanceId=r,c.object=this,t.push(c)}ua.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new hi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new _s(new Float32Array(i*this.count),i,this.count,ro,$t));let r=this.morphTexture.source.data.data,a=0;for(let l=0;l<n.length;l++)a+=n[l];let o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;return r[c]=o,r.set(n,c+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Oc=new F,Zf=new F,$f=new Pe,Sn=class{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Oc.subVectors(n,t).cross(Zf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(Oc),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||$f.getNormalMatrix(e),i=this.coplanarPoint(Oc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Ai=new Vt,Qf=new He(.5,.5),da=new F,vs=class{constructor(e=new Sn,t=new Sn,n=new Sn,i=new Sn,r=new Sn,a=new Sn){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=un,n=!1){let i=this.planes,r=e.elements,a=r[0],o=r[1],c=r[2],l=r[3],h=r[4],u=r[5],d=r[6],f=r[7],g=r[8],_=r[9],m=r[10],p=r[11],v=r[12],S=r[13],M=r[14],E=r[15];if(i[0].setComponents(l-a,f-h,p-g,E-v).normalize(),i[1].setComponents(l+a,f+h,p+g,E+v).normalize(),i[2].setComponents(l+o,f+u,p+_,E+S).normalize(),i[3].setComponents(l-o,f-u,p-_,E-S).normalize(),n)i[4].setComponents(c,d,m,M).normalize(),i[5].setComponents(l-c,f-d,p-m,E-M).normalize();else if(i[4].setComponents(l-c,f-d,p-m,E-M).normalize(),t===un)i[5].setComponents(l+c,f+d,p+m,E+M).normalize();else if(t===us)i[5].setComponents(c,d,m,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ai.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ai)}intersectsSprite(e){Ai.center.set(0,0,0);let t=Qf.distanceTo(e.center);return Ai.radius=.7071067811865476+t,Ai.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ai)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(da.x=i.normal.x>0?e.max.x:e.min.x,da.y=i.normal.y>0?e.max.y:e.min.y,da.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(da)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var ys=class extends Gt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Te(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Na=new F,Ua=new F,nu=new Ue,js=new Fi,fa=new Vt,kc=new F,iu=new F,Ui=class extends ct{constructor(e=new zt,t=new ys){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Na.fromBufferAttribute(t,i-1),Ua.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Na.distanceTo(Ua);e.setAttribute("lineDistance",new Ot(n,1))}else _e("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fa.copy(n.boundingSphere),fa.applyMatrix4(i),fa.radius+=r,e.ray.intersectsSphere(fa)===!1)return;nu.copy(i).invert(),js.copy(e.ray).applyMatrix4(nu);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){let f=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let _=f,m=g-1;_<m;_+=l){let p=h.getX(_),v=h.getX(_+1),S=pa(this,e,js,c,p,v,_);S&&t.push(S)}if(this.isLineLoop){let _=h.getX(g-1),m=h.getX(f),p=pa(this,e,js,c,_,m,g-1);p&&t.push(p)}}else{let f=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let _=f,m=g-1;_<m;_+=l){let p=pa(this,e,js,c,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){let _=pa(this,e,js,c,g-1,f,g-1);_&&t.push(_)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function pa(s,e,t,n,i,r,a){let o=s.geometry.attributes.position;if(Na.fromBufferAttribute(o,i),Ua.fromBufferAttribute(o,r),t.distanceSqToSegment(Na,Ua,kc,iu)>n)return;kc.applyMatrix4(s.matrixWorld);let l=e.ray.origin.distanceTo(kc);if(!(l<e.near||l>e.far))return{distance:l,point:iu.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}var su=new F,ru=new F,rr=class extends Ui{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)su.fromBufferAttribute(t,i),ru.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+su.distanceTo(ru);e.setAttribute("lineDistance",new Ot(n,1))}else _e("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},ar=class extends Ui{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},Ms=class extends Gt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Te(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},au=new Ue,Wc=new Fi,ma=new Vt,ga=new F,or=class extends ct{constructor(e=new zt,t=new Ms){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ma.copy(n.boundingSphere),ma.applyMatrix4(i),ma.radius+=r,e.ray.intersectsSphere(ma)===!1)return;au.copy(i).invert(),Wc.copy(e.ray).applyMatrix4(au);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){let d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let g=d,_=f;g<_;g++){let m=l.getX(g);ga.fromBufferAttribute(u,m),ou(ga,m,c,i,e,t,this)}}else{let d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let g=d,_=f;g<_;g++)ga.fromBufferAttribute(u,g),ou(ga,g,c,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function ou(s,e,t,n,i,r,a){let o=Wc.distanceSqToPoint(s);if(o<t){let c=new F;Wc.closestPointToPoint(s,c),c.applyMatrix4(n);let l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}var cr=class extends Ct{constructor(e=[],t=pi,n,i,r,a,o,c,l,h){super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var jn=class extends Ct{constructor(e,t,n=_n,i,r,a,o=xt,c=xt,l,h=Tn,u=1){if(h!==Tn&&h!==mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:u};super(d,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ps(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Oa=class extends jn{constructor(e,t=_n,n=pi,i,r,a=xt,o=xt,c,l=Tn){let h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,r,a,o,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},lr=class extends Ct{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},ui=class s extends zt{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};let o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],h=[],u=[],d=0,f=0;g("z","y","x",-1,-1,n,t,e,a,r,0),g("z","y","x",1,-1,n,t,-e,a,r,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new Ot(l,3)),this.setAttribute("normal",new Ot(h,3)),this.setAttribute("uv",new Ot(u,2));function g(_,m,p,v,S,M,E,T,C,x,w){let L=M/C,R=E/x,O=M/2,H=E/2,q=T/2,N=C+1,z=x+1,V=0,$=0,Q=new F;for(let le=0;le<z;le++){let xe=le*R-H;for(let Se=0;Se<N;Se++){let Xe=Se*L-O;Q[_]=Xe*v,Q[m]=xe*S,Q[p]=q,l.push(Q.x,Q.y,Q.z),Q[_]=0,Q[m]=0,Q[p]=T>0?1:-1,h.push(Q.x,Q.y,Q.z),u.push(Se/C),u.push(1-le/x),V+=1}}for(let le=0;le<x;le++)for(let xe=0;xe<C;xe++){let Se=d+xe+N*le,Xe=d+xe+N*(le+1),Ze=d+(xe+1)+N*(le+1),Fe=d+(xe+1)+N*le;c.push(Se,Xe,Fe),c.push(Xe,Ze,Fe),$+=6}o.addGroup(f,$,w),f+=$,d+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var hr=class s extends zt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,f=[],g=[],_=[],m=[];for(let p=0;p<h;p++){let v=p*d-a;for(let S=0;S<l;S++){let M=S*u-r;g.push(M,-v,0),_.push(0,0,1),m.push(S/o),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let v=0;v<o;v++){let S=v+l*p,M=v+l*(p+1),E=v+1+l*(p+1),T=v+1+l*p;f.push(S,M,T),f.push(M,E,T)}this.setIndex(f),this.setAttribute("position",new Ot(g,3)),this.setAttribute("normal",new Ot(_,3)),this.setAttribute("uv",new Ot(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.widthSegments,e.heightSegments)}};function Vi(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(cu(i))i.isRenderTargetTexture?(_e("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(cu(i[0])){let r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Nt(s){let e={};for(let t=0;t<s.length;t++){let n=Vi(s[t]);for(let i in n)e[i]=n[i]}return e}function cu(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function ep(s){let e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function bl(s){let e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Be.workingColorSpace}var td={clone:Vi,merge:Nt},tp=`void main() {
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+}`,np=`void main() {
+ gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
+}`,Zt=class extends Gt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=tp,this.fragmentShader=np,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vi(e.uniforms),this.uniformsGroups=ep(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},ka=class extends Zt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},En=class extends Gt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Te(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ht=class extends En{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ve(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Te(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Te(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Te(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};var ur=class extends Gt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wn,this.combine=$a,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ba=class extends Gt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Vu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},za=class extends Gt{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function ba(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function ip(s){function e(i,r){return s[i]-s[r]}let t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function lu(s,e,t){let n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){let o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function nd(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}var Rn=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){let o=t[1];e<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){let o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ga=class extends Rn{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:wi,endingEnd:wi}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,a=e+1,o=i[r],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ei:r=e,o=2*t-n;break;case Ys:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Ei:a=e,c=2*n-t;break;case Ys:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}let l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,p=-d*m+2*d*_-d*g,v=(1+d)*m+(-1.5-2*d)*_+(-.5+d)*g+1,S=(-1-f)*m+(1.5+f)*_+.5*g,M=f*m-f*_;for(let E=0;E!==o;++E)r[E]=p*a[h+E]+v*a[l+E]+S*a[c+E]+M*a[u+E];return r}},dr=class extends Rn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}},Va=class extends Rn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Ha=class extends Rn{interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this.settings||this.DefaultSettings_,u=h.inTangents,d=h.outTangents;if(!u||!d){let _=(n-t)/(i-t),m=1-_;for(let p=0;p!==o;++p)r[p]=a[l+p]*m+a[c+p]*_;return r}let f=o*2,g=e-1;for(let _=0;_!==o;++_){let m=a[l+_],p=a[c+_],v=g*f+_*2,S=d[v],M=d[v+1],E=e*f+_*2,T=u[E],C=u[E+1],x=(n-t)/(i-t),w,L,R,O,H;for(let q=0;q<8;q++){w=x*x,L=w*x,R=1-x,O=R*R,H=O*R;let z=H*t+3*O*x*S+3*R*w*T+L*i-n;if(Math.abs(z)<1e-10)break;let V=3*O*(S-t)+6*R*x*(T-S)+3*w*(i-T);if(Math.abs(V)<1e-10)break;x=x-z/V,x=Math.max(0,Math.min(1,x))}r[_]=H*m+3*O*x*M+3*R*w*C+L*p}return r}},Wt=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ba(t,this.TimeBufferType),this.values=ba(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ba(e.times,Array),values:ba(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Va(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new dr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ga(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Ha(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Pi:t=this.InterpolantFactoryMethodDiscrete;break;case Ii:t=this.InterpolantFactoryMethodLinear;break;case va:t=this.InterpolantFactoryMethodSmooth;break;case Vc:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return _e("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Pi;case this.InterpolantFactoryMethodLinear:return Ii;case this.InterpolantFactoryMethodSmooth:return va;case this.InterpolantFactoryMethodBezier:return Vc}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(we("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(we("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){we("KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){we("KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&gf(i))for(let o=0,c=i.length;o!==c;++o){let l=i[o];if(isNaN(l)){we("KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===va,r=e.length-1,a=1;for(let o=1;o<r;++o){let c=!1,l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{let u=o*n,d=u-n,f=u+n;for(let g=0;g!==n;++g){let _=t[u+g];if(_!==t[d+g]||_!==t[f+g]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];let u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Wt.prototype.ValueTypeName="";Wt.prototype.TimeBufferType=Float32Array;Wt.prototype.ValueBufferType=Float32Array;Wt.prototype.DefaultInterpolation=Ii;var Kn=class extends Wt{constructor(e,t,n){super(e,t,n)}};Kn.prototype.ValueTypeName="bool";Kn.prototype.ValueBufferType=Array;Kn.prototype.DefaultInterpolation=Pi;Kn.prototype.InterpolantFactoryMethodLinear=void 0;Kn.prototype.InterpolantFactoryMethodSmooth=void 0;var fr=class extends Wt{constructor(e,t,n,i){super(e,t,n,i)}};fr.prototype.ValueTypeName="color";var Cn=class extends Wt{constructor(e,t,n,i){super(e,t,n,i)}};Cn.prototype.ValueTypeName="number";var Wa=class extends Rn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t),l=e*o;for(let h=l+o;l!==h;l+=4)Ft.slerpFlat(r,0,a,l-o,a,l,c);return r}},Pn=class extends Wt{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Wa(this.times,this.values,this.getValueSize(),e)}};Pn.prototype.ValueTypeName="quaternion";Pn.prototype.InterpolantFactoryMethodSmooth=void 0;var Jn=class extends Wt{constructor(e,t,n){super(e,t,n)}};Jn.prototype.ValueTypeName="string";Jn.prototype.ValueBufferType=Array;Jn.prototype.DefaultInterpolation=Pi;Jn.prototype.InterpolantFactoryMethodLinear=void 0;Jn.prototype.InterpolantFactoryMethodSmooth=void 0;var In=class extends Wt{constructor(e,t,n,i){super(e,t,n,i)}};In.prototype.ValueTypeName="vector";var Oi=class{constructor(e="",t=-1,n=[],i=zo){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=fn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(rp(n[a]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(Wt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);let h=ip(c);c=lu(c,1,h),l=lu(l,1,h),!i&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new Cn(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){let l=e[o],h=l.name.match(r);if(h&&h.length>1){let u=h[1],d=i[u];d||(i[u]=d=[]),d.push(l)}}let a=[];for(let o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(_e("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return we("AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,g,_){if(f.length!==0){let m=[],p=[];nd(f,m,p,g),m.length!==0&&_.push(new u(d,m,p))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u<l.length;u++){let d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){let f={},g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let _=0;_<d[g].morphTargets.length;_++)f[d[g].morphTargets[_]]=-1;for(let _ in f){let m=[],p=[];for(let v=0;v!==d[g].morphTargets.length;++v){let S=d[g];m.push(S.time),p.push(S.morphTarget===_?1:0)}i.push(new Cn(".morphTargetInfluence["+_+"]",m,p))}c=f.length*a}else{let f=".bones["+t[u].name+"]";n(In,f+".position",d,"pos",i),n(Pn,f+".quaternion",d,"rot",i),n(In,f+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,o)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function sp(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Cn;case"vector":case"vector2":case"vector3":case"vector4":return In;case"color":return fr;case"quaternion":return Pn;case"bool":case"boolean":return Kn;case"string":return Jn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function rp(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=sp(s.type);if(s.times===void 0){let t=[],n=[];nd(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}var An={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(hu(s)||(this.files[s]=e))},get:function(s){if(this.enabled!==!1&&!hu(s))return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};function hu(s){try{let e=s.slice(s.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var qa=class{constructor(e,t,n){let i=this,r=!1,a=0,o=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){let u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){let f=l[u],g=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},id=new qa,Ln=class{constructor(e){this.manager=e!==void 0?e:id,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ln.DEFAULT_MATERIAL_NAME="__DEFAULT";var qn={},qc=class extends Error{constructor(e,t){super(e),this.response=t}},Ss=class extends Ln{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=An.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(qn[e]!==void 0){qn[e].push({onLoad:t,onProgress:n,onError:i});return}qn[e]=[],qn[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&_e("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=qn[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,g=f!==0,_=0,m=new ReadableStream({start(p){v();function v(){u.read().then(({done:S,value:M})=>{if(S)p.close();else{_+=M.byteLength;let E=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:f});for(let T=0,C=h.length;T<C;T++){let x=h[T];x.onProgress&&x.onProgress(E)}p.enqueue(M),v()}},S=>{p.error(S)})}}});return new Response(m)}else throw new qc(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o==="")return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(g=>f.decode(g))}}}).then(l=>{An.add(`file:${e}`,l);let h=qn[e];delete qn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{let h=qn[e];if(h===void 0)throw this.manager.itemError(e),l;delete qn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var as=new WeakMap,Xa=class extends Ln{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=An.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let u=as.get(a);u===void 0&&(u=[],as.set(a,u)),u.push({onLoad:t,onError:i})}return a}let o=ds("img");function c(){h(),t&&t(this);let u=as.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];f.onLoad&&f.onLoad(this)}as.delete(this),r.manager.itemEnd(e)}function l(u){h(),i&&i(u),An.remove(`image:${e}`);let d=as.get(this)||[];for(let f=0;f<d.length;f++){let g=d[f];g.onError&&g.onError(u)}as.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),An.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}};var pr=class extends Ln{constructor(e){super(e)}load(e,t,n,i){let r=new Ct,a=new Xa(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}},ki=class extends ct{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Te(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};var Bc=new Ue,uu=new F,du=new F,mr=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new He(512,512),this.mapType=qt,this.map=null,this.mapPass=null,this.matrix=new Ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new vs,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;uu.setFromMatrixPosition(e.matrixWorld),t.position.copy(uu),du.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(du),t.updateMatrixWorld(),Bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===us||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},xa=new F,_a=new Ft,Mn=new F,gr=class extends ct{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ue,this.projectionMatrix=new Ue,this.projectionMatrixInverse=new Ue,this.coordinateSystem=un,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(xa,_a,Mn),Mn.x===1&&Mn.y===1&&Mn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(xa,_a,Mn.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(xa,_a,Mn),Mn.x===1&&Mn.y===1&&Mn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(xa,_a,Mn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ai=new F,fu=new He,pu=new He,Mt=class extends gr{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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Li*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ks*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Li*2*Math.atan(Math.tan(Ks*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ai.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ai.x,ai.y).multiplyScalar(-e/ai.z),ai.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ai.x,ai.y).multiplyScalar(-e/ai.z)}getViewSize(e,t){return this.getViewBounds(e,fu,pu),t.subVectors(pu,fu)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ks*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Xc=class extends mr{constructor(){super(new Mt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Li*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},br=class extends ki{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Xc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},jc=class extends mr{constructor(){super(new Mt(90,1,.5,500)),this.isPointLightShadow=!0}},Bi=class extends ki{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new jc}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},di=class extends gr{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Kc=class extends mr{constructor(){super(new di(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},fi=class extends ki{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.shadow=new Kc}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},xr=class extends ki{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var Yn=class{static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var zc=new WeakMap,_r=class extends Ln{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&_e("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&_e("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=An.get(`image-bitmap:${e}`);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{zc.has(a)===!0?(i&&i(zc.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(l),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){An.add(`image-bitmap:${e}`,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){i&&i(l),zc.set(c,l),An.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});An.add(`image-bitmap:${e}`,c),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var os=-90,cs=1,ja=class extends ct{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Mt(os,cs,e,t);i.layers=this.layers,this.add(i);let r=new Mt(os,cs,e,t);r.layers=this.layers,this.add(r);let a=new Mt(os,cs,e,t);a.layers=this.layers,this.add(a);let o=new Mt(os,cs,e,t);o.layers=this.layers,this.add(o);let c=new Mt(os,cs,e,t);c.layers=this.layers,this.add(c);let l=new Mt(os,cs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(let l of t)this.remove(l);if(e===un)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),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===us)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),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;let _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},Ka=class extends Mt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var Ja=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;let o=t/a;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Ft.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;Ft.multiplyQuaternionsFlat(e,a,e,t,e,n),Ft.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let o=0;o!==r;++o){let c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let o=t+a;e[o]=e[o]+e[n+a]*i}}},xl="\\[\\]\\.:\\/",ap=new RegExp("["+xl+"]","g"),_l="[^"+xl+"]",op="[^"+xl.replace("\\.","")+"]",cp=/((?:WC+[\/:])*)/.source.replace("WC",_l),lp=/(WCOD+)?/.source.replace("WCOD",op),hp=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_l),up=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_l),dp=new RegExp("^"+cp+lp+hp+up+"$"),fp=["material","materials","bones","map"],Jc=class{constructor(e,t,n){let i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},tt=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ap,"")}static parseTrackName(e){let t=dp.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);fp.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===t||o.uuid===t)return o;let c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){_e("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){we("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){we("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){we("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){we("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){we("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let a=e[i];if(a===void 0){let l=t.nodeName;we("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){we("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){we("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};tt.Composite=Jc;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Ya=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,a=r.length,o=new Array(a),c={endingStart:wi,endingEnd:wi};for(let l=0;l!==a;++l){let h=r[l].createInterpolant(null);o[l]=h,h.settings&&Object.assign(c,h.settings),h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ir,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);let c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Gu:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case zo:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===zu;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===Bu){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=Ei,i.endingEnd=Ei):(e?i.endingStart=this.zeroSlopeAtStart?Ei:wi:i.endingStart=Ys,t?i.endingEnd=this.zeroSlopeAtEnd?Ei:wi:i.endingEnd=Ys)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}},pp=new Float32Array(1),vr=class extends mn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let d=i[u],f=d.name,g=h[f];if(g!==void 0)++g.referenceCount,a[u]=g;else{if(g=a[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,f));continue}let _=t&&t._propertyBindings[u].binding.parsedPath;g=new Ja(tt.create(n,f,_),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,f),a[u]=g}o[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{let o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,a=this._actionsByClip,o=a[r],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new dr(new Float32Array(2),new Float32Array(2),1,pp),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,a=typeof e=="string"?Oi.findByName(i,e):e,o=a!==null?a.uuid:e,c=this._actionsByClip[o],l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=zo),c!==void 0){let u=c.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;let h=new Ya(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e=="string"?Oi.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);let o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){let l=a[o];this._deactivateAction(l);let h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let a in n){let o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let a in r){let o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};var yr=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,_e("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};var Tl=class Tl{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};Tl.prototype.isMatrix2=!0;var Yc=Tl;function vl(s,e,t,n){let i=mp(n);switch(t){case dl:return s*e;case ro:return s*e/i.components*i.byteLength;case ao:return s*e/i.components*i.byteLength;case gi:return s*e*2/i.components*i.byteLength;case oo:return s*e*2/i.components*i.byteLength;case fl:return s*e*3/i.components*i.byteLength;case Qt:return s*e*4/i.components*i.byteLength;case co:return s*e*4/i.components*i.byteLength;case Tr:case wr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Er:case Rr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ho:case fo:return Math.max(s,16)*Math.max(e,8)/4;case lo:case uo:return Math.max(s,8)*Math.max(e,8)/2;case po:case mo:case bo:case xo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case go:case Cr:case _o:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case vo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case yo:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case Mo:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case So:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Ao:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case To:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case wo:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case Eo:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case Ro:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case Co:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case Po:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case Io:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case Lo:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Do:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Fo:case No:case Uo:return Math.ceil(s/4)*Math.ceil(e/4)*16;case Oo:case ko:return Math.ceil(s/4)*Math.ceil(e/4)*8;case Pr:case Bo:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function mp(s){switch(s){case qt:case cl:return{byteLength:1,components:1};case ws:case ll:case Fn:return{byteLength:2,components:1};case io:case so:return{byteLength:2,components:4};case _n:case no:case $t:return{byteLength:4,components:1};case hl:case ul:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?_e("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");function wd(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&s!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function bp(s){let e=new WeakMap;function t(o,c){let l=o.array,h=o.usage,u=l.byteLength,d=s.createBuffer();s.bindBuffer(c,d),s.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=s.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=s.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=s.SHORT;else if(l instanceof Uint32Array)f=s.UNSIGNED_INT;else if(l instanceof Int32Array)f=s.INT;else if(l instanceof Int8Array)f=s.BYTE;else if(l instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,c,l){let h=c.array,u=c.updateRanges;if(s.bindBuffer(l,o),u.length===0)s.bufferSubData(l,0,h);else{u.sort((f,g)=>f.start-g.start);let d=0;for(let f=1;f<u.length;f++){let g=u[d],_=u[f];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++d,u[d]=_)}u.length=d+1;for(let f=0,g=u.length;f<g;f++){let _=u[f];s.bufferSubData(l,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let c=e.get(o);c&&(s.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:r,update:a}}var xp=`#ifdef USE_ALPHAHASH
+ if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
+#endif`,_p=`#ifdef USE_ALPHAHASH
+ const float ALPHA_HASH_SCALE = 0.05;
+ float hash2D( vec2 value ) {
+ return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
+ }
+ float hash3D( vec3 value ) {
+ return hash2D( vec2( hash2D( value.xy ), value.z ) );
+ }
+ float getAlphaHashThreshold( vec3 position ) {
+ float maxDeriv = max(
+ length( dFdx( position.xyz ) ),
+ length( dFdy( position.xyz ) )
+ );
+ float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
+ vec2 pixScales = vec2(
+ exp2( floor( log2( pixScale ) ) ),
+ exp2( ceil( log2( pixScale ) ) )
+ );
+ vec2 alpha = vec2(
+ hash3D( floor( pixScales.x * position.xyz ) ),
+ hash3D( floor( pixScales.y * position.xyz ) )
+ );
+ float lerpFactor = fract( log2( pixScale ) );
+ float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
+ float a = min( lerpFactor, 1.0 - lerpFactor );
+ vec3 cases = vec3(
+ x * x / ( 2.0 * a * ( 1.0 - a ) ),
+ ( x - 0.5 * a ) / ( 1.0 - a ),
+ 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
+ );
+ float threshold = ( x < ( 1.0 - a ) )
+ ? ( ( x < a ) ? cases.x : cases.y )
+ : cases.z;
+ return clamp( threshold , 1.0e-6, 1.0 );
+ }
+#endif`,vp=`#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
+#endif`,yp=`#ifdef USE_ALPHAMAP
+ uniform sampler2D alphaMap;
+#endif`,Mp=`#ifdef USE_ALPHATEST
+ #ifdef ALPHA_TO_COVERAGE
+ diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
+ if ( diffuseColor.a == 0.0 ) discard;
+ #else
+ if ( diffuseColor.a < alphaTest ) discard;
+ #endif
+#endif`,Sp=`#ifdef USE_ALPHATEST
+ uniform float alphaTest;
+#endif`,Ap=`#ifdef USE_AOMAP
+ float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
+ reflectedLight.indirectDiffuse *= ambientOcclusion;
+ #if defined( USE_CLEARCOAT )
+ clearcoatSpecularIndirect *= ambientOcclusion;
+ #endif
+ #if defined( USE_SHEEN )
+ sheenSpecularIndirect *= ambientOcclusion;
+ #endif
+ #if defined( USE_ENVMAP ) && defined( STANDARD )
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
+ reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
+ #endif
+#endif`,Tp=`#ifdef USE_AOMAP
+ uniform sampler2D aoMap;
+ uniform float aoMapIntensity;
+#endif`,wp=`#ifdef USE_BATCHING
+ #if ! defined( GL_ANGLE_multi_draw )
+ #define gl_DrawID _gl_DrawID
+ uniform int _gl_DrawID;
+ #endif
+ uniform highp sampler2D batchingTexture;
+ uniform highp usampler2D batchingIdTexture;
+ mat4 getBatchingMatrix( const in float i ) {
+ int size = textureSize( batchingTexture, 0 ).x;
+ int j = int( i ) * 4;
+ int x = j % size;
+ int y = j / size;
+ vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
+ vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
+ vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
+ vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
+ return mat4( v1, v2, v3, v4 );
+ }
+ float getIndirectIndex( const in int i ) {
+ int size = textureSize( batchingIdTexture, 0 ).x;
+ int x = i % size;
+ int y = i / size;
+ return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
+ }
+#endif
+#ifdef USE_BATCHING_COLOR
+ uniform sampler2D batchingColorTexture;
+ vec4 getBatchingColor( const in float i ) {
+ int size = textureSize( batchingColorTexture, 0 ).x;
+ int j = int( i );
+ int x = j % size;
+ int y = j / size;
+ return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
+ }
+#endif`,Ep=`#ifdef USE_BATCHING
+ mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
+#endif`,Rp=`vec3 transformed = vec3( position );
+#ifdef USE_ALPHAHASH
+ vPosition = vec3( position );
+#endif`,Cp=`vec3 objectNormal = vec3( normal );
+#ifdef USE_TANGENT
+ vec3 objectTangent = vec3( tangent.xyz );
+#endif`,Pp=`float G_BlinnPhong_Implicit( ) {
+ return 0.25;
+}
+float D_BlinnPhong( const in float shininess, const in float dotNH ) {
+ return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
+}
+vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float dotVH = saturate( dot( viewDir, halfDir ) );
+ vec3 F = F_Schlick( specularColor, 1.0, dotVH );
+ float G = G_BlinnPhong_Implicit( );
+ float D = D_BlinnPhong( shininess, dotNH );
+ return F * ( G * D );
+} // validated`,Ip=`#ifdef USE_IRIDESCENCE
+ const mat3 XYZ_TO_REC709 = mat3(
+ 3.2404542, -0.9692660, 0.0556434,
+ -1.5371385, 1.8760108, -0.2040259,
+ -0.4985314, 0.0415560, 1.0572252
+ );
+ vec3 Fresnel0ToIor( vec3 fresnel0 ) {
+ vec3 sqrtF0 = sqrt( fresnel0 );
+ return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
+ }
+ vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
+ return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
+ }
+ float IorToFresnel0( float transmittedIor, float incidentIor ) {
+ return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
+ }
+ vec3 evalSensitivity( float OPD, vec3 shift ) {
+ float phase = 2.0 * PI * OPD * 1.0e-9;
+ vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
+ vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
+ vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
+ vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
+ xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
+ xyz /= 1.0685e-7;
+ vec3 rgb = XYZ_TO_REC709 * xyz;
+ return rgb;
+ }
+ vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
+ vec3 I;
+ float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
+ float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
+ float cosTheta2Sq = 1.0 - sinTheta2Sq;
+ if ( cosTheta2Sq < 0.0 ) {
+ return vec3( 1.0 );
+ }
+ float cosTheta2 = sqrt( cosTheta2Sq );
+ float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
+ float R12 = F_Schlick( R0, 1.0, cosTheta1 );
+ float T121 = 1.0 - R12;
+ float phi12 = 0.0;
+ if ( iridescenceIOR < outsideIOR ) phi12 = PI;
+ float phi21 = PI - phi12;
+ vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
+ vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
+ vec3 phi23 = vec3( 0.0 );
+ if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
+ if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
+ if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
+ float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
+ vec3 phi = vec3( phi21 ) + phi23;
+ vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
+ vec3 r123 = sqrt( R123 );
+ vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
+ vec3 C0 = R12 + Rs;
+ I = C0;
+ vec3 Cm = Rs - T121;
+ for ( int m = 1; m <= 2; ++ m ) {
+ Cm *= r123;
+ vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
+ I += Cm * Sm;
+ }
+ return max( I, vec3( 0.0 ) );
+ }
+#endif`,Lp=`#ifdef USE_BUMPMAP
+ uniform sampler2D bumpMap;
+ uniform float bumpScale;
+ vec2 dHdxy_fwd() {
+ vec2 dSTdx = dFdx( vBumpMapUv );
+ vec2 dSTdy = dFdy( vBumpMapUv );
+ float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
+ float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
+ float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
+ return vec2( dBx, dBy );
+ }
+ vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
+ vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
+ vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
+ vec3 vN = surf_norm;
+ vec3 R1 = cross( vSigmaY, vN );
+ vec3 R2 = cross( vN, vSigmaX );
+ float fDet = dot( vSigmaX, R1 ) * faceDirection;
+ vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
+ return normalize( abs( fDet ) * surf_norm - vGrad );
+ }
+#endif`,Dp=`#if NUM_CLIPPING_PLANES > 0
+ vec4 plane;
+ #ifdef ALPHA_TO_COVERAGE
+ float distanceToPlane, distanceGradient;
+ float clipOpacity = 1.0;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
+ distanceGradient = fwidth( distanceToPlane ) / 2.0;
+ clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
+ if ( clipOpacity == 0.0 ) discard;
+ }
+ #pragma unroll_loop_end
+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
+ float unionClipOpacity = 1.0;
+ #pragma unroll_loop_start
+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
+ distanceGradient = fwidth( distanceToPlane ) / 2.0;
+ unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
+ }
+ #pragma unroll_loop_end
+ clipOpacity *= 1.0 - unionClipOpacity;
+ #endif
+ diffuseColor.a *= clipOpacity;
+ if ( diffuseColor.a == 0.0 ) discard;
+ #else
+ #pragma unroll_loop_start
+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
+ }
+ #pragma unroll_loop_end
+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
+ bool clipped = true;
+ #pragma unroll_loop_start
+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
+ }
+ #pragma unroll_loop_end
+ if ( clipped ) discard;
+ #endif
+ #endif
+#endif`,Fp=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
+#endif`,Np=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+#endif`,Up=`#if NUM_CLIPPING_PLANES > 0
+ vClipPosition = - mvPosition.xyz;
+#endif`,Op=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+ diffuseColor *= vColor;
+#endif`,kp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+ varying vec4 vColor;
+#endif`,Bp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+ varying vec4 vColor;
+#endif`,zp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+ vColor = vec4( 1.0 );
+#endif
+#ifdef USE_COLOR_ALPHA
+ vColor *= color;
+#elif defined( USE_COLOR )
+ vColor.rgb *= color;
+#endif
+#ifdef USE_INSTANCING_COLOR
+ vColor.rgb *= instanceColor.rgb;
+#endif
+#ifdef USE_BATCHING_COLOR
+ vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
+#endif`,Gp=`#define PI 3.141592653589793
+#define PI2 6.283185307179586
+#define PI_HALF 1.5707963267948966
+#define RECIPROCAL_PI 0.3183098861837907
+#define RECIPROCAL_PI2 0.15915494309189535
+#define EPSILON 1e-6
+#ifndef saturate
+#define saturate( a ) clamp( a, 0.0, 1.0 )
+#endif
+#define whiteComplement( a ) ( 1.0 - saturate( a ) )
+float pow2( const in float x ) { return x*x; }
+vec3 pow2( const in vec3 x ) { return x*x; }
+float pow3( const in float x ) { return x*x*x; }
+float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
+float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
+float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
+highp float rand( const in vec2 uv ) {
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
+ highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
+ return fract( sin( sn ) * c );
+}
+#ifdef HIGH_PRECISION
+ float precisionSafeLength( vec3 v ) { return length( v ); }
+#else
+ float precisionSafeLength( vec3 v ) {
+ float maxComponent = max3( abs( v ) );
+ return length( v / maxComponent ) * maxComponent;
+ }
+#endif
+struct IncidentLight {
+ vec3 color;
+ vec3 direction;
+ bool visible;
+};
+struct ReflectedLight {
+ vec3 directDiffuse;
+ vec3 directSpecular;
+ vec3 indirectDiffuse;
+ vec3 indirectSpecular;
+};
+#ifdef USE_ALPHAHASH
+ varying vec3 vPosition;
+#endif
+vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
+}
+vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
+ return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
+}
+bool isPerspectiveMatrix( mat4 m ) {
+ return m[ 2 ][ 3 ] == - 1.0;
+}
+vec2 equirectUv( in vec3 dir ) {
+ float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
+ float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
+ return vec2( u, v );
+}
+vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
+ return RECIPROCAL_PI * diffuseColor;
+}
+vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
+}
+float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
+} // validated`,Vp=`#ifdef ENVMAP_TYPE_CUBE_UV
+ #define cubeUV_minMipLevel 4.0
+ #define cubeUV_minTileSize 16.0
+ float getFace( vec3 direction ) {
+ vec3 absDirection = abs( direction );
+ float face = - 1.0;
+ if ( absDirection.x > absDirection.z ) {
+ if ( absDirection.x > absDirection.y )
+ face = direction.x > 0.0 ? 0.0 : 3.0;
+ else
+ face = direction.y > 0.0 ? 1.0 : 4.0;
+ } else {
+ if ( absDirection.z > absDirection.y )
+ face = direction.z > 0.0 ? 2.0 : 5.0;
+ else
+ face = direction.y > 0.0 ? 1.0 : 4.0;
+ }
+ return face;
+ }
+ vec2 getUV( vec3 direction, float face ) {
+ vec2 uv;
+ if ( face == 0.0 ) {
+ uv = vec2( direction.z, direction.y ) / abs( direction.x );
+ } else if ( face == 1.0 ) {
+ uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
+ } else if ( face == 2.0 ) {
+ uv = vec2( - direction.x, direction.y ) / abs( direction.z );
+ } else if ( face == 3.0 ) {
+ uv = vec2( - direction.z, direction.y ) / abs( direction.x );
+ } else if ( face == 4.0 ) {
+ uv = vec2( - direction.x, direction.z ) / abs( direction.y );
+ } else {
+ uv = vec2( direction.x, direction.y ) / abs( direction.z );
+ }
+ return 0.5 * ( uv + 1.0 );
+ }
+ vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
+ float face = getFace( direction );
+ float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
+ mipInt = max( mipInt, cubeUV_minMipLevel );
+ float faceSize = exp2( mipInt );
+ highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
+ if ( face > 2.0 ) {
+ uv.y += faceSize;
+ face -= 3.0;
+ }
+ uv.x += face * faceSize;
+ uv.x += filterInt * 3.0 * cubeUV_minTileSize;
+ uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
+ uv.x *= CUBEUV_TEXEL_WIDTH;
+ uv.y *= CUBEUV_TEXEL_HEIGHT;
+ #ifdef texture2DGradEXT
+ return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
+ #else
+ return texture2D( envMap, uv ).rgb;
+ #endif
+ }
+ #define cubeUV_r0 1.0
+ #define cubeUV_m0 - 2.0
+ #define cubeUV_r1 0.8
+ #define cubeUV_m1 - 1.0
+ #define cubeUV_r4 0.4
+ #define cubeUV_m4 2.0
+ #define cubeUV_r5 0.305
+ #define cubeUV_m5 3.0
+ #define cubeUV_r6 0.21
+ #define cubeUV_m6 4.0
+ float roughnessToMip( float roughness ) {
+ float mip = 0.0;
+ if ( roughness >= cubeUV_r1 ) {
+ mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
+ } else if ( roughness >= cubeUV_r4 ) {
+ mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
+ } else if ( roughness >= cubeUV_r5 ) {
+ mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
+ } else if ( roughness >= cubeUV_r6 ) {
+ mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
+ } else {
+ mip = - 2.0 * log2( 1.16 * roughness ); }
+ return mip;
+ }
+ vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
+ float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
+ float mipF = fract( mip );
+ float mipInt = floor( mip );
+ vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
+ if ( mipF == 0.0 ) {
+ return vec4( color0, 1.0 );
+ } else {
+ vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
+ return vec4( mix( color0, color1, mipF ), 1.0 );
+ }
+ }
+#endif`,Hp=`vec3 transformedNormal = objectNormal;
+#ifdef USE_TANGENT
+ vec3 transformedTangent = objectTangent;
+#endif
+#ifdef USE_BATCHING
+ mat3 bm = mat3( batchingMatrix );
+ transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
+ transformedNormal = bm * transformedNormal;
+ #ifdef USE_TANGENT
+ transformedTangent = bm * transformedTangent;
+ #endif
+#endif
+#ifdef USE_INSTANCING
+ mat3 im = mat3( instanceMatrix );
+ transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
+ transformedNormal = im * transformedNormal;
+ #ifdef USE_TANGENT
+ transformedTangent = im * transformedTangent;
+ #endif
+#endif
+transformedNormal = normalMatrix * transformedNormal;
+#ifdef FLIP_SIDED
+ transformedNormal = - transformedNormal;
+#endif
+#ifdef USE_TANGENT
+ transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
+ #ifdef FLIP_SIDED
+ transformedTangent = - transformedTangent;
+ #endif
+#endif`,Wp=`#ifdef USE_DISPLACEMENTMAP
+ uniform sampler2D displacementMap;
+ uniform float displacementScale;
+ uniform float displacementBias;
+#endif`,qp=`#ifdef USE_DISPLACEMENTMAP
+ transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
+#endif`,Xp=`#ifdef USE_EMISSIVEMAP
+ vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
+ #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
+ emissiveColor = sRGBTransferEOTF( emissiveColor );
+ #endif
+ totalEmissiveRadiance *= emissiveColor.rgb;
+#endif`,jp=`#ifdef USE_EMISSIVEMAP
+ uniform sampler2D emissiveMap;
+#endif`,Kp="gl_FragColor = linearToOutputTexel( gl_FragColor );",Jp=`vec4 LinearTransferOETF( in vec4 value ) {
+ return value;
+}
+vec4 sRGBTransferEOTF( in vec4 value ) {
+ return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
+}
+vec4 sRGBTransferOETF( in vec4 value ) {
+ return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
+}`,Yp=`#ifdef USE_ENVMAP
+ #ifdef ENV_WORLDPOS
+ vec3 cameraToFrag;
+ if ( isOrthographic ) {
+ cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
+ } else {
+ cameraToFrag = normalize( vWorldPosition - cameraPosition );
+ }
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ #ifdef ENVMAP_MODE_REFLECTION
+ vec3 reflectVec = reflect( cameraToFrag, worldNormal );
+ #else
+ vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
+ #endif
+ #else
+ vec3 reflectVec = vReflect;
+ #endif
+ #ifdef ENVMAP_TYPE_CUBE
+ vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
+ #ifdef ENVMAP_BLENDING_MULTIPLY
+ outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
+ #elif defined( ENVMAP_BLENDING_MIX )
+ outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
+ #elif defined( ENVMAP_BLENDING_ADD )
+ outgoingLight += envColor.xyz * specularStrength * reflectivity;
+ #endif
+ #endif
+#endif`,Zp=`#ifdef USE_ENVMAP
+ uniform float envMapIntensity;
+ uniform mat3 envMapRotation;
+ #ifdef ENVMAP_TYPE_CUBE
+ uniform samplerCube envMap;
+ #else
+ uniform sampler2D envMap;
+ #endif
+#endif`,$p=`#ifdef USE_ENVMAP
+ uniform float reflectivity;
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+ varying vec3 vWorldPosition;
+ uniform float refractionRatio;
+ #else
+ varying vec3 vReflect;
+ #endif
+#endif`,Qp=`#ifdef USE_ENVMAP
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+
+ varying vec3 vWorldPosition;
+ #else
+ varying vec3 vReflect;
+ uniform float refractionRatio;
+ #endif
+#endif`,em=`#ifdef USE_ENVMAP
+ #ifdef ENV_WORLDPOS
+ vWorldPosition = worldPosition.xyz;
+ #else
+ vec3 cameraToVertex;
+ if ( isOrthographic ) {
+ cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
+ } else {
+ cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
+ }
+ vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
+ #ifdef ENVMAP_MODE_REFLECTION
+ vReflect = reflect( cameraToVertex, worldNormal );
+ #else
+ vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
+ #endif
+ #endif
+#endif`,tm=`#ifdef USE_FOG
+ vFogDepth = - mvPosition.z;
+#endif`,nm=`#ifdef USE_FOG
+ varying float vFogDepth;
+#endif`,im=`#ifdef USE_FOG
+ #ifdef FOG_EXP2
+ float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
+ #else
+ float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
+ #endif
+ gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
+#endif`,sm=`#ifdef USE_FOG
+ uniform vec3 fogColor;
+ varying float vFogDepth;
+ #ifdef FOG_EXP2
+ uniform float fogDensity;
+ #else
+ uniform float fogNear;
+ uniform float fogFar;
+ #endif
+#endif`,rm=`#ifdef USE_GRADIENTMAP
+ uniform sampler2D gradientMap;
+#endif
+vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
+ float dotNL = dot( normal, lightDirection );
+ vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
+ #ifdef USE_GRADIENTMAP
+ return vec3( texture2D( gradientMap, coord ).r );
+ #else
+ vec2 fw = fwidth( coord ) * 0.5;
+ return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
+ #endif
+}`,am=`#ifdef USE_LIGHTMAP
+ uniform sampler2D lightMap;
+ uniform float lightMapIntensity;
+#endif`,om=`LambertMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.specularStrength = specularStrength;`,cm=`varying vec3 vViewPosition;
+struct LambertMaterial {
+ vec3 diffuseColor;
+ float specularStrength;
+};
+void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_Lambert
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lm=`uniform bool receiveShadow;
+uniform vec3 ambientLightColor;
+#if defined( USE_LIGHT_PROBES )
+ uniform vec3 lightProbe[ 9 ];
+#endif
+vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
+ float x = normal.x, y = normal.y, z = normal.z;
+ vec3 result = shCoefficients[ 0 ] * 0.886227;
+ result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
+ result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
+ result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
+ result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
+ result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
+ result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
+ result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
+ result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
+ return result;
+}
+vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
+ return irradiance;
+}
+vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
+ vec3 irradiance = ambientLightColor;
+ return irradiance;
+}
+float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
+ float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
+ if ( cutoffDistance > 0.0 ) {
+ distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
+ }
+ return distanceFalloff;
+}
+float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
+ return smoothstep( coneCosine, penumbraCosine, angleCosine );
+}
+#if NUM_DIR_LIGHTS > 0
+ struct DirectionalLight {
+ vec3 direction;
+ vec3 color;
+ };
+ uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
+ void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
+ light.color = directionalLight.color;
+ light.direction = directionalLight.direction;
+ light.visible = true;
+ }
+#endif
+#if NUM_POINT_LIGHTS > 0
+ struct PointLight {
+ vec3 position;
+ vec3 color;
+ float distance;
+ float decay;
+ };
+ uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
+ void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
+ vec3 lVector = pointLight.position - geometryPosition;
+ light.direction = normalize( lVector );
+ float lightDistance = length( lVector );
+ light.color = pointLight.color;
+ light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
+ light.visible = ( light.color != vec3( 0.0 ) );
+ }
+#endif
+#if NUM_SPOT_LIGHTS > 0
+ struct SpotLight {
+ vec3 position;
+ vec3 direction;
+ vec3 color;
+ float distance;
+ float decay;
+ float coneCos;
+ float penumbraCos;
+ };
+ uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
+ void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
+ vec3 lVector = spotLight.position - geometryPosition;
+ light.direction = normalize( lVector );
+ float angleCos = dot( light.direction, spotLight.direction );
+ float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
+ if ( spotAttenuation > 0.0 ) {
+ float lightDistance = length( lVector );
+ light.color = spotLight.color * spotAttenuation;
+ light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
+ light.visible = ( light.color != vec3( 0.0 ) );
+ } else {
+ light.color = vec3( 0.0 );
+ light.visible = false;
+ }
+ }
+#endif
+#if NUM_RECT_AREA_LIGHTS > 0
+ struct RectAreaLight {
+ vec3 color;
+ vec3 position;
+ vec3 halfWidth;
+ vec3 halfHeight;
+ };
+ uniform sampler2D ltc_1; uniform sampler2D ltc_2;
+ uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
+#endif
+#if NUM_HEMI_LIGHTS > 0
+ struct HemisphereLight {
+ vec3 direction;
+ vec3 skyColor;
+ vec3 groundColor;
+ };
+ uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
+ vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
+ float dotNL = dot( normal, hemiLight.direction );
+ float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
+ vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
+ return irradiance;
+ }
+#endif
+#include <lightprobes_pars_fragment>`,hm=`#ifdef USE_ENVMAP
+ vec3 getIBLIrradiance( const in vec3 normal ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
+ return PI * envMapColor.rgb * envMapIntensity;
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 reflectVec = reflect( - viewDir, normal );
+ reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
+ reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
+ return envMapColor.rgb * envMapIntensity;
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ #ifdef USE_ANISOTROPY
+ vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 bentNormal = cross( bitangent, viewDir );
+ bentNormal = normalize( cross( bentNormal, bitangent ) );
+ bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
+ return getIBLRadiance( viewDir, bentNormal, roughness );
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ #endif
+#endif`,um=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,dm=`varying vec3 vViewPosition;
+struct ToonMaterial {
+ vec3 diffuseColor;
+};
+void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_Toon
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,fm=`BlinnPhongMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.specularColor = specular;
+material.specularShininess = shininess;
+material.specularStrength = specularStrength;`,pm=`varying vec3 vViewPosition;
+struct BlinnPhongMaterial {
+ vec3 diffuseColor;
+ vec3 specularColor;
+ float specularShininess;
+ float specularStrength;
+};
+void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+ reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
+}
+void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_BlinnPhong
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,mm=`PhysicalMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
+material.metalness = metalnessFactor;
+vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
+float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
+material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
+material.roughness = min( material.roughness, 1.0 );
+#ifdef IOR
+ material.ior = ior;
+ #ifdef USE_SPECULAR
+ float specularIntensityFactor = specularIntensity;
+ vec3 specularColorFactor = specularColor;
+ #ifdef USE_SPECULAR_COLORMAP
+ specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
+ #endif
+ #ifdef USE_SPECULAR_INTENSITYMAP
+ specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
+ #endif
+ material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
+ #else
+ float specularIntensityFactor = 1.0;
+ vec3 specularColorFactor = vec3( 1.0 );
+ material.specularF90 = 1.0;
+ #endif
+ material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
+#else
+ material.specularColor = vec3( 0.04 );
+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
+ material.specularF90 = 1.0;
+#endif
+#ifdef USE_CLEARCOAT
+ material.clearcoat = clearcoat;
+ material.clearcoatRoughness = clearcoatRoughness;
+ material.clearcoatF0 = vec3( 0.04 );
+ material.clearcoatF90 = 1.0;
+ #ifdef USE_CLEARCOATMAP
+ material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
+ #endif
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
+ #endif
+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
+ material.clearcoatRoughness += geometryRoughness;
+ material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
+#endif
+#ifdef USE_DISPERSION
+ material.dispersion = dispersion;
+#endif
+#ifdef USE_IRIDESCENCE
+ material.iridescence = iridescence;
+ material.iridescenceIOR = iridescenceIOR;
+ #ifdef USE_IRIDESCENCEMAP
+ material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
+ #endif
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
+ material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
+ #else
+ material.iridescenceThickness = iridescenceThicknessMaximum;
+ #endif
+#endif
+#ifdef USE_SHEEN
+ material.sheenColor = sheenColor;
+ #ifdef USE_SHEEN_COLORMAP
+ material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
+ #endif
+ material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
+ #ifdef USE_SHEEN_ROUGHNESSMAP
+ material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
+ #endif
+#endif
+#ifdef USE_ANISOTROPY
+ #ifdef USE_ANISOTROPYMAP
+ mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
+ vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
+ vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
+ #else
+ vec2 anisotropyV = anisotropyVector;
+ #endif
+ material.anisotropy = length( anisotropyV );
+ if( material.anisotropy == 0.0 ) {
+ anisotropyV = vec2( 1.0, 0.0 );
+ } else {
+ anisotropyV /= material.anisotropy;
+ material.anisotropy = saturate( material.anisotropy );
+ }
+ material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
+ material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
+ material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
+#endif`,gm=`uniform sampler2D dfgLUT;
+struct PhysicalMaterial {
+ vec3 diffuseColor;
+ vec3 diffuseContribution;
+ vec3 specularColor;
+ vec3 specularColorBlended;
+ float roughness;
+ float metalness;
+ float specularF90;
+ float dispersion;
+ #ifdef USE_CLEARCOAT
+ float clearcoat;
+ float clearcoatRoughness;
+ vec3 clearcoatF0;
+ float clearcoatF90;
+ #endif
+ #ifdef USE_IRIDESCENCE
+ float iridescence;
+ float iridescenceIOR;
+ float iridescenceThickness;
+ vec3 iridescenceFresnel;
+ vec3 iridescenceF0;
+ vec3 iridescenceFresnelDielectric;
+ vec3 iridescenceFresnelMetallic;
+ #endif
+ #ifdef USE_SHEEN
+ vec3 sheenColor;
+ float sheenRoughness;
+ #endif
+ #ifdef IOR
+ float ior;
+ #endif
+ #ifdef USE_TRANSMISSION
+ float transmission;
+ float transmissionAlpha;
+ float thickness;
+ float attenuationDistance;
+ vec3 attenuationColor;
+ #endif
+ #ifdef USE_ANISOTROPY
+ float anisotropy;
+ float alphaT;
+ vec3 anisotropyT;
+ vec3 anisotropyB;
+ #endif
+};
+vec3 clearcoatSpecularDirect = vec3( 0.0 );
+vec3 clearcoatSpecularIndirect = vec3( 0.0 );
+vec3 sheenSpecularDirect = vec3( 0.0 );
+vec3 sheenSpecularIndirect = vec3(0.0 );
+vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
+ float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
+ float x2 = x * x;
+ float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
+ return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
+}
+float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
+ float a2 = pow2( alpha );
+ float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
+ float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
+ return 0.5 / max( gv + gl, EPSILON );
+}
+float D_GGX( const in float alpha, const in float dotNH ) {
+ float a2 = pow2( alpha );
+ float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
+ return RECIPROCAL_PI * a2 / pow2( denom );
+}
+#ifdef USE_ANISOTROPY
+ float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
+ float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
+ float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
+ return 0.5 / max( gv + gl, EPSILON );
+ }
+ float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
+ float a2 = alphaT * alphaB;
+ highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
+ highp float v2 = dot( v, v );
+ float w2 = a2 / v2;
+ return RECIPROCAL_PI * a2 * pow2 ( w2 );
+ }
+#endif
+#ifdef USE_CLEARCOAT
+ vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
+ vec3 f0 = material.clearcoatF0;
+ float f90 = material.clearcoatF90;
+ float roughness = material.clearcoatRoughness;
+ float alpha = pow2( roughness );
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float dotVH = saturate( dot( viewDir, halfDir ) );
+ vec3 F = F_Schlick( f0, f90, dotVH );
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
+ float D = D_GGX( alpha, dotNH );
+ return F * ( V * D );
+ }
+#endif
+vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
+ vec3 f0 = material.specularColorBlended;
+ float f90 = material.specularF90;
+ float roughness = material.roughness;
+ float alpha = pow2( roughness );
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float dotVH = saturate( dot( viewDir, halfDir ) );
+ vec3 F = F_Schlick( f0, f90, dotVH );
+ #ifdef USE_IRIDESCENCE
+ F = mix( F, material.iridescenceFresnel, material.iridescence );
+ #endif
+ #ifdef USE_ANISOTROPY
+ float dotTL = dot( material.anisotropyT, lightDir );
+ float dotTV = dot( material.anisotropyT, viewDir );
+ float dotTH = dot( material.anisotropyT, halfDir );
+ float dotBL = dot( material.anisotropyB, lightDir );
+ float dotBV = dot( material.anisotropyB, viewDir );
+ float dotBH = dot( material.anisotropyB, halfDir );
+ float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
+ float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
+ #else
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
+ float D = D_GGX( alpha, dotNH );
+ #endif
+ return F * ( V * D );
+}
+vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
+ const float LUT_SIZE = 64.0;
+ const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
+ const float LUT_BIAS = 0.5 / LUT_SIZE;
+ float dotNV = saturate( dot( N, V ) );
+ vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
+ uv = uv * LUT_SCALE + LUT_BIAS;
+ return uv;
+}
+float LTC_ClippedSphereFormFactor( const in vec3 f ) {
+ float l = length( f );
+ return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
+}
+vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
+ float x = dot( v1, v2 );
+ float y = abs( x );
+ float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
+ float b = 3.4175940 + ( 4.1616724 + y ) * y;
+ float v = a / b;
+ float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
+ return cross( v1, v2 ) * theta_sintheta;
+}
+vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
+ vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
+ vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
+ vec3 lightNormal = cross( v1, v2 );
+ if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
+ vec3 T1, T2;
+ T1 = normalize( V - N * dot( V, N ) );
+ T2 = - cross( N, T1 );
+ mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
+ vec3 coords[ 4 ];
+ coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
+ coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
+ coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
+ coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
+ coords[ 0 ] = normalize( coords[ 0 ] );
+ coords[ 1 ] = normalize( coords[ 1 ] );
+ coords[ 2 ] = normalize( coords[ 2 ] );
+ coords[ 3 ] = normalize( coords[ 3 ] );
+ vec3 vectorFormFactor = vec3( 0.0 );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
+ float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
+ return vec3( result );
+}
+#if defined( USE_SHEEN )
+float D_Charlie( float roughness, float dotNH ) {
+ float alpha = pow2( roughness );
+ float invAlpha = 1.0 / alpha;
+ float cos2h = dotNH * dotNH;
+ float sin2h = max( 1.0 - cos2h, 0.0078125 );
+ return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
+}
+float V_Neubelt( float dotNV, float dotNL ) {
+ return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
+}
+vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float D = D_Charlie( sheenRoughness, dotNH );
+ float V = V_Neubelt( dotNV, dotNL );
+ return sheenColor * ( D * V );
+}
+#endif
+float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float r2 = roughness * roughness;
+ float rInv = 1.0 / ( roughness + 0.1 );
+ float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
+ float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
+ float DG = exp( a * dotNV + b );
+ return saturate( DG );
+}
+vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
+ float dotNV = saturate( dot( normal, viewDir ) );
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
+ return specularColor * fab.x + specularF90 * fab.y;
+}
+#ifdef USE_IRIDESCENCE
+void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
+#else
+void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
+#endif
+ float dotNV = saturate( dot( normal, viewDir ) );
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
+ #ifdef USE_IRIDESCENCE
+ vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
+ #else
+ vec3 Fr = specularColor;
+ #endif
+ vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
+ float Ess = fab.x + fab.y;
+ float Ems = 1.0 - Ess;
+ vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
+ singleScatter += FssEss;
+ multiScatter += Fms * Ems;
+}
+vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
+ vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
+ vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
+ vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
+ vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
+ float Ess_V = dfgV.x + dfgV.y;
+ float Ess_L = dfgL.x + dfgL.y;
+ float Ems_V = 1.0 - Ess_V;
+ float Ems_L = 1.0 - Ess_L;
+ vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
+ vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
+ float compensationFactor = Ems_V * Ems_L;
+ vec3 multiScatter = Fms * compensationFactor;
+ return singleScatter + multiScatter;
+}
+#if NUM_RECT_AREA_LIGHTS > 0
+ void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 normal = geometryNormal;
+ vec3 viewDir = geometryViewDir;
+ vec3 position = geometryPosition;
+ vec3 lightPos = rectAreaLight.position;
+ vec3 halfWidth = rectAreaLight.halfWidth;
+ vec3 halfHeight = rectAreaLight.halfHeight;
+ vec3 lightColor = rectAreaLight.color;
+ float roughness = material.roughness;
+ vec3 rectCoords[ 4 ];
+ rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
+ rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
+ rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
+ vec2 uv = LTC_Uv( normal, viewDir, roughness );
+ vec4 t1 = texture2D( ltc_1, uv );
+ vec4 t2 = texture2D( ltc_2, uv );
+ mat3 mInv = mat3(
+ vec3( t1.x, 0, t1.y ),
+ vec3( 0, 1, 0 ),
+ vec3( t1.z, 0, t1.w )
+ );
+ vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
+ reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
+ reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
+ #ifdef USE_CLEARCOAT
+ vec3 Ncc = geometryClearcoatNormal;
+ vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
+ vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
+ vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
+ mat3 mInvClearcoat = mat3(
+ vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
+ vec3( 0, 1, 0 ),
+ vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
+ );
+ vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
+ clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
+ #endif
+ }
+#endif
+void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ #ifdef USE_CLEARCOAT
+ float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
+ vec3 ccIrradiance = dotNLcc * directLight.color;
+ clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
+ #endif
+ #ifdef USE_SHEEN
+
+ sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
+
+ float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
+ float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
+
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
+
+ irradiance *= sheenEnergyComp;
+
+ #endif
+ reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
+}
+void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
+ #ifdef USE_SHEEN
+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
+ diffuse *= sheenEnergyComp;
+ #endif
+ reflectedLight.indirectDiffuse += diffuse;
+}
+void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
+ #ifdef USE_CLEARCOAT
+ clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
+ #endif
+ #ifdef USE_SHEEN
+ sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
+ #endif
+ vec3 singleScatteringDielectric = vec3( 0.0 );
+ vec3 multiScatteringDielectric = vec3( 0.0 );
+ vec3 singleScatteringMetallic = vec3( 0.0 );
+ vec3 multiScatteringMetallic = vec3( 0.0 );
+ #ifdef USE_IRIDESCENCE
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
+ #else
+ computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
+ computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
+ #endif
+ vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
+ vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
+ vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
+ vec3 indirectSpecular = radiance * singleScattering;
+ indirectSpecular += multiScattering * cosineWeightedIrradiance;
+ vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
+ #ifdef USE_SHEEN
+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
+ indirectSpecular *= sheenEnergyComp;
+ indirectDiffuse *= sheenEnergyComp;
+ #endif
+ reflectedLight.indirectSpecular += indirectSpecular;
+ reflectedLight.indirectDiffuse += indirectDiffuse;
+}
+#define RE_Direct RE_Direct_Physical
+#define RE_Direct_RectArea RE_Direct_RectArea_Physical
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
+#define RE_IndirectSpecular RE_IndirectSpecular_Physical
+float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
+ return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
+}`,bm=`
+vec3 geometryPosition = - vViewPosition;
+vec3 geometryNormal = normal;
+vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
+vec3 geometryClearcoatNormal = vec3( 0.0 );
+#ifdef USE_CLEARCOAT
+ geometryClearcoatNormal = clearcoatNormal;
+#endif
+#ifdef USE_IRIDESCENCE
+ float dotNVi = saturate( dot( normal, geometryViewDir ) );
+ if ( material.iridescenceThickness == 0.0 ) {
+ material.iridescence = 0.0;
+ } else {
+ material.iridescence = saturate( material.iridescence );
+ }
+ if ( material.iridescence > 0.0 ) {
+ material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
+ material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
+ material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
+ material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
+ }
+#endif
+IncidentLight directLight;
+#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
+ PointLight pointLight;
+ #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
+ PointLightShadow pointLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
+ pointLight = pointLights[ i ];
+ getPointLightInfo( pointLight, geometryPosition, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
+ pointLightShadow = pointLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
+ SpotLight spotLight;
+ vec4 spotColor;
+ vec3 spotLightCoord;
+ bool inSpotLightMap;
+ #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
+ SpotLightShadow spotLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
+ spotLight = spotLights[ i ];
+ getSpotLightInfo( spotLight, geometryPosition, directLight );
+ #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
+ #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
+ #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
+ #else
+ #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
+ #endif
+ #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
+ spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
+ inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
+ spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
+ directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
+ #endif
+ #undef SPOT_LIGHT_MAP_INDEX
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ spotLightShadow = spotLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
+ DirectionalLight directionalLight;
+ #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
+ DirectionalLightShadow directionalLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
+ directionalLight = directionalLights[ i ];
+ getDirectionalLightInfo( directionalLight, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
+ directionalLightShadow = directionalLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
+ RectAreaLight rectAreaLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
+ rectAreaLight = rectAreaLights[ i ];
+ RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if defined( RE_IndirectDiffuse )
+ vec3 iblIrradiance = vec3( 0.0 );
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
+ #if defined( USE_LIGHT_PROBES )
+ irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
+ #endif
+ #if ( NUM_HEMI_LIGHTS > 0 )
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
+ }
+ #pragma unroll_loop_end
+ #endif
+ #ifdef USE_LIGHT_PROBES_GRID
+ vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
+ vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );
+ irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
+ #endif
+#endif
+#if defined( RE_IndirectSpecular )
+ vec3 radiance = vec3( 0.0 );
+ vec3 clearcoatRadiance = vec3( 0.0 );
+#endif`,xm=`#if defined( RE_IndirectDiffuse )
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
+ irradiance += lightMapIrradiance;
+ #endif
+ #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
+ #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
+ iblIrradiance += getIBLIrradiance( geometryNormal );
+ #endif
+ #endif
+#endif
+#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
+ #ifdef USE_ANISOTROPY
+ radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
+ #else
+ radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
+ #endif
+ #ifdef USE_CLEARCOAT
+ clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
+ #endif
+#endif`,_m=`#if defined( RE_IndirectDiffuse )
+ #if defined( LAMBERT ) || defined( PHONG )
+ irradiance += iblIrradiance;
+ #endif
+ RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+#endif
+#if defined( RE_IndirectSpecular )
+ RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+#endif`,vm=`#ifdef USE_LIGHT_PROBES_GRID
+uniform highp sampler3D probesSH;
+uniform vec3 probesMin;
+uniform vec3 probesMax;
+uniform vec3 probesResolution;
+vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
+ vec3 res = probesResolution;
+ vec3 gridRange = probesMax - probesMin;
+ vec3 resMinusOne = res - 1.0;
+ vec3 probeSpacing = gridRange / resMinusOne;
+ vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
+ vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
+ uvw = uvw * resMinusOne / res + 0.5 / res;
+ float nz = res.z;
+ float paddedSlices = nz + 2.0;
+ float atlasDepth = 7.0 * paddedSlices;
+ float uvZBase = uvw.z * nz + 1.0;
+ vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
+ vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
+ vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
+ vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
+ vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
+ vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
+ vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
+ vec3 c0 = s0.xyz;
+ vec3 c1 = vec3( s0.w, s1.xy );
+ vec3 c2 = vec3( s1.zw, s2.x );
+ vec3 c3 = s2.yzw;
+ vec3 c4 = s3.xyz;
+ vec3 c5 = vec3( s3.w, s4.xy );
+ vec3 c6 = vec3( s4.zw, s5.x );
+ vec3 c7 = s5.yzw;
+ vec3 c8 = s6.xyz;
+ float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
+ vec3 result = c0 * 0.886227;
+ result += c1 * 2.0 * 0.511664 * y;
+ result += c2 * 2.0 * 0.511664 * z;
+ result += c3 * 2.0 * 0.511664 * x;
+ result += c4 * 2.0 * 0.429043 * x * y;
+ result += c5 * 2.0 * 0.429043 * y * z;
+ result += c6 * ( 0.743125 * z * z - 0.247708 );
+ result += c7 * 2.0 * 0.429043 * x * z;
+ result += c8 * 0.429043 * ( x * x - y * y );
+ return max( result, vec3( 0.0 ) );
+}
+#endif`,ym=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
+#endif`,Mm=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+ uniform float logDepthBufFC;
+ varying float vFragDepth;
+ varying float vIsPerspective;
+#endif`,Sm=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+ varying float vFragDepth;
+ varying float vIsPerspective;
+#endif`,Am=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+ vFragDepth = 1.0 + gl_Position.w;
+ vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
+#endif`,Tm=`#ifdef USE_MAP
+ vec4 sampledDiffuseColor = texture2D( map, vMapUv );
+ #ifdef DECODE_VIDEO_TEXTURE
+ sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
+ #endif
+ diffuseColor *= sampledDiffuseColor;
+#endif`,wm=`#ifdef USE_MAP
+ uniform sampler2D map;
+#endif`,Em=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ #if defined( USE_POINTS_UV )
+ vec2 uv = vUv;
+ #else
+ vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
+ #endif
+#endif
+#ifdef USE_MAP
+ diffuseColor *= texture2D( map, uv );
+#endif
+#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, uv ).g;
+#endif`,Rm=`#if defined( USE_POINTS_UV )
+ varying vec2 vUv;
+#else
+ #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ uniform mat3 uvTransform;
+ #endif
+#endif
+#ifdef USE_MAP
+ uniform sampler2D map;
+#endif
+#ifdef USE_ALPHAMAP
+ uniform sampler2D alphaMap;
+#endif`,Cm=`float metalnessFactor = metalness;
+#ifdef USE_METALNESSMAP
+ vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
+ metalnessFactor *= texelMetalness.b;
+#endif`,Pm=`#ifdef USE_METALNESSMAP
+ uniform sampler2D metalnessMap;
+#endif`,Im=`#ifdef USE_INSTANCING_MORPH
+ float morphTargetInfluences[ MORPHTARGETS_COUNT ];
+ float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
+ }
+#endif`,Lm=`#if defined( USE_MORPHCOLORS )
+ vColor *= morphTargetBaseInfluence;
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ #if defined( USE_COLOR_ALPHA )
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
+ #elif defined( USE_COLOR )
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
+ #endif
+ }
+#endif`,Dm=`#ifdef USE_MORPHNORMALS
+ objectNormal *= morphTargetBaseInfluence;
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
+ }
+#endif`,Fm=`#ifdef USE_MORPHTARGETS
+ #ifndef USE_INSTANCING_MORPH
+ uniform float morphTargetBaseInfluence;
+ uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
+ #endif
+ uniform sampler2DArray morphTargetsTexture;
+ uniform ivec2 morphTargetsTextureSize;
+ vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
+ int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
+ int y = texelIndex / morphTargetsTextureSize.x;
+ int x = texelIndex - y * morphTargetsTextureSize.x;
+ ivec3 morphUV = ivec3( x, y, morphTargetIndex );
+ return texelFetch( morphTargetsTexture, morphUV, 0 );
+ }
+#endif`,Nm=`#ifdef USE_MORPHTARGETS
+ transformed *= morphTargetBaseInfluence;
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
+ }
+#endif`,Um=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#ifdef FLAT_SHADED
+ vec3 fdx = dFdx( vViewPosition );
+ vec3 fdy = dFdy( vViewPosition );
+ vec3 normal = normalize( cross( fdx, fdy ) );
+#else
+ vec3 normal = normalize( vNormal );
+ #ifdef DOUBLE_SIDED
+ normal *= faceDirection;
+ #endif
+#endif
+#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
+ #ifdef USE_TANGENT
+ mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
+ #else
+ mat3 tbn = getTangentFrame( - vViewPosition, normal,
+ #if defined( USE_NORMALMAP )
+ vNormalMapUv
+ #elif defined( USE_CLEARCOAT_NORMALMAP )
+ vClearcoatNormalMapUv
+ #else
+ vUv
+ #endif
+ );
+ #endif
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
+ tbn[0] *= faceDirection;
+ tbn[1] *= faceDirection;
+ #endif
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ #ifdef USE_TANGENT
+ mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
+ #else
+ mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
+ #endif
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
+ tbn2[0] *= faceDirection;
+ tbn2[1] *= faceDirection;
+ #endif
+#endif
+vec3 nonPerturbedNormal = normal;`,Om=`#ifdef USE_NORMALMAP_OBJECTSPACE
+ normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
+ #ifdef FLIP_SIDED
+ normal = - normal;
+ #endif
+ #ifdef DOUBLE_SIDED
+ normal = normal * faceDirection;
+ #endif
+ normal = normalize( normalMatrix * normal );
+#elif defined( USE_NORMALMAP_TANGENTSPACE )
+ vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
+ #if defined( USE_PACKED_NORMALMAP )
+ mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
+ #endif
+ mapN.xy *= normalScale;
+ normal = normalize( tbn * mapN );
+#elif defined( USE_BUMPMAP )
+ normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
+#endif`,km=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,Bm=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,zm=`#ifndef FLAT_SHADED
+ vNormal = normalize( transformedNormal );
+ #ifdef USE_TANGENT
+ vTangent = normalize( transformedTangent );
+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
+ #endif
+#endif`,Gm=`#ifdef USE_NORMALMAP
+ uniform sampler2D normalMap;
+ uniform vec2 normalScale;
+#endif
+#ifdef USE_NORMALMAP_OBJECTSPACE
+ uniform mat3 normalMatrix;
+#endif
+#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
+ mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
+ vec3 q0 = dFdx( eye_pos.xyz );
+ vec3 q1 = dFdy( eye_pos.xyz );
+ vec2 st0 = dFdx( uv.st );
+ vec2 st1 = dFdy( uv.st );
+ vec3 N = surf_norm;
+ vec3 q1perp = cross( q1, N );
+ vec3 q0perp = cross( N, q0 );
+ vec3 T = q1perp * st0.x + q0perp * st1.x;
+ vec3 B = q1perp * st0.y + q0perp * st1.y;
+ float det = max( dot( T, T ), dot( B, B ) );
+ float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
+ return mat3( T * scale, B * scale, N );
+ }
+#endif`,Vm=`#ifdef USE_CLEARCOAT
+ vec3 clearcoatNormal = nonPerturbedNormal;
+#endif`,Hm=`#ifdef USE_CLEARCOAT_NORMALMAP
+ vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
+ clearcoatMapN.xy *= clearcoatNormalScale;
+ clearcoatNormal = normalize( tbn2 * clearcoatMapN );
+#endif`,Wm=`#ifdef USE_CLEARCOATMAP
+ uniform sampler2D clearcoatMap;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ uniform sampler2D clearcoatNormalMap;
+ uniform vec2 clearcoatNormalScale;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ uniform sampler2D clearcoatRoughnessMap;
+#endif`,qm=`#ifdef USE_IRIDESCENCEMAP
+ uniform sampler2D iridescenceMap;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ uniform sampler2D iridescenceThicknessMap;
+#endif`,Xm=`#ifdef OPAQUE
+diffuseColor.a = 1.0;
+#endif
+#ifdef USE_TRANSMISSION
+diffuseColor.a *= material.transmissionAlpha;
+#endif
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,jm=`vec3 packNormalToRGB( const in vec3 normal ) {
+ return normalize( normal ) * 0.5 + 0.5;
+}
+vec3 unpackRGBToNormal( const in vec3 rgb ) {
+ return 2.0 * rgb.xyz - 1.0;
+}
+const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
+const float Inv255 = 1. / 255.;
+const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
+const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
+const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
+const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
+vec4 packDepthToRGBA( const in float v ) {
+ if( v <= 0.0 )
+ return vec4( 0., 0., 0., 0. );
+ if( v >= 1.0 )
+ return vec4( 1., 1., 1., 1. );
+ float vuf;
+ float af = modf( v * PackFactors.a, vuf );
+ float bf = modf( vuf * ShiftRight8, vuf );
+ float gf = modf( vuf * ShiftRight8, vuf );
+ return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
+}
+vec3 packDepthToRGB( const in float v ) {
+ if( v <= 0.0 )
+ return vec3( 0., 0., 0. );
+ if( v >= 1.0 )
+ return vec3( 1., 1., 1. );
+ float vuf;
+ float bf = modf( v * PackFactors.b, vuf );
+ float gf = modf( vuf * ShiftRight8, vuf );
+ return vec3( vuf * Inv255, gf * PackUpscale, bf );
+}
+vec2 packDepthToRG( const in float v ) {
+ if( v <= 0.0 )
+ return vec2( 0., 0. );
+ if( v >= 1.0 )
+ return vec2( 1., 1. );
+ float vuf;
+ float gf = modf( v * 256., vuf );
+ return vec2( vuf * Inv255, gf );
+}
+float unpackRGBAToDepth( const in vec4 v ) {
+ return dot( v, UnpackFactors4 );
+}
+float unpackRGBToDepth( const in vec3 v ) {
+ return dot( v, UnpackFactors3 );
+}
+float unpackRGToDepth( const in vec2 v ) {
+ return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
+}
+vec4 pack2HalfToRGBA( const in vec2 v ) {
+ vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
+ return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
+}
+vec2 unpackRGBATo2Half( const in vec4 v ) {
+ return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
+}
+float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
+ return ( viewZ + near ) / ( near - far );
+}
+float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+
+ return depth * ( far - near ) - far;
+ #else
+ return depth * ( near - far ) - near;
+ #endif
+}
+float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
+ return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
+}
+float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
+
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ return ( near * far ) / ( ( near - far ) * depth - near );
+ #else
+ return ( near * far ) / ( ( far - near ) * depth - far );
+ #endif
+}`,Km=`#ifdef PREMULTIPLIED_ALPHA
+ gl_FragColor.rgb *= gl_FragColor.a;
+#endif`,Jm=`vec4 mvPosition = vec4( transformed, 1.0 );
+#ifdef USE_BATCHING
+ mvPosition = batchingMatrix * mvPosition;
+#endif
+#ifdef USE_INSTANCING
+ mvPosition = instanceMatrix * mvPosition;
+#endif
+mvPosition = modelViewMatrix * mvPosition;
+gl_Position = projectionMatrix * mvPosition;`,Ym=`#ifdef DITHERING
+ gl_FragColor.rgb = dithering( gl_FragColor.rgb );
+#endif`,Zm=`#ifdef DITHERING
+ vec3 dithering( vec3 color ) {
+ float grid_position = rand( gl_FragCoord.xy );
+ vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
+ dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
+ return color + dither_shift_RGB;
+ }
+#endif`,$m=`float roughnessFactor = roughness;
+#ifdef USE_ROUGHNESSMAP
+ vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
+ roughnessFactor *= texelRoughness.g;
+#endif`,Qm=`#ifdef USE_ROUGHNESSMAP
+ uniform sampler2D roughnessMap;
+#endif`,eg=`#if NUM_SPOT_LIGHT_COORDS > 0
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
+#endif
+#if NUM_SPOT_LIGHT_MAPS > 0
+ uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
+#endif
+#ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ #if defined( SHADOWMAP_TYPE_PCF )
+ uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
+ #else
+ uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
+ #endif
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
+ struct DirectionalLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ #if defined( SHADOWMAP_TYPE_PCF )
+ uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
+ #else
+ uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
+ #endif
+ struct SpotLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ #if defined( SHADOWMAP_TYPE_PCF )
+ uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
+ #elif defined( SHADOWMAP_TYPE_BASIC )
+ uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
+ #endif
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
+ struct PointLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ float shadowCameraNear;
+ float shadowCameraFar;
+ };
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
+ #endif
+ #if defined( SHADOWMAP_TYPE_PCF )
+ float interleavedGradientNoise( vec2 position ) {
+ return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
+ }
+ vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
+ const float goldenAngle = 2.399963229728653;
+ float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
+ float theta = float( sampleIndex ) * goldenAngle + phi;
+ return vec2( cos( theta ), sin( theta ) ) * r;
+ }
+ #endif
+ #if defined( SHADOWMAP_TYPE_PCF )
+ float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
+ float shadow = 1.0;
+ shadowCoord.xyz /= shadowCoord.w;
+ shadowCoord.z += shadowBias;
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
+ if ( frustumTest ) {
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
+ float radius = shadowRadius * texelSize.x;
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
+ shadow = (
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
+ ) * 0.2;
+ }
+ return mix( 1.0, shadow, shadowIntensity );
+ }
+ #elif defined( SHADOWMAP_TYPE_VSM )
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
+ float shadow = 1.0;
+ shadowCoord.xyz /= shadowCoord.w;
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ shadowCoord.z -= shadowBias;
+ #else
+ shadowCoord.z += shadowBias;
+ #endif
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
+ if ( frustumTest ) {
+ vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
+ float mean = distribution.x;
+ float variance = distribution.y * distribution.y;
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ float hard_shadow = step( mean, shadowCoord.z );
+ #else
+ float hard_shadow = step( shadowCoord.z, mean );
+ #endif
+
+ if ( hard_shadow == 1.0 ) {
+ shadow = 1.0;
+ } else {
+ variance = max( variance, 0.0000001 );
+ float d = shadowCoord.z - mean;
+ float p_max = variance / ( variance + d * d );
+ p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
+ shadow = max( hard_shadow, p_max );
+ }
+ }
+ return mix( 1.0, shadow, shadowIntensity );
+ }
+ #else
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
+ float shadow = 1.0;
+ shadowCoord.xyz /= shadowCoord.w;
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ shadowCoord.z -= shadowBias;
+ #else
+ shadowCoord.z += shadowBias;
+ #endif
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
+ if ( frustumTest ) {
+ float depth = texture2D( shadowMap, shadowCoord.xy ).r;
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ shadow = step( depth, shadowCoord.z );
+ #else
+ shadow = step( shadowCoord.z, depth );
+ #endif
+ }
+ return mix( 1.0, shadow, shadowIntensity );
+ }
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ #if defined( SHADOWMAP_TYPE_PCF )
+ float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
+ float shadow = 1.0;
+ vec3 lightToPosition = shadowCoord.xyz;
+ vec3 bd3D = normalize( lightToPosition );
+ vec3 absVec = abs( lightToPosition );
+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
+ dp -= shadowBias;
+ #else
+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
+ dp += shadowBias;
+ #endif
+ float texelSize = shadowRadius / shadowMapSize.x;
+ vec3 absDir = abs( bd3D );
+ vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
+ tangent = normalize( cross( bd3D, tangent ) );
+ vec3 bitangent = cross( bd3D, tangent );
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
+ vec2 sample0 = vogelDiskSample( 0, 5, phi );
+ vec2 sample1 = vogelDiskSample( 1, 5, phi );
+ vec2 sample2 = vogelDiskSample( 2, 5, phi );
+ vec2 sample3 = vogelDiskSample( 3, 5, phi );
+ vec2 sample4 = vogelDiskSample( 4, 5, phi );
+ shadow = (
+ texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
+ texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
+ texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
+ texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
+ texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
+ ) * 0.2;
+ }
+ return mix( 1.0, shadow, shadowIntensity );
+ }
+ #elif defined( SHADOWMAP_TYPE_BASIC )
+ float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
+ float shadow = 1.0;
+ vec3 lightToPosition = shadowCoord.xyz;
+ vec3 absVec = abs( lightToPosition );
+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
+ dp += shadowBias;
+ vec3 bd3D = normalize( lightToPosition );
+ float depth = textureCube( shadowMap, bd3D ).r;
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ depth = 1.0 - depth;
+ #endif
+ shadow = step( dp, depth );
+ }
+ return mix( 1.0, shadow, shadowIntensity );
+ }
+ #endif
+ #endif
+#endif`,tg=`#if NUM_SPOT_LIGHT_COORDS > 0
+ uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
+#endif
+#ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
+ struct DirectionalLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ struct SpotLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
+ struct PointLightShadow {
+ float shadowIntensity;
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ float shadowCameraNear;
+ float shadowCameraFar;
+ };
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
+ #endif
+#endif`,ng=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+ #ifdef HAS_NORMAL
+ vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
+ #else
+ vec3 shadowWorldNormal = vec3( 0.0 );
+ #endif
+ vec4 shadowWorldPosition;
+#endif
+#if defined( USE_SHADOWMAP )
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
+ vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
+ vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+ #endif
+#endif
+#if NUM_SPOT_LIGHT_COORDS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
+ shadowWorldPosition = worldPosition;
+ #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
+ #endif
+ vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+#endif`,ig=`float getShadowMask() {
+ float shadow = 1.0;
+ #ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ DirectionalLightShadow directionalLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
+ directionalLight = directionalLightShadows[ i ];
+ shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ SpotLightShadow spotLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
+ spotLight = spotLightShadows[ i ];
+ shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
+ PointLightShadow pointLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
+ pointLight = pointLightShadows[ i ];
+ shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #endif
+ return shadow;
+}`,sg=`#ifdef USE_SKINNING
+ mat4 boneMatX = getBoneMatrix( skinIndex.x );
+ mat4 boneMatY = getBoneMatrix( skinIndex.y );
+ mat4 boneMatZ = getBoneMatrix( skinIndex.z );
+ mat4 boneMatW = getBoneMatrix( skinIndex.w );
+#endif`,rg=`#ifdef USE_SKINNING
+ uniform mat4 bindMatrix;
+ uniform mat4 bindMatrixInverse;
+ uniform highp sampler2D boneTexture;
+ mat4 getBoneMatrix( const in float i ) {
+ int size = textureSize( boneTexture, 0 ).x;
+ int j = int( i ) * 4;
+ int x = j % size;
+ int y = j / size;
+ vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
+ vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
+ vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
+ vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
+ return mat4( v1, v2, v3, v4 );
+ }
+#endif`,ag=`#ifdef USE_SKINNING
+ vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
+ vec4 skinned = vec4( 0.0 );
+ skinned += boneMatX * skinVertex * skinWeight.x;
+ skinned += boneMatY * skinVertex * skinWeight.y;
+ skinned += boneMatZ * skinVertex * skinWeight.z;
+ skinned += boneMatW * skinVertex * skinWeight.w;
+ transformed = ( bindMatrixInverse * skinned ).xyz;
+#endif`,og=`#ifdef USE_SKINNING
+ mat4 skinMatrix = mat4( 0.0 );
+ skinMatrix += skinWeight.x * boneMatX;
+ skinMatrix += skinWeight.y * boneMatY;
+ skinMatrix += skinWeight.z * boneMatZ;
+ skinMatrix += skinWeight.w * boneMatW;
+ skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
+ objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
+ #ifdef USE_TANGENT
+ objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
+ #endif
+#endif`,cg=`float specularStrength;
+#ifdef USE_SPECULARMAP
+ vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
+ specularStrength = texelSpecular.r;
+#else
+ specularStrength = 1.0;
+#endif`,lg=`#ifdef USE_SPECULARMAP
+ uniform sampler2D specularMap;
+#endif`,hg=`#if defined( TONE_MAPPING )
+ gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
+#endif`,ug=`#ifndef saturate
+#define saturate( a ) clamp( a, 0.0, 1.0 )
+#endif
+uniform float toneMappingExposure;
+vec3 LinearToneMapping( vec3 color ) {
+ return saturate( toneMappingExposure * color );
+}
+vec3 ReinhardToneMapping( vec3 color ) {
+ color *= toneMappingExposure;
+ return saturate( color / ( vec3( 1.0 ) + color ) );
+}
+vec3 CineonToneMapping( vec3 color ) {
+ color *= toneMappingExposure;
+ color = max( vec3( 0.0 ), color - 0.004 );
+ return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
+}
+vec3 RRTAndODTFit( vec3 v ) {
+ vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
+ vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
+ return a / b;
+}
+vec3 ACESFilmicToneMapping( vec3 color ) {
+ const mat3 ACESInputMat = mat3(
+ vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
+ vec3( 0.04823, 0.01566, 0.83777 )
+ );
+ const mat3 ACESOutputMat = mat3(
+ vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
+ vec3( -0.07367, -0.00605, 1.07602 )
+ );
+ color *= toneMappingExposure / 0.6;
+ color = ACESInputMat * color;
+ color = RRTAndODTFit( color );
+ color = ACESOutputMat * color;
+ return saturate( color );
+}
+const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
+ vec3( 1.6605, - 0.1246, - 0.0182 ),
+ vec3( - 0.5876, 1.1329, - 0.1006 ),
+ vec3( - 0.0728, - 0.0083, 1.1187 )
+);
+const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
+ vec3( 0.6274, 0.0691, 0.0164 ),
+ vec3( 0.3293, 0.9195, 0.0880 ),
+ vec3( 0.0433, 0.0113, 0.8956 )
+);
+vec3 agxDefaultContrastApprox( vec3 x ) {
+ vec3 x2 = x * x;
+ vec3 x4 = x2 * x2;
+ return + 15.5 * x4 * x2
+ - 40.14 * x4 * x
+ + 31.96 * x4
+ - 6.868 * x2 * x
+ + 0.4298 * x2
+ + 0.1191 * x
+ - 0.00232;
+}
+vec3 AgXToneMapping( vec3 color ) {
+ const mat3 AgXInsetMatrix = mat3(
+ vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
+ vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
+ vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
+ );
+ const mat3 AgXOutsetMatrix = mat3(
+ vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
+ vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
+ vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
+ );
+ const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
+ color *= toneMappingExposure;
+ color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
+ color = AgXInsetMatrix * color;
+ color = max( color, 1e-10 ); color = log2( color );
+ color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
+ color = clamp( color, 0.0, 1.0 );
+ color = agxDefaultContrastApprox( color );
+ color = AgXOutsetMatrix * color;
+ color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
+ color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
+ color = clamp( color, 0.0, 1.0 );
+ return color;
+}
+vec3 NeutralToneMapping( vec3 color ) {
+ const float StartCompression = 0.8 - 0.04;
+ const float Desaturation = 0.15;
+ color *= toneMappingExposure;
+ float x = min( color.r, min( color.g, color.b ) );
+ float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
+ color -= offset;
+ float peak = max( color.r, max( color.g, color.b ) );
+ if ( peak < StartCompression ) return color;
+ float d = 1. - StartCompression;
+ float newPeak = 1. - d * d / ( peak + d - StartCompression );
+ color *= newPeak / peak;
+ float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
+ return mix( color, vec3( newPeak ), g );
+}
+vec3 CustomToneMapping( vec3 color ) { return color; }`,dg=`#ifdef USE_TRANSMISSION
+ material.transmission = transmission;
+ material.transmissionAlpha = 1.0;
+ material.thickness = thickness;
+ material.attenuationDistance = attenuationDistance;
+ material.attenuationColor = attenuationColor;
+ #ifdef USE_TRANSMISSIONMAP
+ material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
+ #endif
+ #ifdef USE_THICKNESSMAP
+ material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
+ #endif
+ vec3 pos = vWorldPosition;
+ vec3 v = normalize( cameraPosition - pos );
+ vec3 n = inverseTransformDirection( normal, viewMatrix );
+ vec4 transmitted = getIBLVolumeRefraction(
+ n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
+ pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
+ material.attenuationColor, material.attenuationDistance );
+ material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
+ totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
+#endif`,fg=`#ifdef USE_TRANSMISSION
+ uniform float transmission;
+ uniform float thickness;
+ uniform float attenuationDistance;
+ uniform vec3 attenuationColor;
+ #ifdef USE_TRANSMISSIONMAP
+ uniform sampler2D transmissionMap;
+ #endif
+ #ifdef USE_THICKNESSMAP
+ uniform sampler2D thicknessMap;
+ #endif
+ uniform vec2 transmissionSamplerSize;
+ uniform sampler2D transmissionSamplerMap;
+ uniform mat4 modelMatrix;
+ uniform mat4 projectionMatrix;
+ varying vec3 vWorldPosition;
+ float w0( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
+ }
+ float w1( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
+ }
+ float w2( float a ){
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
+ }
+ float w3( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * a * a );
+ }
+ float g0( float a ) {
+ return w0( a ) + w1( a );
+ }
+ float g1( float a ) {
+ return w2( a ) + w3( a );
+ }
+ float h0( float a ) {
+ return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
+ }
+ float h1( float a ) {
+ return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
+ }
+ vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
+ uv = uv * texelSize.zw + 0.5;
+ vec2 iuv = floor( uv );
+ vec2 fuv = fract( uv );
+ float g0x = g0( fuv.x );
+ float g1x = g1( fuv.x );
+ float h0x = h0( fuv.x );
+ float h1x = h1( fuv.x );
+ float h0y = h0( fuv.y );
+ float h1y = h1( fuv.y );
+ vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
+ vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
+ vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
+ vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
+ return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
+ g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
+ }
+ vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
+ vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
+ vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
+ vec2 fLodSizeInv = 1.0 / fLodSize;
+ vec2 cLodSizeInv = 1.0 / cLodSize;
+ vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
+ vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
+ return mix( fSample, cSample, fract( lod ) );
+ }
+ vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
+ vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
+ vec3 modelScale;
+ modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
+ modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
+ modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
+ return normalize( refractionVector ) * thickness * modelScale;
+ }
+ float applyIorToRoughness( const in float roughness, const in float ior ) {
+ return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
+ }
+ vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
+ float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
+ return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
+ }
+ vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
+ if ( isinf( attenuationDistance ) ) {
+ return vec3( 1.0 );
+ } else {
+ vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
+ vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
+ }
+ }
+ vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
+ const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
+ const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
+ const in vec3 attenuationColor, const in float attenuationDistance ) {
+ vec4 transmittedLight;
+ vec3 transmittance;
+ #ifdef USE_DISPERSION
+ float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
+ vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
+ for ( int i = 0; i < 3; i ++ ) {
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
+ vec3 refractedRayExit = position + transmissionRay;
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
+ refractionCoords += 1.0;
+ refractionCoords /= 2.0;
+ vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
+ transmittedLight[ i ] = transmissionSample[ i ];
+ transmittedLight.a += transmissionSample.a;
+ transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
+ }
+ transmittedLight.a /= 3.0;
+ #else
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
+ vec3 refractedRayExit = position + transmissionRay;
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
+ refractionCoords += 1.0;
+ refractionCoords /= 2.0;
+ transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
+ transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
+ #endif
+ vec3 attenuatedColor = transmittance * transmittedLight.rgb;
+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
+ float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
+ return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
+ }
+#endif`,pg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ varying vec2 vUv;
+#endif
+#ifdef USE_MAP
+ varying vec2 vMapUv;
+#endif
+#ifdef USE_ALPHAMAP
+ varying vec2 vAlphaMapUv;
+#endif
+#ifdef USE_LIGHTMAP
+ varying vec2 vLightMapUv;
+#endif
+#ifdef USE_AOMAP
+ varying vec2 vAoMapUv;
+#endif
+#ifdef USE_BUMPMAP
+ varying vec2 vBumpMapUv;
+#endif
+#ifdef USE_NORMALMAP
+ varying vec2 vNormalMapUv;
+#endif
+#ifdef USE_EMISSIVEMAP
+ varying vec2 vEmissiveMapUv;
+#endif
+#ifdef USE_METALNESSMAP
+ varying vec2 vMetalnessMapUv;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ varying vec2 vRoughnessMapUv;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ varying vec2 vAnisotropyMapUv;
+#endif
+#ifdef USE_CLEARCOATMAP
+ varying vec2 vClearcoatMapUv;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ varying vec2 vClearcoatNormalMapUv;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ varying vec2 vClearcoatRoughnessMapUv;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ varying vec2 vIridescenceMapUv;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ varying vec2 vIridescenceThicknessMapUv;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ varying vec2 vSheenColorMapUv;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ varying vec2 vSheenRoughnessMapUv;
+#endif
+#ifdef USE_SPECULARMAP
+ varying vec2 vSpecularMapUv;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ varying vec2 vSpecularColorMapUv;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ varying vec2 vSpecularIntensityMapUv;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ uniform mat3 transmissionMapTransform;
+ varying vec2 vTransmissionMapUv;
+#endif
+#ifdef USE_THICKNESSMAP
+ uniform mat3 thicknessMapTransform;
+ varying vec2 vThicknessMapUv;
+#endif`,mg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ varying vec2 vUv;
+#endif
+#ifdef USE_MAP
+ uniform mat3 mapTransform;
+ varying vec2 vMapUv;
+#endif
+#ifdef USE_ALPHAMAP
+ uniform mat3 alphaMapTransform;
+ varying vec2 vAlphaMapUv;
+#endif
+#ifdef USE_LIGHTMAP
+ uniform mat3 lightMapTransform;
+ varying vec2 vLightMapUv;
+#endif
+#ifdef USE_AOMAP
+ uniform mat3 aoMapTransform;
+ varying vec2 vAoMapUv;
+#endif
+#ifdef USE_BUMPMAP
+ uniform mat3 bumpMapTransform;
+ varying vec2 vBumpMapUv;
+#endif
+#ifdef USE_NORMALMAP
+ uniform mat3 normalMapTransform;
+ varying vec2 vNormalMapUv;
+#endif
+#ifdef USE_DISPLACEMENTMAP
+ uniform mat3 displacementMapTransform;
+ varying vec2 vDisplacementMapUv;
+#endif
+#ifdef USE_EMISSIVEMAP
+ uniform mat3 emissiveMapTransform;
+ varying vec2 vEmissiveMapUv;
+#endif
+#ifdef USE_METALNESSMAP
+ uniform mat3 metalnessMapTransform;
+ varying vec2 vMetalnessMapUv;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ uniform mat3 roughnessMapTransform;
+ varying vec2 vRoughnessMapUv;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ uniform mat3 anisotropyMapTransform;
+ varying vec2 vAnisotropyMapUv;
+#endif
+#ifdef USE_CLEARCOATMAP
+ uniform mat3 clearcoatMapTransform;
+ varying vec2 vClearcoatMapUv;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ uniform mat3 clearcoatNormalMapTransform;
+ varying vec2 vClearcoatNormalMapUv;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ uniform mat3 clearcoatRoughnessMapTransform;
+ varying vec2 vClearcoatRoughnessMapUv;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ uniform mat3 sheenColorMapTransform;
+ varying vec2 vSheenColorMapUv;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ uniform mat3 sheenRoughnessMapTransform;
+ varying vec2 vSheenRoughnessMapUv;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ uniform mat3 iridescenceMapTransform;
+ varying vec2 vIridescenceMapUv;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ uniform mat3 iridescenceThicknessMapTransform;
+ varying vec2 vIridescenceThicknessMapUv;
+#endif
+#ifdef USE_SPECULARMAP
+ uniform mat3 specularMapTransform;
+ varying vec2 vSpecularMapUv;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ uniform mat3 specularColorMapTransform;
+ varying vec2 vSpecularColorMapUv;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ uniform mat3 specularIntensityMapTransform;
+ varying vec2 vSpecularIntensityMapUv;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ uniform mat3 transmissionMapTransform;
+ varying vec2 vTransmissionMapUv;
+#endif
+#ifdef USE_THICKNESSMAP
+ uniform mat3 thicknessMapTransform;
+ varying vec2 vThicknessMapUv;
+#endif`,gg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ vUv = vec3( uv, 1 ).xy;
+#endif
+#ifdef USE_MAP
+ vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ALPHAMAP
+ vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_LIGHTMAP
+ vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_AOMAP
+ vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_BUMPMAP
+ vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_NORMALMAP
+ vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_DISPLACEMENTMAP
+ vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_EMISSIVEMAP
+ vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_METALNESSMAP
+ vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOATMAP
+ vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULARMAP
+ vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_THICKNESSMAP
+ vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
+#endif`,bg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+ vec4 worldPosition = vec4( transformed, 1.0 );
+ #ifdef USE_BATCHING
+ worldPosition = batchingMatrix * worldPosition;
+ #endif
+ #ifdef USE_INSTANCING
+ worldPosition = instanceMatrix * worldPosition;
+ #endif
+ worldPosition = modelMatrix * worldPosition;
+#endif`,xg=`varying vec2 vUv;
+uniform mat3 uvTransform;
+void main() {
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
+}`,_g=`uniform sampler2D t2D;
+uniform float backgroundIntensity;
+varying vec2 vUv;
+void main() {
+ vec4 texColor = texture2D( t2D, vUv );
+ #ifdef DECODE_VIDEO_TEXTURE
+ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
+ #endif
+ texColor.rgb *= backgroundIntensity;
+ gl_FragColor = texColor;
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+}`,vg=`varying vec3 vWorldDirection;
+#include <common>
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include <begin_vertex>
+ #include <project_vertex>
+ gl_Position.z = gl_Position.w;
+}`,yg=`#ifdef ENVMAP_TYPE_CUBE
+ uniform samplerCube envMap;
+#elif defined( ENVMAP_TYPE_CUBE_UV )
+ uniform sampler2D envMap;
+#endif
+uniform float backgroundBlurriness;
+uniform float backgroundIntensity;
+uniform mat3 backgroundRotation;
+varying vec3 vWorldDirection;
+#include <cube_uv_reflection_fragment>
+void main() {
+ #ifdef ENVMAP_TYPE_CUBE
+ vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
+ vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
+ #else
+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
+ #endif
+ texColor.rgb *= backgroundIntensity;
+ gl_FragColor = texColor;
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+}`,Mg=`varying vec3 vWorldDirection;
+#include <common>
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include <begin_vertex>
+ #include <project_vertex>
+ gl_Position.z = gl_Position.w;
+}`,Sg=`uniform samplerCube tCube;
+uniform float tFlip;
+uniform float opacity;
+varying vec3 vWorldDirection;
+void main() {
+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
+ gl_FragColor = texColor;
+ gl_FragColor.a *= opacity;
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+}`,Ag=`#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+varying vec2 vHighPrecisionZW;
+void main() {
+ #include <uv_vertex>
+ #include <batching_vertex>
+ #include <skinbase_vertex>
+ #include <morphinstance_vertex>
+ #ifdef USE_DISPLACEMENTMAP
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinnormal_vertex>
+ #endif
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ vHighPrecisionZW = gl_Position.zw;
+}`,Tg=`#if DEPTH_PACKING == 3200
+ uniform float opacity;
+#endif
+#include <common>
+#include <packing>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+varying vec2 vHighPrecisionZW;
+void main() {
+ vec4 diffuseColor = vec4( 1.0 );
+ #include <clipping_planes_fragment>
+ #if DEPTH_PACKING == 3200
+ diffuseColor.a = opacity;
+ #endif
+ #include <map_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <logdepthbuf_fragment>
+ #ifdef USE_REVERSED_DEPTH_BUFFER
+ float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
+ #else
+ float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
+ #endif
+ #if DEPTH_PACKING == 3200
+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
+ #elif DEPTH_PACKING == 3201
+ gl_FragColor = packDepthToRGBA( fragCoordZ );
+ #elif DEPTH_PACKING == 3202
+ gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
+ #elif DEPTH_PACKING == 3203
+ gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
+ #endif
+}`,wg=`#define DISTANCE
+varying vec3 vWorldPosition;
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <batching_vertex>
+ #include <skinbase_vertex>
+ #include <morphinstance_vertex>
+ #ifdef USE_DISPLACEMENTMAP
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinnormal_vertex>
+ #endif
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <worldpos_vertex>
+ #include <clipping_planes_vertex>
+ vWorldPosition = worldPosition.xyz;
+}`,Eg=`#define DISTANCE
+uniform vec3 referencePosition;
+uniform float nearDistance;
+uniform float farDistance;
+varying vec3 vWorldPosition;
+#include <common>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main () {
+ vec4 diffuseColor = vec4( 1.0 );
+ #include <clipping_planes_fragment>
+ #include <map_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ float dist = length( vWorldPosition - referencePosition );
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
+ dist = saturate( dist );
+ gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
+}`,Rg=`varying vec3 vWorldDirection;
+#include <common>
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include <begin_vertex>
+ #include <project_vertex>
+}`,Cg=`uniform sampler2D tEquirect;
+varying vec3 vWorldDirection;
+#include <common>
+void main() {
+ vec3 direction = normalize( vWorldDirection );
+ vec2 sampleUV = equirectUv( direction );
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+}`,Pg=`uniform float scale;
+attribute float lineDistance;
+varying float vLineDistance;
+#include <common>
+#include <uv_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ vLineDistance = scale * lineDistance;
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <fog_vertex>
+}`,Ig=`uniform vec3 diffuse;
+uniform float opacity;
+uniform float dashSize;
+uniform float totalSize;
+varying float vLineDistance;
+#include <common>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <fog_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
+ discard;
+ }
+ vec3 outgoingLight = vec3( 0.0 );
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ outgoingLight = diffuseColor.rgb;
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+}`,Lg=`#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #endif
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+ #include <fog_vertex>
+}`,Dg=`uniform vec3 diffuse;
+uniform float opacity;
+#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+#endif
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <envmap_common_pars_fragment>
+#include <envmap_pars_fragment>
+#include <fog_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <specularmap_fragment>
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
+ #else
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
+ #endif
+ #include <aomap_fragment>
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
+ #include <envmap_fragment>
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,Fg=`#define LAMBERT
+varying vec3 vViewPosition;
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ vViewPosition = - mvPosition.xyz;
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+ #include <shadowmap_vertex>
+ #include <fog_vertex>
+}`,Ng=`#define LAMBERT
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform float opacity;
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <cube_uv_reflection_fragment>
+#include <envmap_common_pars_fragment>
+#include <envmap_pars_fragment>
+#include <envmap_physical_pars_fragment>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <normal_pars_fragment>
+#include <lights_lambert_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveRadiance = emissive;
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <specularmap_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ #include <emissivemap_fragment>
+ #include <lights_lambert_fragment>
+ #include <lights_fragment_begin>
+ #include <lights_fragment_maps>
+ #include <lights_fragment_end>
+ #include <aomap_fragment>
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
+ #include <envmap_fragment>
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,Ug=`#define MATCAP
+varying vec3 vViewPosition;
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <color_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <fog_vertex>
+ vViewPosition = - mvPosition.xyz;
+}`,Og=`#define MATCAP
+uniform vec3 diffuse;
+uniform float opacity;
+uniform sampler2D matcap;
+varying vec3 vViewPosition;
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <fog_pars_fragment>
+#include <normal_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ vec3 viewDir = normalize( vViewPosition );
+ vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
+ vec3 y = cross( viewDir, x );
+ vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
+ #ifdef USE_MATCAP
+ vec4 matcapColor = texture2D( matcap, uv );
+ #else
+ vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
+ #endif
+ vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,kg=`#define NORMAL
+#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
+ varying vec3 vViewPosition;
+#endif
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphinstance_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
+ vViewPosition = - mvPosition.xyz;
+#endif
+}`,Bg=`#define NORMAL
+uniform float opacity;
+#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
+ varying vec3 vViewPosition;
+#endif
+#include <uv_pars_fragment>
+#include <normal_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
+ #include <clipping_planes_fragment>
+ #include <logdepthbuf_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
+ #ifdef OPAQUE
+ gl_FragColor.a = 1.0;
+ #endif
+}`,zg=`#define PHONG
+varying vec3 vViewPosition;
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphinstance_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ vViewPosition = - mvPosition.xyz;
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+ #include <shadowmap_vertex>
+ #include <fog_vertex>
+}`,Gg=`#define PHONG
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform vec3 specular;
+uniform float shininess;
+uniform float opacity;
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <cube_uv_reflection_fragment>
+#include <envmap_common_pars_fragment>
+#include <envmap_pars_fragment>
+#include <envmap_physical_pars_fragment>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <normal_pars_fragment>
+#include <lights_phong_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveRadiance = emissive;
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <specularmap_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ #include <emissivemap_fragment>
+ #include <lights_phong_fragment>
+ #include <lights_fragment_begin>
+ #include <lights_fragment_maps>
+ #include <lights_fragment_end>
+ #include <aomap_fragment>
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
+ #include <envmap_fragment>
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,Vg=`#define STANDARD
+varying vec3 vViewPosition;
+#ifdef USE_TRANSMISSION
+ varying vec3 vWorldPosition;
+#endif
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ vViewPosition = - mvPosition.xyz;
+ #include <worldpos_vertex>
+ #include <shadowmap_vertex>
+ #include <fog_vertex>
+#ifdef USE_TRANSMISSION
+ vWorldPosition = worldPosition.xyz;
+#endif
+}`,Hg=`#define STANDARD
+#ifdef PHYSICAL
+ #define IOR
+ #define USE_SPECULAR
+#endif
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform float roughness;
+uniform float metalness;
+uniform float opacity;
+#ifdef IOR
+ uniform float ior;
+#endif
+#ifdef USE_SPECULAR
+ uniform float specularIntensity;
+ uniform vec3 specularColor;
+ #ifdef USE_SPECULAR_COLORMAP
+ uniform sampler2D specularColorMap;
+ #endif
+ #ifdef USE_SPECULAR_INTENSITYMAP
+ uniform sampler2D specularIntensityMap;
+ #endif
+#endif
+#ifdef USE_CLEARCOAT
+ uniform float clearcoat;
+ uniform float clearcoatRoughness;
+#endif
+#ifdef USE_DISPERSION
+ uniform float dispersion;
+#endif
+#ifdef USE_IRIDESCENCE
+ uniform float iridescence;
+ uniform float iridescenceIOR;
+ uniform float iridescenceThicknessMinimum;
+ uniform float iridescenceThicknessMaximum;
+#endif
+#ifdef USE_SHEEN
+ uniform vec3 sheenColor;
+ uniform float sheenRoughness;
+ #ifdef USE_SHEEN_COLORMAP
+ uniform sampler2D sheenColorMap;
+ #endif
+ #ifdef USE_SHEEN_ROUGHNESSMAP
+ uniform sampler2D sheenRoughnessMap;
+ #endif
+#endif
+#ifdef USE_ANISOTROPY
+ uniform vec2 anisotropyVector;
+ #ifdef USE_ANISOTROPYMAP
+ uniform sampler2D anisotropyMap;
+ #endif
+#endif
+varying vec3 vViewPosition;
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <iridescence_fragment>
+#include <cube_uv_reflection_fragment>
+#include <envmap_common_pars_fragment>
+#include <envmap_physical_pars_fragment>
+#include <fog_pars_fragment>
+#include <lights_pars_begin>
+#include <normal_pars_fragment>
+#include <lights_physical_pars_fragment>
+#include <transmission_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <clearcoat_pars_fragment>
+#include <iridescence_pars_fragment>
+#include <roughnessmap_pars_fragment>
+#include <metalnessmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveRadiance = emissive;
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <roughnessmap_fragment>
+ #include <metalnessmap_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ #include <clearcoat_normal_fragment_begin>
+ #include <clearcoat_normal_fragment_maps>
+ #include <emissivemap_fragment>
+ #include <lights_physical_fragment>
+ #include <lights_fragment_begin>
+ #include <lights_fragment_maps>
+ #include <lights_fragment_end>
+ #include <aomap_fragment>
+ vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
+ vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
+ #include <transmission_fragment>
+ vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
+ #ifdef USE_SHEEN
+
+ outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
+
+ #endif
+ #ifdef USE_CLEARCOAT
+ float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
+ vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
+ outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
+ #endif
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,Wg=`#define TOON
+varying vec3 vViewPosition;
+#include <common>
+#include <batching_pars_vertex>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <normal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <displacementmap_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ vViewPosition = - mvPosition.xyz;
+ #include <worldpos_vertex>
+ #include <shadowmap_vertex>
+ #include <fog_vertex>
+}`,qg=`#define TOON
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform float opacity;
+#include <common>
+#include <dithering_pars_fragment>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <gradientmap_pars_fragment>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <normal_pars_fragment>
+#include <lights_toon_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveRadiance = emissive;
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ #include <normal_fragment_begin>
+ #include <normal_fragment_maps>
+ #include <emissivemap_fragment>
+ #include <lights_toon_fragment>
+ #include <lights_fragment_begin>
+ #include <lights_fragment_maps>
+ #include <lights_fragment_end>
+ #include <aomap_fragment>
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+ #include <dithering_fragment>
+}`,Xg=`uniform float size;
+uniform float scale;
+#include <common>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+#ifdef USE_POINTS_UV
+ varying vec2 vUv;
+ uniform mat3 uvTransform;
+#endif
+void main() {
+ #ifdef USE_POINTS_UV
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+ #endif
+ #include <color_vertex>
+ #include <morphinstance_vertex>
+ #include <morphcolor_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <project_vertex>
+ gl_PointSize = size;
+ #ifdef USE_SIZEATTENUATION
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
+ if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
+ #endif
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <worldpos_vertex>
+ #include <fog_vertex>
+}`,jg=`uniform vec3 diffuse;
+uniform float opacity;
+#include <common>
+#include <color_pars_fragment>
+#include <map_particle_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <fog_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ vec3 outgoingLight = vec3( 0.0 );
+ #include <logdepthbuf_fragment>
+ #include <map_particle_fragment>
+ #include <color_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ outgoingLight = diffuseColor.rgb;
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+}`,Kg=`#include <common>
+#include <batching_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <shadowmap_pars_vertex>
+void main() {
+ #include <batching_vertex>
+ #include <beginnormal_vertex>
+ #include <morphinstance_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+ #include <worldpos_vertex>
+ #include <shadowmap_vertex>
+ #include <fog_vertex>
+}`,Jg=`uniform vec3 color;
+uniform float opacity;
+#include <common>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <logdepthbuf_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <shadowmask_pars_fragment>
+void main() {
+ #include <logdepthbuf_fragment>
+ gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
+}`,Yg=`uniform float rotation;
+uniform vec2 center;
+#include <common>
+#include <uv_pars_vertex>
+#include <fog_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+void main() {
+ #include <uv_vertex>
+ vec4 mvPosition = modelViewMatrix[ 3 ];
+ vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
+ #ifndef USE_SIZEATTENUATION
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
+ if ( isPerspective ) scale *= - mvPosition.z;
+ #endif
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
+ vec2 rotatedPosition;
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
+ mvPosition.xy += rotatedPosition;
+ gl_Position = projectionMatrix * mvPosition;
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <fog_vertex>
+}`,Zg=`uniform vec3 diffuse;
+uniform float opacity;
+#include <common>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <alphahash_pars_fragment>
+#include <fog_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+void main() {
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <clipping_planes_fragment>
+ vec3 outgoingLight = vec3( 0.0 );
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <alphahash_fragment>
+ outgoingLight = diffuseColor.rgb;
+ #include <opaque_fragment>
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ #include <fog_fragment>
+}`,Oe={alphahash_fragment:xp,alphahash_pars_fragment:_p,alphamap_fragment:vp,alphamap_pars_fragment:yp,alphatest_fragment:Mp,alphatest_pars_fragment:Sp,aomap_fragment:Ap,aomap_pars_fragment:Tp,batching_pars_vertex:wp,batching_vertex:Ep,begin_vertex:Rp,beginnormal_vertex:Cp,bsdfs:Pp,iridescence_fragment:Ip,bumpmap_pars_fragment:Lp,clipping_planes_fragment:Dp,clipping_planes_pars_fragment:Fp,clipping_planes_pars_vertex:Np,clipping_planes_vertex:Up,color_fragment:Op,color_pars_fragment:kp,color_pars_vertex:Bp,color_vertex:zp,common:Gp,cube_uv_reflection_fragment:Vp,defaultnormal_vertex:Hp,displacementmap_pars_vertex:Wp,displacementmap_vertex:qp,emissivemap_fragment:Xp,emissivemap_pars_fragment:jp,colorspace_fragment:Kp,colorspace_pars_fragment:Jp,envmap_fragment:Yp,envmap_common_pars_fragment:Zp,envmap_pars_fragment:$p,envmap_pars_vertex:Qp,envmap_physical_pars_fragment:hm,envmap_vertex:em,fog_vertex:tm,fog_pars_vertex:nm,fog_fragment:im,fog_pars_fragment:sm,gradientmap_pars_fragment:rm,lightmap_pars_fragment:am,lights_lambert_fragment:om,lights_lambert_pars_fragment:cm,lights_pars_begin:lm,lights_toon_fragment:um,lights_toon_pars_fragment:dm,lights_phong_fragment:fm,lights_phong_pars_fragment:pm,lights_physical_fragment:mm,lights_physical_pars_fragment:gm,lights_fragment_begin:bm,lights_fragment_maps:xm,lights_fragment_end:_m,lightprobes_pars_fragment:vm,logdepthbuf_fragment:ym,logdepthbuf_pars_fragment:Mm,logdepthbuf_pars_vertex:Sm,logdepthbuf_vertex:Am,map_fragment:Tm,map_pars_fragment:wm,map_particle_fragment:Em,map_particle_pars_fragment:Rm,metalnessmap_fragment:Cm,metalnessmap_pars_fragment:Pm,morphinstance_vertex:Im,morphcolor_vertex:Lm,morphnormal_vertex:Dm,morphtarget_pars_vertex:Fm,morphtarget_vertex:Nm,normal_fragment_begin:Um,normal_fragment_maps:Om,normal_pars_fragment:km,normal_pars_vertex:Bm,normal_vertex:zm,normalmap_pars_fragment:Gm,clearcoat_normal_fragment_begin:Vm,clearcoat_normal_fragment_maps:Hm,clearcoat_pars_fragment:Wm,iridescence_pars_fragment:qm,opaque_fragment:Xm,packing:jm,premultiplied_alpha_fragment:Km,project_vertex:Jm,dithering_fragment:Ym,dithering_pars_fragment:Zm,roughnessmap_fragment:$m,roughnessmap_pars_fragment:Qm,shadowmap_pars_fragment:eg,shadowmap_pars_vertex:tg,shadowmap_vertex:ng,shadowmask_pars_fragment:ig,skinbase_vertex:sg,skinning_pars_vertex:rg,skinning_vertex:ag,skinnormal_vertex:og,specularmap_fragment:cg,specularmap_pars_fragment:lg,tonemapping_fragment:hg,tonemapping_pars_fragment:ug,transmission_fragment:dg,transmission_pars_fragment:fg,uv_pars_fragment:pg,uv_pars_vertex:mg,uv_vertex:gg,worldpos_vertex:bg,background_vert:xg,background_frag:_g,backgroundCube_vert:vg,backgroundCube_frag:yg,cube_vert:Mg,cube_frag:Sg,depth_vert:Ag,depth_frag:Tg,distance_vert:wg,distance_frag:Eg,equirect_vert:Rg,equirect_frag:Cg,linedashed_vert:Pg,linedashed_frag:Ig,meshbasic_vert:Lg,meshbasic_frag:Dg,meshlambert_vert:Fg,meshlambert_frag:Ng,meshmatcap_vert:Ug,meshmatcap_frag:Og,meshnormal_vert:kg,meshnormal_frag:Bg,meshphong_vert:zg,meshphong_frag:Gg,meshphysical_vert:Vg,meshphysical_frag:Hg,meshtoon_vert:Wg,meshtoon_frag:qg,points_vert:Xg,points_frag:jg,shadow_vert:Kg,shadow_frag:Jg,sprite_vert:Yg,sprite_frag:Zg},ce={common:{diffuse:{value:new Te(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Pe}},envmap:{envMap:{value:null},envMapRotation:{value:new Pe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Pe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Pe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Pe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Pe},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Pe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Pe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Pe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Pe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Te(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new F},probesMax:{value:new F},probesResolution:{value:new F}},points:{diffuse:{value:new Te(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0},uvTransform:{value:new Pe}},sprite:{diffuse:{value:new Te(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0}}},Un={basic:{uniforms:Nt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:Nt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Te(0)},envMapIntensity:{value:1}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:Nt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Te(0)},specular:{value:new Te(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:Nt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Te(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:Nt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Te(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:Nt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:Nt([ce.points,ce.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:Nt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:Nt([ce.common,ce.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:Nt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:Nt([ce.sprite,ce.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Pe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Pe}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distance:{uniforms:Nt([ce.common,ce.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distance_vert,fragmentShader:Oe.distance_frag},shadow:{uniforms:Nt([ce.lights,ce.fog,{color:{value:new Te(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Un.physical={uniforms:Nt([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Pe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Pe},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Pe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Pe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Pe},sheen:{value:0},sheenColor:{value:new Te(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Pe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Pe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Pe},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Pe},attenuationDistance:{value:0},attenuationColor:{value:new Te(0)},specularColor:{value:new Te(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Pe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Pe},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Pe}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};var Ho={r:0,b:0,g:0},$g=new Ue,Ed=new Pe;Ed.set(-1,0,0,0,1,0,0,0,1);function Qg(s,e,t,n,i,r){let a=new Te(0),o=i===!0?0:1,c,l,h=null,u=0,d=null;function f(v){let S=v.isScene===!0?v.background:null;if(S&&S.isTexture){let M=v.backgroundBlurriness>0;S=e.get(S,M)}return S}function g(v){let S=!1,M=f(v);M===null?m(a,o):M&&M.isColor&&(m(M,1),S=!0);let E=s.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,r):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(s.autoClear||S)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function _(v,S){let M=f(S);M&&(M.isCubeTexture||M.mapping===Ar)?(l===void 0&&(l=new lt(new ui(1,1,1),new Zt({name:"BackgroundCubeMaterial",uniforms:Vi(Un.backgroundCube.uniforms),vertexShader:Un.backgroundCube.vertexShader,fragmentShader:Un.backgroundCube.fragmentShader,side:Pt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(E,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4($g.makeRotationFromEuler(S.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Ed),l.material.toneMapped=Be.getTransfer(M.colorSpace)!==Je,(h!==M||u!==M.version||d!==s.toneMapping)&&(l.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),l.layers.enableAll(),v.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new lt(new hr(2,2),new Zt({name:"BackgroundMaterial",uniforms:Vi(Un.background.uniforms),vertexShader:Un.background.vertexShader,fragmentShader:Un.background.fragmentShader,side:pn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=Be.getTransfer(M.colorSpace)!==Je,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||u!==M.version||d!==s.toneMapping)&&(c.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function m(v,S){v.getRGB(Ho,bl(s)),t.buffers.color.setClear(Ho.r,Ho.g,Ho.b,S,r)}function p(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(v,S=1){a.set(v),o=S,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(v){o=v,m(a,o)},render:g,addToRenderList:_,dispose:p}}function eb(s,e){let t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null),r=i,a=!1;function o(R,O,H,q,N){let z=!1,V=u(R,q,H,O);r!==V&&(r=V,l(r.object)),z=f(R,q,H,N),z&&g(R,q,H,N),N!==null&&e.update(N,s.ELEMENT_ARRAY_BUFFER),(z||a)&&(a=!1,M(R,O,H,q),N!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function c(){return s.createVertexArray()}function l(R){return s.bindVertexArray(R)}function h(R){return s.deleteVertexArray(R)}function u(R,O,H,q){let N=q.wireframe===!0,z=n[O.id];z===void 0&&(z={},n[O.id]=z);let V=R.isInstancedMesh===!0?R.id:0,$=z[V];$===void 0&&($={},z[V]=$);let Q=$[H.id];Q===void 0&&(Q={},$[H.id]=Q);let le=Q[N];return le===void 0&&(le=d(c()),Q[N]=le),le}function d(R){let O=[],H=[],q=[];for(let N=0;N<t;N++)O[N]=0,H[N]=0,q[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:H,attributeDivisors:q,object:R,attributes:{},index:null}}function f(R,O,H,q){let N=r.attributes,z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=N[Q],Se=z[Q];if(Se===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(Se=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(Se=R.instanceColor)),xe===void 0||xe.attribute!==Se||Se&&xe.data!==Se.data)return!0;V++}return r.attributesNum!==V||r.index!==q}function g(R,O,H,q){let N={},z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=z[Q];xe===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(xe=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(xe=R.instanceColor));let Se={};Se.attribute=xe,xe&&xe.data&&(Se.data=xe.data),N[Q]=Se,V++}r.attributes=N,r.attributesNum=V,r.index=q}function _(){let R=r.newAttributes;for(let O=0,H=R.length;O<H;O++)R[O]=0}function m(R){p(R,0)}function p(R,O){let H=r.newAttributes,q=r.enabledAttributes,N=r.attributeDivisors;H[R]=1,q[R]===0&&(s.enableVertexAttribArray(R),q[R]=1),N[R]!==O&&(s.vertexAttribDivisor(R,O),N[R]=O)}function v(){let R=r.newAttributes,O=r.enabledAttributes;for(let H=0,q=O.length;H<q;H++)O[H]!==R[H]&&(s.disableVertexAttribArray(H),O[H]=0)}function S(R,O,H,q,N,z,V){V===!0?s.vertexAttribIPointer(R,O,H,N,z):s.vertexAttribPointer(R,O,H,q,N,z)}function M(R,O,H,q){_();let N=q.attributes,z=H.getAttributes(),V=O.defaultAttributeValues;for(let $ in z){let Q=z[$];if(Q.location>=0){let le=N[$];if(le===void 0&&($==="instanceMatrix"&&R.instanceMatrix&&(le=R.instanceMatrix),$==="instanceColor"&&R.instanceColor&&(le=R.instanceColor)),le!==void 0){let xe=le.normalized,Se=le.itemSize,Xe=e.get(le);if(Xe===void 0)continue;let Ze=Xe.buffer,Fe=Xe.type,J=Xe.bytesPerElement,de=Fe===s.INT||Fe===s.UNSIGNED_INT||le.gpuType===no;if(le.isInterleavedBufferAttribute){let ie=le.data,Ee=ie.stride,Ie=le.offset;if(ie.isInstancedInterleavedBuffer){for(let Re=0;Re<Q.locationSize;Re++)p(Q.location+Re,ie.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let Re=0;Re<Q.locationSize;Re++)m(Q.location+Re);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let Re=0;Re<Q.locationSize;Re++)S(Q.location+Re,Se/Q.locationSize,Fe,xe,Ee*J,(Ie+Se/Q.locationSize*Re)*J,de)}else{if(le.isInstancedBufferAttribute){for(let ie=0;ie<Q.locationSize;ie++)p(Q.location+ie,le.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let ie=0;ie<Q.locationSize;ie++)m(Q.location+ie);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let ie=0;ie<Q.locationSize;ie++)S(Q.location+ie,Se/Q.locationSize,Fe,xe,Se*J,Se/Q.locationSize*ie*J,de)}}else if(V!==void 0){let xe=V[$];if(xe!==void 0)switch(xe.length){case 2:s.vertexAttrib2fv(Q.location,xe);break;case 3:s.vertexAttrib3fv(Q.location,xe);break;case 4:s.vertexAttrib4fv(Q.location,xe);break;default:s.vertexAttrib1fv(Q.location,xe)}}}}v()}function E(){w();for(let R in n){let O=n[R];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R]}}function T(R){if(n[R.id]===void 0)return;let O=n[R.id];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R.id]}function C(R){for(let O in n){let H=n[O];for(let q in H){let N=H[q];if(N[R.id]===void 0)continue;let z=N[R.id];for(let V in z)h(z[V].object),delete z[V];delete N[R.id]}}}function x(R){for(let O in n){let H=n[O],q=R.isInstancedMesh===!0?R.id:0,N=H[q];if(N!==void 0){for(let z in N){let V=N[z];for(let $ in V)h(V[$].object),delete V[$];delete N[z]}delete H[q],Object.keys(H).length===0&&delete n[O]}}}function w(){L(),a=!0,r!==i&&(r=i,l(r.object))}function L(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:w,resetDefaultState:L,dispose:E,releaseStatesOfGeometry:T,releaseStatesOfObject:x,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:m,disableUnusedAttributes:v}}function tb(s,e,t){let n;function i(c){n=c}function r(c,l){s.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,h){h!==0&&(s.drawArraysInstanced(n,c,l,h),t.update(l,n,h))}function o(c,l,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,h);let d=0;for(let f=0;f<h;f++)d+=l[f];t.update(d,n,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function nb(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==Qt&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){let x=C===Fn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==qt&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==$t&&!x)}function c(C){if(C==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp",h=c(l);h!==l&&(_e("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&_e("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),p=s.getParameter(s.MAX_VERTEX_ATTRIBS),v=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),S=s.getParameter(s.MAX_VARYING_VECTORS),M=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),E=s.getParameter(s.MAX_SAMPLES),T=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:v,maxVaryings:S,maxFragmentUniforms:M,maxSamples:E,samples:T}}function ib(s){let e=this,t=null,n=0,i=!1,r=!1,a=new Sn,o=new Pe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){let g=u.clippingPlanes,_=u.clipIntersection,m=u.clipShadows,p=s.get(u);if(!i||g===null||g.length===0||r&&!m)r?h(null):l();else{let v=r?0:n,S=v*4,M=p.clippingState||null;c.value=M,M=h(g,d,S,f);for(let E=0;E!==S;++E)M[E]=t[E];p.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,g){let _=u!==null?u.length:0,m=null;if(_!==0){if(m=c.value,g!==!0||m===null){let p=f+_*4,v=d.matrixWorldInverse;o.getNormalMatrix(v),(m===null||m.length<p)&&(m=new Float32Array(p));for(let S=0,M=f;S!==_;++S,M+=4)a.copy(u[S]).applyMatrix4(v,o),a.normal.toArray(m,M),m[M+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}var bi=4,sd=[.125,.215,.35,.446,.526,.582],Hi=20,sb=256,Nr=new di,rd=new Te,wl=null,El=0,Rl=0,Cl=!1,rb=new F,Is=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){let{size:a=256,position:o=rb}=r;wl=this._renderer.getRenderTarget(),El=this._renderer.getActiveCubeFace(),Rl=this._renderer.getActiveMipmapLevel(),Cl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=cd(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=od(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(wl,El,Rl),this._renderer.xr.enabled=Cl,e.scissorTest=!1,Cs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pi||e.mapping===zi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wl=this._renderer.getRenderTarget(),El=this._renderer.getActiveCubeFace(),Rl=this._renderer.getActiveMipmapLevel(),Cl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:_t,minFilter:_t,generateMipmaps:!1,type:Fn,format:Qt,colorSpace:kt,depthBuffer:!1},i=ad(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ad(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ab(r)),this._blurMaterial=cb(r,e,t),this._ggxMaterial=ob(r,e,t)}return i}_compileMaterial(e){let t=new lt(new zt,e);this._renderer.compile(t,Nr)}_sceneToCubeUV(e,t,n,i,r){let c=new Mt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(rd),u.toneMapping=bn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new lt(new ui,new gn({name:"PMREM.Background",side:Pt,depthWrite:!1,depthTest:!1})));let _=this._backgroundBox,m=_.material,p=!1,v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,p=!0):(m.color.copy(rd),p=!0);for(let S=0;S<6;S++){let M=S%3;M===0?(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[S],r.y,r.z)):M===1?(c.up.set(0,0,l[S]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[S],r.z)):(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[S]));let E=this._cubeSize;Cs(i,M*E,S>2?E:0,E,E),u.setRenderTarget(i),p&&u.render(_,c),u.render(e,c)}u.toneMapping=f,u.autoClear=d,e.background=v}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===pi||e.mapping===zi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=cd()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=od());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;let o=r.uniforms;o.envMap.value=e;let c=this._cubeSize;Cs(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Nr)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let c=a.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),d=0+l*1.25,f=u*d,{_lodMax:g}=this,_=this._sizeLods[n],m=3*_*(n>g-bi?n-g+bi:0),p=4*(this._cubeSize-_);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=g-t,Cs(r,m,p,3*_,2*_),i.setRenderTarget(r),i.render(o,Nr),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=g-n,Cs(e,m,p,3*_,2*_),i.setRenderTarget(e),i.render(o,Nr)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){let c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&we("blur direction must be either latitudinal or longitudinal!");let h=3,u=this._lodMeshes[i];u.material=l;let d=l.uniforms,f=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Hi-1),_=r/g,m=isFinite(r)?1+Math.floor(h*_):Hi;m>Hi&&_e(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Hi}`);let p=[],v=0;for(let C=0;C<Hi;++C){let x=C/_,w=Math.exp(-x*x/2);p.push(w),C===0?v+=w:C<m&&(v+=2*w)}for(let C=0;C<p.length;C++)p[C]=p[C]/v;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);let{_lodMax:S}=this;d.dTheta.value=g,d.mipInt.value=S-n;let M=this._sizeLods[i],E=3*M*(i>S-bi?i-S+bi:0),T=4*(this._cubeSize-M);Cs(t,E,T,3*M,2*M),c.setRenderTarget(t),c.render(u,Nr)}};function ab(s){let e=[],t=[],n=[],i=s,r=s-bi+1+sd.length;for(let a=0;a<r;a++){let o=Math.pow(2,i);e.push(o);let c=1/o;a>s-bi?c=sd[a-s+bi-1]:a===0&&(c=0),t.push(c);let l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,g=6,_=3,m=2,p=1,v=new Float32Array(_*g*f),S=new Float32Array(m*g*f),M=new Float32Array(p*g*f);for(let T=0;T<f;T++){let C=T%3*2/3-1,x=T>2?0:-1,w=[C,x,0,C+2/3,x,0,C+2/3,x+1,0,C,x,0,C+2/3,x+1,0,C,x+1,0];v.set(w,_*g*T),S.set(d,m*g*T);let L=[T,T,T,T,T,T];M.set(L,p*g*T)}let E=new zt;E.setAttribute("position",new St(v,_)),E.setAttribute("uv",new St(S,m)),E.setAttribute("faceIndex",new St(M,p)),n.push(new lt(E,null)),i>bi&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function ad(s,e,t){let n=new Yt(s,e,t);return n.texture.mapping=Ar,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Cs(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function ob(s,e,t){return new Zt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:sb,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:jo(),fragmentShader:`
+
+ precision highp float;
+ precision highp int;
+
+ varying vec3 vOutputDirection;
+
+ uniform sampler2D envMap;
+ uniform float roughness;
+ uniform float mipInt;
+
+ #define ENVMAP_TYPE_CUBE_UV
+ #include <cube_uv_reflection_fragment>
+
+ #define PI 3.14159265359
+
+ // Van der Corput radical inverse
+ float radicalInverse_VdC(uint bits) {
+ bits = (bits << 16u) | (bits >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ return float(bits) * 2.3283064365386963e-10; // / 0x100000000
+ }
+
+ // Hammersley sequence
+ vec2 hammersley(uint i, uint N) {
+ return vec2(float(i) / float(N), radicalInverse_VdC(i));
+ }
+
+ // GGX VNDF importance sampling (Eric Heitz 2018)
+ // "Sampling the GGX Distribution of Visible Normals"
+ // https://jcgt.org/published/0007/04/01/
+ vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
+ float alpha = roughness * roughness;
+
+ // Section 4.1: Orthonormal basis
+ vec3 T1 = vec3(1.0, 0.0, 0.0);
+ vec3 T2 = cross(V, T1);
+
+ // Section 4.2: Parameterization of projected area
+ float r = sqrt(Xi.x);
+ float phi = 2.0 * PI * Xi.y;
+ float t1 = r * cos(phi);
+ float t2 = r * sin(phi);
+ float s = 0.5 * (1.0 + V.z);
+ t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
+
+ // Section 4.3: Reprojection onto hemisphere
+ vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
+
+ // Section 3.4: Transform back to ellipsoid configuration
+ return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
+ }
+
+ void main() {
+ vec3 N = normalize(vOutputDirection);
+ vec3 V = N; // Assume view direction equals normal for pre-filtering
+
+ vec3 prefilteredColor = vec3(0.0);
+ float totalWeight = 0.0;
+
+ // For very low roughness, just sample the environment directly
+ if (roughness < 0.001) {
+ gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
+ return;
+ }
+
+ // Tangent space basis for VNDF sampling
+ vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
+ vec3 tangent = normalize(cross(up, N));
+ vec3 bitangent = cross(N, tangent);
+
+ for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
+ vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
+
+ // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
+ vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
+
+ // Transform H back to world space
+ vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
+ vec3 L = normalize(2.0 * dot(V, H) * H - V);
+
+ float NdotL = max(dot(N, L), 0.0);
+
+ if(NdotL > 0.0) {
+ // Sample environment at fixed mip level
+ // VNDF importance sampling handles the distribution filtering
+ vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
+
+ // Weight by NdotL for the split-sum approximation
+ // VNDF PDF naturally accounts for the visible microfacet distribution
+ prefilteredColor += sampleColor * NdotL;
+ totalWeight += NdotL;
+ }
+ }
+
+ if (totalWeight > 0.0) {
+ prefilteredColor = prefilteredColor / totalWeight;
+ }
+
+ gl_FragColor = vec4(prefilteredColor, 1.0);
+ }
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function cb(s,e,t){let n=new Float32Array(Hi),i=new F(0,1,0);return new Zt({name:"SphericalGaussianBlur",defines:{n:Hi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:jo(),fragmentShader:`
+
+ precision mediump float;
+ precision mediump int;
+
+ varying vec3 vOutputDirection;
+
+ uniform sampler2D envMap;
+ uniform int samples;
+ uniform float weights[ n ];
+ uniform bool latitudinal;
+ uniform float dTheta;
+ uniform float mipInt;
+ uniform vec3 poleAxis;
+
+ #define ENVMAP_TYPE_CUBE_UV
+ #include <cube_uv_reflection_fragment>
+
+ vec3 getSample( float theta, vec3 axis ) {
+
+ float cosTheta = cos( theta );
+ // Rodrigues' axis-angle rotation
+ vec3 sampleDirection = vOutputDirection * cosTheta
+ + cross( axis, vOutputDirection ) * sin( theta )
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
+
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
+
+ }
+
+ void main() {
+
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
+
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
+
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
+
+ }
+
+ axis = normalize( axis );
+
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
+
+ for ( int i = 1; i < n; i++ ) {
+
+ if ( i >= samples ) {
+
+ break;
+
+ }
+
+ float theta = dTheta * float( i );
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
+
+ }
+
+ }
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function od(){return new Zt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:jo(),fragmentShader:`
+
+ precision mediump float;
+ precision mediump int;
+
+ varying vec3 vOutputDirection;
+
+ uniform sampler2D envMap;
+
+ #include <common>
+
+ void main() {
+
+ vec3 outputDirection = normalize( vOutputDirection );
+ vec2 uv = equirectUv( outputDirection );
+
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
+
+ }
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function cd(){return new Zt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:jo(),fragmentShader:`
+
+ precision mediump float;
+ precision mediump int;
+
+ uniform float flipEnvMap;
+
+ varying vec3 vOutputDirection;
+
+ uniform samplerCube envMap;
+
+ void main() {
+
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
+
+ }
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function jo(){return`
+
+ precision mediump float;
+ precision mediump int;
+
+ attribute float faceIndex;
+
+ varying vec3 vOutputDirection;
+
+ // RH coordinate system; PMREM face-indexing convention
+ vec3 getDirection( vec2 uv, float face ) {
+
+ uv = 2.0 * uv - 1.0;
+
+ vec3 direction = vec3( uv, 1.0 );
+
+ if ( face == 0.0 ) {
+
+ direction = direction.zyx; // ( 1, v, u ) pos x
+
+ } else if ( face == 1.0 ) {
+
+ direction = direction.xzy;
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
+
+ } else if ( face == 2.0 ) {
+
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
+
+ } else if ( face == 3.0 ) {
+
+ direction = direction.zyx;
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
+
+ } else if ( face == 4.0 ) {
+
+ direction = direction.xzy;
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
+
+ } else if ( face == 5.0 ) {
+
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
+
+ }
+
+ return direction;
+
+ }
+
+ void main() {
+
+ vOutputDirection = getDirection( uv, faceIndex );
+ gl_Position = vec4( position, 1.0 );
+
+ }
+ `}var qo=class extends Yt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new cr(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
+
+ varying vec3 vWorldDirection;
+
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
+
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
+
+ }
+
+ void main() {
+
+ vWorldDirection = transformDirection( position, modelMatrix );
+
+ #include <begin_vertex>
+ #include <project_vertex>
+
+ }
+ `,fragmentShader:`
+
+ uniform sampler2D tEquirect;
+
+ varying vec3 vWorldDirection;
+
+ #include <common>
+
+ void main() {
+
+ vec3 direction = normalize( vWorldDirection );
+
+ vec2 sampleUV = equirectUv( direction );
+
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+
+ }
+ `},i=new ui(5,5,5),r=new Zt({name:"CubemapFromEquirect",uniforms:Vi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Pt,blending:Dn});r.uniforms.tEquirect.value=t;let a=new lt(i,r),o=t.minFilter;return t.minFilter===xn&&(t.minFilter=_t),new ja(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}};function lb(s){let e=new WeakMap,t=new WeakMap,n=null;function i(d,f=!1){return d==null?null:f?a(d):r(d)}function r(d){if(d&&d.isTexture){let f=d.mapping;if(f===Qa||f===eo)if(e.has(d)){let g=e.get(d).texture;return o(g,d.mapping)}else{let g=d.image;if(g&&g.height>0){let _=new qo(g.height);return _.fromEquirectangularTexture(s,d),e.set(d,_),d.addEventListener("dispose",l),o(_.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture){let f=d.mapping,g=f===Qa||f===eo,_=f===pi||f===zi;if(g||_){let m=t.get(d),p=m!==void 0?m.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==p)return n===null&&(n=new Is(s)),m=g?n.fromEquirectangular(d,m):n.fromCubemap(d,m),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),m.texture;if(m!==void 0)return m.texture;{let v=d.image;return g&&v&&v.height>0||_&&v&&c(v)?(n===null&&(n=new Is(s)),m=g?n.fromEquirectangular(d):n.fromCubemap(d),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),d.addEventListener("dispose",h),m.texture):null}}}return d}function o(d,f){return f===Qa?d.mapping=pi:f===eo&&(d.mapping=zi),d}function c(d){let f=0,g=6;for(let _=0;_<g;_++)d[_]!==void 0&&f++;return f===g}function l(d){let f=d.target;f.removeEventListener("dispose",l);let g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function h(d){let f=d.target;f.removeEventListener("dispose",h);let g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function u(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:u}}function hb(s){let e={};function t(n){if(e[n]!==void 0)return e[n];let i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let i=t(n);return i===null&&Ia("WebGLRenderer: "+n+" extension not supported."),i}}}function ub(s,e,t,n){let i={},r=new WeakMap;function a(u){let d=u.target;d.index!==null&&e.remove(d.index);for(let g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",a),delete i[d.id];let f=r.get(d);f&&(e.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(u){let d=u.attributes;for(let f in d)e.update(d[f],s.ARRAY_BUFFER)}function l(u){let d=[],f=u.index,g=u.attributes.position,_=0;if(g===void 0)return;if(f!==null){let v=f.array;_=f.version;for(let S=0,M=v.length;S<M;S+=3){let E=v[S+0],T=v[S+1],C=v[S+2];d.push(E,T,T,C,C,E)}}else{let v=g.array;_=g.version;for(let S=0,M=v.length/3-1;S<M;S+=3){let E=S+0,T=S+1,C=S+2;d.push(E,T,T,C,C,E)}}let m=new(g.count>=65535?nr:tr)(d,1);m.version=_;let p=r.get(u);p&&e.remove(p),r.set(u,m)}function h(u){let d=r.get(u);if(d){let f=u.index;f!==null&&d.version<f.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function db(s,e,t){let n;function i(u){n=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function c(u,d){s.drawElements(n,d,r,u*a),t.update(d,n,1)}function l(u,d,f){f!==0&&(s.drawElementsInstanced(n,d,r,u*a,f),t.update(d,n,f))}function h(u,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,r,u,0,f);let _=0;for(let m=0;m<f;m++)_+=d[m];t.update(_,n,1)}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h}function fb(s){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:we("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function pb(s,e,t){let n=new WeakMap,i=new nt;function r(a,o,c){let l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0,d=n.get(o);if(d===void 0||d.count!==u){let w=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",w)};d!==void 0&&d.texture.dispose();let f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],v=o.morphAttributes.color||[],S=0;f===!0&&(S=1),g===!0&&(S=2),_===!0&&(S=3);let M=o.attributes.position.count*S,E=1;M>e.maxTextureSize&&(E=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);let T=new Float32Array(M*E*4*u),C=new Qs(T,M,E,u);C.type=$t,C.needsUpdate=!0;let x=S*4;for(let L=0;L<u;L++){let R=m[L],O=p[L],H=v[L],q=M*E*4*L;for(let N=0;N<R.count;N++){let z=N*x;f===!0&&(i.fromBufferAttribute(R,N),T[q+z+0]=i.x,T[q+z+1]=i.y,T[q+z+2]=i.z,T[q+z+3]=0),g===!0&&(i.fromBufferAttribute(O,N),T[q+z+4]=i.x,T[q+z+5]=i.y,T[q+z+6]=i.z,T[q+z+7]=0),_===!0&&(i.fromBufferAttribute(H,N),T[q+z+8]=i.x,T[q+z+9]=i.y,T[q+z+10]=i.z,T[q+z+11]=H.itemSize===4?i.w:1)}}d={count:u,texture:C,size:new He(M,E)},n.set(o,d),o.addEventListener("dispose",w)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<l.length;_++)f+=l[_];let g=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(s,"morphTargetBaseInfluence",g),c.getUniforms().setValue(s,"morphTargetInfluences",l)}c.getUniforms().setValue(s,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(s,"morphTargetsTextureSize",d.size)}return{update:r}}function mb(s,e,t,n,i){let r=new WeakMap;function a(l){let h=i.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==h&&(e.update(d),r.set(d,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==h&&(t.update(l.instanceMatrix,s.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,s.ARRAY_BUFFER),r.set(l,h))),l.isSkinnedMesh){let f=l.skeleton;r.get(f)!==h&&(f.update(),r.set(f,h))}return d}function o(){r=new WeakMap}function c(l){let h=l.target;h.removeEventListener("dispose",c),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}var gb={[tl]:"LINEAR_TONE_MAPPING",[nl]:"REINHARD_TONE_MAPPING",[il]:"CINEON_TONE_MAPPING",[Sr]:"ACES_FILMIC_TONE_MAPPING",[rl]:"AGX_TONE_MAPPING",[al]:"NEUTRAL_TONE_MAPPING",[sl]:"CUSTOM_TONE_MAPPING"};function bb(s,e,t,n,i){let r=new Yt(e,t,{type:s,depthBuffer:n,stencilBuffer:i,depthTexture:n?new jn(e,t):void 0}),a=new Yt(e,t,{type:Fn,depthBuffer:!1,stencilBuffer:!1}),o=new zt;o.setAttribute("position",new Ot([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Ot([0,2,0,0,2,0],2));let c=new ka({uniforms:{tDiffuse:{value:null}},vertexShader:`
+ precision highp float;
+
+ uniform mat4 modelViewMatrix;
+ uniform mat4 projectionMatrix;
+
+ attribute vec3 position;
+ attribute vec2 uv;
+
+ varying vec2 vUv;
+
+ void main() {
+ vUv = uv;
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+ }`,fragmentShader:`
+ precision highp float;
+
+ uniform sampler2D tDiffuse;
+
+ varying vec2 vUv;
+
+ #include <tonemapping_pars_fragment>
+ #include <colorspace_pars_fragment>
+
+ void main() {
+ gl_FragColor = texture2D( tDiffuse, vUv );
+
+ #ifdef LINEAR_TONE_MAPPING
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
+ #elif defined( REINHARD_TONE_MAPPING )
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
+ #elif defined( CINEON_TONE_MAPPING )
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
+ #elif defined( AGX_TONE_MAPPING )
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
+ #elif defined( NEUTRAL_TONE_MAPPING )
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
+ #elif defined( CUSTOM_TONE_MAPPING )
+ gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
+ #endif
+
+ #ifdef SRGB_TRANSFER
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
+ #endif
+ }`,depthTest:!1,depthWrite:!1}),l=new lt(o,c),h=new di(-1,1,1,-1,0,1),u=null,d=null,f=!1,g,_=null,m=[],p=!1;this.setSize=function(v,S){r.setSize(v,S),a.setSize(v,S);for(let M=0;M<m.length;M++){let E=m[M];E.setSize&&E.setSize(v,S)}},this.setEffects=function(v){m=v,p=m.length>0&&m[0].isRenderPass===!0;let S=r.width,M=r.height;for(let E=0;E<m.length;E++){let T=m[E];T.setSize&&T.setSize(S,M)}},this.begin=function(v,S){if(f||v.toneMapping===bn&&m.length===0)return!1;if(_=S,S!==null){let M=S.width,E=S.height;(r.width!==M||r.height!==E)&&this.setSize(M,E)}return p===!1&&v.setRenderTarget(r),g=v.toneMapping,v.toneMapping=bn,!0},this.hasRenderPass=function(){return p},this.end=function(v,S){v.toneMapping=g,f=!0;let M=r,E=a;for(let T=0;T<m.length;T++){let C=m[T];if(C.enabled!==!1&&(C.render(v,E,M,S),C.needsSwap!==!1)){let x=M;M=E,E=x}}if(u!==v.outputColorSpace||d!==v.toneMapping){u=v.outputColorSpace,d=v.toneMapping,c.defines={},Be.getTransfer(u)===Je&&(c.defines.SRGB_TRANSFER="");let T=gb[d];T&&(c.defines[T]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=M.texture,v.setRenderTarget(_),v.render(l,h),_=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){r.depthTexture&&r.depthTexture.dispose(),r.dispose(),a.dispose(),o.dispose(),c.dispose()}}var Rd=new Ct,Ll=new jn(1,1),Cd=new Qs,Pd=new Fa,Id=new cr,ld=[],hd=[],ud=new Float32Array(16),dd=new Float32Array(9),fd=new Float32Array(4);function Ls(s,e,t){let n=s[0];if(n<=0||n>0)return s;let i=e*t,r=ld[i];if(r===void 0&&(r=new Float32Array(i),ld[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function wt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Et(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function Ko(s,e){let t=hd[e];t===void 0&&(t=new Int32Array(e),hd[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function xb(s,e){let t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function _b(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(wt(t,e))return;s.uniform2fv(this.addr,e),Et(t,e)}}function vb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(wt(t,e))return;s.uniform3fv(this.addr,e),Et(t,e)}}function yb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(wt(t,e))return;s.uniform4fv(this.addr,e),Et(t,e)}}function Mb(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(wt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Et(t,e)}else{if(wt(t,n))return;fd.set(n),s.uniformMatrix2fv(this.addr,!1,fd),Et(t,n)}}function Sb(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(wt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Et(t,e)}else{if(wt(t,n))return;dd.set(n),s.uniformMatrix3fv(this.addr,!1,dd),Et(t,n)}}function Ab(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(wt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Et(t,e)}else{if(wt(t,n))return;ud.set(n),s.uniformMatrix4fv(this.addr,!1,ud),Et(t,n)}}function Tb(s,e){let t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function wb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(wt(t,e))return;s.uniform2iv(this.addr,e),Et(t,e)}}function Eb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(wt(t,e))return;s.uniform3iv(this.addr,e),Et(t,e)}}function Rb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(wt(t,e))return;s.uniform4iv(this.addr,e),Et(t,e)}}function Cb(s,e){let t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Pb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(wt(t,e))return;s.uniform2uiv(this.addr,e),Et(t,e)}}function Ib(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(wt(t,e))return;s.uniform3uiv(this.addr,e),Et(t,e)}}function Lb(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(wt(t,e))return;s.uniform4uiv(this.addr,e),Et(t,e)}}function Db(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(Ll.compareFunction=t.isReversedDepthBuffer()?Vo:Go,r=Ll):r=Rd,t.setTexture2D(e||r,i)}function Fb(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Pd,i)}function Nb(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Id,i)}function Ub(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Cd,i)}function Ob(s){switch(s){case 5126:return xb;case 35664:return _b;case 35665:return vb;case 35666:return yb;case 35674:return Mb;case 35675:return Sb;case 35676:return Ab;case 5124:case 35670:return Tb;case 35667:case 35671:return wb;case 35668:case 35672:return Eb;case 35669:case 35673:return Rb;case 5125:return Cb;case 36294:return Pb;case 36295:return Ib;case 36296:return Lb;case 35678:case 36198:case 36298:case 36306:case 35682:return Db;case 35679:case 36299:case 36307:return Fb;case 35680:case 36300:case 36308:case 36293:return Nb;case 36289:case 36303:case 36311:case 36292:return Ub}}function kb(s,e){s.uniform1fv(this.addr,e)}function Bb(s,e){let t=Ls(e,this.size,2);s.uniform2fv(this.addr,t)}function zb(s,e){let t=Ls(e,this.size,3);s.uniform3fv(this.addr,t)}function Gb(s,e){let t=Ls(e,this.size,4);s.uniform4fv(this.addr,t)}function Vb(s,e){let t=Ls(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function Hb(s,e){let t=Ls(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function Wb(s,e){let t=Ls(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function qb(s,e){s.uniform1iv(this.addr,e)}function Xb(s,e){s.uniform2iv(this.addr,e)}function jb(s,e){s.uniform3iv(this.addr,e)}function Kb(s,e){s.uniform4iv(this.addr,e)}function Jb(s,e){s.uniform1uiv(this.addr,e)}function Yb(s,e){s.uniform2uiv(this.addr,e)}function Zb(s,e){s.uniform3uiv(this.addr,e)}function $b(s,e){s.uniform4uiv(this.addr,e)}function Qb(s,e,t){let n=this.cache,i=e.length,r=Ko(t,i);wt(n,r)||(s.uniform1iv(this.addr,r),Et(n,r));let a;this.type===s.SAMPLER_2D_SHADOW?a=Ll:a=Rd;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,r[o])}function e0(s,e,t){let n=this.cache,i=e.length,r=Ko(t,i);wt(n,r)||(s.uniform1iv(this.addr,r),Et(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Pd,r[a])}function t0(s,e,t){let n=this.cache,i=e.length,r=Ko(t,i);wt(n,r)||(s.uniform1iv(this.addr,r),Et(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Id,r[a])}function n0(s,e,t){let n=this.cache,i=e.length,r=Ko(t,i);wt(n,r)||(s.uniform1iv(this.addr,r),Et(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Cd,r[a])}function i0(s){switch(s){case 5126:return kb;case 35664:return Bb;case 35665:return zb;case 35666:return Gb;case 35674:return Vb;case 35675:return Hb;case 35676:return Wb;case 5124:case 35670:return qb;case 35667:case 35671:return Xb;case 35668:case 35672:return jb;case 35669:case 35673:return Kb;case 5125:return Jb;case 36294:return Yb;case 36295:return Zb;case 36296:return $b;case 35678:case 36198:case 36298:case 36306:case 35682:return Qb;case 35679:case 36299:case 36307:return e0;case 35680:case 36300:case 36308:case 36293:return t0;case 36289:case 36303:case 36311:case 36292:return n0}}var Dl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Ob(t.type)}},Fl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=i0(t.type)}},Nl=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,a=i.length;r!==a;++r){let o=i[r];o.setValue(e,t[o.id],n)}}},Pl=/(\w+)(\])?(\[|\.)?/g;function pd(s,e){s.seq.push(e),s.map[e.id]=e}function s0(s,e,t){let n=s.name,i=n.length;for(Pl.lastIndex=0;;){let r=Pl.exec(n),a=Pl.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){pd(t,l===void 0?new Dl(o,s,e):new Fl(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new Nl(o),pd(t,u)),t=u}}}var Ps=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){let o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);s0(o,c,this)}let i=[],r=[];for(let a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):r.push(a);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){let r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){let o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let a=e[i];a.id in t&&n.push(a)}return n}};function md(s,e,t){let n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}var r0=37297,a0=0;function o0(s,e){let t=s.split(`
+`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){let o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
+`)}var gd=new Pe;function c0(s){Be._getMatrix(gd,Be.workingColorSpace,s);let e=`mat3( ${gd.elements.map(t=>t.toFixed(4))} )`;switch(Be.getTransfer(s)){case Zs:return[e,"LinearTransferOETF"];case Je:return[e,"sRGBTransferOETF"];default:return _e("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function bd(s,e,t){let n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";let a=/ERROR: 0:(\d+)/.exec(r);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
+
+`+r+`
+
+`+o0(s.getShaderSource(e),o)}else return r}function l0(s,e){let t=c0(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
+`)}var h0={[tl]:"Linear",[nl]:"Reinhard",[il]:"Cineon",[Sr]:"ACESFilmic",[rl]:"AgX",[al]:"Neutral",[sl]:"Custom"};function u0(s,e){let t=h0[e];return t===void 0?(_e("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Wo=new F;function d0(){Be.getLuminanceCoefficients(Wo);let s=Wo.x.toFixed(4),e=Wo.y.toFixed(4),t=Wo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
+`)}function f0(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Or).join(`
+`)}function p0(s){let e=[];for(let t in s){let n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
+`)}function m0(s,e){let t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){let r=s.getActiveAttrib(e,i),a=r.name,o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function Or(s){return s!==""}function xd(s,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function _d(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var g0=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ul(s){return s.replace(g0,x0)}var b0=new Map;function x0(s,e){let t=Oe[e];if(t===void 0){let n=b0.get(e);if(n!==void 0)t=Oe[n],_e('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ul(t)}var _0=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function vd(s){return s.replace(_0,v0)}function v0(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function yd(s){let e=`precision ${s.precision} float;
+ precision ${s.precision} int;
+ precision ${s.precision} sampler2D;
+ precision ${s.precision} samplerCube;
+ precision ${s.precision} sampler3D;
+ precision ${s.precision} sampler2DArray;
+ precision ${s.precision} sampler2DShadow;
+ precision ${s.precision} samplerCubeShadow;
+ precision ${s.precision} sampler2DArrayShadow;
+ precision ${s.precision} isampler2D;
+ precision ${s.precision} isampler3D;
+ precision ${s.precision} isamplerCube;
+ precision ${s.precision} isampler2DArray;
+ precision ${s.precision} usampler2D;
+ precision ${s.precision} usampler3D;
+ precision ${s.precision} usamplerCube;
+ precision ${s.precision} usampler2DArray;
+ `;return s.precision==="highp"?e+=`
+#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
+#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
+#define LOW_PRECISION`),e}var y0={[Mr]:"SHADOWMAP_TYPE_PCF",[As]:"SHADOWMAP_TYPE_VSM"};function M0(s){return y0[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var S0={[pi]:"ENVMAP_TYPE_CUBE",[zi]:"ENVMAP_TYPE_CUBE",[Ar]:"ENVMAP_TYPE_CUBE_UV"};function A0(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":S0[s.envMapMode]||"ENVMAP_TYPE_CUBE"}var T0={[zi]:"ENVMAP_MODE_REFRACTION"};function w0(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":T0[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}var E0={[$a]:"ENVMAP_BLENDING_MULTIPLY",[Uu]:"ENVMAP_BLENDING_MIX",[Ou]:"ENVMAP_BLENDING_ADD"};function R0(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":E0[s.combine]||"ENVMAP_BLENDING_NONE"}function C0(s){let e=s.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function P0(s,e,t,n){let i=s.getContext(),r=t.defines,a=t.vertexShader,o=t.fragmentShader,c=M0(t),l=A0(t),h=w0(t),u=R0(t),d=C0(t),f=f0(t),g=p0(r),_=i.createProgram(),m,p,v=t.glslVersion?"#version "+t.glslVersion+`
+`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Or).join(`
+`),m.length>0&&(m+=`
+`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Or).join(`
+`),p.length>0&&(p+=`
+`)):(m=[yd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
+`].filter(Or).join(`
+`),p=[yd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==bn?"#define TONE_MAPPING":"",t.toneMapping!==bn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==bn?u0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,l0("linearToOutputTexel",t.outputColorSpace),d0(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
+`].filter(Or).join(`
+`)),a=Ul(a),a=xd(a,t),a=_d(a,t),o=Ul(o),o=xd(o,t),o=_d(o,t),a=vd(a),o=vd(o),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
+`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
+`)+`
+`+m,p=["#define varying in",t.glslVersion===ml?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ml?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
+`)+`
+`+p);let S=v+m+a,M=v+p+o,E=md(i,i.VERTEX_SHADER,S),T=md(i,i.FRAGMENT_SHADER,M);i.attachShader(_,E),i.attachShader(_,T),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(R){if(s.debug.checkShaderErrors){let O=i.getProgramInfoLog(_)||"",H=i.getShaderInfoLog(E)||"",q=i.getShaderInfoLog(T)||"",N=O.trim(),z=H.trim(),V=q.trim(),$=!0,Q=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if($=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,E,T);else{let le=bd(i,E,"vertex"),xe=bd(i,T,"fragment");we("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
+
+Material Name: `+R.name+`
+Material Type: `+R.type+`
+
+Program Info Log: `+N+`
+`+le+`
+`+xe)}else N!==""?_e("WebGLProgram: Program Info Log:",N):(z===""||V==="")&&(Q=!1);Q&&(R.diagnostics={runnable:$,programLog:N,vertexShader:{log:z,prefix:m},fragmentShader:{log:V,prefix:p}})}i.deleteShader(E),i.deleteShader(T),x=new Ps(i,_),w=m0(i,_)}let x;this.getUniforms=function(){return x===void 0&&C(this),x};let w;this.getAttributes=function(){return w===void 0&&C(this),w};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(_,r0)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=a0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=E,this.fragmentShader=T,this}var I0=0,Ol=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new kl(e),t.set(e,n)),n}},kl=class{constructor(e){this.id=I0++,this.code=e,this.usedTimes=0}};function L0(s){return s===gi||s===Cr||s===Pr}function D0(s,e,t,n,i,r){let a=new er,o=new Ol,c=new Set,l=[],h=new Map,u=n.logarithmicDepthBuffer,d=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(x){return c.add(x),x===0?"uv":`uv${x}`}function _(x,w,L,R,O,H){let q=R.fog,N=O.geometry,z=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?R.environment:null,V=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,$=e.get(x.envMap||z,V),Q=$&&$.mapping===Ar?$.image.height:null,le=f[x.type];x.precision!==null&&(d=n.getMaxPrecision(x.precision),d!==x.precision&&_e("WebGLProgram.getParameters:",x.precision,"not supported, using",d,"instead."));let xe=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,Se=xe!==void 0?xe.length:0,Xe=0;N.morphAttributes.position!==void 0&&(Xe=1),N.morphAttributes.normal!==void 0&&(Xe=2),N.morphAttributes.color!==void 0&&(Xe=3);let Ze,Fe,J,de;if(le){let Le=Un[le];Ze=Le.vertexShader,Fe=Le.fragmentShader}else Ze=x.vertexShader,Fe=x.fragmentShader,o.update(x),J=o.getVertexShaderID(x),de=o.getFragmentShaderID(x);let ie=s.getRenderTarget(),Ee=s.state.buffers.depth.getReversed(),Ie=O.isInstancedMesh===!0,Re=O.isBatchedMesh===!0,ht=!!x.map,We=!!x.matcap,$e=!!$,ot=!!x.aoMap,Ge=!!x.lightMap,At=!!x.bumpMap,ut=!!x.normalMap,Xt=!!x.displacementMap,I=!!x.emissiveMap,Tt=!!x.metalnessMap,qe=!!x.roughnessMap,rt=x.anisotropy>0,oe=x.clearcoat>0,dt=x.dispersion>0,A=x.iridescence>0,b=x.sheen>0,U=x.transmission>0,j=rt&&!!x.anisotropyMap,Z=oe&&!!x.clearcoatMap,ee=oe&&!!x.clearcoatNormalMap,ae=oe&&!!x.clearcoatRoughnessMap,W=A&&!!x.iridescenceMap,K=A&&!!x.iridescenceThicknessMap,fe=b&&!!x.sheenColorMap,ge=b&&!!x.sheenRoughnessMap,se=!!x.specularMap,te=!!x.specularColorMap,Ce=!!x.specularIntensityMap,Ne=U&&!!x.transmissionMap,Ke=U&&!!x.thicknessMap,P=!!x.gradientMap,ne=!!x.alphaMap,X=x.alphaTest>0,pe=!!x.alphaHash,re=!!x.extensions,Y=bn;x.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(Y=s.toneMapping);let ye={shaderID:le,shaderType:x.type,shaderName:x.name,vertexShader:Ze,fragmentShader:Fe,defines:x.defines,customVertexShaderID:J,customFragmentShaderID:de,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,batching:Re,batchingColor:Re&&O._colorsTexture!==null,instancing:Ie,instancingColor:Ie&&O.instanceColor!==null,instancingMorph:Ie&&O.morphTexture!==null,outputColorSpace:ie===null?s.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:Be.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:ht,matcap:We,envMap:$e,envMapMode:$e&&$.mapping,envMapCubeUVHeight:Q,aoMap:ot,lightMap:Ge,bumpMap:At,normalMap:ut,displacementMap:Xt,emissiveMap:I,normalMapObjectSpace:ut&&x.normalMapType===Hu,normalMapTangentSpace:ut&&x.normalMapType===Dr,packedNormalMap:ut&&x.normalMapType===Dr&&L0(x.normalMap.format),metalnessMap:Tt,roughnessMap:qe,anisotropy:rt,anisotropyMap:j,clearcoat:oe,clearcoatMap:Z,clearcoatNormalMap:ee,clearcoatRoughnessMap:ae,dispersion:dt,iridescence:A,iridescenceMap:W,iridescenceThicknessMap:K,sheen:b,sheenColorMap:fe,sheenRoughnessMap:ge,specularMap:se,specularColorMap:te,specularIntensityMap:Ce,transmission:U,transmissionMap:Ne,thicknessMap:Ke,gradientMap:P,opaque:x.transparent===!1&&x.blending===Ri&&x.alphaToCoverage===!1,alphaMap:ne,alphaTest:X,alphaHash:pe,combine:x.combine,mapUv:ht&&g(x.map.channel),aoMapUv:ot&&g(x.aoMap.channel),lightMapUv:Ge&&g(x.lightMap.channel),bumpMapUv:At&&g(x.bumpMap.channel),normalMapUv:ut&&g(x.normalMap.channel),displacementMapUv:Xt&&g(x.displacementMap.channel),emissiveMapUv:I&&g(x.emissiveMap.channel),metalnessMapUv:Tt&&g(x.metalnessMap.channel),roughnessMapUv:qe&&g(x.roughnessMap.channel),anisotropyMapUv:j&&g(x.anisotropyMap.channel),clearcoatMapUv:Z&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:ee&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:K&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:ge&&g(x.sheenRoughnessMap.channel),specularMapUv:se&&g(x.specularMap.channel),specularColorMapUv:te&&g(x.specularColorMap.channel),specularIntensityMapUv:Ce&&g(x.specularIntensityMap.channel),transmissionMapUv:Ne&&g(x.transmissionMap.channel),thicknessMapUv:Ke&&g(x.thicknessMap.channel),alphaMapUv:ne&&g(x.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(ut||rt),vertexNormals:!!N.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!N.attributes.uv&&(ht||ne),fog:!!q,useFog:x.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||N.attributes.normal===void 0&&ut===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Ee,skinning:O.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:Se,morphTextureStride:Xe,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:H.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:s.shadowMap.enabled&&L.length>0,shadowMapType:s.shadowMap.type,toneMapping:Y,decodeVideoTexture:ht&&x.map.isVideoTexture===!0&&Be.getTransfer(x.map.colorSpace)===Je,decodeVideoTextureEmissive:I&&x.emissiveMap.isVideoTexture===!0&&Be.getTransfer(x.emissiveMap.colorSpace)===Je,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===sn,flipSided:x.side===Pt,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:re&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(re&&x.extensions.multiDraw===!0||Re)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return ye.vertexUv1s=c.has(1),ye.vertexUv2s=c.has(2),ye.vertexUv3s=c.has(3),c.clear(),ye}function m(x){let w=[];if(x.shaderID?w.push(x.shaderID):(w.push(x.customVertexShaderID),w.push(x.customFragmentShaderID)),x.defines!==void 0)for(let L in x.defines)w.push(L),w.push(x.defines[L]);return x.isRawShaderMaterial===!1&&(p(w,x),v(w,x),w.push(s.outputColorSpace)),w.push(x.customProgramCacheKey),w.join()}function p(x,w){x.push(w.precision),x.push(w.outputColorSpace),x.push(w.envMapMode),x.push(w.envMapCubeUVHeight),x.push(w.mapUv),x.push(w.alphaMapUv),x.push(w.lightMapUv),x.push(w.aoMapUv),x.push(w.bumpMapUv),x.push(w.normalMapUv),x.push(w.displacementMapUv),x.push(w.emissiveMapUv),x.push(w.metalnessMapUv),x.push(w.roughnessMapUv),x.push(w.anisotropyMapUv),x.push(w.clearcoatMapUv),x.push(w.clearcoatNormalMapUv),x.push(w.clearcoatRoughnessMapUv),x.push(w.iridescenceMapUv),x.push(w.iridescenceThicknessMapUv),x.push(w.sheenColorMapUv),x.push(w.sheenRoughnessMapUv),x.push(w.specularMapUv),x.push(w.specularColorMapUv),x.push(w.specularIntensityMapUv),x.push(w.transmissionMapUv),x.push(w.thicknessMapUv),x.push(w.combine),x.push(w.fogExp2),x.push(w.sizeAttenuation),x.push(w.morphTargetsCount),x.push(w.morphAttributeCount),x.push(w.numDirLights),x.push(w.numPointLights),x.push(w.numSpotLights),x.push(w.numSpotLightMaps),x.push(w.numHemiLights),x.push(w.numRectAreaLights),x.push(w.numDirLightShadows),x.push(w.numPointLightShadows),x.push(w.numSpotLightShadows),x.push(w.numSpotLightShadowsWithMaps),x.push(w.numLightProbes),x.push(w.shadowMapType),x.push(w.toneMapping),x.push(w.numClippingPlanes),x.push(w.numClipIntersection),x.push(w.depthPacking)}function v(x,w){a.disableAll(),w.instancing&&a.enable(0),w.instancingColor&&a.enable(1),w.instancingMorph&&a.enable(2),w.matcap&&a.enable(3),w.envMap&&a.enable(4),w.normalMapObjectSpace&&a.enable(5),w.normalMapTangentSpace&&a.enable(6),w.clearcoat&&a.enable(7),w.iridescence&&a.enable(8),w.alphaTest&&a.enable(9),w.vertexColors&&a.enable(10),w.vertexAlphas&&a.enable(11),w.vertexUv1s&&a.enable(12),w.vertexUv2s&&a.enable(13),w.vertexUv3s&&a.enable(14),w.vertexTangents&&a.enable(15),w.anisotropy&&a.enable(16),w.alphaHash&&a.enable(17),w.batching&&a.enable(18),w.dispersion&&a.enable(19),w.batchingColor&&a.enable(20),w.gradientMap&&a.enable(21),w.packedNormalMap&&a.enable(22),w.vertexNormals&&a.enable(23),x.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.reversedDepthBuffer&&a.enable(4),w.skinning&&a.enable(5),w.morphTargets&&a.enable(6),w.morphNormals&&a.enable(7),w.morphColors&&a.enable(8),w.premultipliedAlpha&&a.enable(9),w.shadowMapEnabled&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),w.decodeVideoTextureEmissive&&a.enable(20),w.alphaToCoverage&&a.enable(21),w.numLightProbeGrids>0&&a.enable(22),x.push(a.mask)}function S(x){let w=f[x.type],L;if(w){let R=Un[w];L=td.clone(R.uniforms)}else L=x.uniforms;return L}function M(x,w){let L=h.get(w);return L!==void 0?++L.usedTimes:(L=new P0(s,w,x,i),l.push(L),h.set(w,L)),L}function E(x){if(--x.usedTimes===0){let w=l.indexOf(x);l[w]=l[l.length-1],l.pop(),h.delete(x.cacheKey),x.destroy()}}function T(x){o.remove(x)}function C(){o.dispose()}return{getParameters:_,getProgramCacheKey:m,getUniforms:S,acquireProgram:M,releaseProgram:E,releaseShaderCache:T,programs:l,dispose:C}}function F0(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,c){s.get(a)[o]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function N0(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function Md(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Sd(){let s=[],e=0,t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function o(d,f,g,_,m,p){let v=s[e];return v===void 0?(v={id:d.id,object:d,geometry:f,material:g,materialVariant:a(d),groupOrder:_,renderOrder:d.renderOrder,z:m,group:p},s[e]=v):(v.id=d.id,v.object=d,v.geometry=f,v.material=g,v.materialVariant=a(d),v.groupOrder=_,v.renderOrder=d.renderOrder,v.z=m,v.group=p),e++,v}function c(d,f,g,_,m,p){let v=o(d,f,g,_,m,p);g.transmission>0?n.push(v):g.transparent===!0?i.push(v):t.push(v)}function l(d,f,g,_,m,p){let v=o(d,f,g,_,m,p);g.transmission>0?n.unshift(v):g.transparent===!0?i.unshift(v):t.unshift(v)}function h(d,f){t.length>1&&t.sort(d||N0),n.length>1&&n.sort(f||Md),i.length>1&&i.sort(f||Md)}function u(){for(let d=e,f=s.length;d<f;d++){let g=s[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:c,unshift:l,finish:u,sort:h}}function U0(){let s=new WeakMap;function e(n,i){let r=s.get(n),a;return r===void 0?(a=new Sd,s.set(n,[a])):i>=r.length?(a=new Sd,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function O0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Te};break;case"SpotLight":t={position:new F,direction:new F,color:new Te,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Te,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Te,groundColor:new Te};break;case"RectAreaLight":t={color:new Te,position:new F,halfWidth:new F,halfHeight:new F};break}return s[e.id]=t,t}}}function k0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}var B0=0;function z0(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function G0(s){let e=new O0,t=k0(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new F);let i=new F,r=new Ue,a=new Ue;function o(l){let h=0,u=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,g=0,_=0,m=0,p=0,v=0,S=0,M=0,E=0,T=0,C=0;l.sort(z0);for(let w=0,L=l.length;w<L;w++){let R=l[w],O=R.color,H=R.intensity,q=R.distance,N=null;if(R.shadow&&R.shadow.map&&(R.shadow.map.texture.format===gi?N=R.shadow.map.texture:N=R.shadow.map.depthTexture||R.shadow.map.texture),R.isAmbientLight)h+=O.r*H,u+=O.g*H,d+=O.b*H;else if(R.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(R.sh.coefficients[z],H);C++}else if(R.isDirectionalLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.directionalShadow[f]=$,n.directionalShadowMap[f]=N,n.directionalShadowMatrix[f]=R.shadow.matrix,v++}n.directional[f]=z,f++}else if(R.isSpotLight){let z=e.get(R);z.position.setFromMatrixPosition(R.matrixWorld),z.color.copy(O).multiplyScalar(H),z.distance=q,z.coneCos=Math.cos(R.angle),z.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),z.decay=R.decay,n.spot[_]=z;let V=R.shadow;if(R.map&&(n.spotLightMap[E]=R.map,E++,V.updateMatrices(R),R.castShadow&&T++),n.spotLightMatrix[_]=V.matrix,R.castShadow){let $=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.spotShadow[_]=$,n.spotShadowMap[_]=N,M++}_++}else if(R.isRectAreaLight){let z=e.get(R);z.color.copy(O).multiplyScalar(H),z.halfWidth.set(R.width*.5,0,0),z.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=z,m++}else if(R.isPointLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),z.distance=R.distance,z.decay=R.decay,R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,$.shadowCameraNear=V.camera.near,$.shadowCameraFar=V.camera.far,n.pointShadow[g]=$,n.pointShadowMap[g]=N,n.pointShadowMatrix[g]=R.shadow.matrix,S++}n.point[g]=z,g++}else if(R.isHemisphereLight){let z=e.get(R);z.skyColor.copy(R.color).multiplyScalar(H),z.groundColor.copy(R.groundColor).multiplyScalar(H),n.hemi[p]=z,p++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ce.LTC_FLOAT_1,n.rectAreaLTC2=ce.LTC_FLOAT_2):(n.rectAreaLTC1=ce.LTC_HALF_1,n.rectAreaLTC2=ce.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;let x=n.hash;(x.directionalLength!==f||x.pointLength!==g||x.spotLength!==_||x.rectAreaLength!==m||x.hemiLength!==p||x.numDirectionalShadows!==v||x.numPointShadows!==S||x.numSpotShadows!==M||x.numSpotMaps!==E||x.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=M+E-T,n.spotLightMap.length=E,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,x.directionalLength=f,x.pointLength=g,x.spotLength=_,x.rectAreaLength=m,x.hemiLength=p,x.numDirectionalShadows=v,x.numPointShadows=S,x.numSpotShadows=M,x.numSpotMaps=E,x.numLightProbes=C,n.version=B0++)}function c(l,h){let u=0,d=0,f=0,g=0,_=0,m=h.matrixWorldInverse;for(let p=0,v=l.length;p<v;p++){let S=l[p];if(S.isDirectionalLight){let M=n.directional[u];M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),u++}else if(S.isSpotLight){let M=n.spot[f];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),f++}else if(S.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),a.identity(),r.copy(S.matrixWorld),r.premultiply(m),a.extractRotation(r),M.halfWidth.set(S.width*.5,0,0),M.halfHeight.set(0,S.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(S.isPointLight){let M=n.point[d];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),d++}else if(S.isHemisphereLight){let M=n.hemi[_];M.direction.setFromMatrixPosition(S.matrixWorld),M.direction.transformDirection(m),_++}}}return{setup:o,setupView:c,state:n}}function Ad(s){let e=new G0(s),t=[],n=[],i=[];function r(d){u.camera=d,t.length=0,n.length=0,i.length=0}function a(d){t.push(d)}function o(d){n.push(d)}function c(d){i.push(d)}function l(){e.setup(t)}function h(d){e.setupView(t,d)}let u={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:u,setupLights:l,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function V0(s){let e=new WeakMap;function t(i,r=0){let a=e.get(i),o;return a===void 0?(o=new Ad(s),e.set(i,[o])):r>=a.length?(o=new Ad(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}var H0=`void main() {
+ gl_Position = vec4( position, 1.0 );
+}`,W0=`uniform sampler2D shadow_pass;
+uniform vec2 resolution;
+uniform float radius;
+void main() {
+ const float samples = float( VSM_SAMPLES );
+ float mean = 0.0;
+ float squared_mean = 0.0;
+ float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
+ float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
+ for ( float i = 0.0; i < samples; i ++ ) {
+ float uvOffset = uvStart + i * uvStride;
+ #ifdef HORIZONTAL_PASS
+ vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
+ mean += distribution.x;
+ squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
+ #else
+ float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
+ mean += depth;
+ squared_mean += depth * depth;
+ #endif
+ }
+ mean = mean / samples;
+ squared_mean = squared_mean / samples;
+ float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
+ gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
+}`,q0=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],X0=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Td=new Ue,Ur=new F,Il=new F;function j0(s,e,t){let n=new vs,i=new He,r=new He,a=new nt,o=new Ba,c=new za,l={},h=t.maxTextureSize,u={[pn]:Pt,[Pt]:pn,[sn]:sn},d=new Zt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:H0,fragmentShader:W0}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let g=new zt;g.setAttribute("position",new St(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new lt(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Mr;let p=this.type;this.render=function(T,C,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;this.type===bu&&(_e("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Mr);let w=s.getRenderTarget(),L=s.getActiveCubeFace(),R=s.getActiveMipmapLevel(),O=s.state;O.setBlending(Dn),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);let H=p!==this.type;H&&C.traverse(function(q){q.material&&(Array.isArray(q.material)?q.material.forEach(N=>N.needsUpdate=!0):q.material.needsUpdate=!0)});for(let q=0,N=T.length;q<N;q++){let z=T[q],V=z.shadow;if(V===void 0){_e("WebGLShadowMap:",z,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);let $=V.getFrameExtents();i.multiply($),r.copy(V.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/$.x),i.x=r.x*$.x,V.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/$.y),i.y=r.y*$.y,V.mapSize.y=r.y));let Q=s.state.buffers.depth.getReversed();if(V.camera._reversedDepth=Q,V.map===null||H===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===As){if(z.isPointLight){_e("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Yt(i.x,i.y,{format:gi,type:Fn,minFilter:_t,magFilter:_t,generateMipmaps:!1}),V.map.texture.name=z.name+".shadowMap",V.map.depthTexture=new jn(i.x,i.y,$t),V.map.depthTexture.name=z.name+".shadowMapDepth",V.map.depthTexture.format=Tn,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt}else z.isPointLight?(V.map=new qo(i.x),V.map.depthTexture=new Oa(i.x,_n)):(V.map=new Yt(i.x,i.y),V.map.depthTexture=new jn(i.x,i.y,_n)),V.map.depthTexture.name=z.name+".shadowMap",V.map.depthTexture.format=Tn,this.type===Mr?(V.map.depthTexture.compareFunction=Q?Vo:Go,V.map.depthTexture.minFilter=_t,V.map.depthTexture.magFilter=_t):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt);V.camera.updateProjectionMatrix()}let le=V.map.isWebGLCubeRenderTarget?6:1;for(let xe=0;xe<le;xe++){if(V.map.isWebGLCubeRenderTarget)s.setRenderTarget(V.map,xe),s.clear();else{xe===0&&(s.setRenderTarget(V.map),s.clear());let Se=V.getViewport(xe);a.set(r.x*Se.x,r.y*Se.y,r.x*Se.z,r.y*Se.w),O.viewport(a)}if(z.isPointLight){let Se=V.camera,Xe=V.matrix,Ze=z.distance||Se.far;Ze!==Se.far&&(Se.far=Ze,Se.updateProjectionMatrix()),Ur.setFromMatrixPosition(z.matrixWorld),Se.position.copy(Ur),Il.copy(Se.position),Il.add(q0[xe]),Se.up.copy(X0[xe]),Se.lookAt(Il),Se.updateMatrixWorld(),Xe.makeTranslation(-Ur.x,-Ur.y,-Ur.z),Td.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),V._frustum.setFromProjectionMatrix(Td,Se.coordinateSystem,Se.reversedDepth)}else V.updateMatrices(z);n=V.getFrustum(),M(C,x,V.camera,z,this.type)}V.isPointLightShadow!==!0&&this.type===As&&v(V,x),V.needsUpdate=!1}p=this.type,m.needsUpdate=!1,s.setRenderTarget(w,L,R)};function v(T,C){let x=e.update(_);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Yt(i.x,i.y,{format:gi,type:Fn})),d.uniforms.shadow_pass.value=T.map.depthTexture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,s.setRenderTarget(T.mapPass),s.clear(),s.renderBufferDirect(C,null,x,d,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,s.setRenderTarget(T.map),s.clear(),s.renderBufferDirect(C,null,x,f,_,null)}function S(T,C,x,w){let L=null,R=x.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(R!==void 0)L=R;else if(L=x.isPointLight===!0?c:o,s.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){let O=L.uuid,H=C.uuid,q=l[O];q===void 0&&(q={},l[O]=q);let N=q[H];N===void 0&&(N=L.clone(),q[H]=N,C.addEventListener("dispose",E)),L=N}if(L.visible=C.visible,L.wireframe=C.wireframe,w===As?L.side=C.shadowSide!==null?C.shadowSide:C.side:L.side=C.shadowSide!==null?C.shadowSide:u[C.side],L.alphaMap=C.alphaMap,L.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,L.map=C.map,L.clipShadows=C.clipShadows,L.clippingPlanes=C.clippingPlanes,L.clipIntersection=C.clipIntersection,L.displacementMap=C.displacementMap,L.displacementScale=C.displacementScale,L.displacementBias=C.displacementBias,L.wireframeLinewidth=C.wireframeLinewidth,L.linewidth=C.linewidth,x.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let O=s.properties.get(L);O.light=x}return L}function M(T,C,x,w,L){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&L===As)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,T.matrixWorld);let H=e.update(T),q=T.material;if(Array.isArray(q)){let N=H.groups;for(let z=0,V=N.length;z<V;z++){let $=N[z],Q=q[$.materialIndex];if(Q&&Q.visible){let le=S(T,Q,w,L);T.onBeforeShadow(s,T,C,x,H,le,$),s.renderBufferDirect(x,null,H,le,T,$),T.onAfterShadow(s,T,C,x,H,le,$)}}}else if(q.visible){let N=S(T,q,w,L);T.onBeforeShadow(s,T,C,x,H,N,null),s.renderBufferDirect(x,null,H,N,T,null),T.onAfterShadow(s,T,C,x,H,N,null)}}let O=T.children;for(let H=0,q=O.length;H<q;H++)M(O[H],C,x,w,L)}function E(T){T.target.removeEventListener("dispose",E);for(let x in l){let w=l[x],L=T.target.uuid;L in w&&(w[L].dispose(),delete w[L])}}}function K0(s,e){function t(){let P=!1,ne=new nt,X=null,pe=new nt(0,0,0,0);return{setMask:function(re){X!==re&&!P&&(s.colorMask(re,re,re,re),X=re)},setLocked:function(re){P=re},setClear:function(re,Y,ye,Le,pt){pt===!0&&(re*=Le,Y*=Le,ye*=Le),ne.set(re,Y,ye,Le),pe.equals(ne)===!1&&(s.clearColor(re,Y,ye,Le),pe.copy(ne))},reset:function(){P=!1,X=null,pe.set(-1,0,0,0)}}}function n(){let P=!1,ne=!1,X=null,pe=null,re=null;return{setReversed:function(Y){if(ne!==Y){let ye=e.get("EXT_clip_control");Y?ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.ZERO_TO_ONE_EXT):ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.NEGATIVE_ONE_TO_ONE_EXT),ne=Y;let Le=re;re=null,this.setClear(Le)}},getReversed:function(){return ne},setTest:function(Y){Y?ie(s.DEPTH_TEST):Ee(s.DEPTH_TEST)},setMask:function(Y){X!==Y&&!P&&(s.depthMask(Y),X=Y)},setFunc:function(Y){if(ne&&(Y=Qu[Y]),pe!==Y){switch(Y){case Sa:s.depthFunc(s.NEVER);break;case Aa:s.depthFunc(s.ALWAYS);break;case Ta:s.depthFunc(s.LESS);break;case Ci:s.depthFunc(s.LEQUAL);break;case wa:s.depthFunc(s.EQUAL);break;case Ea:s.depthFunc(s.GEQUAL);break;case Ra:s.depthFunc(s.GREATER);break;case Ca:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}pe=Y}},setLocked:function(Y){P=Y},setClear:function(Y){re!==Y&&(re=Y,ne&&(Y=1-Y),s.clearDepth(Y))},reset:function(){P=!1,X=null,pe=null,re=null,ne=!1}}}function i(){let P=!1,ne=null,X=null,pe=null,re=null,Y=null,ye=null,Le=null,pt=null;return{setTest:function(Qe){P||(Qe?ie(s.STENCIL_TEST):Ee(s.STENCIL_TEST))},setMask:function(Qe){ne!==Qe&&!P&&(s.stencilMask(Qe),ne=Qe)},setFunc:function(Qe,Bn,vn){(X!==Qe||pe!==Bn||re!==vn)&&(s.stencilFunc(Qe,Bn,vn),X=Qe,pe=Bn,re=vn)},setOp:function(Qe,Bn,vn){(Y!==Qe||ye!==Bn||Le!==vn)&&(s.stencilOp(Qe,Bn,vn),Y=Qe,ye=Bn,Le=vn)},setLocked:function(Qe){P=Qe},setClear:function(Qe){pt!==Qe&&(s.clearStencil(Qe),pt=Qe)},reset:function(){P=!1,ne=null,X=null,pe=null,re=null,Y=null,ye=null,Le=null,pt=null}}}let r=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap,h={},u={},d={},f=new WeakMap,g=[],_=null,m=!1,p=null,v=null,S=null,M=null,E=null,T=null,C=null,x=new Te(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,z=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),V=!1,$=0,Q=s.getParameter(s.VERSION);Q.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(Q)[1]),V=$>=1):Q.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),V=$>=2);let le=null,xe={},Se=s.getParameter(s.SCISSOR_BOX),Xe=s.getParameter(s.VIEWPORT),Ze=new nt().fromArray(Se),Fe=new nt().fromArray(Xe);function J(P,ne,X,pe){let re=new Uint8Array(4),Y=s.createTexture();s.bindTexture(P,Y),s.texParameteri(P,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(P,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ye=0;ye<X;ye++)P===s.TEXTURE_3D||P===s.TEXTURE_2D_ARRAY?s.texImage3D(ne,0,s.RGBA,1,1,pe,0,s.RGBA,s.UNSIGNED_BYTE,re):s.texImage2D(ne+ye,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,re);return Y}let de={};de[s.TEXTURE_2D]=J(s.TEXTURE_2D,s.TEXTURE_2D,1),de[s.TEXTURE_CUBE_MAP]=J(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),de[s.TEXTURE_2D_ARRAY]=J(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),de[s.TEXTURE_3D]=J(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ie(s.DEPTH_TEST),a.setFunc(Ci),At(!1),ut(Zc),ie(s.CULL_FACE),ot(Dn);function ie(P){h[P]!==!0&&(s.enable(P),h[P]=!0)}function Ee(P){h[P]!==!1&&(s.disable(P),h[P]=!1)}function Ie(P,ne){return d[P]!==ne?(s.bindFramebuffer(P,ne),d[P]=ne,P===s.DRAW_FRAMEBUFFER&&(d[s.FRAMEBUFFER]=ne),P===s.FRAMEBUFFER&&(d[s.DRAW_FRAMEBUFFER]=ne),!0):!1}function Re(P,ne){let X=g,pe=!1;if(P){X=f.get(ne),X===void 0&&(X=[],f.set(ne,X));let re=P.textures;if(X.length!==re.length||X[0]!==s.COLOR_ATTACHMENT0){for(let Y=0,ye=re.length;Y<ye;Y++)X[Y]=s.COLOR_ATTACHMENT0+Y;X.length=re.length,pe=!0}}else X[0]!==s.BACK&&(X[0]=s.BACK,pe=!0);pe&&s.drawBuffers(X)}function ht(P){return _!==P?(s.useProgram(P),_=P,!0):!1}let We={[ci]:s.FUNC_ADD,[_u]:s.FUNC_SUBTRACT,[vu]:s.FUNC_REVERSE_SUBTRACT};We[yu]=s.MIN,We[Mu]=s.MAX;let $e={[Su]:s.ZERO,[Au]:s.ONE,[Tu]:s.SRC_COLOR,[ya]:s.SRC_ALPHA,[Iu]:s.SRC_ALPHA_SATURATE,[Cu]:s.DST_COLOR,[Eu]:s.DST_ALPHA,[wu]:s.ONE_MINUS_SRC_COLOR,[Ma]:s.ONE_MINUS_SRC_ALPHA,[Pu]:s.ONE_MINUS_DST_COLOR,[Ru]:s.ONE_MINUS_DST_ALPHA,[Lu]:s.CONSTANT_COLOR,[Du]:s.ONE_MINUS_CONSTANT_COLOR,[Fu]:s.CONSTANT_ALPHA,[Nu]:s.ONE_MINUS_CONSTANT_ALPHA};function ot(P,ne,X,pe,re,Y,ye,Le,pt,Qe){if(P===Dn){m===!0&&(Ee(s.BLEND),m=!1);return}if(m===!1&&(ie(s.BLEND),m=!0),P!==xu){if(P!==p||Qe!==L){if((v!==ci||E!==ci)&&(s.blendEquation(s.FUNC_ADD),v=ci,E=ci),Qe)switch(P){case Ri:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case $c:s.blendFunc(s.ONE,s.ONE);break;case Qc:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case el:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:we("WebGLState: Invalid blending: ",P);break}else switch(P){case Ri:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case $c:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Qc:we("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case el:we("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:we("WebGLState: Invalid blending: ",P);break}S=null,M=null,T=null,C=null,x.set(0,0,0),w=0,p=P,L=Qe}return}re=re||ne,Y=Y||X,ye=ye||pe,(ne!==v||re!==E)&&(s.blendEquationSeparate(We[ne],We[re]),v=ne,E=re),(X!==S||pe!==M||Y!==T||ye!==C)&&(s.blendFuncSeparate($e[X],$e[pe],$e[Y],$e[ye]),S=X,M=pe,T=Y,C=ye),(Le.equals(x)===!1||pt!==w)&&(s.blendColor(Le.r,Le.g,Le.b,pt),x.copy(Le),w=pt),p=P,L=!1}function Ge(P,ne){P.side===sn?Ee(s.CULL_FACE):ie(s.CULL_FACE);let X=P.side===Pt;ne&&(X=!X),At(X),P.blending===Ri&&P.transparent===!1?ot(Dn):ot(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),r.setMask(P.colorWrite);let pe=P.stencilWrite;o.setTest(pe),pe&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),I(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?ie(s.SAMPLE_ALPHA_TO_COVERAGE):Ee(s.SAMPLE_ALPHA_TO_COVERAGE)}function At(P){R!==P&&(P?s.frontFace(s.CW):s.frontFace(s.CCW),R=P)}function ut(P){P!==mu?(ie(s.CULL_FACE),P!==O&&(P===Zc?s.cullFace(s.BACK):P===gu?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Ee(s.CULL_FACE),O=P}function Xt(P){P!==H&&(V&&s.lineWidth(P),H=P)}function I(P,ne,X){P?(ie(s.POLYGON_OFFSET_FILL),(q!==ne||N!==X)&&(q=ne,N=X,a.getReversed()&&(ne=-ne),s.polygonOffset(ne,X))):Ee(s.POLYGON_OFFSET_FILL)}function Tt(P){P?ie(s.SCISSOR_TEST):Ee(s.SCISSOR_TEST)}function qe(P){P===void 0&&(P=s.TEXTURE0+z-1),le!==P&&(s.activeTexture(P),le=P)}function rt(P,ne,X){X===void 0&&(le===null?X=s.TEXTURE0+z-1:X=le);let pe=xe[X];pe===void 0&&(pe={type:void 0,texture:void 0},xe[X]=pe),(pe.type!==P||pe.texture!==ne)&&(le!==X&&(s.activeTexture(X),le=X),s.bindTexture(P,ne||de[P]),pe.type=P,pe.texture=ne)}function oe(){let P=xe[le];P!==void 0&&P.type!==void 0&&(s.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function dt(){try{s.compressedTexImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function A(){try{s.compressedTexImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function b(){try{s.texSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function U(){try{s.texSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function j(){try{s.compressedTexSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function Z(){try{s.compressedTexSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function ee(){try{s.texStorage2D(...arguments)}catch(P){we("WebGLState:",P)}}function ae(){try{s.texStorage3D(...arguments)}catch(P){we("WebGLState:",P)}}function W(){try{s.texImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function K(){try{s.texImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function fe(P){return u[P]!==void 0?u[P]:s.getParameter(P)}function ge(P,ne){u[P]!==ne&&(s.pixelStorei(P,ne),u[P]=ne)}function se(P){Ze.equals(P)===!1&&(s.scissor(P.x,P.y,P.z,P.w),Ze.copy(P))}function te(P){Fe.equals(P)===!1&&(s.viewport(P.x,P.y,P.z,P.w),Fe.copy(P))}function Ce(P,ne){let X=l.get(ne);X===void 0&&(X=new WeakMap,l.set(ne,X));let pe=X.get(P);pe===void 0&&(pe=s.getUniformBlockIndex(ne,P.name),X.set(P,pe))}function Ne(P,ne){let pe=l.get(ne).get(P);c.get(ne)!==pe&&(s.uniformBlockBinding(ne,pe,P.__bindingPointIndex),c.set(ne,pe))}function Ke(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),s.pixelStorei(s.PACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL),s.pixelStorei(s.PACK_ROW_LENGTH,0),s.pixelStorei(s.PACK_SKIP_PIXELS,0),s.pixelStorei(s.PACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_ROW_LENGTH,0),s.pixelStorei(s.UNPACK_IMAGE_HEIGHT,0),s.pixelStorei(s.UNPACK_SKIP_PIXELS,0),s.pixelStorei(s.UNPACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_SKIP_IMAGES,0),h={},u={},le=null,xe={},d={},f=new WeakMap,g=[],_=null,m=!1,p=null,v=null,S=null,M=null,E=null,T=null,C=null,x=new Te(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,Ze.set(0,0,s.canvas.width,s.canvas.height),Fe.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ie,disable:Ee,bindFramebuffer:Ie,drawBuffers:Re,useProgram:ht,setBlending:ot,setMaterial:Ge,setFlipSided:At,setCullFace:ut,setLineWidth:Xt,setPolygonOffset:I,setScissorTest:Tt,activeTexture:qe,bindTexture:rt,unbindTexture:oe,compressedTexImage2D:dt,compressedTexImage3D:A,texImage2D:W,texImage3D:K,pixelStorei:ge,getParameter:fe,updateUBOMapping:Ce,uniformBlockBinding:Ne,texStorage2D:ee,texStorage3D:ae,texSubImage2D:b,texSubImage3D:U,compressedTexSubImage2D:j,compressedTexSubImage3D:Z,scissor:se,viewport:te,reset:Ke}}function J0(s,e,t,n,i,r,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new He,h=new WeakMap,u=new Set,d,f=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(A,b){return g?new OffscreenCanvas(A,b):ds("canvas")}function m(A,b,U){let j=1,Z=dt(A);if((Z.width>U||Z.height>U)&&(j=U/Math.max(Z.width,Z.height)),j<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){let ee=Math.floor(j*Z.width),ae=Math.floor(j*Z.height);d===void 0&&(d=_(ee,ae));let W=b?_(ee,ae):d;return W.width=ee,W.height=ae,W.getContext("2d").drawImage(A,0,0,ee,ae),_e("WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+ee+"x"+ae+")."),W}else return"data"in A&&_e("WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),A;return A}function p(A){return A.generateMipmaps}function v(A){s.generateMipmap(A)}function S(A){return A.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?s.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function M(A,b,U,j,Z,ee=!1){if(A!==null){if(s[A]!==void 0)return s[A];_e("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ae;j&&(ae=e.get("EXT_texture_norm16"),ae||_e("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=b;if(b===s.RED&&(U===s.FLOAT&&(W=s.R32F),U===s.HALF_FLOAT&&(W=s.R16F),U===s.UNSIGNED_BYTE&&(W=s.R8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.R16_EXT),U===s.SHORT&&ae&&(W=ae.R16_SNORM_EXT)),b===s.RED_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.R8UI),U===s.UNSIGNED_SHORT&&(W=s.R16UI),U===s.UNSIGNED_INT&&(W=s.R32UI),U===s.BYTE&&(W=s.R8I),U===s.SHORT&&(W=s.R16I),U===s.INT&&(W=s.R32I)),b===s.RG&&(U===s.FLOAT&&(W=s.RG32F),U===s.HALF_FLOAT&&(W=s.RG16F),U===s.UNSIGNED_BYTE&&(W=s.RG8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RG16_EXT),U===s.SHORT&&ae&&(W=ae.RG16_SNORM_EXT)),b===s.RG_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RG8UI),U===s.UNSIGNED_SHORT&&(W=s.RG16UI),U===s.UNSIGNED_INT&&(W=s.RG32UI),U===s.BYTE&&(W=s.RG8I),U===s.SHORT&&(W=s.RG16I),U===s.INT&&(W=s.RG32I)),b===s.RGB_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGB8UI),U===s.UNSIGNED_SHORT&&(W=s.RGB16UI),U===s.UNSIGNED_INT&&(W=s.RGB32UI),U===s.BYTE&&(W=s.RGB8I),U===s.SHORT&&(W=s.RGB16I),U===s.INT&&(W=s.RGB32I)),b===s.RGBA_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGBA8UI),U===s.UNSIGNED_SHORT&&(W=s.RGBA16UI),U===s.UNSIGNED_INT&&(W=s.RGBA32UI),U===s.BYTE&&(W=s.RGBA8I),U===s.SHORT&&(W=s.RGBA16I),U===s.INT&&(W=s.RGBA32I)),b===s.RGB&&(U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGB16_EXT),U===s.SHORT&&ae&&(W=ae.RGB16_SNORM_EXT),U===s.UNSIGNED_INT_5_9_9_9_REV&&(W=s.RGB9_E5),U===s.UNSIGNED_INT_10F_11F_11F_REV&&(W=s.R11F_G11F_B10F)),b===s.RGBA){let K=ee?Zs:Be.getTransfer(Z);U===s.FLOAT&&(W=s.RGBA32F),U===s.HALF_FLOAT&&(W=s.RGBA16F),U===s.UNSIGNED_BYTE&&(W=K===Je?s.SRGB8_ALPHA8:s.RGBA8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGBA16_EXT),U===s.SHORT&&ae&&(W=ae.RGBA16_SNORM_EXT),U===s.UNSIGNED_SHORT_4_4_4_4&&(W=s.RGBA4),U===s.UNSIGNED_SHORT_5_5_5_1&&(W=s.RGB5_A1)}return(W===s.R16F||W===s.R32F||W===s.RG16F||W===s.RG32F||W===s.RGBA16F||W===s.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function E(A,b){let U;return A?b===null||b===_n||b===Es?U=s.DEPTH24_STENCIL8:b===$t?U=s.DEPTH32F_STENCIL8:b===ws&&(U=s.DEPTH24_STENCIL8,_e("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===_n||b===Es?U=s.DEPTH_COMPONENT24:b===$t?U=s.DEPTH_COMPONENT32F:b===ws&&(U=s.DEPTH_COMPONENT16),U}function T(A,b){return p(A)===!0||A.isFramebufferTexture&&A.minFilter!==xt&&A.minFilter!==_t?Math.log2(Math.max(b.width,b.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?b.mipmaps.length:1}function C(A){let b=A.target;b.removeEventListener("dispose",C),w(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&u.delete(b)}function x(A){let b=A.target;b.removeEventListener("dispose",x),R(b)}function w(A){let b=n.get(A);if(b.__webglInit===void 0)return;let U=A.source,j=f.get(U);if(j){let Z=j[b.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&L(A),Object.keys(j).length===0&&f.delete(U)}n.remove(A)}function L(A){let b=n.get(A);s.deleteTexture(b.__webglTexture);let U=A.source,j=f.get(U);delete j[b.__cacheKey],a.memory.textures--}function R(A){let b=n.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),n.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(b.__webglFramebuffer[j]))for(let Z=0;Z<b.__webglFramebuffer[j].length;Z++)s.deleteFramebuffer(b.__webglFramebuffer[j][Z]);else s.deleteFramebuffer(b.__webglFramebuffer[j]);b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer[j])}else{if(Array.isArray(b.__webglFramebuffer))for(let j=0;j<b.__webglFramebuffer.length;j++)s.deleteFramebuffer(b.__webglFramebuffer[j]);else s.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&s.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let j=0;j<b.__webglColorRenderbuffer.length;j++)b.__webglColorRenderbuffer[j]&&s.deleteRenderbuffer(b.__webglColorRenderbuffer[j]);b.__webglDepthRenderbuffer&&s.deleteRenderbuffer(b.__webglDepthRenderbuffer)}let U=A.textures;for(let j=0,Z=U.length;j<Z;j++){let ee=n.get(U[j]);ee.__webglTexture&&(s.deleteTexture(ee.__webglTexture),a.memory.textures--),n.remove(U[j])}n.remove(A)}let O=0;function H(){O=0}function q(){return O}function N(A){O=A}function z(){let A=O;return A>=i.maxTextures&&_e("WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+i.maxTextures),O+=1,A}function V(A){let b=[];return b.push(A.wrapS),b.push(A.wrapT),b.push(A.wrapR||0),b.push(A.magFilter),b.push(A.minFilter),b.push(A.anisotropy),b.push(A.internalFormat),b.push(A.format),b.push(A.type),b.push(A.generateMipmaps),b.push(A.premultiplyAlpha),b.push(A.flipY),b.push(A.unpackAlignment),b.push(A.colorSpace),b.join()}function $(A,b){let U=n.get(A);if(A.isVideoTexture&&rt(A),A.isRenderTargetTexture===!1&&A.isExternalTexture!==!0&&A.version>0&&U.__version!==A.version){let j=A.image;if(j===null)_e("WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)_e("WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(U,A,b);return}}else A.isExternalTexture&&(U.__webglTexture=A.sourceTexture?A.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,U.__webglTexture,s.TEXTURE0+b)}function Q(A,b){let U=n.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&U.__version!==A.version){Ee(U,A,b);return}else A.isExternalTexture&&(U.__webglTexture=A.sourceTexture?A.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,U.__webglTexture,s.TEXTURE0+b)}function le(A,b){let U=n.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&U.__version!==A.version){Ee(U,A,b);return}t.bindTexture(s.TEXTURE_3D,U.__webglTexture,s.TEXTURE0+b)}function xe(A,b){let U=n.get(A);if(A.isCubeDepthTexture!==!0&&A.version>0&&U.__version!==A.version){Ie(U,A,b);return}t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+b)}let Se={[li]:s.REPEAT,[nn]:s.CLAMP_TO_EDGE,[hs]:s.MIRRORED_REPEAT},Xe={[xt]:s.NEAREST,[to]:s.NEAREST_MIPMAP_NEAREST,[Gi]:s.NEAREST_MIPMAP_LINEAR,[_t]:s.LINEAR,[Ts]:s.LINEAR_MIPMAP_NEAREST,[xn]:s.LINEAR_MIPMAP_LINEAR},Ze={[Wu]:s.NEVER,[Ju]:s.ALWAYS,[qu]:s.LESS,[Go]:s.LEQUAL,[Xu]:s.EQUAL,[Vo]:s.GEQUAL,[ju]:s.GREATER,[Ku]:s.NOTEQUAL};function Fe(A,b){if(b.type===$t&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===_t||b.magFilter===Ts||b.magFilter===Gi||b.magFilter===xn||b.minFilter===_t||b.minFilter===Ts||b.minFilter===Gi||b.minFilter===xn)&&_e("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(A,s.TEXTURE_WRAP_S,Se[b.wrapS]),s.texParameteri(A,s.TEXTURE_WRAP_T,Se[b.wrapT]),(A===s.TEXTURE_3D||A===s.TEXTURE_2D_ARRAY)&&s.texParameteri(A,s.TEXTURE_WRAP_R,Se[b.wrapR]),s.texParameteri(A,s.TEXTURE_MAG_FILTER,Xe[b.magFilter]),s.texParameteri(A,s.TEXTURE_MIN_FILTER,Xe[b.minFilter]),b.compareFunction&&(s.texParameteri(A,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(A,s.TEXTURE_COMPARE_FUNC,Ze[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===xt||b.minFilter!==Gi&&b.minFilter!==xn||b.type===$t&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||n.get(b).__currentAnisotropy){let U=e.get("EXT_texture_filter_anisotropic");s.texParameterf(A,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,i.getMaxAnisotropy())),n.get(b).__currentAnisotropy=b.anisotropy}}}function J(A,b){let U=!1;A.__webglInit===void 0&&(A.__webglInit=!0,b.addEventListener("dispose",C));let j=b.source,Z=f.get(j);Z===void 0&&(Z={},f.set(j,Z));let ee=V(b);if(ee!==A.__cacheKey){Z[ee]===void 0&&(Z[ee]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,U=!0),Z[ee].usedTimes++;let ae=Z[A.__cacheKey];ae!==void 0&&(Z[A.__cacheKey].usedTimes--,ae.usedTimes===0&&L(b)),A.__cacheKey=ee,A.__webglTexture=Z[ee].texture}return U}function de(A,b,U){return Math.floor(Math.floor(A/U)/b)}function ie(A,b,U,j){let ee=A.updateRanges;if(ee.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,b.width,b.height,U,j,b.data);else{ee.sort((ge,se)=>ge.start-se.start);let ae=0;for(let ge=1;ge<ee.length;ge++){let se=ee[ae],te=ee[ge],Ce=se.start+se.count,Ne=de(te.start,b.width,4),Ke=de(se.start,b.width,4);te.start<=Ce+1&&Ne===Ke&&de(te.start+te.count-1,b.width,4)===Ne?se.count=Math.max(se.count,te.start+te.count-se.start):(++ae,ee[ae]=te)}ee.length=ae+1;let W=t.getParameter(s.UNPACK_ROW_LENGTH),K=t.getParameter(s.UNPACK_SKIP_PIXELS),fe=t.getParameter(s.UNPACK_SKIP_ROWS);t.pixelStorei(s.UNPACK_ROW_LENGTH,b.width);for(let ge=0,se=ee.length;ge<se;ge++){let te=ee[ge],Ce=Math.floor(te.start/4),Ne=Math.ceil(te.count/4),Ke=Ce%b.width,P=Math.floor(Ce/b.width),ne=Ne,X=1;t.pixelStorei(s.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(s.UNPACK_SKIP_ROWS,P),t.texSubImage2D(s.TEXTURE_2D,0,Ke,P,ne,X,U,j,b.data)}A.clearUpdateRanges(),t.pixelStorei(s.UNPACK_ROW_LENGTH,W),t.pixelStorei(s.UNPACK_SKIP_PIXELS,K),t.pixelStorei(s.UNPACK_SKIP_ROWS,fe)}}function Ee(A,b,U){let j=s.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(j=s.TEXTURE_2D_ARRAY),b.isData3DTexture&&(j=s.TEXTURE_3D);let Z=J(A,b),ee=b.source;t.bindTexture(j,A.__webglTexture,s.TEXTURE0+U);let ae=n.get(ee);if(ee.version!==ae.__version||Z===!0){if(t.activeTexture(s.TEXTURE0+U),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){let X=Be.getPrimaries(Be.workingColorSpace),pe=b.colorSpace===Zn?null:Be.getPrimaries(b.colorSpace),re=b.colorSpace===Zn||X===pe?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,re)}t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment);let K=m(b.image,!1,i.maxTextureSize);K=oe(b,K);let fe=r.convert(b.format,b.colorSpace),ge=r.convert(b.type),se=M(b.internalFormat,fe,ge,b.normalized,b.colorSpace,b.isVideoTexture);Fe(j,b);let te,Ce=b.mipmaps,Ne=b.isVideoTexture!==!0,Ke=ae.__version===void 0||Z===!0,P=ee.dataReady,ne=T(b,K);if(b.isDepthTexture)se=E(b.format===mi,b.type),Ke&&(Ne?t.texStorage2D(s.TEXTURE_2D,1,se,K.width,K.height):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,null));else if(b.isDataTexture)if(Ce.length>0){Ne&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Ce[0].width,Ce[0].height);for(let X=0,pe=Ce.length;X<pe;X++)te=Ce[X],Ne?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data);b.generateMipmaps=!1}else Ne?(Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height),P&&ie(b,K,fe,ge)):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,K.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){Ne&&Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,Ce[0].width,Ce[0].height,K.depth);for(let X=0,pe=Ce.length;X<pe;X++)if(te=Ce[X],b.format!==Qt)if(fe!==null)if(Ne){if(P)if(b.layerUpdates.size>0){let re=vl(te.width,te.height,b.format,b.type);for(let Y of b.layerUpdates){let ye=te.data.subarray(Y*re/te.data.BYTES_PER_ELEMENT,(Y+1)*re/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,Y,te.width,te.height,1,fe,ye)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,te.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,te.data,0,0);else _e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ne?P&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,ge,te.data):t.texImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,fe,ge,te.data)}else{Ne&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Ce[0].width,Ce[0].height);for(let X=0,pe=Ce.length;X<pe;X++)te=Ce[X],b.format!==Qt?fe!==null?Ne?P&&t.compressedTexSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,te.data):t.compressedTexImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,te.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ne?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data)}else if(b.isDataArrayTexture)if(Ne){if(Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,K.width,K.height,K.depth),P)if(b.layerUpdates.size>0){let X=vl(K.width,K.height,b.format,b.type);for(let pe of b.layerUpdates){let re=K.data.subarray(pe*X/K.data.BYTES_PER_ELEMENT,(pe+1)*X/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,pe,K.width,K.height,1,fe,ge,re)}b.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isData3DTexture)Ne?(Ke&&t.texStorage3D(s.TEXTURE_3D,ne,se,K.width,K.height,K.depth),P&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)):t.texImage3D(s.TEXTURE_3D,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isFramebufferTexture){if(Ke)if(Ne)t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height);else{let X=K.width,pe=K.height;for(let re=0;re<ne;re++)t.texImage2D(s.TEXTURE_2D,re,se,X,pe,0,fe,ge,null),X>>=1,pe>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in s){let X=s.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),K.parentNode!==X){X.appendChild(K),u.add(b),X.onpaint=Le=>{let pt=Le.changedElements;for(let Qe of u)pt.includes(Qe.image)&&(Qe.needsUpdate=!0)},X.requestPaint();return}let pe=0,re=s.RGBA,Y=s.RGBA,ye=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,pe,re,Y,ye,K),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(Ce.length>0){if(Ne&&Ke){let X=dt(Ce[0]);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}for(let X=0,pe=Ce.length;X<pe;X++)te=Ce[X],Ne?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,fe,ge,te):t.texImage2D(s.TEXTURE_2D,X,se,fe,ge,te);b.generateMipmaps=!1}else if(Ne){if(Ke){let X=dt(K);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}P&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,fe,ge,K)}else t.texImage2D(s.TEXTURE_2D,0,se,fe,ge,K);p(b)&&v(j),ae.__version=ee.version,b.onUpdate&&b.onUpdate(b)}A.__version=b.version}function Ie(A,b,U){if(b.image.length!==6)return;let j=J(A,b),Z=b.source;t.bindTexture(s.TEXTURE_CUBE_MAP,A.__webglTexture,s.TEXTURE0+U);let ee=n.get(Z);if(Z.version!==ee.__version||j===!0){t.activeTexture(s.TEXTURE0+U);let ae=Be.getPrimaries(Be.workingColorSpace),W=b.colorSpace===Zn?null:Be.getPrimaries(b.colorSpace),K=b.colorSpace===Zn||ae===W?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,K);let fe=b.isCompressedTexture||b.image[0].isCompressedTexture,ge=b.image[0]&&b.image[0].isDataTexture,se=[];for(let Y=0;Y<6;Y++)!fe&&!ge?se[Y]=m(b.image[Y],!0,i.maxCubemapSize):se[Y]=ge?b.image[Y].image:b.image[Y],se[Y]=oe(b,se[Y]);let te=se[0],Ce=r.convert(b.format,b.colorSpace),Ne=r.convert(b.type),Ke=M(b.internalFormat,Ce,Ne,b.normalized,b.colorSpace),P=b.isVideoTexture!==!0,ne=ee.__version===void 0||j===!0,X=Z.dataReady,pe=T(b,te);Fe(s.TEXTURE_CUBE_MAP,b);let re;if(fe){P&&ne&&t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,te.width,te.height);for(let Y=0;Y<6;Y++){re=se[Y].mipmaps;for(let ye=0;ye<re.length;ye++){let Le=re[ye];b.format!==Qt?Ce!==null?P?X&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye,0,0,Le.width,Le.height,Ce,Le.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye,Ke,Le.width,Le.height,0,Le.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye,0,0,Le.width,Le.height,Ce,Ne,Le.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye,Ke,Le.width,Le.height,0,Ce,Ne,Le.data)}}}else{if(re=b.mipmaps,P&&ne){re.length>0&&pe++;let Y=dt(se[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,Y.width,Y.height)}for(let Y=0;Y<6;Y++)if(ge){P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,se[Y].width,se[Y].height,Ce,Ne,se[Y].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Ke,se[Y].width,se[Y].height,0,Ce,Ne,se[Y].data);for(let ye=0;ye<re.length;ye++){let pt=re[ye].image[Y].image;P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye+1,0,0,pt.width,pt.height,Ce,Ne,pt.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye+1,Ke,pt.width,pt.height,0,Ce,Ne,pt.data)}}else{P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,Ce,Ne,se[Y]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Ke,Ce,Ne,se[Y]);for(let ye=0;ye<re.length;ye++){let Le=re[ye];P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye+1,0,0,Ce,Ne,Le.image[Y]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Y,ye+1,Ke,Ce,Ne,Le.image[Y])}}}p(b)&&v(s.TEXTURE_CUBE_MAP),ee.__version=Z.version,b.onUpdate&&b.onUpdate(b)}A.__version=b.version}function Re(A,b,U,j,Z,ee){let ae=r.convert(U.format,U.colorSpace),W=r.convert(U.type),K=M(U.internalFormat,ae,W,U.normalized,U.colorSpace),fe=n.get(b),ge=n.get(U);if(ge.__renderTarget=b,!fe.__hasExternalTextures){let se=Math.max(1,b.width>>ee),te=Math.max(1,b.height>>ee);Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY?t.texImage3D(Z,ee,K,se,te,b.depth,0,ae,W,null):t.texImage2D(Z,ee,K,se,te,0,ae,W,null)}t.bindFramebuffer(s.FRAMEBUFFER,A),qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,j,Z,ge.__webglTexture,0,Tt(b)):(Z===s.TEXTURE_2D||Z>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,j,Z,ge.__webglTexture,ee),t.bindFramebuffer(s.FRAMEBUFFER,null)}function ht(A,b,U){if(s.bindRenderbuffer(s.RENDERBUFFER,A),b.depthBuffer){let j=b.depthTexture,Z=j&&j.isDepthTexture?j.type:null,ee=E(b.stencilBuffer,Z),ae=b.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Tt(b),ee,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,Tt(b),ee,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,ee,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,ae,s.RENDERBUFFER,A)}else{let j=b.textures;for(let Z=0;Z<j.length;Z++){let ee=j[Z],ae=r.convert(ee.format,ee.colorSpace),W=r.convert(ee.type),K=M(ee.internalFormat,ae,W,ee.normalized,ee.colorSpace);qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Tt(b),K,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,Tt(b),K,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,K,b.width,b.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function We(A,b,U){let j=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,A),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Z=n.get(b.depthTexture);if(Z.__renderTarget=b,(!Z.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),j){if(Z.__webglInit===void 0&&(Z.__webglInit=!0,b.depthTexture.addEventListener("dispose",C)),Z.__webglTexture===void 0){Z.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,Z.__webglTexture),Fe(s.TEXTURE_CUBE_MAP,b.depthTexture);let fe=r.convert(b.depthTexture.format),ge=r.convert(b.depthTexture.type),se;b.depthTexture.format===Tn?se=s.DEPTH_COMPONENT24:b.depthTexture.format===mi&&(se=s.DEPTH24_STENCIL8);for(let te=0;te<6;te++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,se,b.width,b.height,0,fe,ge,null)}}else $(b.depthTexture,0);let ee=Z.__webglTexture,ae=Tt(b),W=j?s.TEXTURE_CUBE_MAP_POSITIVE_X+U:s.TEXTURE_2D,K=b.depthTexture.format===mi?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(b.depthTexture.format===Tn)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else if(b.depthTexture.format===mi)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else throw new Error("Unknown depthTexture format")}function $e(A){let b=n.get(A),U=A.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==A.depthTexture){let j=A.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),j){let Z=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,j.removeEventListener("dispose",Z)};j.addEventListener("dispose",Z),b.__depthDisposeCallback=Z}b.__boundDepthTexture=j}if(A.depthTexture&&!b.__autoAllocateDepthBuffer)if(U)for(let j=0;j<6;j++)We(b.__webglFramebuffer[j],A,j);else{let j=A.texture.mipmaps;j&&j.length>0?We(b.__webglFramebuffer[0],A,0):We(b.__webglFramebuffer,A,0)}else if(U){b.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[j]),b.__webglDepthbuffer[j]===void 0)b.__webglDepthbuffer[j]=s.createRenderbuffer(),ht(b.__webglDepthbuffer[j],A,!1);else{let Z=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer[j];s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}else{let j=A.texture.mipmaps;if(j&&j.length>0?t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=s.createRenderbuffer(),ht(b.__webglDepthbuffer,A,!1);else{let Z=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function ot(A,b,U){let j=n.get(A);b!==void 0&&Re(j.__webglFramebuffer,A,A.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),U!==void 0&&$e(A)}function Ge(A){let b=A.texture,U=n.get(A),j=n.get(b);A.addEventListener("dispose",x);let Z=A.textures,ee=A.isWebGLCubeRenderTarget===!0,ae=Z.length>1;if(ae||(j.__webglTexture===void 0&&(j.__webglTexture=s.createTexture()),j.__version=b.version,a.memory.textures++),ee){U.__webglFramebuffer=[];for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer[W]=[];for(let K=0;K<b.mipmaps.length;K++)U.__webglFramebuffer[W][K]=s.createFramebuffer()}else U.__webglFramebuffer[W]=s.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer=[];for(let W=0;W<b.mipmaps.length;W++)U.__webglFramebuffer[W]=s.createFramebuffer()}else U.__webglFramebuffer=s.createFramebuffer();if(ae)for(let W=0,K=Z.length;W<K;W++){let fe=n.get(Z[W]);fe.__webglTexture===void 0&&(fe.__webglTexture=s.createTexture(),a.memory.textures++)}if(A.samples>0&&qe(A)===!1){U.__webglMultisampledFramebuffer=s.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let W=0;W<Z.length;W++){let K=Z[W];U.__webglColorRenderbuffer[W]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,U.__webglColorRenderbuffer[W]);let fe=r.convert(K.format,K.colorSpace),ge=r.convert(K.type),se=M(K.internalFormat,fe,ge,K.normalized,K.colorSpace,A.isXRRenderTarget===!0),te=Tt(A);s.renderbufferStorageMultisample(s.RENDERBUFFER,te,se,A.width,A.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+W,s.RENDERBUFFER,U.__webglColorRenderbuffer[W])}s.bindRenderbuffer(s.RENDERBUFFER,null),A.depthBuffer&&(U.__webglDepthRenderbuffer=s.createRenderbuffer(),ht(U.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(ee){t.bindTexture(s.TEXTURE_CUBE_MAP,j.__webglTexture),Fe(s.TEXTURE_CUBE_MAP,b);for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Re(U.__webglFramebuffer[W][K],A,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,K);else Re(U.__webglFramebuffer[W],A,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);p(b)&&v(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ae){for(let W=0,K=Z.length;W<K;W++){let fe=Z[W],ge=n.get(fe),se=s.TEXTURE_2D;(A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(se=A.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(se,ge.__webglTexture),Fe(se,fe),Re(U.__webglFramebuffer,A,fe,s.COLOR_ATTACHMENT0+W,se,0),p(fe)&&v(se)}t.unbindTexture()}else{let W=s.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(W=A.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(W,j.__webglTexture),Fe(W,b),b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Re(U.__webglFramebuffer[K],A,b,s.COLOR_ATTACHMENT0,W,K);else Re(U.__webglFramebuffer,A,b,s.COLOR_ATTACHMENT0,W,0);p(b)&&v(W),t.unbindTexture()}A.depthBuffer&&$e(A)}function At(A){let b=A.textures;for(let U=0,j=b.length;U<j;U++){let Z=b[U];if(p(Z)){let ee=S(A),ae=n.get(Z).__webglTexture;t.bindTexture(ee,ae),v(ee),t.unbindTexture()}}}let ut=[],Xt=[];function I(A){if(A.samples>0){if(qe(A)===!1){let b=A.textures,U=A.width,j=A.height,Z=s.COLOR_BUFFER_BIT,ee=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ae=n.get(A),W=b.length>1;if(W)for(let fe=0;fe<b.length;fe++)t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ae.__webglMultisampledFramebuffer);let K=A.texture.mipmaps;K&&K.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer);for(let fe=0;fe<b.length;fe++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(Z|=s.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(Z|=s.STENCIL_BUFFER_BIT)),W){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,ge,0)}s.blitFramebuffer(0,0,U,j,0,0,U,j,Z,s.NEAREST),c===!0&&(ut.length=0,Xt.length=0,ut.push(s.COLOR_ATTACHMENT0+fe),A.depthBuffer&&A.resolveDepthBuffer===!1&&(ut.push(ee),Xt.push(ee),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Xt)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,ut))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),W)for(let fe=0;fe<b.length;fe++){t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,ge,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&c){let b=A.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[b])}}}function Tt(A){return Math.min(i.maxSamples,A.samples)}function qe(A){let b=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function rt(A){let b=a.render.frame;h.get(A)!==b&&(h.set(A,b),A.update())}function oe(A,b){let U=A.colorSpace,j=A.format,Z=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||U!==kt&&U!==Zn&&(Be.getTransfer(U)===Je?(j!==Qt||Z!==qt)&&_e("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):we("WebGLTextures: Unsupported texture color space:",U)),b}function dt(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(l.width=A.naturalWidth||A.width,l.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(l.width=A.displayWidth,l.height=A.displayHeight):(l.width=A.width,l.height=A.height),l}this.allocateTextureUnit=z,this.resetTextureUnits=H,this.getTextureUnits=q,this.setTextureUnits=N,this.setTexture2D=$,this.setTexture2DArray=Q,this.setTexture3D=le,this.setTextureCube=xe,this.rebindTextures=ot,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=At,this.updateMultisampleRenderTarget=I,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Re,this.useMultisampledRTT=qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Y0(s,e){function t(n,i=Zn){let r,a=Be.getTransfer(i);if(n===qt)return s.UNSIGNED_BYTE;if(n===io)return s.UNSIGNED_SHORT_4_4_4_4;if(n===so)return s.UNSIGNED_SHORT_5_5_5_1;if(n===hl)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===ul)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===cl)return s.BYTE;if(n===ll)return s.SHORT;if(n===ws)return s.UNSIGNED_SHORT;if(n===no)return s.INT;if(n===_n)return s.UNSIGNED_INT;if(n===$t)return s.FLOAT;if(n===Fn)return s.HALF_FLOAT;if(n===dl)return s.ALPHA;if(n===fl)return s.RGB;if(n===Qt)return s.RGBA;if(n===Tn)return s.DEPTH_COMPONENT;if(n===mi)return s.DEPTH_STENCIL;if(n===ro)return s.RED;if(n===ao)return s.RED_INTEGER;if(n===gi)return s.RG;if(n===oo)return s.RG_INTEGER;if(n===co)return s.RGBA_INTEGER;if(n===Tr||n===wr||n===Er||n===Rr)if(a===Je)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Tr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===wr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Er)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Rr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Tr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===wr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Er)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Rr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===lo||n===ho||n===uo||n===fo)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===lo)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ho)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===uo)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===fo)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===po||n===mo||n===go||n===bo||n===xo||n===Cr||n===_o)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===po||n===mo)return a===Je?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===go)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===bo)return r.COMPRESSED_R11_EAC;if(n===xo)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Cr)return r.COMPRESSED_RG11_EAC;if(n===_o)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===vo||n===yo||n===Mo||n===So||n===Ao||n===To||n===wo||n===Eo||n===Ro||n===Co||n===Po||n===Io||n===Lo||n===Do)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===vo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===yo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Mo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===So)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ao)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===To)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===wo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Eo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ro)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Co)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Po)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Io)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Lo)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Do)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Fo||n===No||n===Uo)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Fo)return a===Je?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===No)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Uo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Oo||n===ko||n===Pr||n===Bo)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===Oo)return r.COMPRESSED_RED_RGTC1_EXT;if(n===ko)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Pr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bo)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Es?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}var Z0=`
+void main() {
+
+ gl_Position = vec4( position, 1.0 );
+
+}`,$0=`
+uniform sampler2DArray depthColor;
+uniform float depthWidth;
+uniform float depthHeight;
+
+void main() {
+
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
+
+ if ( coord.x >= 1.0 ) {
+
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
+
+ } else {
+
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
+
+ }
+
+}`,Bl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new lr(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Zt({vertexShader:Z0,fragmentShader:$0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new lt(new hr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},zl=class extends mn{constructor(e,t){super();let n=this,i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,g=null,_=typeof XRWebGLBinding<"u",m=new Bl,p={},v=t.getContextAttributes(),S=null,M=null,E=[],T=[],C=new He,x=null,w=new Mt;w.viewport=new nt;let L=new Mt;L.viewport=new nt;let R=[w,L],O=new Ka,H=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let de=E[J];return de===void 0&&(de=new ms,E[J]=de),de.getTargetRaySpace()},this.getControllerGrip=function(J){let de=E[J];return de===void 0&&(de=new ms,E[J]=de),de.getGripSpace()},this.getHand=function(J){let de=E[J];return de===void 0&&(de=new ms,E[J]=de),de.getHandSpace()};function N(J){let de=T.indexOf(J.inputSource);if(de===-1)return;let ie=E[de];ie!==void 0&&(ie.update(J.inputSource,J.frame,l||a),ie.dispatchEvent({type:J.type,data:J.inputSource}))}function z(){i.removeEventListener("select",N),i.removeEventListener("selectstart",N),i.removeEventListener("selectend",N),i.removeEventListener("squeeze",N),i.removeEventListener("squeezestart",N),i.removeEventListener("squeezeend",N),i.removeEventListener("end",z),i.removeEventListener("inputsourceschange",V);for(let J=0;J<E.length;J++){let de=T[J];de!==null&&(T[J]=null,E[J].disconnect(de))}H=null,q=null,m.reset();for(let J in p)delete p[J];e.setRenderTarget(S),f=null,d=null,u=null,i=null,M=null,Fe.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){r=J,n.isPresenting===!0&&_e("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&_e("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(J){l=J},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(J){if(i=J,i!==null){if(S=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",z),i.addEventListener("inputsourceschange",V),v.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(C),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let ie=null,Ee=null,Ie=null;v.depth&&(Ie=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ie=v.stencil?mi:Tn,Ee=v.stencil?Es:_n);let Re={colorFormat:t.RGBA8,depthFormat:Ie,scaleFactor:r};u=this.getBinding(),d=u.createProjectionLayer(Re),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new Yt(d.textureWidth,d.textureHeight,{format:Qt,type:qt,depthTexture:new jn(d.textureWidth,d.textureHeight,Ee,void 0,void 0,void 0,void 0,void 0,void 0,ie),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let ie={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,ie),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new Yt(f.framebufferWidth,f.framebufferHeight,{format:Qt,type:qt,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),Fe.setContext(i),Fe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function V(J){for(let de=0;de<J.removed.length;de++){let ie=J.removed[de],Ee=T.indexOf(ie);Ee>=0&&(T[Ee]=null,E[Ee].disconnect(ie))}for(let de=0;de<J.added.length;de++){let ie=J.added[de],Ee=T.indexOf(ie);if(Ee===-1){for(let Re=0;Re<E.length;Re++)if(Re>=T.length){T.push(ie),Ee=Re;break}else if(T[Re]===null){T[Re]=ie,Ee=Re;break}if(Ee===-1)break}let Ie=E[Ee];Ie&&Ie.connect(ie)}}let $=new F,Q=new F;function le(J,de,ie){$.setFromMatrixPosition(de.matrixWorld),Q.setFromMatrixPosition(ie.matrixWorld);let Ee=$.distanceTo(Q),Ie=de.projectionMatrix.elements,Re=ie.projectionMatrix.elements,ht=Ie[14]/(Ie[10]-1),We=Ie[14]/(Ie[10]+1),$e=(Ie[9]+1)/Ie[5],ot=(Ie[9]-1)/Ie[5],Ge=(Ie[8]-1)/Ie[0],At=(Re[8]+1)/Re[0],ut=ht*Ge,Xt=ht*At,I=Ee/(-Ge+At),Tt=I*-Ge;if(de.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(Tt),J.translateZ(I),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Ie[10]===-1)J.projectionMatrix.copy(de.projectionMatrix),J.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{let qe=ht+I,rt=We+I,oe=ut-Tt,dt=Xt+(Ee-Tt),A=$e*We/rt*qe,b=ot*We/rt*qe;J.projectionMatrix.makePerspective(oe,dt,A,b,qe,rt),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function xe(J,de){de===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(de.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(i===null)return;let de=J.near,ie=J.far;m.texture!==null&&(m.depthNear>0&&(de=m.depthNear),m.depthFar>0&&(ie=m.depthFar)),O.near=L.near=w.near=de,O.far=L.far=w.far=ie,(H!==O.near||q!==O.far)&&(i.updateRenderState({depthNear:O.near,depthFar:O.far}),H=O.near,q=O.far),O.layers.mask=J.layers.mask|6,w.layers.mask=O.layers.mask&-5,L.layers.mask=O.layers.mask&-3;let Ee=J.parent,Ie=O.cameras;xe(O,Ee);for(let Re=0;Re<Ie.length;Re++)xe(Ie[Re],Ee);Ie.length===2?le(O,w,L):O.projectionMatrix.copy(w.projectionMatrix),Se(J,O,Ee)};function Se(J,de,ie){ie===null?J.matrix.copy(de.matrixWorld):(J.matrix.copy(ie.matrixWorld),J.matrix.invert(),J.matrix.multiply(de.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(de.projectionMatrix),J.projectionMatrixInverse.copy(de.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Li*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(J){c=J,d!==null&&(d.fixedFoveation=J),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=J)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(O)},this.getCameraTexture=function(J){return p[J]};let Xe=null;function Ze(J,de){if(h=de.getViewerPose(l||a),g=de,h!==null){let ie=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Ee=!1;ie.length!==O.cameras.length&&(O.cameras.length=0,Ee=!0);for(let We=0;We<ie.length;We++){let $e=ie[We],ot=null;if(f!==null)ot=f.getViewport($e);else{let At=u.getViewSubImage(d,$e);ot=At.viewport,We===0&&(e.setRenderTargetTextures(M,At.colorTexture,At.depthStencilTexture),e.setRenderTarget(M))}let Ge=R[We];Ge===void 0&&(Ge=new Mt,Ge.layers.enable(We),Ge.viewport=new nt,R[We]=Ge),Ge.matrix.fromArray($e.transform.matrix),Ge.matrix.decompose(Ge.position,Ge.quaternion,Ge.scale),Ge.projectionMatrix.fromArray($e.projectionMatrix),Ge.projectionMatrixInverse.copy(Ge.projectionMatrix).invert(),Ge.viewport.set(ot.x,ot.y,ot.width,ot.height),We===0&&(O.matrix.copy(Ge.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),Ee===!0&&O.cameras.push(Ge)}let Ie=i.enabledFeatures;if(Ie&&Ie.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();let We=u.getDepthInformation(ie[0]);We&&We.isValid&&We.texture&&m.init(We,i.renderState)}if(Ie&&Ie.includes("camera-access")&&_){e.state.unbindTexture(),u=n.getBinding();for(let We=0;We<ie.length;We++){let $e=ie[We].camera;if($e){let ot=p[$e];ot||(ot=new lr,p[$e]=ot);let Ge=u.getCameraImage($e);ot.sourceTexture=Ge}}}}for(let ie=0;ie<E.length;ie++){let Ee=T[ie],Ie=E[ie];Ee!==null&&Ie!==void 0&&Ie.update(Ee,de,l||a)}Xe&&Xe(J,de),de.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:de}),g=null}let Fe=new wd;Fe.setAnimationLoop(Ze),this.setAnimationLoop=function(J){Xe=J},this.dispose=function(){}}},Q0=new Ue,Ld=new Pe;Ld.set(-1,0,0,0,1,0,0,0,1);function ex(s,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,bl(s)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function i(m,p,v,S,M){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,M)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),_(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?c(m,p,v,S):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Pt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Pt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);let v=e.get(p),S=v.envMap,M=v.envMapRotation;S&&(m.envMap.value=S,m.envMapRotation.value.setFromMatrix4(Q0.makeRotationFromEuler(M)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(Ld),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,v,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*v,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,v){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Pt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){let v=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function tx(s,e,t,n){let i={},r={},a=[],o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(v,S){let M=S.program;n.uniformBlockBinding(v,M)}function l(v,S){let M=i[v.id];M===void 0&&(g(v),M=h(v),i[v.id]=M,v.addEventListener("dispose",m));let E=S.program;n.updateUBOMapping(v,E);let T=e.render.frame;r[v.id]!==T&&(d(v),r[v.id]=T)}function h(v){let S=u();v.__bindingPointIndex=S;let M=s.createBuffer(),E=v.__size,T=v.usage;return s.bindBuffer(s.UNIFORM_BUFFER,M),s.bufferData(s.UNIFORM_BUFFER,E,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,S,M),M}function u(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return we("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){let S=i[v.id],M=v.uniforms,E=v.__cache;s.bindBuffer(s.UNIFORM_BUFFER,S);for(let T=0,C=M.length;T<C;T++){let x=Array.isArray(M[T])?M[T]:[M[T]];for(let w=0,L=x.length;w<L;w++){let R=x[w];if(f(R,T,w,E)===!0){let O=R.__offset,H=Array.isArray(R.value)?R.value:[R.value],q=0;for(let N=0;N<H.length;N++){let z=H[N],V=_(z);typeof z=="number"||typeof z=="boolean"?(R.__data[0]=z,s.bufferSubData(s.UNIFORM_BUFFER,O+q,R.__data)):z.isMatrix3?(R.__data[0]=z.elements[0],R.__data[1]=z.elements[1],R.__data[2]=z.elements[2],R.__data[3]=0,R.__data[4]=z.elements[3],R.__data[5]=z.elements[4],R.__data[6]=z.elements[5],R.__data[7]=0,R.__data[8]=z.elements[6],R.__data[9]=z.elements[7],R.__data[10]=z.elements[8],R.__data[11]=0):ArrayBuffer.isView(z)?R.__data.set(new z.constructor(z.buffer,z.byteOffset,R.__data.length)):(z.toArray(R.__data,q),q+=V.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,O,R.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(v,S,M,E){let T=v.value,C=S+"_"+M;if(E[C]===void 0)return typeof T=="number"||typeof T=="boolean"?E[C]=T:ArrayBuffer.isView(T)?E[C]=T.slice():E[C]=T.clone(),!0;{let x=E[C];if(typeof T=="number"||typeof T=="boolean"){if(x!==T)return E[C]=T,!0}else{if(ArrayBuffer.isView(T))return!0;if(x.equals(T)===!1)return x.copy(T),!0}}return!1}function g(v){let S=v.uniforms,M=0,E=16;for(let C=0,x=S.length;C<x;C++){let w=Array.isArray(S[C])?S[C]:[S[C]];for(let L=0,R=w.length;L<R;L++){let O=w[L],H=Array.isArray(O.value)?O.value:[O.value];for(let q=0,N=H.length;q<N;q++){let z=H[q],V=_(z),$=M%E,Q=$%V.boundary,le=$+Q;M+=Q,le!==0&&E-le<V.storage&&(M+=E-le),O.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=M,M+=V.storage}}}let T=M%E;return T>0&&(M+=E-T),v.__size=M,v.__cache={},this}function _(v){let S={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(S.boundary=4,S.storage=4):v.isVector2?(S.boundary=8,S.storage=8):v.isVector3||v.isColor?(S.boundary=16,S.storage=12):v.isVector4?(S.boundary=16,S.storage=16):v.isMatrix3?(S.boundary=48,S.storage=48):v.isMatrix4?(S.boundary=64,S.storage=64):v.isTexture?_e("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(v)?(S.boundary=16,S.storage=v.byteLength):_e("WebGLRenderer: Unsupported uniform value type.",v),S}function m(v){let S=v.target;S.removeEventListener("dispose",m);let M=a.indexOf(S.__bindingPointIndex);a.splice(M,1),s.deleteBuffer(i[S.id]),delete i[S.id],delete r[S.id]}function p(){for(let v in i)s.deleteBuffer(i[v]);a=[],i={},r={}}return{bind:c,update:l,dispose:p}}var nx=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Nn=null;function ix(){return Nn===null&&(Nn=new _s(nx,16,16,gi,Fn),Nn.name="DFG_LUT",Nn.minFilter=_t,Nn.magFilter=_t,Nn.wrapS=nn,Nn.wrapT=nn,Nn.generateMipmaps=!1,Nn.needsUpdate=!0),Nn}var Xo=class{constructor(e={}){let{canvas:t=Yu(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=qt}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;let _=f,m=new Set([co,oo,ao]),p=new Set([qt,_n,ws,Es,io,so]),v=new Uint32Array(4),S=new Int32Array(4),M=new F,E=null,T=null,C=[],x=[],w=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=bn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let L=this,R=!1,O=null;this._outputColorSpace=bt;let H=0,q=0,N=null,z=-1,V=null,$=new nt,Q=new nt,le=null,xe=new Te(0),Se=0,Xe=t.width,Ze=t.height,Fe=1,J=null,de=null,ie=new nt(0,0,Xe,Ze),Ee=new nt(0,0,Xe,Ze),Ie=!1,Re=new vs,ht=!1,We=!1,$e=new Ue,ot=new F,Ge=new nt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ut=!1;function Xt(){return N===null?Fe:1}let I=n;function Tt(y,D){return t.getContext(y,D)}try{let y={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"184"}`),t.addEventListener("webglcontextlost",Y,!1),t.addEventListener("webglcontextrestored",ye,!1),t.addEventListener("webglcontextcreationerror",Le,!1),I===null){let D="webgl2";if(I=Tt(D,y),I===null)throw Tt(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw we("WebGLRenderer: "+y.message),y}let qe,rt,oe,dt,A,b,U,j,Z,ee,ae,W,K,fe,ge,se,te,Ce,Ne,Ke,P,ne,X;function pe(){qe=new hb(I),qe.init(),P=new Y0(I,qe),rt=new nb(I,qe,e,P),oe=new K0(I,qe),rt.reversedDepthBuffer&&d&&oe.buffers.depth.setReversed(!0),dt=new fb(I),A=new F0,b=new J0(I,qe,oe,A,rt,P,dt),U=new lb(L),j=new bp(I),ne=new eb(I,j),Z=new ub(I,j,dt,ne),ee=new mb(I,Z,j,ne,dt),Ce=new pb(I,rt,b),ge=new ib(A),ae=new D0(L,U,qe,rt,ne,ge),W=new ex(L,A),K=new U0,fe=new V0(qe),te=new Qg(L,U,oe,ee,g,c),se=new j0(L,ee,rt),X=new tx(I,dt,rt,oe),Ne=new tb(I,qe,dt),Ke=new db(I,qe,dt),dt.programs=ae.programs,L.capabilities=rt,L.extensions=qe,L.properties=A,L.renderLists=K,L.shadowMap=se,L.state=oe,L.info=dt}pe(),_!==qt&&(w=new bb(_,t.width,t.height,i,r));let re=new zl(L,I);this.xr=re,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let y=qe.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){let y=qe.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return Fe},this.setPixelRatio=function(y){y!==void 0&&(Fe=y,this.setSize(Xe,Ze,!1))},this.getSize=function(y){return y.set(Xe,Ze)},this.setSize=function(y,D,G=!0){if(re.isPresenting){_e("WebGLRenderer: Can't change size while VR device is presenting.");return}Xe=y,Ze=D,t.width=Math.floor(y*Fe),t.height=Math.floor(D*Fe),G===!0&&(t.style.width=y+"px",t.style.height=D+"px"),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,y,D)},this.getDrawingBufferSize=function(y){return y.set(Xe*Fe,Ze*Fe).floor()},this.setDrawingBufferSize=function(y,D,G){Xe=y,Ze=D,Fe=G,t.width=Math.floor(y*G),t.height=Math.floor(D*G),this.setViewport(0,0,y,D)},this.setEffects=function(y){if(_===qt){we("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(y){for(let D=0;D<y.length;D++)if(y[D].isOutputPass===!0){_e("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}w.setEffects(y||[])},this.getCurrentViewport=function(y){return y.copy($)},this.getViewport=function(y){return y.copy(ie)},this.setViewport=function(y,D,G,k){y.isVector4?ie.set(y.x,y.y,y.z,y.w):ie.set(y,D,G,k),oe.viewport($.copy(ie).multiplyScalar(Fe).round())},this.getScissor=function(y){return y.copy(Ee)},this.setScissor=function(y,D,G,k){y.isVector4?Ee.set(y.x,y.y,y.z,y.w):Ee.set(y,D,G,k),oe.scissor(Q.copy(Ee).multiplyScalar(Fe).round())},this.getScissorTest=function(){return Ie},this.setScissorTest=function(y){oe.setScissorTest(Ie=y)},this.setOpaqueSort=function(y){J=y},this.setTransparentSort=function(y){de=y},this.getClearColor=function(y){return y.copy(te.getClearColor())},this.setClearColor=function(){te.setClearColor(...arguments)},this.getClearAlpha=function(){return te.getClearAlpha()},this.setClearAlpha=function(){te.setClearAlpha(...arguments)},this.clear=function(y=!0,D=!0,G=!0){let k=0;if(y){let B=!1;if(N!==null){let ue=N.texture.format;B=m.has(ue)}if(B){let ue=N.texture.type,be=p.has(ue),he=te.getClearColor(),ve=te.getClearAlpha(),Me=he.r,De=he.g,ke=he.b;be?(v[0]=Me,v[1]=De,v[2]=ke,v[3]=ve,I.clearBufferuiv(I.COLOR,0,v)):(S[0]=Me,S[1]=De,S[2]=ke,S[3]=ve,I.clearBufferiv(I.COLOR,0,S))}else k|=I.COLOR_BUFFER_BIT}D&&(k|=I.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),G&&(k|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k!==0&&I.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(y){y.setRenderer(this),O=y},this.dispose=function(){t.removeEventListener("webglcontextlost",Y,!1),t.removeEventListener("webglcontextrestored",ye,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),te.dispose(),K.dispose(),fe.dispose(),A.dispose(),U.dispose(),ee.dispose(),ne.dispose(),X.dispose(),ae.dispose(),re.dispose(),re.removeEventListener("sessionstart",Ah),re.removeEventListener("sessionend",Th),vi.stop()};function Y(y){y.preventDefault(),$s("WebGLRenderer: Context Lost."),R=!0}function ye(){$s("WebGLRenderer: Context Restored."),R=!1;let y=dt.autoReset,D=se.enabled,G=se.autoUpdate,k=se.needsUpdate,B=se.type;pe(),dt.autoReset=y,se.enabled=D,se.autoUpdate=G,se.needsUpdate=k,se.type=B}function Le(y){we("WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function pt(y){let D=y.target;D.removeEventListener("dispose",pt),Qe(D)}function Qe(y){Bn(y),A.remove(y)}function Bn(y){let D=A.get(y).programs;D!==void 0&&(D.forEach(function(G){ae.releaseProgram(G)}),y.isShaderMaterial&&ae.releaseShaderCache(y))}this.renderBufferDirect=function(y,D,G,k,B,ue){D===null&&(D=At);let be=B.isMesh&&B.matrixWorld.determinant()<0,he=of(y,D,G,k,B);oe.setMaterial(k,be);let ve=G.index,Me=1;if(k.wireframe===!0){if(ve=Z.getWireframeAttribute(G),ve===void 0)return;Me=2}let De=G.drawRange,ke=G.attributes.position,Ae=De.start*Me,et=(De.start+De.count)*Me;ue!==null&&(Ae=Math.max(Ae,ue.start*Me),et=Math.min(et,(ue.start+ue.count)*Me)),ve!==null?(Ae=Math.max(Ae,0),et=Math.min(et,ve.count)):ke!=null&&(Ae=Math.max(Ae,0),et=Math.min(et,ke.count));let mt=et-Ae;if(mt<0||mt===1/0)return;ne.setup(B,k,he,G,ve);let ft,it=Ne;if(ve!==null&&(ft=j.get(ve),it=Ke,it.setIndex(ft)),B.isMesh)k.wireframe===!0?(oe.setLineWidth(k.wireframeLinewidth*Xt()),it.setMode(I.LINES)):it.setMode(I.TRIANGLES);else if(B.isLine){let It=k.linewidth;It===void 0&&(It=1),oe.setLineWidth(It*Xt()),B.isLineSegments?it.setMode(I.LINES):B.isLineLoop?it.setMode(I.LINE_LOOP):it.setMode(I.LINE_STRIP)}else B.isPoints?it.setMode(I.POINTS):B.isSprite&&it.setMode(I.TRIANGLES);if(B.isBatchedMesh)if(qe.get("WEBGL_multi_draw"))it.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else{let It=B._multiDrawStarts,me=B._multiDrawCounts,jt=B._multiDrawCount,je=ve?j.get(ve).bytesPerElement:1,en=A.get(k).currentProgram.getUniforms();for(let yn=0;yn<jt;yn++)en.setValue(I,"_gl_DrawID",yn),it.render(It[yn]/je,me[yn])}else if(B.isInstancedMesh)it.renderInstances(Ae,mt,B.count);else if(G.isInstancedBufferGeometry){let It=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,me=Math.min(G.instanceCount,It);it.renderInstances(Ae,mt,me)}else it.render(Ae,mt)};function vn(y,D,G){y.transparent===!0&&y.side===sn&&y.forceSinglePass===!1?(y.side=Pt,y.needsUpdate=!0,jr(y,D,G),y.side=pn,y.needsUpdate=!0,jr(y,D,G),y.side=sn):jr(y,D,G)}this.compile=function(y,D,G=null){G===null&&(G=y),T=fe.get(G),T.init(D),x.push(T),G.traverseVisible(function(B){B.isLight&&B.layers.test(D.layers)&&(T.pushLight(B),B.castShadow&&T.pushShadow(B))}),y!==G&&y.traverseVisible(function(B){B.isLight&&B.layers.test(D.layers)&&(T.pushLight(B),B.castShadow&&T.pushShadow(B))}),T.setupLights();let k=new Set;return y.traverse(function(B){if(!(B.isMesh||B.isPoints||B.isLine||B.isSprite))return;let ue=B.material;if(ue)if(Array.isArray(ue))for(let be=0;be<ue.length;be++){let he=ue[be];vn(he,G,B),k.add(he)}else vn(ue,G,B),k.add(ue)}),T=x.pop(),k},this.compileAsync=function(y,D,G=null){let k=this.compile(y,D,G);return new Promise(B=>{function ue(){if(k.forEach(function(be){A.get(be).currentProgram.isReady()&&k.delete(be)}),k.size===0){B(y);return}setTimeout(ue,10)}qe.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let fc=null;function rf(y){fc&&fc(y)}function Ah(){vi.stop()}function Th(){vi.start()}let vi=new wd;vi.setAnimationLoop(rf),typeof self<"u"&&vi.setContext(self),this.setAnimationLoop=function(y){fc=y,re.setAnimationLoop(y),y===null?vi.stop():vi.start()},re.addEventListener("sessionstart",Ah),re.addEventListener("sessionend",Th),this.render=function(y,D){if(D!==void 0&&D.isCamera!==!0){we("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;O!==null&&O.renderStart(y,D);let G=re.enabled===!0&&re.isPresenting===!0,k=w!==null&&(N===null||G)&&w.begin(L,N);if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(re.cameraAutoUpdate===!0&&re.updateCamera(D),D=re.getCamera()),y.isScene===!0&&y.onBeforeRender(L,y,D,N),T=fe.get(y,x.length),T.init(D),T.state.textureUnits=b.getTextureUnits(),x.push(T),$e.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Re.setFromProjectionMatrix($e,un,D.reversedDepth),We=this.localClippingEnabled,ht=ge.init(this.clippingPlanes,We),E=K.get(y,C.length),E.init(),C.push(E),re.enabled===!0&&re.isPresenting===!0){let be=L.xr.getDepthSensingMesh();be!==null&&pc(be,D,-1/0,L.sortObjects)}pc(y,D,0,L.sortObjects),E.finish(),L.sortObjects===!0&&E.sort(J,de),ut=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,ut&&te.addToRenderList(E,y),this.info.render.frame++,ht===!0&&ge.beginShadows();let B=T.state.shadowsArray;if(se.render(B,y,D),ht===!0&&ge.endShadows(),this.info.autoReset===!0&&this.info.reset(),(k&&w.hasRenderPass())===!1){let be=E.opaque,he=E.transmissive;if(T.setupLights(),D.isArrayCamera){let ve=D.cameras;if(he.length>0)for(let Me=0,De=ve.length;Me<De;Me++){let ke=ve[Me];Eh(be,he,y,ke)}ut&&te.render(y);for(let Me=0,De=ve.length;Me<De;Me++){let ke=ve[Me];wh(E,y,ke,ke.viewport)}}else he.length>0&&Eh(be,he,y,D),ut&&te.render(y),wh(E,y,D)}N!==null&&q===0&&(b.updateMultisampleRenderTarget(N),b.updateRenderTargetMipmap(N)),k&&w.end(L),y.isScene===!0&&y.onAfterRender(L,y,D),ne.resetDefaultState(),z=-1,V=null,x.pop(),x.length>0?(T=x[x.length-1],b.setTextureUnits(T.state.textureUnits),ht===!0&&ge.setGlobalState(L.clippingPlanes,T.state.camera)):T=null,C.pop(),C.length>0?E=C[C.length-1]:E=null,O!==null&&O.renderEnd()};function pc(y,D,G,k){if(y.visible===!1)return;if(y.layers.test(D.layers)){if(y.isGroup)G=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(D);else if(y.isLightProbeGrid)T.pushLightProbeGrid(y);else if(y.isLight)T.pushLight(y),y.castShadow&&T.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||Re.intersectsSprite(y)){k&&Ge.setFromMatrixPosition(y.matrixWorld).applyMatrix4($e);let be=ee.update(y),he=y.material;he.visible&&E.push(y,be,he,G,Ge.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||Re.intersectsObject(y))){let be=ee.update(y),he=y.material;if(k&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),Ge.copy(y.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),Ge.copy(be.boundingSphere.center)),Ge.applyMatrix4(y.matrixWorld).applyMatrix4($e)),Array.isArray(he)){let ve=be.groups;for(let Me=0,De=ve.length;Me<De;Me++){let ke=ve[Me],Ae=he[ke.materialIndex];Ae&&Ae.visible&&E.push(y,be,Ae,G,Ge.z,ke)}}else he.visible&&E.push(y,be,he,G,Ge.z,null)}}let ue=y.children;for(let be=0,he=ue.length;be<he;be++)pc(ue[be],D,G,k)}function wh(y,D,G,k){let{opaque:B,transmissive:ue,transparent:be}=y;T.setupLightsView(G),ht===!0&&ge.setGlobalState(L.clippingPlanes,G),k&&oe.viewport($.copy(k)),B.length>0&&Xr(B,D,G),ue.length>0&&Xr(ue,D,G),be.length>0&&Xr(be,D,G),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function Eh(y,D,G,k){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[k.id]===void 0){let Ae=qe.has("EXT_color_buffer_half_float")||qe.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[k.id]=new Yt(1,1,{generateMipmaps:!0,type:Ae?Fn:qt,minFilter:xn,samples:Math.max(4,rt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Be.workingColorSpace})}let ue=T.state.transmissionRenderTarget[k.id],be=k.viewport||$;ue.setSize(be.z*L.transmissionResolutionScale,be.w*L.transmissionResolutionScale);let he=L.getRenderTarget(),ve=L.getActiveCubeFace(),Me=L.getActiveMipmapLevel();L.setRenderTarget(ue),L.getClearColor(xe),Se=L.getClearAlpha(),Se<1&&L.setClearColor(16777215,.5),L.clear(),ut&&te.render(G);let De=L.toneMapping;L.toneMapping=bn;let ke=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),T.setupLightsView(k),ht===!0&&ge.setGlobalState(L.clippingPlanes,k),Xr(y,G,k),b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue),qe.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let et=0,mt=D.length;et<mt;et++){let ft=D[et],{object:it,geometry:It,material:me,group:jt}=ft;if(me.side===sn&&it.layers.test(k.layers)){let je=me.side;me.side=Pt,me.needsUpdate=!0,Rh(it,G,k,It,me,jt),me.side=je,me.needsUpdate=!0,Ae=!0}}Ae===!0&&(b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue))}L.setRenderTarget(he,ve,Me),L.setClearColor(xe,Se),ke!==void 0&&(k.viewport=ke),L.toneMapping=De}function Xr(y,D,G){let k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,ue=y.length;B<ue;B++){let be=y[B],{object:he,geometry:ve,group:Me}=be,De=be.material;De.allowOverride===!0&&k!==null&&(De=k),he.layers.test(G.layers)&&Rh(he,D,G,ve,De,Me)}}function Rh(y,D,G,k,B,ue){y.onBeforeRender(L,D,G,k,B,ue),y.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),B.onBeforeRender(L,D,G,k,y,ue),B.transparent===!0&&B.side===sn&&B.forceSinglePass===!1?(B.side=Pt,B.needsUpdate=!0,L.renderBufferDirect(G,D,k,B,y,ue),B.side=pn,B.needsUpdate=!0,L.renderBufferDirect(G,D,k,B,y,ue),B.side=sn):L.renderBufferDirect(G,D,k,B,y,ue),y.onAfterRender(L,D,G,k,B,ue)}function jr(y,D,G){D.isScene!==!0&&(D=At);let k=A.get(y),B=T.state.lights,ue=T.state.shadowsArray,be=B.state.version,he=ae.getParameters(y,B.state,ue,D,G,T.state.lightProbeGridArray),ve=ae.getProgramCacheKey(he),Me=k.programs;k.environment=y.isMeshStandardMaterial||y.isMeshLambertMaterial||y.isMeshPhongMaterial?D.environment:null,k.fog=D.fog;let De=y.isMeshStandardMaterial||y.isMeshLambertMaterial&&!y.envMap||y.isMeshPhongMaterial&&!y.envMap;k.envMap=U.get(y.envMap||k.environment,De),k.envMapRotation=k.environment!==null&&y.envMap===null?D.environmentRotation:y.envMapRotation,Me===void 0&&(y.addEventListener("dispose",pt),Me=new Map,k.programs=Me);let ke=Me.get(ve);if(ke!==void 0){if(k.currentProgram===ke&&k.lightsStateVersion===be)return Ph(y,he),ke}else he.uniforms=ae.getUniforms(y),O!==null&&y.isNodeMaterial&&O.build(y,G,he),y.onBeforeCompile(he,L),ke=ae.acquireProgram(he,ve),Me.set(ve,ke),k.uniforms=he.uniforms;let Ae=k.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ae.clippingPlanes=ge.uniform),Ph(y,he),k.needsLights=lf(y),k.lightsStateVersion=be,k.needsLights&&(Ae.ambientLightColor.value=B.state.ambient,Ae.lightProbe.value=B.state.probe,Ae.directionalLights.value=B.state.directional,Ae.directionalLightShadows.value=B.state.directionalShadow,Ae.spotLights.value=B.state.spot,Ae.spotLightShadows.value=B.state.spotShadow,Ae.rectAreaLights.value=B.state.rectArea,Ae.ltc_1.value=B.state.rectAreaLTC1,Ae.ltc_2.value=B.state.rectAreaLTC2,Ae.pointLights.value=B.state.point,Ae.pointLightShadows.value=B.state.pointShadow,Ae.hemisphereLights.value=B.state.hemi,Ae.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Ae.spotLightMatrix.value=B.state.spotLightMatrix,Ae.spotLightMap.value=B.state.spotLightMap,Ae.pointShadowMatrix.value=B.state.pointShadowMatrix),k.lightProbeGrid=T.state.lightProbeGridArray.length>0,k.currentProgram=ke,k.uniformsList=null,ke}function Ch(y){if(y.uniformsList===null){let D=y.currentProgram.getUniforms();y.uniformsList=Ps.seqWithValue(D.seq,y.uniforms)}return y.uniformsList}function Ph(y,D){let G=A.get(y);G.outputColorSpace=D.outputColorSpace,G.batching=D.batching,G.batchingColor=D.batchingColor,G.instancing=D.instancing,G.instancingColor=D.instancingColor,G.instancingMorph=D.instancingMorph,G.skinning=D.skinning,G.morphTargets=D.morphTargets,G.morphNormals=D.morphNormals,G.morphColors=D.morphColors,G.morphTargetsCount=D.morphTargetsCount,G.numClippingPlanes=D.numClippingPlanes,G.numIntersection=D.numClipIntersection,G.vertexAlphas=D.vertexAlphas,G.vertexTangents=D.vertexTangents,G.toneMapping=D.toneMapping}function af(y,D){if(y.length===0)return null;if(y.length===1)return y[0].texture!==null?y[0]:null;M.setFromMatrixPosition(D.matrixWorld);for(let G=0,k=y.length;G<k;G++){let B=y[G];if(B.texture!==null&&B.boundingBox.containsPoint(M))return B}return null}function of(y,D,G,k,B){D.isScene!==!0&&(D=At),b.resetTextureUnits();let ue=D.fog,be=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?D.environment:null,he=N===null?L.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:Be.workingColorSpace,ve=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Me=U.get(k.envMap||be,ve),De=k.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,ke=!!G.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ae=!!G.morphAttributes.position,et=!!G.morphAttributes.normal,mt=!!G.morphAttributes.color,ft=bn;k.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(ft=L.toneMapping);let it=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,It=it!==void 0?it.length:0,me=A.get(k),jt=T.state.lights;if(ht===!0&&(We===!0||y!==V)){let at=y===V&&k.id===z;ge.setState(k,y,at)}let je=!1;k.version===me.__version?(me.needsLights&&me.lightsStateVersion!==jt.state.version||me.outputColorSpace!==he||B.isBatchedMesh&&me.batching===!1||!B.isBatchedMesh&&me.batching===!0||B.isBatchedMesh&&me.batchingColor===!0&&B.colorTexture===null||B.isBatchedMesh&&me.batchingColor===!1&&B.colorTexture!==null||B.isInstancedMesh&&me.instancing===!1||!B.isInstancedMesh&&me.instancing===!0||B.isSkinnedMesh&&me.skinning===!1||!B.isSkinnedMesh&&me.skinning===!0||B.isInstancedMesh&&me.instancingColor===!0&&B.instanceColor===null||B.isInstancedMesh&&me.instancingColor===!1&&B.instanceColor!==null||B.isInstancedMesh&&me.instancingMorph===!0&&B.morphTexture===null||B.isInstancedMesh&&me.instancingMorph===!1&&B.morphTexture!==null||me.envMap!==Me||k.fog===!0&&me.fog!==ue||me.numClippingPlanes!==void 0&&(me.numClippingPlanes!==ge.numPlanes||me.numIntersection!==ge.numIntersection)||me.vertexAlphas!==De||me.vertexTangents!==ke||me.morphTargets!==Ae||me.morphNormals!==et||me.morphColors!==mt||me.toneMapping!==ft||me.morphTargetsCount!==It||!!me.lightProbeGrid!=T.state.lightProbeGridArray.length>0)&&(je=!0):(je=!0,me.__version=k.version);let en=me.currentProgram;je===!0&&(en=jr(k,D,B),O&&k.isNodeMaterial&&O.onUpdateProgram(k,en,me));let yn=!1,$n=!1,ji=!1,st=en.getUniforms(),gt=me.uniforms;if(oe.useProgram(en.program)&&(yn=!0,$n=!0,ji=!0),k.id!==z&&(z=k.id,$n=!0),me.needsLights){let at=af(T.state.lightProbeGridArray,B);me.lightProbeGrid!==at&&(me.lightProbeGrid=at,$n=!0)}if(yn||V!==y){oe.buffers.depth.getReversed()&&y.reversedDepth!==!0&&(y._reversedDepth=!0,y.updateProjectionMatrix()),st.setValue(I,"projectionMatrix",y.projectionMatrix),st.setValue(I,"viewMatrix",y.matrixWorldInverse);let ei=st.map.cameraPosition;ei!==void 0&&ei.setValue(I,ot.setFromMatrixPosition(y.matrixWorld)),rt.logarithmicDepthBuffer&&st.setValue(I,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&st.setValue(I,"isOrthographic",y.isOrthographicCamera===!0),V!==y&&(V=y,$n=!0,ji=!0)}if(me.needsLights&&(jt.state.directionalShadowMap.length>0&&st.setValue(I,"directionalShadowMap",jt.state.directionalShadowMap,b),jt.state.spotShadowMap.length>0&&st.setValue(I,"spotShadowMap",jt.state.spotShadowMap,b),jt.state.pointShadowMap.length>0&&st.setValue(I,"pointShadowMap",jt.state.pointShadowMap,b)),B.isSkinnedMesh){st.setOptional(I,B,"bindMatrix"),st.setOptional(I,B,"bindMatrixInverse");let at=B.skeleton;at&&(at.boneTexture===null&&at.computeBoneTexture(),st.setValue(I,"boneTexture",at.boneTexture,b))}B.isBatchedMesh&&(st.setOptional(I,B,"batchingTexture"),st.setValue(I,"batchingTexture",B._matricesTexture,b),st.setOptional(I,B,"batchingIdTexture"),st.setValue(I,"batchingIdTexture",B._indirectTexture,b),st.setOptional(I,B,"batchingColorTexture"),B._colorsTexture!==null&&st.setValue(I,"batchingColorTexture",B._colorsTexture,b));let Qn=G.morphAttributes;if((Qn.position!==void 0||Qn.normal!==void 0||Qn.color!==void 0)&&Ce.update(B,G,en),($n||me.receiveShadow!==B.receiveShadow)&&(me.receiveShadow=B.receiveShadow,st.setValue(I,"receiveShadow",B.receiveShadow)),(k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&D.environment!==null&&(gt.envMapIntensity.value=D.environmentIntensity),gt.dfgLUT!==void 0&&(gt.dfgLUT.value=ix()),$n){if(st.setValue(I,"toneMappingExposure",L.toneMappingExposure),me.needsLights&&cf(gt,ji),ue&&k.fog===!0&&W.refreshFogUniforms(gt,ue),W.refreshMaterialUniforms(gt,k,Fe,Ze,T.state.transmissionRenderTarget[y.id]),me.needsLights&&me.lightProbeGrid){let at=me.lightProbeGrid;gt.probesSH.value=at.texture,gt.probesMin.value.copy(at.boundingBox.min),gt.probesMax.value.copy(at.boundingBox.max),gt.probesResolution.value.copy(at.resolution)}Ps.upload(I,Ch(me),gt,b)}if(k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(Ps.upload(I,Ch(me),gt,b),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&st.setValue(I,"center",B.center),st.setValue(I,"modelViewMatrix",B.modelViewMatrix),st.setValue(I,"normalMatrix",B.normalMatrix),st.setValue(I,"modelMatrix",B.matrixWorld),k.uniformsGroups!==void 0){let at=k.uniformsGroups;for(let ei=0,Ki=at.length;ei<Ki;ei++){let Ih=at[ei];X.update(Ih,en),X.bind(Ih,en)}}return en}function cf(y,D){y.ambientLightColor.needsUpdate=D,y.lightProbe.needsUpdate=D,y.directionalLights.needsUpdate=D,y.directionalLightShadows.needsUpdate=D,y.pointLights.needsUpdate=D,y.pointLightShadows.needsUpdate=D,y.spotLights.needsUpdate=D,y.spotLightShadows.needsUpdate=D,y.rectAreaLights.needsUpdate=D,y.hemisphereLights.needsUpdate=D}function lf(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(y,D,G){let k=A.get(y);k.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),A.get(y.texture).__webglTexture=D,A.get(y.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:G,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,D){let G=A.get(y);G.__webglFramebuffer=D,G.__useDefaultFramebuffer=D===void 0};let hf=I.createFramebuffer();this.setRenderTarget=function(y,D=0,G=0){N=y,H=D,q=G;let k=null,B=!1,ue=!1;if(y){let he=A.get(y);if(he.__useDefaultFramebuffer!==void 0){oe.bindFramebuffer(I.FRAMEBUFFER,he.__webglFramebuffer),$.copy(y.viewport),Q.copy(y.scissor),le=y.scissorTest,oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),z=-1;return}else if(he.__webglFramebuffer===void 0)b.setupRenderTarget(y);else if(he.__hasExternalTextures)b.rebindTextures(y,A.get(y.texture).__webglTexture,A.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){let De=y.depthTexture;if(he.__boundDepthTexture!==De){if(De!==null&&A.has(De)&&(y.width!==De.image.width||y.height!==De.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(y)}}let ve=y.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(ue=!0);let Me=A.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(Me[D])?k=Me[D][G]:k=Me[D],B=!0):y.samples>0&&b.useMultisampledRTT(y)===!1?k=A.get(y).__webglMultisampledFramebuffer:Array.isArray(Me)?k=Me[G]:k=Me,$.copy(y.viewport),Q.copy(y.scissor),le=y.scissorTest}else $.copy(ie).multiplyScalar(Fe).floor(),Q.copy(Ee).multiplyScalar(Fe).floor(),le=Ie;if(G!==0&&(k=hf),oe.bindFramebuffer(I.FRAMEBUFFER,k)&&oe.drawBuffers(y,k),oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),B){let he=A.get(y.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+D,he.__webglTexture,G)}else if(ue){let he=D;for(let ve=0;ve<y.textures.length;ve++){let Me=A.get(y.textures[ve]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+ve,Me.__webglTexture,G,he)}}else if(y!==null&&G!==0){let he=A.get(y.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,he.__webglTexture,G)}z=-1},this.readRenderTargetPixels=function(y,D,G,k,B,ue,be,he=0){if(!(y&&y.isWebGLRenderTarget)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=A.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve){oe.bindFramebuffer(I.FRAMEBUFFER,ve);try{let Me=y.textures[he],De=Me.format,ke=Me.type;if(y.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!rt.textureFormatReadable(De)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!rt.textureTypeReadable(ke)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=y.width-k&&G>=0&&G<=y.height-B&&I.readPixels(D,G,k,B,P.convert(De),P.convert(ke),ue)}finally{let Me=N!==null?A.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,Me)}}},this.readRenderTargetPixelsAsync=async function(y,D,G,k,B,ue,be,he=0){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=A.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve)if(D>=0&&D<=y.width-k&&G>=0&&G<=y.height-B){oe.bindFramebuffer(I.FRAMEBUFFER,ve);let Me=y.textures[he],De=Me.format,ke=Me.type;if(y.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!rt.textureFormatReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!rt.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ae=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Ae),I.bufferData(I.PIXEL_PACK_BUFFER,ue.byteLength,I.STREAM_READ),I.readPixels(D,G,k,B,P.convert(De),P.convert(ke),0);let et=N!==null?A.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,et);let mt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await $u(I,mt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Ae),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ue),I.deleteBuffer(Ae),I.deleteSync(mt),ue}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,D=null,G=0){let k=Math.pow(2,-G),B=Math.floor(y.image.width*k),ue=Math.floor(y.image.height*k),be=D!==null?D.x:0,he=D!==null?D.y:0;b.setTexture2D(y,0),I.copyTexSubImage2D(I.TEXTURE_2D,G,0,0,be,he,B,ue),oe.unbindTexture()};let uf=I.createFramebuffer(),df=I.createFramebuffer();this.copyTextureToTexture=function(y,D,G=null,k=null,B=0,ue=0){let be,he,ve,Me,De,ke,Ae,et,mt,ft=y.isCompressedTexture?y.mipmaps[ue]:y.image;if(G!==null)be=G.max.x-G.min.x,he=G.max.y-G.min.y,ve=G.isBox3?G.max.z-G.min.z:1,Me=G.min.x,De=G.min.y,ke=G.isBox3?G.min.z:0;else{let gt=Math.pow(2,-B);be=Math.floor(ft.width*gt),he=Math.floor(ft.height*gt),y.isDataArrayTexture?ve=ft.depth:y.isData3DTexture?ve=Math.floor(ft.depth*gt):ve=1,Me=0,De=0,ke=0}k!==null?(Ae=k.x,et=k.y,mt=k.z):(Ae=0,et=0,mt=0);let it=P.convert(D.format),It=P.convert(D.type),me;D.isData3DTexture?(b.setTexture3D(D,0),me=I.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(b.setTexture2DArray(D,0),me=I.TEXTURE_2D_ARRAY):(b.setTexture2D(D,0),me=I.TEXTURE_2D),oe.activeTexture(I.TEXTURE0),oe.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,D.flipY),oe.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),oe.pixelStorei(I.UNPACK_ALIGNMENT,D.unpackAlignment);let jt=oe.getParameter(I.UNPACK_ROW_LENGTH),je=oe.getParameter(I.UNPACK_IMAGE_HEIGHT),en=oe.getParameter(I.UNPACK_SKIP_PIXELS),yn=oe.getParameter(I.UNPACK_SKIP_ROWS),$n=oe.getParameter(I.UNPACK_SKIP_IMAGES);oe.pixelStorei(I.UNPACK_ROW_LENGTH,ft.width),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,ft.height),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,Me),oe.pixelStorei(I.UNPACK_SKIP_ROWS,De),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,ke);let ji=y.isDataArrayTexture||y.isData3DTexture,st=D.isDataArrayTexture||D.isData3DTexture;if(y.isDepthTexture){let gt=A.get(y),Qn=A.get(D),at=A.get(gt.__renderTarget),ei=A.get(Qn.__renderTarget);oe.bindFramebuffer(I.READ_FRAMEBUFFER,at.__webglFramebuffer),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,ei.__webglFramebuffer);for(let Ki=0;Ki<ve;Ki++)ji&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,A.get(y).__webglTexture,B,ke+Ki),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,A.get(D).__webglTexture,ue,mt+Ki)),I.blitFramebuffer(Me,De,be,he,Ae,et,be,he,I.DEPTH_BUFFER_BIT,I.NEAREST);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(B!==0||y.isRenderTargetTexture||A.has(y)){let gt=A.get(y),Qn=A.get(D);oe.bindFramebuffer(I.READ_FRAMEBUFFER,uf),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,df);for(let at=0;at<ve;at++)ji?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,gt.__webglTexture,B,ke+at):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,gt.__webglTexture,B),st?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,Qn.__webglTexture,ue,mt+at):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,Qn.__webglTexture,ue),B!==0?I.blitFramebuffer(Me,De,be,he,Ae,et,be,he,I.COLOR_BUFFER_BIT,I.NEAREST):st?I.copyTexSubImage3D(me,ue,Ae,et,mt+at,Me,De,be,he):I.copyTexSubImage2D(me,ue,Ae,et,Me,De,be,he);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else st?y.isDataTexture||y.isData3DTexture?I.texSubImage3D(me,ue,Ae,et,mt,be,he,ve,it,It,ft.data):D.isCompressedArrayTexture?I.compressedTexSubImage3D(me,ue,Ae,et,mt,be,he,ve,it,ft.data):I.texSubImage3D(me,ue,Ae,et,mt,be,he,ve,it,It,ft):y.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,ue,Ae,et,be,he,it,It,ft.data):y.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,ue,Ae,et,ft.width,ft.height,it,ft.data):I.texSubImage2D(I.TEXTURE_2D,ue,Ae,et,be,he,it,It,ft);oe.pixelStorei(I.UNPACK_ROW_LENGTH,jt),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,je),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,en),oe.pixelStorei(I.UNPACK_SKIP_ROWS,yn),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,$n),ue===0&&D.generateMipmaps&&I.generateMipmap(me),oe.unbindTexture()},this.initRenderTarget=function(y){A.get(y).__webglFramebuffer===void 0&&b.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?b.setTextureCube(y,0):y.isData3DTexture?b.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?b.setTexture2DArray(y,0):b.setTexture2D(y,0),oe.unbindTexture()},this.resetState=function(){H=0,q=0,N=null,oe.reset(),ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return un}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Be._getDrawingBufferColorSpace(e),t.unpackColorSpace=Be._getUnpackColorSpace()}};function Gl(s,e){if(e===pl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Rs||e===Lr){let t=s.getIndex();if(t===null){let a=[],o=s.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}let n=t.count-2,i=[];if(e===Rs)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}function Dd(s){let e=new Map,t=new Map,n=s.clone();return Fd(s,n,function(i,r){e.set(r,i),t.set(i,r)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;let r=i,a=e.get(i),o=a.skeleton.bones;r.skeleton=a.skeleton.clone(),r.bindMatrix.copy(a.bindMatrix),r.skeleton.bones=o.map(function(c){return t.get(c)}),r.bind(r.skeleton,r.bindMatrix)}),n}function Fd(s,e,t){t(s,e);for(let n=0;n<s.children.length;n++)Fd(s.children[n],e.children[n],t)}var Jo=class extends Ln{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Kl(t)}),this.register(function(t){return new Jl(t)}),this.register(function(t){return new sh(t)}),this.register(function(t){return new rh(t)}),this.register(function(t){return new ah(t)}),this.register(function(t){return new Zl(t)}),this.register(function(t){return new $l(t)}),this.register(function(t){return new Ql(t)}),this.register(function(t){return new eh(t)}),this.register(function(t){return new jl(t)}),this.register(function(t){return new th(t)}),this.register(function(t){return new Yl(t)}),this.register(function(t){return new ih(t)}),this.register(function(t){return new nh(t)}),this.register(function(t){return new ql(t)}),this.register(function(t){return new Yo(t,ze.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new Yo(t,ze.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new oh(t)})}load(e,t,n,i){let r=this,a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){let l=Yn.extractUrlBase(e);a=Yn.resolveURL(l,this.path)}else a=Yn.extractUrlBase(e);this.manager.itemStart(e);let o=function(l){i?i(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new Ss(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r,a={},o={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===Bd){try{a[ze.KHR_BINARY_GLTF]=new ch(e)}catch(u){i&&i(u);return}r=JSON.parse(a[ze.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new mh(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){let u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){let u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case ze.KHR_MATERIALS_UNLIT:a[u]=new Xl;break;case ze.KHR_DRACO_MESH_COMPRESSION:a[u]=new lh(r,this.dracoLoader);break;case ze.KHR_TEXTURE_TRANSFORM:a[u]=new hh;break;case ze.KHR_MESH_QUANTIZATION:a[u]=new uh;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}};function sx(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}function vt(s,e,t){let n=s.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},ql=class{constructor(e){this.parser=e,this.name=ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],l,h=new Te(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],kt);let u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new fi(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Bi(h),l.distance=u;break;case"spot":l=new br(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),On(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}},Xl=class{constructor(){this.name=ze.KHR_MATERIALS_UNLIT}getMaterialType(){return gn}extendParams(e,t,n){let i=[];e.color=new Te(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],kt),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,bt))}return Promise.all(i)}},jl=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},Kl=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new He(r,r)}return Promise.all(i)}},Jl=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_DISPERSION}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},Yl=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(i)}},Zl=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_SHEEN}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Te(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],kt)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,bt)),n.sheenRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(i)}},$l=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(i)}},Ql=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_VOLUME}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Te().setRGB(r[0],r[1],r[2],kt),Promise.all(i)}},eh=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_IOR}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},th=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_SPECULAR}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];return t.specularColor=new Te().setRGB(r[0],r[1],r[2],kt),n.specularColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,bt)),Promise.all(i)}},nh=class{constructor(e){this.parser=e,this.name=ze.EXT_MATERIALS_BUMP}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(i)}},ih=class{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return vt(this.parser,e,this.name)!==null?Ht:null}extendMaterialParams(e,t){let n=vt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(i)}},sh=class{constructor(e){this.parser=e,this.name=ze.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}},rh=class{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},ah=class{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},Yo=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){let c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){let f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,i.mode,i.filter),f})})}else return null}},oh=class{constructor(e){this.name=ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let l of i.primitives)if(l.mode!==rn.TRIANGLES&&l.mode!==rn.TRIANGLE_STRIP&&l.mode!==rn.TRIANGLE_FAN&&l.mode!==void 0)return null;let a=n.extensions[this.name].attributes,o=[],c={};for(let l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{let h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(let g of u){let _=new Ue,m=new F,p=new Ft,v=new F(1,1,1),S=new Ni(g.geometry,g.material,d);for(let M=0;M<d;M++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,M),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,M),c.SCALE&&v.fromBufferAttribute(c.SCALE,M),S.setMatrixAt(M,_.compose(m,p,v));for(let M in c)if(M==="_COLOR_0"){let E=c[M];S.instanceColor=new hi(E.array,E.itemSize,E.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&g.geometry.setAttribute(M,c[M]);ct.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),f.push(S)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}},Bd="glTF",kr=12,Nd={JSON:1313821514,BIN:5130562},ch=class{constructor(e){this.name=ze.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,kr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Bd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-kr,r=new DataView(e,kr),a=0;for(;a<i;){let o=r.getUint32(a,!0);a+=4;let c=r.getUint32(a,!0);if(a+=4,c===Nd.JSON){let l=new Uint8Array(e,kr+a,o);this.content=n.decode(l)}else if(c===Nd.BIN){let l=kr+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},lh=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ze.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(let h in a){let u=fh[h]||h.toLowerCase();o[u]=a[h]}for(let h in e.attributes){let u=fh[h]||h.toLowerCase();if(a[h]!==void 0){let d=n.accessors[e.attributes[h]],f=Ds[d.componentType];l[u]=f.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(f){for(let g in f.attributes){let _=f.attributes[g],m=c[g];m!==void 0&&(_.normalized=m)}u(f)},o,l,kt,d)})})}},hh=class{constructor(){this.name=ze.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}},uh=class{constructor(){this.name=ze.KHR_MESH_QUANTIZATION}},Zo=class extends Rn{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,f=d*u,g=e*l,_=g-l,m=-2*f+3*d,p=f-d,v=1-m,S=p-d+u;for(let M=0;M!==o;M++){let E=a[_+M+o],T=a[_+M+c]*h,C=a[g+M+o],x=a[g+M]*h;r[M]=v*E+S*T+m*C+p*x}return r}},rx=new Ft,dh=class extends Zo{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return rx.fromArray(r).normalize().toArray(r),r}},rn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ds={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ud={9728:xt,9729:_t,9984:to,9985:Ts,9986:Gi,9987:xn},Od={33071:nn,33648:hs,10497:li},Vl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fh={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},xi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ax={CUBICSPLINE:void 0,LINEAR:Ii,STEP:Pi},Hl={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ox(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new En({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:pn})),s.DefaultMaterial}function Wi(s,e,t){for(let n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function On(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function cx(s,e,t){let n=!1,i=!1,r=!1;for(let l=0,h=e.length;l<h;l++){let u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);let a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){let u=e[l];if(n){let d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(i){let d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(r){let d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){let h=l[0],u=l[1],d=l[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=d),s.morphTargetsRelative=!0,s})}function lx(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function hx(s){let e,t=s.extensions&&s.extensions[ze.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Wl(t.attributes):e=s.indices+":"+Wl(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+Wl(s.targets[n]);return e}function Wl(s){let e="",t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function ph(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ux(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var dx=new Ue,mh=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new sx,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,r=o.indexOf("Firefox")>-1,a=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||r&&a<98?this.textureLoader=new pr(this.options.manager):this.textureLoader=new _r(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ss(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){let o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return Wi(r,o,i),On(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(let c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(a,o)=>{let c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(let[l,h]of a.children.entries())r(h,o.children[l])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ze.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,a){n.load(Yn.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let a=Vl[i.type],o=Ds[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new St(l,a,c))}let r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){let o=a[0],c=Vl[i.type],l=Ds[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0,_,m;if(f&&f!==u){let p=Math.floor(d/f),v="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,S=t.cache.get(v);S||(_=new l(o,p*f,i.count*f/h),S=new gs(_,f/h),t.cache.add(v,S)),m=new bs(S,c,d%f/h,g)}else o===null?_=new l(i.count*c):_=new l(o,d,i.count*c),m=new St(_,c,g);if(i.sparse!==void 0){let p=Vl.SCALAR,v=Ds[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,E=new v(a[1],S,i.sparse.count*p),T=new l(a[2],M,i.sparse.count*c);o!==null&&(m=new St(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let C=0,x=E.length;C<x;C++){let w=E[C];if(m.setX(w,T[C*c]),c>=2&&m.setY(w,T[C*c+1]),c>=3&&m.setZ(w,T[C*c+2]),c>=4&&m.setW(w,T[C*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r],o=this.textureLoader;if(a.uri){let c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,a=r.textures[e],o=r.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];let l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);let d=(r.samplers||{})[a.sampler]||{};return h.magFilter=Ud[d.magFilter]||_t,h.minFilter=Ud[d.minFilter]||xn,h.wrapS=Od[d.wrapS]||li,h.wrapT=Od[d.wrapT]||li,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==xt&&h.minFilter!==_t,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());let a=i.images[e],o=self.URL||self.webkitURL,c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let g=d;t.isImageBitmapLoader===!0&&(g=function(_){let m=new Ct(_);m.needsUpdate=!0,d(m)}),t.load(Yn.resolveURL(u,r.path),g,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),On(u,a),u.userData.mimeType=a.mimeType||ux(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[ze.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[ze.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let c=r.associations.get(a);a=r.extensions[ze.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new Ms,Gt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new ys,Gt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),r&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return En}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],a,o={},c=r.extensions||{},l=[];if(c[ze.KHR_MATERIALS_UNLIT]){let u=i[ze.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Te(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],kt),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,bt)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=sn);let h=r.alphaMode||Hl.OPAQUE;if(h===Hl.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Hl.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==gn&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new He(1,1),r.normalTexture.scale!==void 0)){let u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==gn&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==gn){let u=r.emissiveFactor;o.emissive=new Te().setRGB(u[0],u[1],u[2],kt)}return r.emissiveTexture!==void 0&&a!==gn&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,bt)),Promise.all(l).then(function(){let u=new a(o);return r.name&&(u.name=r.name),On(u,r),t.associations.set(u,{materials:e}),r.extensions&&Wi(i,u,r),u})}createUniqueName(e){let t=tt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return kd(c,o,t)})}let a=[];for(let o=0,c=e.length;o<c;o++){let l=e[o],h=hx(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[ze.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=kd(new zt,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){let h=a[c].material===void 0?ox(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){let l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,g=h.length;f<g;f++){let _=h[f],m=a[f],p,v=l[f];if(m.mode===rn.TRIANGLES||m.mode===rn.TRIANGLE_STRIP||m.mode===rn.TRIANGLE_FAN||m.mode===void 0)p=r.isSkinnedMesh===!0?new ir(_,v):new lt(_,v),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===rn.TRIANGLE_STRIP?p.geometry=Gl(p.geometry,Lr):m.mode===rn.TRIANGLE_FAN&&(p.geometry=Gl(p.geometry,Rs));else if(m.mode===rn.LINES)p=new rr(_,v);else if(m.mode===rn.LINE_STRIP)p=new Ui(_,v);else if(m.mode===rn.LINE_LOOP)p=new ar(_,v);else if(m.mode===rn.POINTS)p=new or(_,v);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&lx(p,r),p.name=t.createUniqueName(r.name||"mesh_"+e),On(p,r),m.extensions&&Wi(i,p,m),t.assignFinalMaterial(p),u.push(p)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&Wi(i,u[0],r),u[0];let d=new dn;r.extensions&&Wi(i,d,r),t.associations.set(d,{meshes:e});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Mt(Fr.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new di(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),On(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){let r=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){let u=a[l];if(u){o.push(u);let d=new Ue;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new sr(o,c)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){let f=i.channels[u],g=i.samplers[f.sampler],_=f.target,m=_.node,p=i.parameters!==void 0?i.parameters[g.input]:g.input,v=i.parameters!==void 0?i.parameters[g.output]:g.output;_.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",v)),l.push(g),h.push(_))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){let d=u[0],f=u[1],g=u[2],_=u[3],m=u[4],p=[];for(let S=0,M=d.length;S<M;S++){let E=d[S],T=f[S],C=g[S],x=_[S],w=m[S];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();let L=n._createAnimationTracks(E,T,C,x,w);if(L)for(let R=0;R<L.length;R++)p.push(L[R])}let v=new Oi(r,void 0,p);return On(v,i),v})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){let a=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));let c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){let h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,dx)});for(let f=0,g=u.length;f<g;f++)h.add(u[f]);if(h.userData.pivot!==void 0&&u.length>0){let f=h.userData.pivot,g=u[0];h.pivot=new F().fromArray(f),h.position.x-=f[0],h.position.y-=f[1],h.position.z-=f[2],g.position.set(0,0,0),delete h.userData.pivot}return h})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(l){return i._getNodeRef(i.cameraCache,r.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(r.isBone===!0?h=new xs:l.length>1?h=new dn:l.length===1?h=l[0]:h=new ct,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=a),On(h,r),r.extensions&&Wi(n,h,r),r.matrix!==void 0){let u=new Ue;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new dn;n.name&&(r.name=i.createUniqueName(n.name)),On(r,n),n.extensions&&Wi(t,r,n);let a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++){let d=c[h];d.parent!==null?r.add(Dd(d)):r.add(d)}let l=h=>{let u=new Map;for(let[d,f]of i.associations)(d instanceof Gt||d instanceof Ct)&&u.set(d,f);return h.traverse(d=>{let f=i.associations.get(d);f!=null&&u.set(d,f)}),u};return i.associations=l(r),r})}_createAnimationTracks(e,t,n,i,r){let a=[],o=e.name?e.name:e.uuid,c=[];function l(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}xi[r.path]===xi.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(o);let h;switch(xi[r.path]){case xi.weights:h=Cn;break;case xi.rotation:h=Pn;break;case xi.translation:case xi.scale:h=In;break;default:n.itemSize===1?h=Cn:h=In;break}let u=i.interpolation!==void 0?ax[i.interpolation]:Ii,d=this._getArrayFromAccessor(n);for(let f=0,g=c.length;f<g;f++){let _=new h(c[f]+"."+xi[r.path],t.array,d,u);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),a.push(_)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=ph(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){let i=this instanceof Pn?dh:Zo;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function fx(s,e,t){let n=e.attributes,i=new Bt;if(n.POSITION!==void 0){let o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new F(c[0],c[1],c[2]),new F(l[0],l[1],l[2])),o.normalized){let h=ph(Ds[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=e.targets;if(r!==void 0){let o=new F,c=new F;for(let l=0,h=r.length;l<h;l++){let u=r[l];if(u.POSITION!==void 0){let d=t.json.accessors[u.POSITION],f=d.min,g=d.max;if(f!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),d.normalized){let _=ph(Ds[d.componentType]);c.multiplyScalar(_)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}s.boundingBox=i;let a=new Vt;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function kd(s,e,t){let n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){s.setAttribute(o,c)})}for(let a in n){let o=fh[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){let a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return Be.workingColorSpace!==kt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Be.workingColorSpace}" not supported.`),On(s,e),fx(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?cx(s,e.targets,t):s})}var $o=class extends Di{constructor(){super(),this.name="RoomEnvironment",this.position.y=-3.5;let e=new ui;e.deleteAttribute("uv");let t=new En({side:Pt}),n=new En,i=new Bi(16777215,900,28,2);i.position.set(.418,16.199,.3),this.add(i);let r=new lt(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);let a=new Ni(e,n,6),o=new ct;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),a.setMatrixAt(0,o.matrix),o.position.set(-5.607,-.754,-.758),o.rotation.set(0,.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),a.setMatrixAt(1,o.matrix),o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),a.setMatrixAt(2,o.matrix),o.position.set(-2.017,.018,6.124),o.rotation.set(0,.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),a.setMatrixAt(3,o.matrix),o.position.set(2.291,-.756,-2.621),o.rotation.set(0,-.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),a.setMatrixAt(4,o.matrix),o.position.set(-2.193,-.369,-5.547),o.rotation.set(0,.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),a.setMatrixAt(5,o.matrix),this.add(a);let c=new lt(e,Fs(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);let l=new lt(e,Fs(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);let h=new lt(e,Fs(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);let u=new lt(e,Fs(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);let d=new lt(e,Fs(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);let f=new lt(e,Fs(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function Fs(s){return new ur({color:0,emissive:16777215,emissiveIntensity:s})}var px=["viseme_aa","viseme_CH","viseme_DD","viseme_E","viseme_FF","viseme_I","viseme_kk","viseme_nn","viseme_O","viseme_PP","viseme_RR","viseme_sil","viseme_SS","viseme_TH","viseme_U"],mx=["jawOpen","mouthOpen"],zd={a:"viseme_aa",e:"viseme_E",i:"viseme_I",o:"viseme_O",u:"viseme_U",b:"viseme_PP",m:"viseme_PP",p:"viseme_PP",f:"viseme_FF",v:"viseme_FF",d:"viseme_DD",t:"viseme_DD",n:"viseme_DD",l:"viseme_DD",k:"viseme_kk",g:"viseme_kk",c:"viseme_kk",q:"viseme_kk",s:"viseme_SS",z:"viseme_SS",x:"viseme_SS",r:"viseme_RR",w:"viseme_U",y:"viseme_I",h:"viseme_E",j:"viseme_CH"},Gd={th:"viseme_TH",ch:"viseme_CH",sh:"viseme_CH"},Qo=80,gx=120,bx=200,xx=.35;function ec(s){let e=new Map,t=new Map;return s?.traverse?.(n=>{if(!n.isMesh||!n.morphTargetDictionary||!n.morphTargetInfluences)return;let i=n.morphTargetDictionary;for(let r of px)i[r]!==void 0&&(e.has(r)||e.set(r,[]),e.get(r).push({mesh:n,index:i[r]}));for(let r of mx)i[r]!==void 0&&(t.has(r)||t.set(r,[]),t.get(r).push({mesh:n,index:i[r]}))}),e.size?{mode:"arkit",map:e}:t.size?{mode:"jaw",map:t}:null}function Vd(s){let e=[],t=String(s||"").toLowerCase(),n=0;for(let i=0;i<t.length;){let r=i+1<t.length?t[i]+t[i+1]:"";if(Gd[r]){e.push({viseme:Gd[r],startMs:n,endMs:n+Qo*2}),n+=Qo*2,i+=2;continue}let a=t[i];zd[a]?(e.push({viseme:zd[a],startMs:n,endMs:n+Qo}),n+=Qo):/\s/.test(a)?n+=gx:/[.,!?;:]/.test(a)&&(n+=bx),i++}return e}function Br(s){let e=Vd(s);return e.length?e[e.length-1].endMs:0}function tc(s,e,t={}){let n=t.rate&&t.rate>0?t.rate:1,i=e?Vd(s):[],r=i.length?i[i.length-1].endMs:0,a=-1,o=!1,c=e?new Map([...e.map.keys()].map(d=>[d,0])):new Map;function l(d,f){let g=e?.map.get(d);if(g)for(let{mesh:_,index:m}of g)_.morphTargetInfluences[m]=f}function h(d){if(!e||o)return;a<0&&(a=d);let f=(d-a)*n,g=null;if(f<=r){for(let _ of i)if(f>=_.startMs&&f<_.endMs){g=_.viseme;break}}for(let _ of c.keys()){let m=0;e.mode==="arkit"?m=_===g?.92:0:m=g?.45+.25*Math.abs(Math.sin(f/70)):0;let p=c.get(_)+(m-c.get(_))*xx;c.set(_,p),l(_,p)}f>r+120&&(o=!0)}function u(){o=!0;for(let d of c.keys())c.set(d,0),l(d,0)}return{tick:h,stop:u,get done(){return o},get totalMs(){return r}}}var gh=null;function vx(){return gh||(gh=Promise.resolve().then(()=>(Wd(),Hd)).then(s=>s.MeshoptDecoder)),gh}var qd={bust:{center:.86,dist:.62,fov:28},upper:{center:.72,dist:1,fov:30},full:{center:.5,dist:1.9,fov:32}},yx=["eyeBlinkLeft","eyeBlinkRight","eyesClosed","blink"],Ns=class{constructor(e,t={}){this.container=e,this._opts=t,this.scene=new Di,this._applyBackground(t.background),this.canvas=document.createElement("canvas"),this.canvas.style.cssText="display:block;width:100%;height:100%;outline:none",e.appendChild(this.canvas);let n=e.clientWidth||320,i=e.clientHeight||360;this.camera=new Mt(30,n/i,.05,200),this.camera.position.set(0,1.5,2.2),this.renderer=new Xo({canvas:this.canvas,antialias:!0,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),this.renderer.setSize(n,i,!1),this.renderer.outputColorSpace=bt,this.renderer.toneMapping=Sr,this.renderer.toneMappingExposure=1.05;let r=new Is(this.renderer);this._envTex=r.fromScene(new $o,.04).texture,this.scene.environment=this._envTex,r.dispose(),this.scene.add(new xr(16777215,.6));let a=new fi(16777215,1.4);a.position.set(1.5,3,2.5),this.scene.add(a);let o=new fi(10075135,.5);o.position.set(-2,2,-2),this.scene.add(o),this.clock=new yr,this.mixer=null,this.model=null,this.morph=null,this._idleAction=null,this._talkAction=null,this._speaking=!1,this._loadToken=0,this._frameHooks=new Set,this._headBone=null,this._blinkTargets=[],this._nextBlink=1+Math.random()*3,this._blinkT=-1,this._reduce=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||!1,this._resizeObs=new ResizeObserver(()=>this._resize()),this._resizeObs.observe(e),this._visible=!document.hidden,this._onscreen=!0,this._render=this._render.bind(this),this._onVisibility=()=>{this._visible=!document.hidden,this._kick()},document.addEventListener("visibilitychange",this._onVisibility),this._inViewObs=new IntersectionObserver(c=>{this._onscreen=c.some(l=>l.isIntersecting),this._kick()},{threshold:0}),this._inViewObs.observe(e),this._raf=0,this._raf=requestAnimationFrame(this._render)}_kick(){this._raf||!this.renderer||!this._visible||!this._onscreen||(this.clock.getDelta(),this._raf=requestAnimationFrame(this._render))}onFrame(e){return this._frameHooks.add(e),()=>this._frameHooks.delete(e)}async load(e,t={}){let n=++this._loadToken,i=new Jo;i.setMeshoptDecoder(await vx());let r=await i.loadAsync(e);if(n!==this._loadToken)return null;if(this.model&&(this.scene.remove(this.model),this._disposeObject(this.model)),this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.model)),this.mixer=null,this._idleAction=null,this._talkAction=null,this.model=r.scene,this.scene.add(this.model),this.morph=ec(this.model),this._collectRigRefs(this.model),r.animations?.length){this.mixer=new vr(this.model);let a=Xd(r.animations,["idle","breathing","stand","rest"])||r.animations[0],o=Xd(r.animations,["talk","talking","speak","gesture","wave"]);a&&(this._idleAction=this.mixer.clipAction(a),this._idleAction.setLoop(Ir,1/0).play()),o&&o!==a&&(this._talkAction=this.mixer.clipAction(o),this._talkAction.setLoop(Ir,1/0),this._talkAction.enabled=!0,this._talkAction.setEffectiveWeight(0),this._talkAction.play())}return this._frame(t.framing||"upper"),r}setSpeaking(e){this._speaking=!!e,this._talkAction&&this._talkAction.setEffectiveWeight(e?.85:0)}_collectRigRefs(e){this._headBone=null,this._blinkTargets=[],e.traverse(t=>{if(t.isBone&&/head/i.test(t.name)&&!/headtop|end/i.test(t.name)&&!this._headBone&&(this._headBone=t,t.userData._restQ=t.quaternion.clone()),t.isMesh&&t.morphTargetDictionary)for(let n of yx){let i=t.morphTargetDictionary[n];i!==void 0&&this._blinkTargets.push({mesh:t,index:i})}})}_frame(e){let t=qd[e]||qd.upper,n=new Bt().setFromObject(this.model),i=new F,r=new F;n.getSize(i),n.getCenter(r);let a=i.y||1.7,o=n.min.y+a*t.center,c=r.x,l=Math.max(i.x,a)||1;this.camera.fov=t.fov;let h=t.fov*Math.PI/180,u=l/2/Math.tan(h/2)*t.dist;this.camera.position.set(c,o,n.max.z+u),this.camera.near=Math.max(.01,u/100),this.camera.far=u*50,this.camera.lookAt(c,o,r.z),this.camera.updateProjectionMatrix(),this._focus=new F(c,o,r.z)}_proceduralIdle(e){if(this.mixer||this._reduce||!this.model)return;let t=Math.sin(e*1.6)*.006;if(this.model.position.y=t,this._headBone&&this._headBone.userData._restQ){let n=Math.sin(e*.6)*.05,i=Math.sin(e*.9)*.03+(this._speaking?Math.sin(e*6)*.04:0);this._headBone.quaternion.copy(this._headBone.userData._restQ),this._headBone.rotateY(n),this._headBone.rotateX(i)}}_blink(e,t){if(!this._blinkTargets.length||this._reduce)return;if(this._blinkT<0){this._nextBlink-=e,this._nextBlink<=0&&(this._blinkT=0,this._nextBlink=2+Math.random()*4);return}this._blinkT+=e;let n=.16,i=this._blinkT<n/2?this._blinkT/(n/2):1-(this._blinkT-n/2)/(n/2),r=Fr.clamp(i,0,1);for(let{mesh:a,index:o}of this._blinkTargets)a.morphTargetInfluences[o]=r;this._blinkT>=n&&(this._blinkT=-1)}_render(){if(!this.renderer||!this._visible||!this._onscreen){this._raf=0;return}this._raf=requestAnimationFrame(this._render);let e=Math.min(this.clock.getDelta(),.05),t=this.clock.elapsedTime,n=t*1e3;this.mixer?.update(e),this._proceduralIdle(t),this._blink(e,t);for(let i of this._frameHooks)try{i(e,n)}catch{}this.renderer.render(this.scene,this.camera)}_resize(){if(!this.renderer||!this.camera)return;let e=this.container.clientWidth||1,t=this.container.clientHeight||1;this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}_applyBackground(e){if(!e||e==="transparent"){this.scene.background=null;return}try{this.scene.background=new Te(e)}catch{this.scene.background=null}}_disposeObject(e){e.traverse?.(t=>{t.geometry?.dispose?.(),(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>{if(i){for(let r of Object.values(i))r?.isTexture&&r.dispose();i.dispose?.()}})})}dispose(){cancelAnimationFrame(this._raf),this._raf=0,this._resizeObs?.disconnect(),this._inViewObs?.disconnect(),document.removeEventListener("visibilitychange",this._onVisibility),this._frameHooks.clear(),this.model&&(this.scene.remove(this.model),this._disposeObject(this.model)),this._envTex?.dispose(),this._envTex=null,this.renderer?.dispose(),this.renderer?.forceContextLoss?.(),this.renderer=null,this.canvas?.remove(),this.scene=null,this.camera=null,this.model=null}};function Xd(s,e){for(let t of e){let n=s.find(i=>i.name&&i.name.toLowerCase().includes(t));if(n)return n}return null}var Us=typeof window<"u"&&"speechSynthesis"in window,Os=class{constructor(e,t={}){this.stage=e,this.muted=!!t.muted,this.onState=t.onState||(()=>{}),this.onCaption=t.onCaption||(()=>{}),this.onError=t.onError||(()=>{}),this.agent=null,this._queue=[],this._active=null,this._frameUnsub=e.onFrame((n,i)=>this._tick(i)),this._voices=[],Us&&(this._onVoices=this._loadVoices.bind(this),this._loadVoices(),window.speechSynthesis.addEventListener?.("voiceschanged",this._onVoices))}setAgent(e){this.agent=e}setMuted(e){this.muted=!!e,e&&Us&&window.speechSynthesis.cancel()}speak(e,t={}){let n=String(e||"").trim();return n?(t.interrupt&&this.cancel(),new Promise(i=>{this._queue.push({text:n,resolve:i}),this._active||this._next()})):Promise.resolve()}cancel(){Us&&window.speechSynthesis.cancel(),this._finishActive(!0);for(let e of this._queue.splice(0))e.resolve();this.onCaption(null),this.stage.setSpeaking(!1),this.onState("idle")}get speaking(){return!!this._active}_next(){let e=this._queue.shift();if(!e){this.onState("idle"),this.onCaption(null),this.stage.setSpeaking(!1);return}let t=this.agent?.voice?.rate||1,n=tc(e.text,this.stage.morph,{rate:t}),i={text:e.text,lipsync:n,resolve:e.resolve,utter:null,fallbackTimer:0};if(this._active=i,this.stage.setSpeaking(!0),this.onState("speaking"),this.onCaption(e.text),Us&&!this.muted){let r=new SpeechSynthesisUtterance(e.text),a=this._pickVoice();a&&(r.voice=a),r.lang=this.agent?.voice?.lang||a?.lang||"en-US",r.pitch=jd(this.agent?.voice?.pitch??1,0,2),r.rate=jd(this.agent?.voice?.rate??1,.1,3),r.onend=()=>this._finishActive(!1),r.onerror=c=>{c?.error&&!/interrupt|cancel/i.test(c.error)?(this.onError(new Error("speech-synthesis: "+c.error)),this._runVisualFallback(i)):this._finishActive(!1)},i.utter=r;let o=Br(e.text)*(1/(r.rate||1))+1500;i.fallbackTimer=window.setTimeout(()=>this._finishActive(!1),Math.max(2500,o));try{window.speechSynthesis.speak(r)}catch(c){this.onError(c instanceof Error?c:new Error(String(c))),this._runVisualFallback(i)}}else this._runVisualFallback(i)}_runVisualFallback(e){if(e!==this._active)return;let t=e.lipsync.totalMs?e.lipsync.totalMs+350:Math.max(1200,Br(e.text)+350);e.fallbackTimer=window.setTimeout(()=>this._finishActive(!1),t)}_tick(e){this._active?.lipsync?.tick(e)}_finishActive(e){let t=this._active;if(t){this._active=null,t.fallbackTimer&&clearTimeout(t.fallbackTimer),t.lipsync?.stop();try{t.resolve()}catch{}e||this._next()}}_loadVoices(){Us&&(this._voices=window.speechSynthesis.getVoices()||[])}_pickVoice(){this._voices.length||this._loadVoices();let e=this.agent?.voice||{},t=this._voices;if(!t.length)return null;for(let n of e.match||[]){let i=t.find(r=>r.name?.toLowerCase().includes(n.toLowerCase()));if(i)return i}if(e.lang){let n=t.find(i=>i.lang?.toLowerCase().startsWith(e.lang.toLowerCase().slice(0,2)));if(n)return n}return t.find(n=>n.localService)||t[0]}dispose(){this.cancel(),this._frameUnsub?.(),Us&&window.speechSynthesis.removeEventListener?.("voiceschanged",this._onVoices)}};function jd(s,e,t){return Math.max(e,Math.min(t,Number(s)))}var zr="https://three.ws/avatars/",qi=[{id:"sol",name:"Sol",tagline:"Calm, clear product guide",file:"realistic-halfbody.glb",lipsync:"viseme",framing:"bust",voice:{lang:"en-US",pitch:1,rate:1,match:["samantha","jenny","aria","google us english"]},accent:"#6366f1"},{id:"nova",name:"Nova",tagline:"Upbeat, friendly host",file:"selfie-girl.glb",lipsync:"viseme",framing:"upper",voice:{lang:"en-US",pitch:1.12,rate:1.04,match:["jenny","aria","samantha","google us english"]},accent:"#ec4899"},{id:"vera",name:"Vera",tagline:"Composed, professional",file:"realistic-female.glb",lipsync:"viseme",framing:"bust",voice:{lang:"en-GB",pitch:1,rate:.98,match:["libby","sonia","google uk english female","serena"]},accent:"#14b8a6"},{id:"atlas",name:"Atlas",tagline:"Confident, grounded",file:"realistic-male.glb",lipsync:"viseme",framing:"bust",voice:{lang:"en-US",pitch:.92,rate:.98,match:["guy","eric","google us english","daniel"]},accent:"#3b82f6"},{id:"echo",name:"Echo",tagline:"Neutral, even-keeled",file:"default.glb",lipsync:"viseme",framing:"upper",voice:{lang:"en-US",pitch:1,rate:1,match:["google us english","samantha","guy"]},accent:"#8b5cf6"}],ks="sol";function Gr(s){return qi.find(e=>e.id===s)||qi.find(e=>e.id===ks)}function Vr(s,e=zr){return s?s.url?s.url:(e.endsWith("/")?e:e+"/")+s.file:null}function nc(s){return s?typeof s=="string"?{id:"custom",name:"Assistant",tagline:"Custom avatar",url:s,lipsync:"viseme",framing:"bust",voice:{lang:"en-US",pitch:1,rate:1,match:[]},accent:"#6366f1"}:{...Gr(ks),id:"custom",name:"Assistant",...s}:null}var Kd=6e3,Jd=8e3,Mx='script,style,noscript,template,svg,iframe,canvas,[aria-hidden="true"],[hidden],[data-concierge-ignore]';function _i(s){return String(s||"").replace(/\s+/g," ").trim()}function Sx(s,e){if(!s)return"";let t=s.cloneNode(!0);for(let n of t.querySelectorAll(Mx))n.remove();for(let n of t.querySelectorAll("[data-three-concierge]"))n.remove();return _i(t.textContent).slice(0,e)}function bh(s,e={}){if(!s)return{url:"",title:"",description:"",headings:[],nav:[],content:"",name:""};let t=_i(s.title).slice(0,200),n=_i(s.querySelector('meta[name="description"]')?.getAttribute("content")||s.querySelector('meta[property="og:description"]')?.getAttribute("content")).slice(0,500),i=[...s.querySelectorAll("h1, h2, h3")].map(h=>_i(h.textContent)).filter(h=>h&&h.length<=120).slice(0,24),r=[...s.querySelectorAll("nav a, header a")].map(h=>_i(h.textContent)).filter(h=>h&&h.length<=40),a=[...new Set(r)].slice(0,24),o=s.querySelector("main")||s.querySelector('[role="main"]')||s.querySelector("article")||s.body,c=Sx(o,6e3),l=_i(s.querySelector('meta[property="og:site_name"]')?.getAttribute("content"))||(e.siteName?_i(e.siteName):"")||(typeof location<"u"?location.hostname:"");return{url:typeof location<"u"?location.href.split("#")[0]:"",title:t,description:n,headings:i,nav:a,content:c,name:l.slice(0,120)}}function ic(s,e={}){let t=bh(s,e),n=_i(e.knowledge).slice(0,8e3),i=t.content;if(n){let r=Math.max(0,6e3-Math.min(n.length,6e3));i=i.slice(0,r)}return{url:t.url,name:t.name,title:t.title,description:t.description,headings:t.headings,nav:t.nav,knowledge:n,content:i}}var Hr="https://three.ws/api/concierge",sc=20;function xh(s){let e=String(s||"").trim();if(!e||e==="[DONE]")return null;try{let t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}function _h(s){let e="";return{push(t){e+=t;let n;for(;(n=e.indexOf(`
+
+`))!==-1;){let i=e.slice(0,n);e=e.slice(n+2);let r=i.split(`
+`).filter(o=>o.startsWith("data:")).map(o=>o.slice(5).trim()).join(`
+`),a=xh(r);a&&s(a)}}}}async function rc(s){let e=s.endpoint||Hr,t=(s.history||[]).slice(-20).map(h=>({role:h.role,content:String(h.content).slice(0,4e3)})),n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:String(s.message).slice(0,2e3),history:t,site:s.site||{},persona:s.persona||void 0,lang:s.lang||(typeof navigator<"u"?navigator.language:void 0)}),signal:s.signal});if(!n.ok){let h="";try{let d=await n.json();h=d?.error||d?.message||""}catch{}let u=new Error(h||`concierge endpoint returned HTTP ${n.status}`);throw u.status=n.status,u}let i="",r={},a=null,o=_h(h=>{h.type==="chunk"&&typeof h.text=="string"?(i+=h.text,s.onChunk?.(h.text)):h.type==="done"?r={provider:h.provider,model:h.model}:h.type==="error"&&(a=new Error(h.error||"concierge stream error"))}),c=n.body.getReader(),l=new TextDecoder;for(;;){let{done:h,value:u}=await c.read();if(h)break;o.push(l.decode(u,{stream:!0}))}if(o.push(l.decode()),a&&!i)throw a;return{text:i,...r}}var Ax={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Xi(s){return String(s??"").replace(/[&<>"']/g,e=>Ax[e])}function Tx(s){let e=String(s||"").trim();return/^(https?:\/\/|mailto:|\/)/i.test(e)?e:null}function vh(s){let e=Xi(s);return e=e.replace(/`([^`]+)`/g,"<code>$1</code>"),e=e.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),e=e.replace(/(^|[\s(])\*([^*\n]+)\*(?=[\s).,!?:;]|$)/g,"$1<em>$2</em>"),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,i)=>{let r=Tx(i);return r?`<a href="${Xi(r)}" target="_blank" rel="noopener noreferrer">${n}</a>`:n}),e}function Bs(s){let e=String(s??"").replace(/\r\n/g,`
+`),t=[],n=e.split(`
+`),i=0;for(;i<n.length;){let r=n[i];if(/^```/.test(r)){let o=[];for(i++;i<n.length&&!/^```/.test(n[i]);)o.push(n[i++]);i++,t.push(`<pre><code>${Xi(o.join(`
+`))}</code></pre>`);continue}if(/^\s*[-*]\s+/.test(r)){let o=[];for(;i<n.length&&/^\s*[-*]\s+/.test(n[i]);)o.push(`<li>${vh(n[i].replace(/^\s*[-*]\s+/,""))}</li>`),i++;t.push(`<ul>${o.join("")}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(r)){let o=[];for(;i<n.length&&/^\s*\d+[.)]\s+/.test(n[i]);)o.push(`<li>${vh(n[i].replace(/^\s*\d+[.)]\s+/,""))}</li>`),i++;t.push(`<ol>${o.join("")}</ol>`);continue}if(!r.trim()){i++;continue}let a=[];for(;i<n.length&&n[i].trim()&&!/^```|^\s*[-*]\s+|^\s*\d+[.)]\s+/.test(n[i]);)a.push(n[i++]);t.push(`<p>${vh(a.join(" "))}</p>`)}return t.join("")}function Wr(s){return String(s??"").replace(/```[\s\S]*?```/g," code sample. ").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*\n]+)\*/g,"$1").replace(/\[([^\]]+)\]\([^)\s]+\)/g,"$1").replace(/^[\s]*[-*]\s+/gm,"").replace(/^[\s]*\d+[.)]\s+/gm,"").replace(/\s+/g," ").trim()}function Yd(){return typeof window>"u"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}function ac(){return!!Yd()}function oc(s={}){let e=Yd(),t=null,n="",i=null;function r(){if(t)try{t.stop()}catch{}}return{supported:!!e,get listening(){return!!t},start(){return!e||t?Promise.resolve(""):(n="",t=new e,t.lang=s.lang||(typeof navigator<"u"?navigator.language:"en-US"),t.interimResults=!0,t.continuous=!1,t.maxAlternatives=1,s.onState?.("listening"),new Promise(a=>{i=a,t.onresult=o=>{let c="";for(let l=o.resultIndex;l<o.results.length;l++){let h=o.results[l];h.isFinal?n+=h[0].transcript:c+=h[0].transcript}s.onInterim?.(n+c)},t.onerror=o=>{o?.error&&!/no-speech|aborted/i.test(o.error)&&s.onError?.(new Error("speech-recognition: "+o.error))},t.onend=()=>{t=null,s.onState?.("idle");let o=n.trim();i?.(o),i=null};try{t.start()}catch(o){t=null,s.onState?.("idle"),s.onError?.(o instanceof Error?o:new Error(String(o))),a(""),i=null}}))},stop(){r()},dispose(){r(),t=null}}}var yh=`
+.tc-root{
+ --tc-accent:#6366f1;
+ --tc-bg:#0b0c12;
+ --tc-surface:#12141d;
+ --tc-surface-2:#191c28;
+ --tc-border:rgba(255,255,255,.09);
+ --tc-text:#eceef6;
+ --tc-text-dim:#8b93ab;
+ --tc-user-text:#fff;
+ --tc-shadow:0 24px 64px rgba(0,0,0,.5),0 4px 16px rgba(0,0,0,.35);
+ --tc-radius:16px;
+ position:fixed;z-index:2147482800;display:flex;flex-direction:column;align-items:flex-end;gap:12px;
+ font-family:ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
+ -webkit-font-smoothing:antialiased;line-height:1.45;
+ -webkit-user-select:none;user-select:none;
+}
+.tc-root[data-tc-theme=light]{
+ --tc-bg:#ffffff;
+ --tc-surface:#f4f5f9;
+ --tc-surface-2:#eceef5;
+ --tc-border:rgba(15,18,32,.10);
+ --tc-text:#171923;
+ --tc-text-dim:#5f677e;
+ --tc-shadow:0 24px 64px rgba(20,24,40,.18),0 4px 16px rgba(20,24,40,.10);
+}
+.tc-root[data-tc-pos=bottom-right]{right:20px;bottom:20px}
+.tc-root[data-tc-pos=bottom-left]{left:20px;bottom:20px;align-items:flex-start}
+.tc-root *,.tc-root *::before,.tc-root *::after{box-sizing:border-box}
+.tc-root button{font:inherit;border:none;background:none;color:inherit;cursor:pointer;padding:0}
+.tc-root button:focus-visible,.tc-root textarea:focus-visible,.tc-root a:focus-visible{outline:2px solid var(--tc-accent);outline-offset:2px;border-radius:6px}
+
+/* \u2500\u2500 Launcher \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
+.tc-launcher{position:relative;width:56px;height:56px;border-radius:50%;display:grid;place-items:center;color:#fff;
+ background:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 88%,#fff 12%),color-mix(in srgb,var(--tc-accent) 82%,#000 18%));
+ box-shadow:0 10px 30px color-mix(in srgb,var(--tc-accent) 45%,transparent),0 2px 8px rgba(0,0,0,.25);
+ transition:transform .18s ease,box-shadow .18s ease,filter .18s ease}
+.tc-launcher::before{content:'';position:absolute;inset:0;border-radius:50%;background:linear-gradient(180deg,rgba(255,255,255,.32),transparent 55%);pointer-events:none}
+.tc-launcher:hover{transform:translateY(-2px) scale(1.04);filter:brightness(1.07)}
+.tc-launcher:active{transform:scale(.96)}
+.tc-launcher svg{width:24px;height:24px;transition:transform .25s ease}
+.tc-root.is-open .tc-launcher svg{transform:rotate(90deg)}
+.tc-pulse{position:absolute;inset:-4px;border-radius:50%;background:color-mix(in srgb,var(--tc-accent) 55%,transparent);animation:tc-pulse 2.6s ease-out infinite;pointer-events:none}
+.tc-root.is-open .tc-pulse{display:none}
+@keyframes tc-pulse{0%{transform:scale(.9);opacity:.55}70%{transform:scale(1.45);opacity:0}100%{transform:scale(1.45);opacity:0}}
+
+/* \u2500\u2500 Teaser bubble \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
+.tc-teaser{max-width:240px;background:var(--tc-bg);color:var(--tc-text);border:1px solid var(--tc-border);border-radius:14px;
+ padding:10px 34px 10px 14px;font-size:13.5px;box-shadow:var(--tc-shadow);position:relative;
+ opacity:0;transform:translateY(8px);transition:opacity .3s ease,transform .3s ease;cursor:pointer}
+.tc-teaser.is-in{opacity:1;transform:translateY(0)}
+.tc-teaser-close{position:absolute;top:6px;right:6px;width:20px;height:20px;display:grid;place-items:center;color:var(--tc-text-dim);border-radius:50%}
+.tc-teaser-close:hover{color:var(--tc-text);background:var(--tc-surface-2)}
+
+/* \u2500\u2500 Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
+.tc-panel{width:380px;max-width:calc(100vw - 2.5rem);max-height:min(72vh,680px);display:flex;flex-direction:column;overflow:hidden;
+ background:var(--tc-bg);color:var(--tc-text);border:1px solid var(--tc-border);border-radius:var(--tc-radius);box-shadow:var(--tc-shadow);
+ opacity:0;transform:translateY(14px) scale(.97);transform-origin:100% 100%;
+ transition:opacity .24s ease,transform .24s cubic-bezier(.2,.9,.3,1.1)}
+.tc-root[data-tc-pos=bottom-left] .tc-panel{transform-origin:0 100%}
+.tc-root.is-open .tc-panel{opacity:1;transform:translateY(0) scale(1)}
+.tc-panel[hidden]{display:none}
+
+/* Header */
+.tc-head{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 14px;border-bottom:1px solid var(--tc-border);background:var(--tc-surface)}
+.tc-head-id{display:flex;align-items:center;gap:9px;min-width:0}
+.tc-head-dot{width:8px;height:8px;border-radius:50%;background:#34d399;box-shadow:0 0 0 3px color-mix(in srgb,#34d399 22%,transparent);flex-shrink:0}
+.tc-head-name{font-weight:650;font-size:14px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.tc-head-sub{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--tc-text-dim);text-transform:lowercase}
+.tc-head-actions{display:flex;align-items:center;gap:2px;flex-shrink:0}
+.tc-icon-btn{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:var(--tc-text-dim);transition:color .15s ease,background .15s ease}
+.tc-icon-btn:hover{color:var(--tc-text);background:var(--tc-surface-2)}
+.tc-icon-btn[aria-pressed=true]{color:var(--tc-accent)}
+.tc-icon-btn svg{width:16px;height:16px}
+
+/* Stage (3D avatar) */
+.tc-stage{flex-shrink:0;position:relative;height:150px;border-bottom:1px solid var(--tc-border);
+ background:
+ radial-gradient(120px 90px at 50% 100%,color-mix(in srgb,var(--tc-accent) 26%,transparent),transparent 72%),
+ linear-gradient(180deg,color-mix(in srgb,var(--tc-surface) 55%,transparent),var(--tc-bg));
+ transition:height .25s ease}
+.tc-root.is-compact .tc-stage{height:0;border-bottom:none;overflow:hidden}
+.tc-stage-canvas{position:absolute;inset:0}
+.tc-stage-glow{position:absolute;left:50%;bottom:8px;width:120px;height:22px;transform:translateX(-50%);border-radius:50%;
+ background:color-mix(in srgb,var(--tc-accent) 30%,transparent);filter:blur(12px);opacity:.5;pointer-events:none}
+.tc-stage-skel{position:absolute;left:50%;bottom:10px;width:84px;height:112px;transform:translateX(-50%);
+ border-radius:44% 44% 38% 38%/56% 56% 44% 44%;overflow:hidden;opacity:0;transition:opacity .25s ease;pointer-events:none;
+ background:linear-gradient(180deg,color-mix(in srgb,var(--tc-accent) 16%,transparent),transparent)}
+.tc-stage.is-loading .tc-stage-skel{opacity:1}
+.tc-stage-skel::after{content:'';position:absolute;inset:0;background:linear-gradient(110deg,transparent 18%,rgba(255,255,255,.2) 46%,transparent 72%);transform:translateX(-120%);animation:tc-shimmer 1.2s ease-in-out infinite}
+@keyframes tc-shimmer{to{transform:translateX(120%)}}
+.tc-stage-caption{position:absolute;left:10px;right:10px;bottom:8px;text-align:center;font-size:11.5px;color:var(--tc-text-dim);
+ overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}
+.tc-stage-caption.is-in{opacity:1}
+
+/* Messages */
+.tc-thread{flex:1;min-height:120px;overflow-y:auto;overscroll-behavior:contain;padding:14px;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin;scrollbar-color:var(--tc-surface-2) transparent}
+.tc-msg{max-width:86%;padding:9px 12px;border-radius:14px;font-size:13.5px;-webkit-user-select:text;user-select:text;
+ overflow-wrap:anywhere;animation:tc-msg-in .22s ease both}
+@keyframes tc-msg-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
+.tc-msg.is-user{align-self:flex-end;color:var(--tc-user-text);border-bottom-right-radius:5px;
+ background:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 90%,#fff 10%),color-mix(in srgb,var(--tc-accent) 80%,#000 20%))}
+.tc-msg.is-bot{align-self:flex-start;background:var(--tc-surface);border:1px solid var(--tc-border);border-bottom-left-radius:5px}
+.tc-msg.is-error{border-color:color-mix(in srgb,#f87171 45%,transparent);background:color-mix(in srgb,#f87171 9%,var(--tc-surface))}
+.tc-msg p{margin:0 0 8px}.tc-msg p:last-child{margin:0}
+.tc-msg ul,.tc-msg ol{margin:0 0 8px;padding-left:18px}.tc-msg ul:last-child,.tc-msg ol:last-child{margin-bottom:0}
+.tc-msg li{margin:2px 0}
+.tc-msg a{color:var(--tc-accent);text-decoration:underline;text-underline-offset:2px}
+.tc-msg code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;background:color-mix(in srgb,var(--tc-accent) 12%,transparent);padding:1px 5px;border-radius:5px}
+.tc-msg pre{margin:0 0 8px;padding:10px;border-radius:9px;background:var(--tc-surface-2);overflow-x:auto}
+.tc-msg pre:last-child{margin-bottom:0}
+.tc-msg pre code{background:none;padding:0}
+.tc-caret{display:inline-block;width:7px;height:14px;margin-left:2px;vertical-align:-2px;background:var(--tc-accent);border-radius:2px;animation:tc-caret 1s steps(2) infinite}
+@keyframes tc-caret{50%{opacity:0}}
+.tc-typing{align-self:flex-start;display:inline-flex;gap:4px;padding:11px 13px;border-radius:14px;border-bottom-left-radius:5px;background:var(--tc-surface);border:1px solid var(--tc-border)}
+.tc-typing i{width:6px;height:6px;border-radius:50%;background:var(--tc-text-dim);animation:tc-blink 1.2s ease-in-out infinite}
+.tc-typing i:nth-child(2){animation-delay:.18s}.tc-typing i:nth-child(3){animation-delay:.36s}
+@keyframes tc-blink{0%,66%,100%{opacity:.35;transform:translateY(0)}33%{opacity:1;transform:translateY(-3px)}}
+.tc-retry{align-self:flex-start;margin-top:-4px;font-size:12px;color:var(--tc-accent);padding:3px 8px;border-radius:7px}
+.tc-retry:hover{background:var(--tc-surface-2)}
+
+/* Empty state + chips */
+.tc-empty{margin:auto 0;text-align:center;padding:12px 6px;display:flex;flex-direction:column;gap:6px;align-items:center}
+.tc-empty-title{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;color:var(--tc-text-dim)}
+.tc-chips{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;padding:4px 0}
+.tc-chip{font-size:12px;color:var(--tc-text);background:var(--tc-surface);border:1px solid var(--tc-border);border-radius:999px;padding:6px 11px;
+ transition:border-color .15s ease,background .15s ease,transform .15s ease}
+.tc-chip:hover{border-color:color-mix(in srgb,var(--tc-accent) 55%,transparent);background:var(--tc-surface-2);transform:translateY(-1px)}
+
+/* Input row */
+.tc-input{flex-shrink:0;display:flex;align-items:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--tc-border);background:var(--tc-surface)}
+.tc-input textarea{flex:1;resize:none;background:transparent;border:none;color:var(--tc-text);font:inherit;font-size:13.5px;line-height:1.5;
+ padding:6px 2px;max-height:110px;min-height:30px;overflow-y:auto;-webkit-user-select:text;user-select:text}
+.tc-input textarea::placeholder{color:var(--tc-text-dim)}
+.tc-input textarea:focus{outline:none}
+.tc-input textarea:disabled{opacity:.5}
+.tc-mic,.tc-send{flex-shrink:0;width:34px;height:34px;border-radius:10px;display:grid;place-items:center;transition:background .15s ease,color .15s ease,transform .12s ease}
+.tc-mic{color:var(--tc-text-dim);background:var(--tc-surface-2)}
+.tc-mic:hover{color:var(--tc-text)}
+.tc-mic.is-live{color:#fff;background:#ef4444;animation:tc-mic 1.4s ease-in-out infinite}
+@keyframes tc-mic{50%{box-shadow:0 0 0 6px color-mix(in srgb,#ef4444 25%,transparent)}}
+.tc-send{color:#fff;background:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 88%,#fff 12%),color-mix(in srgb,var(--tc-accent) 80%,#000 20%))}
+.tc-send:hover{filter:brightness(1.08)}
+.tc-send:active{transform:scale(.94)}
+.tc-send:disabled{opacity:.4;cursor:not-allowed;filter:none}
+.tc-mic svg,.tc-send svg{width:15px;height:15px}
+
+/* Footer */
+.tc-foot{flex-shrink:0;text-align:center;padding:5px 0 7px;background:var(--tc-surface)}
+.tc-foot a{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--tc-text-dim);text-decoration:none;transition:color .15s ease}
+.tc-foot a:hover{color:var(--tc-accent)}
+
+/* Picker */
+.tc-picker{position:absolute;inset:auto 0 0 0;top:0;z-index:5;background:color-mix(in srgb,var(--tc-bg) 88%,transparent);backdrop-filter:blur(8px);
+ display:flex;flex-direction:column;padding:14px;overflow-y:auto;opacity:0;pointer-events:none;transition:opacity .2s ease}
+.tc-picker.is-in{opacity:1;pointer-events:auto}
+.tc-picker-title{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var(--tc-text-dim);margin:0 0 10px;text-transform:lowercase}
+.tc-picker-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
+.tc-picker-card{display:flex;flex-direction:column;gap:2px;text-align:left;padding:10px 12px;border-radius:11px;background:var(--tc-surface);border:1px solid var(--tc-border);transition:border-color .15s ease,transform .15s ease}
+.tc-picker-card:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--tc-accent) 55%,transparent)}
+.tc-picker-card.is-current{border-color:var(--tc-accent);box-shadow:0 0 0 1px var(--tc-accent)}
+.tc-picker-name{font-size:13px;font-weight:600}
+.tc-picker-tag{font-size:11px;color:var(--tc-text-dim)}
+
+/* Small screens: full-width sheet */
+@media (max-width:480px){
+ .tc-root[data-tc-pos=bottom-right],.tc-root[data-tc-pos=bottom-left]{right:12px;left:12px;bottom:12px;align-items:stretch}
+ .tc-panel{width:100%;max-width:none;max-height:min(78vh,640px)}
+ .tc-launcher{align-self:flex-end}
+ .tc-root[data-tc-pos=bottom-left] .tc-launcher{align-self:flex-start}
+}
+@media (prefers-reduced-motion:reduce){
+ .tc-panel,.tc-msg,.tc-teaser,.tc-launcher,.tc-stage{transition:none;animation:none}
+ .tc-pulse,.tc-typing i,.tc-caret{animation:none}
+}
+`,Zd=!1;function cc(s=typeof document<"u"?document:null){if(Zd||!s)return;Zd=!0;let e=s.createElement("style");e.id="three-concierge-style",e.textContent=yh,s.head.appendChild(e)}var $d="tc:avatar",Qd="tc:muted",ef="tc:thread",tf="tc:teased",kn={spark:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z"/></svg>',close:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg>',sound:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"/></svg>',soundOff:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"/></svg>',swap:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"/></svg>',collapse:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 15.75l7.5-7.5 7.5 7.5"/></svg>',mic:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"/></svg>',send:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.2" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"/></svg>'};function lc(s,e){try{return window[s].getItem(e)}catch{return null}}function hc(s,e,t){try{window[s].setItem(e,t)}catch{}}function Mh(s){let e=[],t=s,n,i=/[^.!?\n]*[.!?\n]+["')\]]?\s*/g,r=0;for(;(n=i.exec(t))!==null;){let a=n[0].trim();a&&e.push(a),r=i.lastIndex}return{sentences:e,rest:t.slice(r)}}var an=class{constructor(e={}){this.config={endpoint:e.endpoint||Hr,assetBase:e.assetBase||zr,avatars:Array.isArray(e.avatars)&&e.avatars.length?qi.filter(n=>e.avatars.includes(n.id)):qi,name:e.name||"",siteName:e.siteName||"",greeting:e.greeting||"",suggestions:Array.isArray(e.suggestions)?e.suggestions.slice(0,4):[],knowledge:e.knowledge||"",persona:e.persona||"",accent:e.accent||"",position:e.position==="bottom-left"?"bottom-left":"bottom-right",theme:["dark","light"].includes(e.theme)?e.theme:"auto",open:!!e.open,muted:!!e.muted,picker:e.picker!==!1,teaser:e.teaser!==!1,zIndex:e.zIndex,lang:e.lang||""},this._custom=e.customAvatar?nc(e.customAvatar):null;let t=lc("localStorage",$d);this.avatar=this._custom||nf(this.config.avatars,e.avatar||t),this.open=!1,this.busy=!1,this.muted=this.config.muted||lc("localStorage",Qd)==="1",this.messages=this._restoreThread(),this._listeners=new Map,this._stage=null,this._narrator=null,this._mic=null,this._abort=null,this._destroyed=!1,!(typeof window>"u"||typeof document>"u")&&(this._build(),this.config.open?this.setOpen(!0):this.config.teaser&&this._scheduleTeaser(),this._emit("ready",{avatar:this.avatar.id}))}on(e,t){return this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t),()=>this._listeners.get(e)?.delete(t)}_emit(e,t){for(let n of this._listeners.get(e)||[])try{n(t)}catch{}}_build(){cc();let e=document.createElement("div");e.className="tc-root",e.setAttribute("data-three-concierge",""),e.setAttribute("data-tc-pos",this.config.position),this.config.zIndex&&(e.style.zIndex=String(this.config.zIndex)),this.config.accent&&e.style.setProperty("--tc-accent",this.config.accent),this._applyTheme(e);let t=this.config.name||this.avatar.name;e.innerHTML=`
+ <section class="tc-panel" role="dialog" aria-modal="false" aria-label="${Xi(t)}, site assistant" hidden>
+ <header class="tc-head">
+ <div class="tc-head-id">
+ <span class="tc-head-dot" aria-hidden="true"></span>
+ <div>
+ <div class="tc-head-name"></div>
+ <div class="tc-head-sub">// ai concierge</div>
+ </div>
+ </div>
+ <div class="tc-head-actions">
+ <button type="button" class="tc-icon-btn tc-btn-mute" aria-label="Toggle voice" aria-pressed="false">${kn.sound}</button>
+ ${this.config.picker&&!this._custom?`<button type="button" class="tc-icon-btn tc-btn-swap" aria-label="Choose a different avatar">${kn.swap}</button>`:""}
+ <button type="button" class="tc-icon-btn tc-btn-compact" aria-label="Toggle avatar view" aria-pressed="false">${kn.collapse}</button>
+ <button type="button" class="tc-icon-btn tc-btn-close" aria-label="Close assistant">${kn.close}</button>
+ </div>
+ </header>
+ <div class="tc-stage is-loading" aria-hidden="true">
+ <div class="tc-stage-glow"></div>
+ <div class="tc-stage-skel"></div>
+ <div class="tc-stage-canvas"></div>
+ <div class="tc-stage-caption"></div>
+ </div>
+ <div class="tc-thread" aria-live="polite"></div>
+ <div class="tc-input">
+ <textarea rows="1" maxlength="2000" placeholder="Ask anything\u2026" aria-label="Your question"></textarea>
+ ${ac()?`<button type="button" class="tc-mic" aria-label="Ask by voice" aria-pressed="false">${kn.mic}</button>`:""}
+ <button type="button" class="tc-send" aria-label="Send" disabled>${kn.send}</button>
+ </div>
+ <footer class="tc-foot"><a href="https://three.ws/concierge" target="_blank" rel="noopener noreferrer">powered by three.ws</a></footer>
+ <div class="tc-picker" role="listbox" aria-label="Choose your concierge" hidden>
+ <p class="tc-picker-title">// choose your concierge</p>
+ <div class="tc-picker-grid"></div>
+ </div>
+ </section>
+ <button type="button" class="tc-launcher" aria-label="Open site assistant" aria-expanded="false">
+ <span class="tc-pulse" aria-hidden="true"></span>
+ ${kn.spark}
+ </button>
+ `,document.body.appendChild(e),this.root=e,this.$={panel:e.querySelector(".tc-panel"),launcher:e.querySelector(".tc-launcher"),headName:e.querySelector(".tc-head-name"),mute:e.querySelector(".tc-btn-mute"),swap:e.querySelector(".tc-btn-swap"),compact:e.querySelector(".tc-btn-compact"),close:e.querySelector(".tc-btn-close"),stage:e.querySelector(".tc-stage"),stageCanvas:e.querySelector(".tc-stage-canvas"),caption:e.querySelector(".tc-stage-caption"),thread:e.querySelector(".tc-thread"),textarea:e.querySelector("textarea"),mic:e.querySelector(".tc-mic"),send:e.querySelector(".tc-send"),picker:e.querySelector(".tc-picker"),pickerGrid:e.querySelector(".tc-picker-grid")},this.$.headName.textContent=t,this._syncMuteButton(),this._renderThread(),this.$.launcher.addEventListener("click",()=>this.toggle()),this.$.close.addEventListener("click",()=>this.setOpen(!1)),this.$.mute.addEventListener("click",()=>this.setMuted(!this.muted)),this.$.swap?.addEventListener("click",()=>this.togglePicker()),this.$.compact.addEventListener("click",()=>this._toggleCompact()),this.$.send.addEventListener("click",()=>this._submit()),this.$.textarea.addEventListener("input",()=>this._syncInput()),this.$.textarea.addEventListener("keydown",n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),this._submit())}),this._onKeydown=n=>{n.key==="Escape"&&this.open&&(this.$.picker.hidden?this.setOpen(!1):this.togglePicker(!1))},e.addEventListener("keydown",this._onKeydown),this.$.mic&&(this._mic=oc({lang:this.config.lang||void 0,onInterim:n=>{this.$.textarea.value=n,this._syncInput()},onState:n=>{this.$.mic.classList.toggle("is-live",n==="listening"),this.$.mic.setAttribute("aria-pressed",n==="listening"?"true":"false")},onError:n=>this._emit("error",n)}),this.$.mic.addEventListener("click",()=>this._toggleMic())),this.config.theme==="auto"&&window.matchMedia&&(this._mq=window.matchMedia("(prefers-color-scheme: dark)"),this._onScheme=()=>this._applyTheme(e),this._mq.addEventListener?.("change",this._onScheme))}_applyTheme(e){let t=this.config.theme!=="auto"?this.config.theme:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light";e.setAttribute("data-tc-theme",t)}setOpen(e){if(!(this._destroyed||e===this.open)){if(this.open=e,this.root.classList.toggle("is-open",e),this.$.launcher.setAttribute("aria-expanded",String(e)),this.$.launcher.setAttribute("aria-label",e?"Close site assistant":"Open site assistant"),e)this._killTeaser(),this.$.panel.hidden=!1,requestAnimationFrame(()=>this.root.classList.add("is-open")),this._ensureStage(),this.$.textarea.focus({preventScroll:!0}),this._scrollThread(!1);else{this._narrator?.cancel(),this._mic?.stop();let t=this.$.panel;setTimeout(()=>{this.open||(t.hidden=!0)},240),this.$.launcher.focus({preventScroll:!0})}this._emit(e?"open":"close",{})}}toggle(){this.setOpen(!this.open)}_toggleCompact(){let e=this.root.classList.toggle("is-compact");this.$.compact.setAttribute("aria-pressed",String(e))}_scheduleTeaser(){lc("sessionStorage",tf)==="1"||this.messages.length||(this._teaserTimer=setTimeout(()=>{if(this.open||this._destroyed)return;hc("sessionStorage",tf,"1");let e=document.createElement("div");e.className="tc-teaser",e.setAttribute("role","status"),e.innerHTML=`<span></span><button type="button" class="tc-teaser-close" aria-label="Dismiss">${kn.close}</button>`,e.querySelector("span").textContent=this._greetingText(),this.root.insertBefore(e,this.$.launcher),requestAnimationFrame(()=>e.classList.add("is-in")),e.addEventListener("click",t=>{t.target.closest(".tc-teaser-close")?e.remove():(e.remove(),this.setOpen(!0))}),this._teaser=e,this._teaserHide=setTimeout(()=>this._killTeaser(),12e3)},6e3))}_killTeaser(){clearTimeout(this._teaserTimer),clearTimeout(this._teaserHide),this._teaser?.remove(),this._teaser=null}_greetingText(){if(this.config.greeting)return this.config.greeting;let e=this.config.siteName||document.querySelector('meta[property="og:site_name"]')?.content||"";return e?`Hi! Ask me anything about ${e}.`:"Hi! Ask me anything about this site."}async _ensureStage(){if(!(this._stage||this._stageLoading)){this._stageLoading=!0;try{this._stage=new Ns(this.$.stageCanvas,{background:"transparent"}),this._narrator=new Os(this._stage,{muted:this.muted,onCaption:e=>this._setCaption(e),onError:()=>{}}),this._narrator.setAgent(this.avatar),await this._stage.load(Vr(this.avatar,this.config.assetBase),{framing:this.avatar.framing||"bust"}),this.$.stage.classList.remove("is-loading")}catch(e){this.root.classList.add("is-compact"),this.$.compact.style.display="none",this._emit("error",e instanceof Error?e:new Error(String(e)))}finally{this._stageLoading=!1}}}_setCaption(e){let t=this.$.caption;t&&(e?(t.textContent=e,t.classList.add("is-in")):t.classList.remove("is-in"))}async setAvatar(e){let t=nf(this.config.avatars,e);if(!(!t||t.id===this.avatar.id)&&(this.avatar=t,hc("localStorage",$d,t.id),this.config.name||(this.$.headName.textContent=t.name),this._narrator?.cancel(),this._narrator?.setAgent(t),this._renderPicker(),this._emit("agentchange",{avatar:t.id}),this._stage)){this.$.stage.classList.add("is-loading");try{await this._stage.load(Vr(t,this.config.assetBase),{framing:t.framing||"bust"})}catch(n){this._emit("error",n instanceof Error?n:new Error(String(n)))}this.$.stage.classList.remove("is-loading")}}togglePicker(e){(e!==void 0?e:this.$.picker.hidden)?(this._renderPicker(),this.$.picker.hidden=!1,requestAnimationFrame(()=>this.$.picker.classList.add("is-in"))):(this.$.picker.classList.remove("is-in"),setTimeout(()=>{this.$.picker.hidden=!0},200))}_renderPicker(){let e=this.$.pickerGrid;if(e){e.textContent="";for(let t of this.config.avatars){let n=document.createElement("button");n.type="button",n.className="tc-picker-card"+(t.id===this.avatar.id?" is-current":""),n.setAttribute("role","option"),n.setAttribute("aria-selected",String(t.id===this.avatar.id)),n.innerHTML='<span class="tc-picker-name"></span><span class="tc-picker-tag"></span>',n.querySelector(".tc-picker-name").textContent=t.name,n.querySelector(".tc-picker-tag").textContent=t.tagline,n.addEventListener("click",()=>{this.setAvatar(t.id),this.togglePicker(!1)}),e.appendChild(n)}}}setMuted(e){this.muted=!!e,hc("localStorage",Qd,e?"1":"0"),this._narrator?.setMuted(this.muted),this._syncMuteButton()}_syncMuteButton(){let e=this.$?.mute;e&&(e.innerHTML=this.muted?kn.soundOff:kn.sound,e.setAttribute("aria-pressed",String(this.muted)),e.setAttribute("aria-label",this.muted?"Unmute voice":"Mute voice"))}async _toggleMic(){if(!this._mic)return;if(this._mic.listening){this._mic.stop();return}this._narrator?.cancel();let e=await this._mic.start();e&&(this.$.textarea.value=e,this._syncInput(),this._submit())}_restoreThread(){try{let e=lc("sessionStorage",ef),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>n&&(n.role==="user"||n.role==="assistant")&&typeof n.content=="string"):[]}catch{return[]}}_persistThread(){hc("sessionStorage",ef,JSON.stringify(this.messages.slice(-40)))}_renderThread(){let e=this.$.thread;if(e.textContent="",!this.messages.length){let t=document.createElement("div");t.className="tc-empty";let n=document.createElement("p");n.className="tc-empty-title",n.textContent=this._greetingText(),t.appendChild(n);let i=this.config.suggestions.length?this.config.suggestions:wx(this.config.siteName);if(i.length){let r=document.createElement("div");r.className="tc-chips";for(let a of i.slice(0,4)){let o=document.createElement("button");o.type="button",o.className="tc-chip",o.textContent=a,o.addEventListener("click",()=>this.ask(a)),r.appendChild(o)}t.appendChild(r)}e.appendChild(t);return}for(let t of this.messages)e.appendChild(this._bubble(t.role,t.content));this._scrollThread(!1)}_bubble(e,t,{error:n=!1}={}){let i=document.createElement("div");return i.className=`tc-msg is-${e==="user"?"user":"bot"}${n?" is-error":""}`,e==="user"?i.textContent=t:i.innerHTML=Bs(t),i}_scrollThread(e=!0){let t=this.$.thread;t.scrollTo({top:t.scrollHeight,behavior:e&&!matchMedia("(prefers-reduced-motion: reduce)").matches?"smooth":"auto"})}_syncInput(){let e=this.$.textarea;e.style.height="auto",e.style.height=Math.min(e.scrollHeight,110)+"px",this.$.send.disabled=this.busy||!e.value.trim()}_submit(){let e=this.$.textarea.value.trim();!e||this.busy||(this.$.textarea.value="",this._syncInput(),this.ask(e))}async ask(e){let t=String(e||"").trim();if(!t||this.busy||this._destroyed)return"";this.setOpen(!0),this._narrator?.cancel(),this.messages.length||(this.$.thread.textContent=""),this.messages.push({role:"user",content:t}),this.$.thread.appendChild(this._bubble("user",t)),this._persistThread(),this._emit("message",{role:"user",content:t}),this._scrollThread(),this.busy=!0,this.$.send.disabled=!0;let n=document.createElement("div");n.className="tc-typing",n.setAttribute("aria-label","Assistant is thinking"),n.innerHTML="<i></i><i></i><i></i>",this.$.thread.appendChild(n),this._scrollThread();let i=document.createElement("div");i.className="tc-msg is-bot";let r="",a="",o=!1;this._abort=new AbortController;let c="";try{c=(await rc({endpoint:this.config.endpoint,message:t,history:this.messages.slice(0,-1),site:ic(document,{knowledge:this.config.knowledge,siteName:this.config.siteName}),persona:this.config.persona||void 0,lang:this.config.lang||void 0,signal:this._abort.signal,onChunk:u=>{o||(o=!0,n.remove(),this.$.thread.appendChild(i)),r+=u,i.innerHTML=Bs(r)+'<span class="tc-caret" aria-hidden="true"></span>',this._scrollThread(),a+=u;let{sentences:d,rest:f}=Mh(a);a=f;for(let g of d){let _=Wr(g);_&&this._narrator?.speak(_)}}})).text.trim();let h=Wr(a);h&&this._narrator?.speak(h),n.remove(),c?(o||this.$.thread.appendChild(i),i.innerHTML=Bs(c),this.messages.push({role:"assistant",content:c}),this._persistThread(),this._emit("message",{role:"assistant",content:c})):(i.remove(),this._renderErrorBubble(t,"I could not come up with an answer just now."))}catch(l){if(n.remove(),i.remove(),l?.name!=="AbortError"){let h=l?.status===429?"I am getting a lot of questions right now, give me a few seconds and try again.":"Something went wrong reaching my brain. Check your connection and try again.";this._renderErrorBubble(t,h),this._emit("error",l instanceof Error?l:new Error(String(l)))}}finally{this.busy=!1,this._abort=null,this._syncInput(),this._scrollThread(),this.$.textarea.focus({preventScroll:!0})}return c}_renderErrorBubble(e,t){let n=this._bubble("assistant",t,{error:!0});this.$.thread.appendChild(n);let i=document.createElement("button");i.type="button",i.className="tc-retry",i.textContent="Try again",i.addEventListener("click",()=>{if(i.remove(),n.remove(),this.messages[this.messages.length-1]?.role==="user"){this.messages.pop(),this._persistThread();let r=this.$.thread.querySelectorAll(".tc-msg.is-user");r[r.length-1]?.remove()}this.ask(e)}),this.$.thread.appendChild(i)}reset(){this._abort?.abort(),this._narrator?.cancel(),this.messages=[],this._persistThread(),this._renderThread()}dispose(){this._destroyed||(this._destroyed=!0,this._abort?.abort(),this._killTeaser(),this._mq?.removeEventListener?.("change",this._onScheme),this._mic?.dispose(),this._narrator?.dispose(),this._stage?.dispose(),this.root?.remove(),this._listeners.clear())}};function nf(s,e){return s.find(t=>t.id===e)||s.find(t=>t.id===ks)||s[0]||Gr(e)}function wx(s){return[`What is ${s||"this site"}?`,"How do I get started?","What does it cost?"]}var uc=(s,e)=>s.hasAttribute(e),qr=class extends HTMLElement{connectedCallback(){if(!this._widget){this.style.display="none",this._widget=new an({endpoint:this.getAttribute("endpoint")||void 0,avatar:this.getAttribute("avatar")||void 0,avatars:this.getAttribute("avatars")?.split(",").map(e=>e.trim()).filter(Boolean),customAvatar:this.getAttribute("custom-avatar")||void 0,assetBase:this.getAttribute("asset-base")||void 0,name:this.getAttribute("name")||void 0,siteName:this.getAttribute("site-name")||void 0,greeting:this.getAttribute("greeting")||void 0,suggestions:this.getAttribute("suggestions")?.split("|").map(e=>e.trim()).filter(Boolean),knowledge:this.getAttribute("knowledge")||void 0,persona:this.getAttribute("persona")||void 0,accent:this.getAttribute("accent")||void 0,position:this.getAttribute("position")||void 0,theme:this.getAttribute("theme")||void 0,lang:this.getAttribute("lang")||void 0,open:uc(this,"open"),muted:uc(this,"muted"),picker:!uc(this,"no-picker"),teaser:!uc(this,"no-teaser"),zIndex:this.getAttribute("z-index")?Number(this.getAttribute("z-index")):void 0});for(let e of["ready","open","close","message","agentchange","error"])this._widget.on(e,t=>{this.dispatchEvent(new CustomEvent(`three-concierge:${e}`,{detail:t,bubbles:!0,composed:!0}))})}}disconnectedCallback(){this._widget?.dispose(),this._widget=null}ask(e){return this._widget?.ask(e)}open(){this._widget?.setOpen(!0)}close(){this._widget?.setOpen(!1)}reset(){this._widget?.reset()}setAvatar(e){return this._widget?.setAvatar(e)}setMuted(e){this._widget?.setMuted(e)}get controller(){return this._widget}};function dc(s="three-concierge"){return typeof customElements<"u"&&!customElements.get(s)&&customElements.define(s,qr),s}var Ex="0.1.0";typeof window<"u"&&dc();function Rx(s){return new an(s)}function sf(){if(typeof document>"u"||window.__threeWsConcierge)return;let s=document.currentScript||document.querySelector("script[data-concierge]");if(!s||!s.hasAttribute("data-concierge"))return;let e=s.dataset;window.__threeWsConcierge=new an({endpoint:e.endpoint||void 0,avatar:e.avatar||void 0,avatars:e.avatars?.split(",").map(t=>t.trim()).filter(Boolean),customAvatar:e.customAvatar||void 0,assetBase:e.assetBase||void 0,name:e.name||void 0,siteName:e.siteName||void 0,greeting:e.greeting||void 0,suggestions:e.suggestions?.split("|").map(t=>t.trim()).filter(Boolean),knowledge:e.knowledge||void 0,persona:e.persona||void 0,accent:e.accent||void 0,position:e.position||void 0,theme:e.theme||void 0,lang:e.lang||void 0,open:"open"in e,muted:"muted"in e,picker:!("noPicker"in e),teaser:!("noTeaser"in e),zIndex:e.zIndex?Number(e.zIndex):void 0})}typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",sf,{once:!0}):sf());var Cx=an;typeof window<"u"&&(window.ThreeWsConcierge=Sh,window.Concierge=window.Concierge||an);
+/*! Bundled license information:
+
+three/build/three.core.js:
+three/build/three.module.js:
+ (**
+ * @license
+ * Copyright 2010-2026 Three.js Authors
+ * SPDX-License-Identifier: MIT
+ *)
+*/
+//# sourceMappingURL=concierge.global.js.map
diff --git a/public/concierge/concierge.global.js.map b/public/concierge/concierge.global.js.map
new file mode 100644
index 000000000..a3e2e8329
--- /dev/null
+++ b/public/concierge/concierge.global.js.map
@@ -0,0 +1,7 @@
+{
+ "version": 3,
+ "sources": ["../../node_modules/three/examples/jsm/libs/meshopt_decoder.module.js", "../src/index.js", "../../node_modules/three/build/three.core.js", "../../node_modules/three/build/three.module.js", "../../node_modules/three/examples/jsm/utils/BufferGeometryUtils.js", "../../node_modules/three/examples/jsm/utils/SkeletonUtils.js", "../../node_modules/three/examples/jsm/loaders/GLTFLoader.js", "../../node_modules/three/examples/jsm/environments/RoomEnvironment.js", "../src/lipsync.js", "../src/stage.js", "../src/narrator.js", "../src/catalog.js", "../src/context.js", "../src/client.js", "../src/markdown.js", "../src/mic.js", "../src/styles.js", "../src/widget.js", "../src/element.js", "../src/global.js"],
+ "sourcesContent": ["// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2026, by Arseny Kapoulkine ([email protected])\nvar MeshoptDecoder = (function () {\n\t// Built with clang version 22.1.0-wasi-sdk\n\t// Built from meshoptimizer 1.1\n\tvar wasm_base =\n\t\t'b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb'; // embed! base\n\tvar wasm_simd =\n\t\t'b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQr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Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb'; // embed! simd\n\n\tvar detector = new Uint8Array([\n\t\t0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0,\n\t\t11, 7, 0, 65, 0, 253, 15, 26, 11,\n\t]);\n\tvar wasmpack = new Uint8Array([\n\t\t32, 0, 65, 2, 1, 106, 34, 33, 3, 128, 11, 4, 13, 64, 6, 253, 10, 7, 15, 116, 127, 5, 8, 12, 40, 16, 19, 54, 20, 9, 27, 255, 113, 17, 42, 67,\n\t\t24, 23, 146, 148, 18, 14, 22, 45, 70, 69, 56, 114, 101, 21, 25, 63, 75, 136, 108, 28, 118, 29, 73, 115,\n\t]);\n\n\tif (typeof WebAssembly !== 'object') {\n\t\treturn {\n\t\t\tsupported: false,\n\t\t};\n\t}\n\n\tvar wasm = WebAssembly.validate(detector) ? unpack(wasm_simd) : unpack(wasm_base);\n\n\tvar instance;\n\n\tvar ready = WebAssembly.instantiate(wasm, {}).then(function (result) {\n\t\tinstance = result.instance;\n\t\tinstance.exports.__wasm_call_ctors();\n\t});\n\n\tfunction unpack(data) {\n\t\tvar result = new Uint8Array(data.length);\n\t\tfor (var i = 0; i < data.length; ++i) {\n\t\t\tvar ch = data.charCodeAt(i);\n\t\t\tresult[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4;\n\t\t}\n\t\tvar write = 0;\n\t\tfor (var i = 0; i < data.length; ++i) {\n\t\t\tresult[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n\t\t}\n\t\treturn result.buffer.slice(0, write);\n\t}\n\n\tfunction decode(instance, fun, target, count, size, source, filter) {\n\t\tvar sbrk = instance.exports.sbrk;\n\t\tvar count4 = (count + 3) & ~3;\n\t\tvar tp = sbrk(count4 * size);\n\t\tvar sp = sbrk(source.length);\n\t\tvar heap = new Uint8Array(instance.exports.memory.buffer);\n\t\theap.set(source, sp);\n\t\tvar res = fun(tp, count, size, sp, source.length);\n\t\tif (res == 0 && filter) {\n\t\t\tfilter(tp, count4, size);\n\t\t}\n\t\ttarget.set(heap.subarray(tp, tp + count * size));\n\t\tsbrk(tp - sbrk(0));\n\t\tif (res != 0) {\n\t\t\tthrow new Error('Malformed buffer data: ' + res);\n\t\t}\n\t}\n\n\tvar filters = {\n\t\tNONE: '',\n\t\tOCTAHEDRAL: 'meshopt_decodeFilterOct',\n\t\tQUATERNION: 'meshopt_decodeFilterQuat',\n\t\tEXPONENTIAL: 'meshopt_decodeFilterExp',\n\t\tCOLOR: 'meshopt_decodeFilterColor',\n\t};\n\n\tvar decoders = {\n\t\tATTRIBUTES: 'meshopt_decodeVertexBuffer',\n\t\tTRIANGLES: 'meshopt_decodeIndexBuffer',\n\t\tINDICES: 'meshopt_decodeIndexSequence',\n\t};\n\n\tvar workers = [];\n\tvar requestId = 0;\n\n\tfunction createWorker(url) {\n\t\tvar worker = {\n\t\t\tobject: new Worker(url),\n\t\t\tpending: 0,\n\t\t\trequests: {},\n\t\t};\n\n\t\tworker.object.onmessage = function (event) {\n\t\t\tvar data = event.data;\n\n\t\t\tworker.pending -= data.count;\n\t\t\tworker.requests[data.id][data.action](data.value);\n\t\t\tdelete worker.requests[data.id];\n\t\t};\n\n\t\treturn worker;\n\t}\n\n\tfunction initWorkers(count) {\n\t\tvar source =\n\t\t\t'self.ready = WebAssembly.instantiate(new Uint8Array([' +\n\t\t\tnew Uint8Array(wasm) +\n\t\t\t']), {})' +\n\t\t\t'.then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });' +\n\t\t\t'self.onmessage = ' +\n\t\t\tworkerProcess.name +\n\t\t\t';' +\n\t\t\tdecode.toString() +\n\t\t\tworkerProcess.toString();\n\n\t\tvar blob = new Blob([source], { type: 'text/javascript' });\n\t\tvar url = URL.createObjectURL(blob);\n\n\t\tfor (var i = workers.length; i < count; ++i) {\n\t\t\tworkers[i] = createWorker(url);\n\t\t}\n\n\t\tfor (var i = count; i < workers.length; ++i) {\n\t\t\tworkers[i].object.postMessage({});\n\t\t}\n\n\t\tworkers.length = count;\n\n\t\tURL.revokeObjectURL(url);\n\t}\n\n\tfunction decodeWorker(count, size, source, mode, filter) {\n\t\tvar worker = workers[0];\n\n\t\tfor (var i = 1; i < workers.length; ++i) {\n\t\t\tif (workers[i].pending < worker.pending) {\n\t\t\t\tworker = workers[i];\n\t\t\t}\n\t\t}\n\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar data = new Uint8Array(source);\n\t\t\tvar id = ++requestId;\n\n\t\t\tworker.pending += count;\n\t\t\tworker.requests[id] = { resolve: resolve, reject: reject };\n\t\t\tworker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [data.buffer]);\n\t\t});\n\t}\n\n\tfunction workerProcess(event) {\n\t\tvar data = event.data;\n\t\tself.ready.then(function (instance) {\n\t\t\tif (!data.id) {\n\t\t\t\treturn self.close();\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tvar target = new Uint8Array(data.count * data.size);\n\t\t\t\tdecode(instance, instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);\n\t\t\t\tself.postMessage({ id: data.id, count: data.count, action: 'resolve', value: target }, [target.buffer]);\n\t\t\t} catch (error) {\n\t\t\t\tself.postMessage({ id: data.id, count: data.count, action: 'reject', value: error });\n\t\t\t}\n\t\t});\n\t}\n\n\treturn {\n\t\tready: ready,\n\t\tsupported: true,\n\t\tuseWorkers: function (count) {\n\t\t\tinitWorkers(count);\n\t\t},\n\t\tdecodeVertexBuffer: function (target, count, size, source, filter) {\n\t\t\tdecode(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);\n\t\t},\n\t\tdecodeIndexBuffer: function (target, count, size, source) {\n\t\t\tdecode(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);\n\t\t},\n\t\tdecodeIndexSequence: function (target, count, size, source) {\n\t\t\tdecode(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);\n\t\t},\n\t\tdecodeGltfBuffer: function (target, count, size, source, mode, filter) {\n\t\t\tdecode(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n\t\t},\n\t\tdecodeGltfBufferAsync: function (count, size, source, mode, filter) {\n\t\t\tif (workers.length > 0) {\n\t\t\t\treturn decodeWorker(count, size, source, decoders[mode], filters[filter]);\n\t\t\t}\n\n\t\t\treturn ready.then(function () {\n\t\t\t\tvar target = new Uint8Array(count * size);\n\t\t\t\tdecode(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n\t\t\t\treturn target;\n\t\t\t});\n\t\t},\n\t};\n})();\n\nexport { MeshoptDecoder };\n", "/**\n * @three-ws/concierge, public entry\n * ==================================\n *\n * An AI concierge for any website: floating launcher, chat panel with a\n * rigged 3D avatar that blinks and lipsyncs, streaming answers grounded in\n * the live page, voice out (Web Speech TTS) and push-to-talk voice in.\n *\n * Three ways in:\n *\n * 1. Zero-JS CDN tag:\n * <script type=\"module\"\n * src=\"https://three.ws/concierge/concierge.global.js\"\n * data-concierge data-site-name=\"Acme\"></script>\n * 2. HTML tag:\n * import '@three-ws/concierge';\n * <three-concierge site-name=\"Acme\" accent=\"#f97316\"></three-concierge>\n * 3. Imperative:\n * import { Concierge } from '@three-ws/concierge';\n * const c = new Concierge({ siteName: 'Acme', knowledge: FAQ });\n * c.ask('What does the Pro plan cost?');\n *\n * `three` is a peer dependency for the module builds; the .global.js build\n * inlines it for script-tag use.\n */\n\nexport const VERSION = '0.1.0';\n\nexport { Concierge, drainSentences } from './widget.js';\nexport { ThreeConciergeElement, registerElement } from './element.js';\nexport { AvatarStage } from './stage.js';\nexport { SpeechNarrator } from './narrator.js';\nexport { createLipsync, buildMorphMap, estimateDurationMs } from './lipsync.js';\nexport {\n\tAVATARS, DEFAULT_AVATAR_ID, DEFAULT_ASSET_BASE,\n\tgetAvatar, avatarUrl, customAvatarEntry,\n} from './catalog.js';\nexport { harvestSiteContext, buildSitePayload, MAX_CONTENT_CHARS, MAX_KNOWLEDGE_CHARS } from './context.js';\nexport { askConcierge, parseSseEvent, createSseBuffer, DEFAULT_ENDPOINT, MAX_HISTORY_TURNS } from './client.js';\nexport { renderMarkdown, stripMarkdown, escapeHtml } from './markdown.js';\nexport { createMic, micSupported } from './mic.js';\nexport { CSS, ensureStyles } from './styles.js';\n\nimport { Concierge } from './widget.js';\nimport { registerElement } from './element.js';\n\n// Register the <three-concierge> element on import (browser only).\nif (typeof window !== 'undefined') {\n\tregisterElement();\n}\n\n/**\n * Convenience factory, mount a concierge and return the controller.\n * @param {ConstructorParameters<typeof Concierge>[0]} [config]\n */\nexport function mount(config) {\n\treturn new Concierge(config);\n}\n\n/**\n * Auto-init from a `<script data-concierge>` tag so a site can install the\n * widget with no JS at all, the script's `data-*` attributes become config.\n * Idempotent: only the first tagged script mounts an instance.\n */\nfunction autoInit() {\n\tif (typeof document === 'undefined' || window.__threeWsConcierge) return;\n\tconst tag = document.currentScript || document.querySelector('script[data-concierge]');\n\tif (!tag || !tag.hasAttribute('data-concierge')) return;\n\n\tconst d = tag.dataset;\n\twindow.__threeWsConcierge = new Concierge({\n\t\tendpoint: d.endpoint || undefined,\n\t\tavatar: d.avatar || undefined,\n\t\tavatars: d.avatars?.split(',').map((s) => s.trim()).filter(Boolean),\n\t\tcustomAvatar: d.customAvatar || undefined,\n\t\tassetBase: d.assetBase || undefined,\n\t\tname: d.name || undefined,\n\t\tsiteName: d.siteName || undefined,\n\t\tgreeting: d.greeting || undefined,\n\t\tsuggestions: d.suggestions?.split('|').map((s) => s.trim()).filter(Boolean),\n\t\tknowledge: d.knowledge || undefined,\n\t\tpersona: d.persona || undefined,\n\t\taccent: d.accent || undefined,\n\t\tposition: d.position || undefined,\n\t\ttheme: d.theme || undefined,\n\t\tlang: d.lang || undefined,\n\t\topen: 'open' in d,\n\t\tmuted: 'muted' in d,\n\t\tpicker: !('noPicker' in d),\n\t\tteaser: !('noTeaser' in d),\n\t\tzIndex: d.zIndex ? Number(d.zIndex) : undefined,\n\t});\n}\n\nif (typeof window !== 'undefined') {\n\tif (document.readyState === 'loading') {\n\t\tdocument.addEventListener('DOMContentLoaded', autoInit, { once: true });\n\t} else {\n\t\tautoInit();\n\t}\n}\n\nexport default Concierge;\n", "/**\n * @license\n * Copyright 2010-2026 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '184';\n\n/**\n * Represents mouse buttons and interaction types in context of controls.\n *\n * @type {ConstantsMouse}\n * @constant\n */\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\n\n/**\n * Represents touch interaction types in context of controls.\n *\n * @type {ConstantsTouch}\n * @constant\n */\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\n\n/**\n * Disables face culling.\n *\n * @type {number}\n * @constant\n */\nconst CullFaceNone = 0;\n\n/**\n * Culls back faces.\n *\n * @type {number}\n * @constant\n */\nconst CullFaceBack = 1;\n\n/**\n * Culls front faces.\n *\n * @type {number}\n * @constant\n */\nconst CullFaceFront = 2;\n\n/**\n * Culls both front and back faces.\n *\n * @type {number}\n * @constant\n */\nconst CullFaceFrontBack = 3;\n\n/**\n * Gives unfiltered shadow maps - fastest, but lowest quality.\n *\n * @type {number}\n * @constant\n */\nconst BasicShadowMap = 0;\n\n/**\n * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm.\n *\n * @type {number}\n * @constant\n */\nconst PCFShadowMap = 1;\n\n/**\n * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm with\n * better soft shadows especially when using low-resolution shadow maps.\n *\n * @type {number}\n * @constant\n */\nconst PCFSoftShadowMap = 2;\n\n/**\n * Filters shadow maps using the Variance Shadow Map (VSM) algorithm.\n * When using VSMShadowMap all shadow receivers will also cast shadows.\n *\n * @type {number}\n * @constant\n */\nconst VSMShadowMap = 3;\n\n/**\n * Only front faces are rendered.\n *\n * @type {number}\n * @constant\n */\nconst FrontSide = 0;\n\n/**\n * Only back faces are rendered.\n *\n * @type {number}\n * @constant\n */\nconst BackSide = 1;\n\n/**\n * Both front and back faces are rendered.\n *\n * @type {number}\n * @constant\n */\nconst DoubleSide = 2;\n\n/**\n * No blending is performed which effectively disables\n * alpha transparency.\n *\n * @type {number}\n * @constant\n */\nconst NoBlending = 0;\n\n/**\n * The default blending.\n *\n * @type {number}\n * @constant\n */\nconst NormalBlending = 1;\n\n/**\n * Represents additive blending.\n *\n * @type {number}\n * @constant\n */\nconst AdditiveBlending = 2;\n\n/**\n * Represents subtractive blending.\n *\n * @type {number}\n * @constant\n */\nconst SubtractiveBlending = 3;\n\n/**\n * Represents multiply blending.\n *\n * @type {number}\n * @constant\n */\nconst MultiplyBlending = 4;\n\n/**\n * Represents custom blending.\n *\n * @type {number}\n * @constant\n */\nconst CustomBlending = 5;\n\n/**\n * Represents material blending.\n *\n * @type {number}\n * @constant\n */\nconst MaterialBlending = 6;\n\n/**\n * A `source + destination` blending equation.\n *\n * @type {number}\n * @constant\n */\nconst AddEquation = 100;\n\n/**\n * A `source - destination` blending equation.\n *\n * @type {number}\n * @constant\n */\nconst SubtractEquation = 101;\n\n/**\n * A `destination - source` blending equation.\n *\n * @type {number}\n * @constant\n */\nconst ReverseSubtractEquation = 102;\n\n/**\n * A blend equation that uses the minimum of source and destination.\n *\n * @type {number}\n * @constant\n */\nconst MinEquation = 103;\n\n/**\n * A blend equation that uses the maximum of source and destination.\n *\n * @type {number}\n * @constant\n */\nconst MaxEquation = 104;\n\n/**\n * Multiplies all colors by `0`.\n *\n * @type {number}\n * @constant\n */\nconst ZeroFactor = 200;\n\n/**\n * Multiplies all colors by `1`.\n *\n * @type {number}\n * @constant\n */\nconst OneFactor = 201;\n\n/**\n * Multiplies all colors by the source colors.\n *\n * @type {number}\n * @constant\n */\nconst SrcColorFactor = 202;\n\n/**\n * Multiplies all colors by `1` minus each source color.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusSrcColorFactor = 203;\n\n/**\n * Multiplies all colors by the source alpha value.\n *\n * @type {number}\n * @constant\n */\nconst SrcAlphaFactor = 204;\n\n/**\n * Multiplies all colors by 1 minus the source alpha value.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusSrcAlphaFactor = 205;\n\n/**\n * Multiplies all colors by the destination alpha value.\n *\n * @type {number}\n * @constant\n */\nconst DstAlphaFactor = 206;\n\n/**\n * Multiplies all colors by `1` minus the destination alpha value.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusDstAlphaFactor = 207;\n\n/**\n * Multiplies all colors by the destination color.\n *\n * @type {number}\n * @constant\n */\nconst DstColorFactor = 208;\n\n/**\n * Multiplies all colors by `1` minus each destination color.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusDstColorFactor = 209;\n\n/**\n * Multiplies the RGB colors by the smaller of either the source alpha\n * value or the value of `1` minus the destination alpha value. The alpha\n * value is multiplied by `1`.\n *\n * @type {number}\n * @constant\n */\nconst SrcAlphaSaturateFactor = 210;\n\n/**\n * Multiplies all colors by a constant color.\n *\n * @type {number}\n * @constant\n */\nconst ConstantColorFactor = 211;\n\n/**\n * Multiplies all colors by `1` minus a constant color.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusConstantColorFactor = 212;\n\n/**\n * Multiplies all colors by a constant alpha value.\n *\n * @type {number}\n * @constant\n */\nconst ConstantAlphaFactor = 213;\n\n/**\n * Multiplies all colors by 1 minus a constant alpha value.\n *\n * @type {number}\n * @constant\n */\nconst OneMinusConstantAlphaFactor = 214;\n\n/**\n * Never pass.\n *\n * @type {number}\n * @constant\n */\nconst NeverDepth = 0;\n\n/**\n * Always pass.\n *\n * @type {number}\n * @constant\n */\nconst AlwaysDepth = 1;\n\n/**\n * Pass if the incoming value is less than the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst LessDepth = 2;\n\n/**\n * Pass if the incoming value is less than or equal to the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst LessEqualDepth = 3;\n\n/**\n * Pass if the incoming value equals the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst EqualDepth = 4;\n\n/**\n * Pass if the incoming value is greater than or equal to the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterEqualDepth = 5;\n\n/**\n * Pass if the incoming value is greater than the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterDepth = 6;\n\n/**\n * Pass if the incoming value is not equal to the depth buffer value.\n *\n * @type {number}\n * @constant\n */\nconst NotEqualDepth = 7;\n\n/**\n * Multiplies the environment map color with the surface color.\n *\n * @type {number}\n * @constant\n */\nconst MultiplyOperation = 0;\n\n/**\n * Uses reflectivity to blend between the two colors.\n *\n * @type {number}\n * @constant\n */\nconst MixOperation = 1;\n\n/**\n * Adds the two colors.\n *\n * @type {number}\n * @constant\n */\nconst AddOperation = 2;\n\n/**\n * No tone mapping is applied.\n *\n * @type {number}\n * @constant\n */\nconst NoToneMapping = 0;\n\n/**\n * Linear tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst LinearToneMapping = 1;\n\n/**\n * Reinhard tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst ReinhardToneMapping = 2;\n\n/**\n * Cineon tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst CineonToneMapping = 3;\n\n/**\n * ACES Filmic tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst ACESFilmicToneMapping = 4;\n\n/**\n * Custom tone mapping.\n *\n * Expects a custom implementation by modifying shader code of the material's fragment shader.\n *\n * @type {number}\n * @constant\n */\nconst CustomToneMapping = 5;\n\n/**\n * AgX tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst AgXToneMapping = 6;\n\n/**\n * Neutral tone mapping.\n *\n * Implementation based on the Khronos 3D Commerce Group standard tone mapping.\n *\n * @type {number}\n * @constant\n */\nconst NeutralToneMapping = 7;\n\n/**\n * The skinned mesh shares the same world space as the skeleton.\n *\n * @type {string}\n * @constant\n */\nconst AttachedBindMode = 'attached';\n\n/**\n * The skinned mesh does not share the same world space as the skeleton.\n * This is useful when a skeleton is shared across multiple skinned meshes.\n *\n * @type {string}\n * @constant\n */\nconst DetachedBindMode = 'detached';\n\n/**\n * Maps textures using the geometry's UV coordinates.\n *\n * @type {number}\n * @constant\n */\nconst UVMapping = 300;\n\n/**\n * Reflection mapping for cube textures.\n *\n * @type {number}\n * @constant\n */\nconst CubeReflectionMapping = 301;\n\n/**\n * Refraction mapping for cube textures.\n *\n * @type {number}\n * @constant\n */\nconst CubeRefractionMapping = 302;\n\n/**\n * Reflection mapping for equirectangular textures.\n *\n * @type {number}\n * @constant\n */\nconst EquirectangularReflectionMapping = 303;\n\n/**\n * Refraction mapping for equirectangular textures.\n *\n * @type {number}\n * @constant\n */\nconst EquirectangularRefractionMapping = 304;\n\n/**\n * Reflection mapping for PMREM textures.\n *\n * @type {number}\n * @constant\n */\nconst CubeUVReflectionMapping = 306;\n\n/**\n * The texture will simply repeat to infinity.\n *\n * @type {number}\n * @constant\n */\nconst RepeatWrapping = 1000;\n\n/**\n * The last pixel of the texture stretches to the edge of the mesh.\n *\n * @type {number}\n * @constant\n */\nconst ClampToEdgeWrapping = 1001;\n\n/**\n * The texture will repeats to infinity, mirroring on each repeat.\n *\n * @type {number}\n * @constant\n */\nconst MirroredRepeatWrapping = 1002;\n\n/**\n * Returns the value of the texture element that is nearest (in Manhattan distance)\n * to the specified texture coordinates.\n *\n * @type {number}\n * @constant\n */\nconst NearestFilter = 1003;\n\n/**\n * Chooses the mipmap that most closely matches the size of the pixel being textured\n * and uses the `NearestFilter` criterion (the texel nearest to the center of the pixel)\n * to produce a texture value.\n *\n * @type {number}\n * @constant\n */\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004; // legacy\n\n/**\n * Chooses the two mipmaps that most closely match the size of the pixel being textured and\n * uses the `NearestFilter` criterion to produce a texture value from each mipmap.\n * The final texture value is a weighted average of those two values.\n *\n * @type {number}\n * @constant\n */\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005; // legacy\n\n/**\n * Returns the weighted average of the four texture elements that are closest to the specified\n * texture coordinates, and can include items wrapped or repeated from other parts of a texture,\n * depending on the values of `wrapS` and `wrapT`, and on the exact mapping.\n *\n * @type {number}\n * @constant\n */\nconst LinearFilter = 1006;\n\n/**\n * Chooses the mipmap that most closely matches the size of the pixel being textured and uses\n * the `LinearFilter` criterion (a weighted average of the four texels that are closest to the\n * center of the pixel) to produce a texture value.\n *\n * @type {number}\n * @constant\n */\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007; // legacy\n\n/**\n * Chooses the two mipmaps that most closely match the size of the pixel being textured and uses\n * the `LinearFilter` criterion to produce a texture value from each mipmap. The final texture value\n * is a weighted average of those two values.\n *\n * @type {number}\n * @constant\n */\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008; // legacy\n\n/**\n * An unsigned byte data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedByteType = 1009;\n\n/**\n * A byte data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst ByteType = 1010;\n\n/**\n * A short data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst ShortType = 1011;\n\n/**\n * An unsigned short data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedShortType = 1012;\n\n/**\n * An int data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst IntType = 1013;\n\n/**\n * An unsigned int data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedIntType = 1014;\n\n/**\n * A float data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst FloatType = 1015;\n\n/**\n * A half float data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst HalfFloatType = 1016;\n\n/**\n * An unsigned short 4_4_4_4 (packed) data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedShort4444Type = 1017;\n\n/**\n * An unsigned short 5_5_5_1 (packed) data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedShort5551Type = 1018;\n\n/**\n * An unsigned int 24_8 data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedInt248Type = 1020;\n\n/**\n * An unsigned int 5_9_9_9 (packed) data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedInt5999Type = 35902;\n\n/**\n * An unsigned int 10_11_11 (packed) data type for textures.\n *\n * @type {number}\n * @constant\n */\nconst UnsignedInt101111Type = 35899;\n\n/**\n * Discards the red, green and blue components and reads just the alpha component.\n *\n * @type {number}\n * @constant\n */\nconst AlphaFormat = 1021;\n\n/**\n * Discards the alpha component and reads the red, green and blue component.\n *\n * @type {number}\n * @constant\n */\nconst RGBFormat = 1022;\n\n/**\n * Reads the red, green, blue and alpha components.\n *\n * @type {number}\n * @constant\n */\nconst RGBAFormat = 1023;\n\n/**\n * Reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`.\n *\n * @type {number}\n * @constant\n */\nconst DepthFormat = 1026;\n\n/**\n * Reads each element is a pair of depth and stencil values. The depth component of the pair is interpreted as\n * in `DepthFormat`. The stencil component is interpreted based on the depth + stencil internal format.\n *\n * @type {number}\n * @constant\n */\nconst DepthStencilFormat = 1027;\n\n/**\n * Discards the green, blue and alpha components and reads just the red component.\n *\n * @type {number}\n * @constant\n */\nconst RedFormat = 1028;\n\n/**\n * Discards the green, blue and alpha components and reads just the red component. The texels are read as integers instead of floating point.\n *\n * @type {number}\n * @constant\n */\nconst RedIntegerFormat = 1029;\n\n/**\n * Discards the alpha, and blue components and reads the red, and green components.\n *\n * @type {number}\n * @constant\n */\nconst RGFormat = 1030;\n\n/**\n * Discards the alpha, and blue components and reads the red, and green components. The texels are read as integers instead of floating point.\n *\n * @type {number}\n * @constant\n */\nconst RGIntegerFormat = 1031;\n\n/**\n * Discards the alpha component and reads the red, green and blue component. The texels are read as integers instead of floating point.\n *\n * @type {number}\n * @constant\n */\nconst RGBIntegerFormat = 1032;\n\n/**\n * Reads the red, green, blue and alpha components. The texels are read as integers instead of floating point.\n *\n * @type {number}\n * @constant\n */\nconst RGBAIntegerFormat = 1033;\n\n/**\n * A DXT1-compressed image in an RGB image format.\n *\n * @type {number}\n * @constant\n */\nconst RGB_S3TC_DXT1_Format = 33776;\n\n/**\n * A DXT1-compressed image in an RGB image format with a simple on/off alpha value.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_S3TC_DXT1_Format = 33777;\n\n/**\n * A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_S3TC_DXT3_Format = 33778;\n\n/**\n * A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3\n * compression in how the alpha compression is done.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_S3TC_DXT5_Format = 33779;\n\n/**\n * PVRTC RGB compression in 4-bit mode. One block for each 4\u00D74 pixels.\n *\n * @type {number}\n * @constant\n */\nconst RGB_PVRTC_4BPPV1_Format = 35840;\n\n/**\n * PVRTC RGB compression in 2-bit mode. One block for each 8\u00D74 pixels.\n *\n * @type {number}\n * @constant\n */\nconst RGB_PVRTC_2BPPV1_Format = 35841;\n\n/**\n * PVRTC RGBA compression in 4-bit mode. One block for each 4\u00D74 pixels.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\n\n/**\n * PVRTC RGBA compression in 2-bit mode. One block for each 8\u00D74 pixels.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\n\n/**\n * ETC1 RGB format.\n *\n * @type {number}\n * @constant\n */\nconst RGB_ETC1_Format = 36196;\n\n/**\n * ETC2 RGB format.\n *\n * @type {number}\n * @constant\n */\nconst RGB_ETC2_Format = 37492;\n\n/**\n * ETC2 RGBA format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ETC2_EAC_Format = 37496;\n\n/**\n * EAC R11 UNORM format.\n *\n * @type {number}\n * @constant\n */\nconst R11_EAC_Format = 37488; // 0x9270\n\n/**\n * EAC R11 SNORM format.\n *\n * @type {number}\n * @constant\n */\nconst SIGNED_R11_EAC_Format = 37489; // 0x9271\n\n/**\n * EAC RG11 UNORM format.\n *\n * @type {number}\n * @constant\n */\nconst RG11_EAC_Format = 37490; // 0x9272\n\n/**\n * EAC RG11 SNORM format.\n *\n * @type {number}\n * @constant\n */\nconst SIGNED_RG11_EAC_Format = 37491; // 0x9273\n\n/**\n * ASTC RGBA 4x4 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_4x4_Format = 37808;\n\n/**\n * ASTC RGBA 5x4 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_5x4_Format = 37809;\n\n/**\n * ASTC RGBA 5x5 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_5x5_Format = 37810;\n\n/**\n * ASTC RGBA 6x5 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_6x5_Format = 37811;\n\n/**\n * ASTC RGBA 6x6 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_6x6_Format = 37812;\n\n/**\n * ASTC RGBA 8x5 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_8x5_Format = 37813;\n\n/**\n * ASTC RGBA 8x6 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_8x6_Format = 37814;\n\n/**\n * ASTC RGBA 8x8 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_8x8_Format = 37815;\n\n/**\n * ASTC RGBA 10x5 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_10x5_Format = 37816;\n\n/**\n * ASTC RGBA 10x6 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_10x6_Format = 37817;\n\n/**\n * ASTC RGBA 10x8 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_10x8_Format = 37818;\n\n/**\n * ASTC RGBA 10x10 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_10x10_Format = 37819;\n\n/**\n * ASTC RGBA 12x10 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_12x10_Format = 37820;\n\n/**\n * ASTC RGBA 12x12 format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_ASTC_12x12_Format = 37821;\n\n/**\n * BPTC RGBA format.\n *\n * @type {number}\n * @constant\n */\nconst RGBA_BPTC_Format = 36492;\n\n/**\n * BPTC Signed RGB format.\n *\n * @type {number}\n * @constant\n */\nconst RGB_BPTC_SIGNED_Format = 36494;\n\n/**\n * BPTC Unsigned RGB format.\n *\n * @type {number}\n * @constant\n */\nconst RGB_BPTC_UNSIGNED_Format = 36495;\n\n/**\n * RGTC1 Red format.\n *\n * @type {number}\n * @constant\n */\nconst RED_RGTC1_Format = 36283;\n\n/**\n * RGTC1 Signed Red format.\n *\n * @type {number}\n * @constant\n */\nconst SIGNED_RED_RGTC1_Format = 36284;\n\n/**\n * RGTC2 Red Green format.\n *\n * @type {number}\n * @constant\n */\nconst RED_GREEN_RGTC2_Format = 36285;\n\n/**\n * RGTC2 Signed Red Green format.\n *\n * @type {number}\n * @constant\n */\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\n\n/**\n * Animations are played once.\n *\n * @type {number}\n * @constant\n */\nconst LoopOnce = 2200;\n\n/**\n * Animations are played with a chosen number of repetitions, each time jumping from\n * the end of the clip directly to its beginning.\n *\n * @type {number}\n * @constant\n */\nconst LoopRepeat = 2201;\n\n/**\n * Animations are played with a chosen number of repetitions, alternately playing forward\n * and backward.\n *\n * @type {number}\n * @constant\n */\nconst LoopPingPong = 2202;\n\n/**\n * Discrete interpolation mode for keyframe tracks.\n *\n * @type {number}\n * @constant\n */\nconst InterpolateDiscrete = 2300;\n\n/**\n * Linear interpolation mode for keyframe tracks.\n *\n * @type {number}\n * @constant\n */\nconst InterpolateLinear = 2301;\n\n/**\n * Smooth interpolation mode for keyframe tracks.\n *\n * @type {number}\n * @constant\n */\nconst InterpolateSmooth = 2302;\n\n/**\n * Bezier interpolation mode for keyframe tracks.\n *\n * Uses cubic Bezier curves with explicit 2D control points.\n * Requires tangent data to be set on the track.\n *\n * @type {number}\n * @constant\n */\nconst InterpolateBezier = 2303;\n\n/**\n * Zero curvature ending for animations.\n *\n * @type {number}\n * @constant\n */\nconst ZeroCurvatureEnding = 2400;\n\n/**\n * Zero slope ending for animations.\n *\n * @type {number}\n * @constant\n */\nconst ZeroSlopeEnding = 2401;\n\n/**\n * Wrap around ending for animations.\n *\n * @type {number}\n * @constant\n */\nconst WrapAroundEnding = 2402;\n\n/**\n * Default animation blend mode.\n *\n * @type {number}\n * @constant\n */\nconst NormalAnimationBlendMode = 2500;\n\n/**\n * Additive animation blend mode. Can be used to layer motions on top of\n * each other to build complex performances from smaller re-usable assets.\n *\n * @type {number}\n * @constant\n */\nconst AdditiveAnimationBlendMode = 2501;\n\n/**\n * For every three vertices draw a single triangle.\n *\n * @type {number}\n * @constant\n */\nconst TrianglesDrawMode = 0;\n\n/**\n * For each vertex draw a triangle from the last three vertices.\n *\n * @type {number}\n * @constant\n */\nconst TriangleStripDrawMode = 1;\n\n/**\n * For each vertex draw a triangle from the first vertex and the last two vertices.\n *\n * @type {number}\n * @constant\n */\nconst TriangleFanDrawMode = 2;\n\n/**\n * The depth value is inverted (1.0 - z) for visualization purposes.\n *\n * @type {number}\n * @constant\n */\nconst BasicDepthPacking = 3200;\n\n/**\n * The depth value is packed into 32 bit RGBA.\n *\n * @type {number}\n * @constant\n */\nconst RGBADepthPacking = 3201;\n\n/**\n * The depth value is packed into 24 bit RGB.\n *\n * @type {number}\n * @constant\n */\nconst RGBDepthPacking = 3202;\n\n/**\n * The depth value is packed into 16 bit RG.\n *\n * @type {number}\n * @constant\n */\nconst RGDepthPacking = 3203;\n\n/**\n * Normal information is relative to the underlying surface.\n *\n * @type {number}\n * @constant\n */\nconst TangentSpaceNormalMap = 0;\n\n/**\n * Normal information is relative to the object orientation.\n *\n * @type {number}\n * @constant\n */\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\n\n/**\n * No color space.\n *\n * @type {string}\n * @constant\n */\nconst NoColorSpace = '';\n\n/**\n * sRGB color space.\n *\n * @type {string}\n * @constant\n */\nconst SRGBColorSpace = 'srgb';\n\n/**\n * sRGB-linear color space.\n *\n * @type {string}\n * @constant\n */\nconst LinearSRGBColorSpace = 'srgb-linear';\n\n/**\n * Linear transfer function.\n *\n * @type {string}\n * @constant\n */\nconst LinearTransfer = 'linear';\n\n/**\n * sRGB transfer function.\n *\n * @type {string}\n * @constant\n */\nconst SRGBTransfer = 'srgb';\n\n/**\n * No normal map packing.\n *\n * @type {string}\n * @constant\n */\nconst NoNormalPacking = '';\n\n/**\n * Normal RG packing.\n *\n * @type {string}\n * @constant\n */\nconst NormalRGPacking = 'rg';\n\n/**\n * Normal GA packing.\n *\n * @type {string}\n * @constant\n */\nconst NormalGAPacking = 'ga';\n\n/**\n * Sets the stencil buffer value to `0`.\n *\n * @type {number}\n * @constant\n */\nconst ZeroStencilOp = 0;\n\n/**\n * Keeps the current value.\n *\n * @type {number}\n * @constant\n */\nconst KeepStencilOp = 7680;\n\n/**\n * Sets the stencil buffer value to the specified reference value.\n *\n * @type {number}\n * @constant\n */\nconst ReplaceStencilOp = 7681;\n\n/**\n * Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.\n *\n * @type {number}\n * @constant\n */\nconst IncrementStencilOp = 7682;\n\n/**\n * Decrements the current stencil buffer value. Clamps to `0`.\n *\n * @type {number}\n * @constant\n */\nconst DecrementStencilOp = 7683;\n\n/**\n * Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing\n * the maximum representable unsigned value.\n *\n * @type {number}\n * @constant\n */\nconst IncrementWrapStencilOp = 34055;\n\n/**\n * Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable\n * unsigned value when decrementing a stencil buffer value of `0`.\n *\n * @type {number}\n * @constant\n */\nconst DecrementWrapStencilOp = 34056;\n\n/**\n * Inverts the current stencil buffer value bitwise.\n *\n * @type {number}\n * @constant\n */\nconst InvertStencilOp = 5386;\n\n/**\n * Will never return true.\n *\n * @type {number}\n * @constant\n */\nconst NeverStencilFunc = 512;\n\n/**\n * Will return true if the stencil reference value is less than the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst LessStencilFunc = 513;\n\n/**\n * Will return true if the stencil reference value is equal to the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst EqualStencilFunc = 514;\n\n/**\n * Will return true if the stencil reference value is less than or equal to the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst LessEqualStencilFunc = 515;\n\n/**\n * Will return true if the stencil reference value is greater than the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterStencilFunc = 516;\n\n/**\n * Will return true if the stencil reference value is not equal to the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst NotEqualStencilFunc = 517;\n\n/**\n * Will return true if the stencil reference value is greater than or equal to the current stencil value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterEqualStencilFunc = 518;\n\n/**\n * Will always return true.\n *\n * @type {number}\n * @constant\n */\nconst AlwaysStencilFunc = 519;\n\n/**\n * Never pass.\n *\n * @type {number}\n * @constant\n */\nconst NeverCompare = 512;\n\n/**\n * Pass if the incoming value is less than the texture value.\n *\n * @type {number}\n * @constant\n */\nconst LessCompare = 513;\n\n/**\n * Pass if the incoming value equals the texture value.\n *\n * @type {number}\n * @constant\n */\nconst EqualCompare = 514;\n\n/**\n * Pass if the incoming value is less than or equal to the texture value.\n *\n * @type {number}\n * @constant\n */\nconst LessEqualCompare = 515;\n\n/**\n * Pass if the incoming value is greater than the texture value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterCompare = 516;\n\n/**\n * Pass if the incoming value is not equal to the texture value.\n *\n * @type {number}\n * @constant\n */\nconst NotEqualCompare = 517;\n\n/**\n * Pass if the incoming value is greater than or equal to the texture value.\n *\n * @type {number}\n * @constant\n */\nconst GreaterEqualCompare = 518;\n\n/**\n * Always pass.\n *\n * @type {number}\n * @constant\n */\nconst AlwaysCompare = 519;\n\n/**\n * The contents are intended to be specified once by the application, and used many\n * times as the source for drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst StaticDrawUsage = 35044;\n\n/**\n * The contents are intended to be respecified repeatedly by the application, and\n * used many times as the source for drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst DynamicDrawUsage = 35048;\n\n/**\n * The contents are intended to be specified once by the application, and used at most\n * a few times as the source for drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst StreamDrawUsage = 35040;\n\n/**\n * The contents are intended to be specified once by reading data from the 3D API, and queried\n * many times by the application.\n *\n * @type {number}\n * @constant\n */\nconst StaticReadUsage = 35045;\n\n/**\n * The contents are intended to be respecified repeatedly by reading data from the 3D API, and queried\n * many times by the application.\n *\n * @type {number}\n * @constant\n */\nconst DynamicReadUsage = 35049;\n\n/**\n * The contents are intended to be specified once by reading data from the 3D API, and queried at most\n * a few times by the application\n *\n * @type {number}\n * @constant\n */\nconst StreamReadUsage = 35041;\n\n/**\n * The contents are intended to be specified once by reading data from the 3D API, and used many times as\n * the source for WebGL drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst StaticCopyUsage = 35046;\n\n/**\n * The contents are intended to be respecified repeatedly by reading data from the 3D API, and used many times\n * as the source for WebGL drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst DynamicCopyUsage = 35050;\n\n/**\n * The contents are intended to be specified once by reading data from the 3D API, and used at most a few times\n * as the source for WebGL drawing and image specification commands.\n *\n * @type {number}\n * @constant\n */\nconst StreamCopyUsage = 35042;\n\n/**\n * GLSL 1 shader code.\n *\n * @type {string}\n * @constant\n */\nconst GLSL1 = '100';\n\n/**\n * GLSL 3 shader code.\n *\n * @type {string}\n * @constant\n */\nconst GLSL3 = '300 es';\n\n/**\n * WebGL coordinate system.\n *\n * @type {number}\n * @constant\n */\nconst WebGLCoordinateSystem = 2000;\n\n/**\n * WebGPU coordinate system.\n *\n * @type {number}\n * @constant\n */\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * Represents the different timestamp query types.\n *\n * @type {ConstantsTimestampQuery}\n * @constant\n */\nconst TimestampQuery = {\n\tCOMPUTE: 'compute',\n\tRENDER: 'render'\n};\n\n/**\n * Represents mouse buttons and interaction types in context of controls.\n *\n * @type {ConstantsInterpolationSamplingType}\n * @constant\n */\nconst InterpolationSamplingType = {\n\tPERSPECTIVE: 'perspective',\n\tLINEAR: 'linear',\n\tFLAT: 'flat'\n};\n\n/**\n * Represents the different interpolation sampling modes.\n *\n * @type {ConstantsInterpolationSamplingMode}\n * @constant\n */\nconst InterpolationSamplingMode = {\n\tNORMAL: 'normal',\n\tCENTROID: 'centroid',\n\tSAMPLE: 'sample',\n\tFIRST: 'first',\n\tEITHER: 'either'\n};\n\n/**\n * Compatibility flags for features that may not be supported across all platforms.\n *\n * @type {Object}\n * @constant\n */\nconst Compatibility = {\n\tTEXTURE_COMPARE: 'depthTextureCompare'\n};\n\n/**\n * This type represents mouse buttons and interaction types in context of controls.\n *\n * @typedef {Object} ConstantsMouse\n * @property {number} MIDDLE - The left mouse button.\n * @property {number} LEFT - The middle mouse button.\n * @property {number} RIGHT - The right mouse button.\n * @property {number} ROTATE - A rotate interaction.\n * @property {number} DOLLY - A dolly interaction.\n * @property {number} PAN - A pan interaction.\n **/\n\n/**\n * This type represents touch interaction types in context of controls.\n *\n * @typedef {Object} ConstantsTouch\n * @property {number} ROTATE - A rotate interaction.\n * @property {number} PAN - A pan interaction.\n * @property {number} DOLLY_PAN - The dolly-pan interaction.\n * @property {number} DOLLY_ROTATE - A dolly-rotate interaction.\n **/\n\n/**\n * This type represents the different timestamp query types.\n *\n * @typedef {Object} ConstantsTimestampQuery\n * @property {string} COMPUTE - A `compute` timestamp query.\n * @property {string} RENDER - A `render` timestamp query.\n **/\n\n/**\n * Represents the different interpolation sampling types.\n *\n * @typedef {Object} ConstantsInterpolationSamplingType\n * @property {string} PERSPECTIVE - Perspective-correct interpolation.\n * @property {string} LINEAR - Linear interpolation.\n * @property {string} FLAT - Flat interpolation.\n */\n\n/**\n * Represents the different interpolation sampling modes.\n *\n * @typedef {Object} ConstantsInterpolationSamplingMode\n * @property {string} NORMAL - Normal sampling mode.\n * @property {string} CENTROID - Centroid sampling mode.\n * @property {string} SAMPLE - Sample-specific sampling mode.\n * @property {string} FIRST - Flat interpolation using the first vertex.\n * @property {string} EITHER - Flat interpolation using either vertex.\n */\n\n/**\n * Checks if an array contains values that require Uint32 representation.\n *\n * This function determines whether the array contains any values >= 65535,\n * which would require a Uint32Array rather than a Uint16Array for proper storage.\n * The function iterates from the end of the array, assuming larger values are\n * typically located at the end.\n *\n * @private\n * @param {Array<number>} array - The array to check.\n * @return {boolean} True if the array contains values >= 65535, false otherwise.\n */\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\n/**\n * Map of typed array constructor names to their constructors.\n * This mapping enables dynamic creation of typed arrays based on string type names.\n *\n * @private\n * @constant\n * @type {Object<string, TypedArrayConstructor>}\n */\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\n/**\n * Creates a typed array of the specified type from the given buffer.\n *\n * @private\n * @param {string} type - The name of the typed array type (e.g., 'Float32Array', 'Uint16Array').\n * @param {ArrayBuffer} buffer - The buffer to create the typed array from.\n * @return {TypedArray} A new typed array of the specified type.\n */\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\n/**\n * Returns `true` if the given object is a typed array.\n *\n * @param {any} array - The object to check.\n * @return {boolean} Whether the given object is a typed array.\n */\nfunction isTypedArray( array ) {\n\n\treturn ArrayBuffer.isView( array ) && ! ( array instanceof DataView );\n\n}\n\n/**\n * Creates an XHTML element with the specified tag name.\n *\n * This function uses the XHTML namespace to create DOM elements,\n * ensuring proper element creation in XML-based contexts.\n *\n * @private\n * @param {string} name - The tag name of the element to create (e.g., 'canvas', 'div').\n * @return {HTMLElement} The created XHTML element.\n */\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\n/**\n * Creates a canvas element configured for block display.\n *\n * This is a convenience function that creates a canvas element with\n * display style set to 'block', which is commonly used in three.js\n * rendering contexts to avoid inline element spacing issues.\n *\n * @return {HTMLCanvasElement} A canvas element with display set to 'block'.\n */\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\n/**\n * Internal cache for tracking warning messages to prevent duplicate warnings.\n *\n * @private\n * @type {Object<string, boolean>}\n */\nconst _cache = {};\n\n/**\n * Custom console function handler for intercepting log, warn, and error calls.\n *\n * @private\n * @type {Function|null}\n */\nlet _setConsoleFunction = null;\n\n/**\n * Sets a custom function to handle console output.\n *\n * This allows external code to intercept and handle console.log, console.warn,\n * and console.error calls made by three.js, which is useful for custom logging,\n * testing, or debugging workflows.\n *\n * @param {Function} fn - The function to handle console output. Should accept\n * (type, message, ...params) where type is 'log', 'warn', or 'error'.\n */\nfunction setConsoleFunction( fn ) {\n\n\t_setConsoleFunction = fn;\n\n}\n\n/**\n * Gets the currently set custom console function.\n *\n * @return {Function|null} The custom console function, or null if not set.\n */\nfunction getConsoleFunction() {\n\n\treturn _setConsoleFunction;\n\n}\n\n/**\n * Logs an informational message with the 'THREE.' prefix.\n *\n * If a custom console function is set via setConsoleFunction(), it will be used\n * instead of the native console.log. The first parameter is treated as the\n * method name and is automatically prefixed with 'THREE.'.\n *\n * @param {...any} params - The message components. The first param is used as\n * the method name and prefixed with 'THREE.'.\n */\nfunction log( ...params ) {\n\n\tconst message = 'THREE.' + params.shift();\n\n\tif ( _setConsoleFunction ) {\n\n\t\t_setConsoleFunction( 'log', message, ...params );\n\n\t} else {\n\n\t\tconsole.log( message, ...params );\n\n\t}\n\n}\n\n/**\n * Enhances log/warn/error messages related to TSL.\n *\n * @param {Array<any>} params - The original message parameters.\n * @returns {Array<any>} The filtered and enhanced message parameters.\n */\nfunction enhanceLogMessage( params ) {\n\n\tconst message = params[ 0 ];\n\n\tif ( typeof message === 'string' && message.startsWith( 'TSL:' ) ) {\n\n\t\tconst stackTrace = params[ 1 ];\n\n\t\tif ( stackTrace && stackTrace.isStackTrace ) {\n\n\t\t\tparams[ 0 ] += ' ' + stackTrace.getLocation();\n\n\t\t} else {\n\n\t\t\tparams[ 1 ] = 'Stack trace not available. Enable \"THREE.Node.captureStackTrace\" to capture stack traces.';\n\n\t\t}\n\n\t}\n\n\treturn params;\n\n}\n\n/**\n * Logs a warning message with the 'THREE.' prefix.\n *\n * If a custom console function is set via setConsoleFunction(), it will be used\n * instead of the native console.warn. The first parameter is treated as the\n * method name and is automatically prefixed with 'THREE.'.\n *\n * @param {...any} params - The message components. The first param is used as\n * the method name and prefixed with 'THREE.'.\n */\nfunction warn( ...params ) {\n\n\tparams = enhanceLogMessage( params );\n\n\tconst message = 'THREE.' + params.shift();\n\n\tif ( _setConsoleFunction ) {\n\n\t\t_setConsoleFunction( 'warn', message, ...params );\n\n\t} else {\n\n\t\tconst stackTrace = params[ 0 ];\n\n\t\tif ( stackTrace && stackTrace.isStackTrace ) {\n\n\t\t\tconsole.warn( stackTrace.getError( message ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( message, ...params );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Logs an error message with the 'THREE.' prefix.\n *\n * If a custom console function is set via setConsoleFunction(), it will be used\n * instead of the native console.error. The first parameter is treated as the\n * method name and is automatically prefixed with 'THREE.'.\n *\n * @param {...any} params - The message components. The first param is used as\n * the method name and prefixed with 'THREE.'.\n */\nfunction error( ...params ) {\n\n\tparams = enhanceLogMessage( params );\n\n\tconst message = 'THREE.' + params.shift();\n\n\tif ( _setConsoleFunction ) {\n\n\t\t_setConsoleFunction( 'error', message, ...params );\n\n\t} else {\n\n\t\tconst stackTrace = params[ 0 ];\n\n\t\tif ( stackTrace && stackTrace.isStackTrace ) {\n\n\t\t\tconsole.error( stackTrace.getError( message ) );\n\n\t\t} else {\n\n\t\t\tconsole.error( message, ...params );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Logs a warning message only once, preventing duplicate warnings.\n *\n * This function maintains an internal cache of warning messages and will only\n * output each unique warning message once. Useful for warnings that may be\n * triggered repeatedly but should only be shown to the user once.\n *\n * @param {...any} params - The warning message components.\n */\nfunction warnOnce( ...params ) {\n\n\tconst message = params.join( ' ' );\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\twarn( ...params );\n\n}\n\n/**\n * Yields execution to the main thread to allow rendering and other tasks.\n * Uses scheduler.yield() when available (Chrome 115+), falls back to requestAnimationFrame.\n *\n * @return {Promise<void>}\n */\nfunction yieldToMain() {\n\n\tif ( typeof self !== 'undefined' && typeof self.scheduler !== 'undefined' && typeof self.scheduler.yield !== 'undefined' ) {\n\n\t\treturn self.scheduler.yield();\n\n\t}\n\n\treturn new Promise( resolve => {\n\n\t\trequestAnimationFrame( resolve );\n\n\t} );\n\n}\n\n/**\n * Asynchronously probes for WebGL sync object completion.\n *\n * This function creates a promise that resolves when the WebGL sync object\n * signals completion or rejects if the sync operation fails. It uses polling\n * at the specified interval to check the sync status without blocking the\n * main thread. This is useful for GPU-CPU synchronization in WebGL contexts.\n *\n * @private\n * @param {WebGL2RenderingContext} gl - The WebGL rendering context.\n * @param {WebGLSync} sync - The WebGL sync object to wait for.\n * @param {number} interval - The polling interval in milliseconds.\n * @return {Promise<void>} A promise that resolves when the sync completes or rejects if it fails.\n */\nfunction probeAsync( gl, sync, interval ) {\n\n\treturn new Promise( function ( resolve, reject ) {\n\n\t\tfunction probe() {\n\n\t\t\tswitch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {\n\n\t\t\t\tcase gl.WAIT_FAILED:\n\t\t\t\t\treject();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase gl.TIMEOUT_EXPIRED:\n\t\t\t\t\tsetTimeout( probe, interval );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tresolve();\n\n\t\t\t}\n\n\t\t}\n\n\t\tsetTimeout( probe, interval );\n\n\t} );\n\n}\n\n/**\n * Used to select the correct depth functions\n * when reversed depth buffer is used.\n *\n * @private\n * @type {Object}\n */\nconst ReversedDepthFuncs = {\n\t[ NeverDepth ]: AlwaysDepth,\n\t[ LessDepth ]: GreaterDepth,\n\t[ EqualDepth ]: NotEqualDepth,\n\t[ LessEqualDepth ]: GreaterEqualDepth,\n\n\t[ AlwaysDepth ]: NeverDepth,\n\t[ GreaterDepth ]: LessDepth,\n\t[ NotEqualDepth ]: EqualDepth,\n\t[ GreaterEqualDepth ]: LessEqualDepth,\n};\n\n/**\n * This modules allows to dispatch event objects on custom JavaScript objects.\n *\n * Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/)\n *\n * Code Example:\n * ```js\n * class Car extends EventDispatcher {\n * \tstart() {\n *\t\tthis.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );\n *\t}\n *};\n *\n * // Using events with the custom object\n * const car = new Car();\n * car.addEventListener( 'start', function ( event ) {\n * \talert( event.message );\n * } );\n *\n * car.start();\n * ```\n */\nclass EventDispatcher {\n\n\t/**\n\t * Adds the given event listener to the given event type.\n\t *\n\t * @param {string} type - The type of event to listen to.\n\t * @param {Function} listener - The function that gets called when the event is fired.\n\t */\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === -1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns `true` if the given event listener has been added to the given event type.\n\t *\n\t * @param {string} type - The type of event.\n\t * @param {Function} listener - The listener to check.\n\t * @return {boolean} Whether the given event listener has been added to the given event type.\n\t */\n\thasEventListener( type, listener ) {\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners === undefined ) return false;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== -1;\n\n\t}\n\n\t/**\n\t * Removes the given event listener from the given event type.\n\t *\n\t * @param {string} type - The type of event.\n\t * @param {Function} listener - The listener to remove.\n\t */\n\tremoveEventListener( type, listener ) {\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners === undefined ) return;\n\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== -1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Dispatches an event object.\n\t *\n\t * @param {Object} event - The event that gets fired.\n\t */\n\tdispatchEvent( event ) {\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners === undefined ) return;\n\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n/**\n * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)\n * (universally unique identifier).\n *\n * @return {string} The UUID.\n */\nfunction generateUUID() {\n\n\t// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\n/**\n * Clamps the given value between min and max.\n *\n * @param {number} value - The value to clamp.\n * @param {number} min - The min value.\n * @param {number} max - The max value.\n * @return {number} The clamped value.\n */\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n/**\n * Computes the Euclidean modulo of the given parameters that\n * is `( ( n % m ) + m ) % m`.\n *\n * @param {number} n - The first parameter.\n * @param {number} m - The second parameter.\n * @return {number} The Euclidean modulo.\n */\nfunction euclideanModulo( n, m ) {\n\n\t// https://en.wikipedia.org/wiki/Modulo_operation\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n/**\n * Performs a linear mapping from range `<a1, a2>` to range `<b1, b2>`\n * for the given value. `a2` must be greater than `a1`.\n *\n * @param {number} x - The value to be mapped.\n * @param {number} a1 - Minimum value for range A.\n * @param {number} a2 - Maximum value for range A.\n * @param {number} b1 - Minimum value for range B.\n * @param {number} b2 - Maximum value for range B.\n * @return {number} The mapped value.\n */\nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n/**\n * Returns the percentage in the closed interval `[0, 1]` of the given value\n * between the start and end point.\n *\n * @param {number} x - The start point\n * @param {number} y - The end point.\n * @param {number} value - A value between start and end.\n * @return {number} The interpolation factor.\n */\nfunction inverseLerp( x, y, value ) {\n\n\t// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n/**\n * Returns a value linearly interpolated from two known points based on the given interval -\n * `t = 0` will return `x` and `t = 1` will return `y`.\n *\n * @param {number} x - The start point\n * @param {number} y - The end point.\n * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n * @return {number} The interpolated value.\n */\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n/**\n * Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta\n * time to maintain frame rate independent movement. For details, see\n * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).\n *\n * @param {number} x - The current point.\n * @param {number} y - The target point.\n * @param {number} lambda - A higher lambda value will make the movement more sudden,\n * and a lower value will make the movement more gradual.\n * @param {number} dt - Delta time in seconds.\n * @return {number} The interpolated value.\n */\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n/**\n * Returns a value that alternates between `0` and the given `length` parameter.\n *\n * @param {number} x - The value to pingpong.\n * @param {number} [length=1] - The positive value the function will pingpong to.\n * @return {number} The alternated value.\n */\nfunction pingpong( x, length = 1 ) {\n\n\t// https://www.desmos.com/calculator/vcsjnyz7x4\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n/**\n * Returns a value in the range `[0,1]` that represents the percentage that `x` has\n * moved between `min` and `max`, but smoothed or slowed down the closer `x` is to\n * the `min` and `max`.\n *\n * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.\n *\n * @param {number} x - The value to evaluate based on its position between `min` and `max`.\n * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`.\n * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`.\n * @return {number} The alternated value.\n */\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\n/**\n * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)\n * that has zero 1st and 2nd order derivatives at `x=0` and `x=1`.\n *\n * @param {number} x - The value to evaluate based on its position between `min` and `max`.\n * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`.\n * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`.\n * @return {number} The alternated value.\n */\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n/**\n * Returns a random integer from `<low, high>` interval.\n *\n * @param {number} low - The lower value boundary.\n * @param {number} high - The upper value boundary\n * @return {number} A random integer.\n */\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n/**\n * Returns a random float from `<low, high>` interval.\n *\n * @param {number} low - The lower value boundary.\n * @param {number} high - The upper value boundary\n * @return {number} A random float.\n */\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n/**\n * Returns a random integer from `<-range/2, range/2>` interval.\n *\n * @param {number} range - Defines the value range.\n * @return {number} A random float.\n */\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n/**\n * Returns a deterministic pseudo-random float in the interval `[0, 1]`.\n *\n * @param {number} [s] - The integer seed.\n * @return {number} A random float.\n */\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\n/**\n * Converts degrees to radians.\n *\n * @param {number} degrees - A value in degrees.\n * @return {number} The converted value in radians.\n */\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\n/**\n * Converts radians to degrees.\n *\n * @param {number} radians - A value in radians.\n * @return {number} The converted value in degrees.\n */\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\n/**\n * Returns `true` if the given number is a power of two.\n *\n * @param {number} value - The value to check.\n * @return {boolean} Whether the given number is a power of two or not.\n */\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\n/**\n * Returns the smallest power of two that is greater than or equal to the given number.\n *\n * @param {number} value - The value to find a POT for. Must be greater than `0`.\n * @return {number} The smallest power of two that is greater than or equal to the given number.\n */\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\n/**\n * Returns the largest power of two that is less than or equal to the given number.\n *\n * @param {number} value - The value to find a POT for. Must be greater than `0`.\n * @return {number} The largest power of two that is less than or equal to the given number.\n */\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\n/**\n * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)\n * defined by the given angles and order.\n *\n * Rotations are applied to the axes in the order specified by order:\n * rotation by angle `a` is applied first, then by angle `b`, then by angle `c`.\n *\n * @param {Quaternion} q - The quaternion to set.\n * @param {number} a - The rotation applied to the first axis, in radians.\n * @param {number} b - The rotation applied to the second axis, in radians.\n * @param {number} c - The rotation applied to the third axis, in radians.\n * @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order.\n */\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\twarn( 'MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\n/**\n * Denormalizes the given value according to the given typed array.\n *\n * @param {number} value - The value to denormalize.\n * @param {TypedArray} array - The typed array that defines the data type of the value.\n * @return {number} The denormalize (float) value in the range `[0,1]`.\n */\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, -1 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, -1 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, -1 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\n/**\n * Normalizes the given value according to the given typed array.\n *\n * @param {number} value - The float value in the range `[0,1]` to normalize.\n * @param {TypedArray} array - The typed array that defines the data type of the value.\n * @return {number} The normalize value.\n */\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\n/**\n * @class\n * @classdesc A collection of math utility functions.\n * @hideconstructor\n */\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\t/**\n\t * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)\n\t * (universally unique identifier).\n\t *\n\t * @static\n\t * @method\n\t * @return {string} The UUID.\n\t */\n\tgenerateUUID: generateUUID,\n\t/**\n\t * Clamps the given value between min and max.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The value to clamp.\n\t * @param {number} min - The min value.\n\t * @param {number} max - The max value.\n\t * @return {number} The clamped value.\n\t */\n\tclamp: clamp,\n\t/**\n\t * Computes the Euclidean modulo of the given parameters that\n\t * is `( ( n % m ) + m ) % m`.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} n - The first parameter.\n\t * @param {number} m - The second parameter.\n\t * @return {number} The Euclidean modulo.\n\t */\n\teuclideanModulo: euclideanModulo,\n\t/**\n\t * Performs a linear mapping from range `<a1, a2>` to range `<b1, b2>`\n\t * for the given value.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The value to be mapped.\n\t * @param {number} a1 - Minimum value for range A.\n\t * @param {number} a2 - Maximum value for range A.\n\t * @param {number} b1 - Minimum value for range B.\n\t * @param {number} b2 - Maximum value for range B.\n\t * @return {number} The mapped value.\n\t */\n\tmapLinear: mapLinear,\n\t/**\n\t * Returns the percentage in the closed interval `[0, 1]` of the given value\n\t * between the start and end point.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The start point\n\t * @param {number} y - The end point.\n\t * @param {number} value - A value between start and end.\n\t * @return {number} The interpolation factor.\n\t */\n\tinverseLerp: inverseLerp,\n\t/**\n\t * Returns a value linearly interpolated from two known points based on the given interval -\n\t * `t = 0` will return `x` and `t = 1` will return `y`.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The start point\n\t * @param {number} y - The end point.\n\t * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n\t * @return {number} The interpolated value.\n\t */\n\tlerp: lerp,\n\t/**\n\t * Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta\n\t * time to maintain frame rate independent movement. For details, see\n\t * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The current point.\n\t * @param {number} y - The target point.\n\t * @param {number} lambda - A higher lambda value will make the movement more sudden,\n\t * and a lower value will make the movement more gradual.\n\t * @param {number} dt - Delta time in seconds.\n\t * @return {number} The interpolated value.\n\t */\n\tdamp: damp,\n\t/**\n\t * Returns a value that alternates between `0` and the given `length` parameter.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The value to pingpong.\n\t * @param {number} [length=1] - The positive value the function will pingpong to.\n\t * @return {number} The alternated value.\n\t */\n\tpingpong: pingpong,\n\t/**\n\t * Returns a value in the range `[0,1]` that represents the percentage that `x` has\n\t * moved between `min` and `max`, but smoothed or slowed down the closer `x` is to\n\t * the `min` and `max`.\n\t *\n\t * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The value to evaluate based on its position between min and max.\n\t * @param {number} min - The min value. Any x value below min will be `0`.\n\t * @param {number} max - The max value. Any x value above max will be `1`.\n\t * @return {number} The alternated value.\n\t */\n\tsmoothstep: smoothstep,\n\t/**\n\t * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)\n\t * that has zero 1st and 2nd order derivatives at x=0 and x=1.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} x - The value to evaluate based on its position between min and max.\n\t * @param {number} min - The min value. Any x value below min will be `0`.\n\t * @param {number} max - The max value. Any x value above max will be `1`.\n\t * @return {number} The alternated value.\n\t */\n\tsmootherstep: smootherstep,\n\t/**\n\t * Returns a random integer from `<low, high>` interval.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} low - The lower value boundary.\n\t * @param {number} high - The upper value boundary\n\t * @return {number} A random integer.\n\t */\n\trandInt: randInt,\n\t/**\n\t * Returns a random float from `<low, high>` interval.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} low - The lower value boundary.\n\t * @param {number} high - The upper value boundary\n\t * @return {number} A random float.\n\t */\n\trandFloat: randFloat,\n\t/**\n\t * Returns a random integer from `<-range/2, range/2>` interval.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} range - Defines the value range.\n\t * @return {number} A random float.\n\t */\n\trandFloatSpread: randFloatSpread,\n\t/**\n\t * Returns a deterministic pseudo-random float in the interval `[0, 1]`.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} [s] - The integer seed.\n\t * @return {number} A random float.\n\t */\n\tseededRandom: seededRandom,\n\t/**\n\t * Converts degrees to radians.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} degrees - A value in degrees.\n\t * @return {number} The converted value in radians.\n\t */\n\tdegToRad: degToRad,\n\t/**\n\t * Converts radians to degrees.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} radians - A value in radians.\n\t * @return {number} The converted value in degrees.\n\t */\n\tradToDeg: radToDeg,\n\t/**\n\t * Returns `true` if the given number is a power of two.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The value to check.\n\t * @return {boolean} Whether the given number is a power of two or not.\n\t */\n\tisPowerOfTwo: isPowerOfTwo,\n\t/**\n\t * Returns the smallest power of two that is greater than or equal to the given number.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The value to find a POT for.\n\t * @return {number} The smallest power of two that is greater than or equal to the given number.\n\t */\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\t/**\n\t * Returns the largest power of two that is less than or equal to the given number.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The value to find a POT for.\n\t * @return {number} The largest power of two that is less than or equal to the given number.\n\t */\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\t/**\n\t * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)\n\t * defined by the given angles and order.\n\t *\n\t * Rotations are applied to the axes in the order specified by order:\n\t * rotation by angle `a` is applied first, then by angle `b`, then by angle `c`.\n\t *\n\t * @static\n\t * @method\n\t * @param {Quaternion} q - The quaternion to set.\n\t * @param {number} a - The rotation applied to the first axis, in radians.\n\t * @param {number} b - The rotation applied to the second axis, in radians.\n\t * @param {number} c - The rotation applied to the third axis, in radians.\n\t * @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order.\n\t */\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\t/**\n\t * Normalizes the given value according to the given typed array.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The float value in the range `[0,1]` to normalize.\n\t * @param {TypedArray} array - The typed array that defines the data type of the value.\n\t * @return {number} The normalize value.\n\t */\n\tnormalize: normalize,\n\t/**\n\t * Denormalizes the given value according to the given typed array.\n\t *\n\t * @static\n\t * @method\n\t * @param {number} value - The value to denormalize.\n\t * @param {TypedArray} array - The typed array that defines the data type of the value.\n\t * @return {number} The denormalize (float) value in the range `[0,1]`.\n\t */\n\tdenormalize: denormalize\n};\n\n/**\n * Class representing a 2D vector. A 2D vector is an ordered pair of numbers\n * (labeled x and y), which can be used to represent a number of things, such as:\n *\n * - A point in 2D space (i.e. a position on a plane).\n * - A direction and length across a plane. In three.js the length will\n * always be the Euclidean distance(straight-line distance) from `(0, 0)` to `(x, y)`\n * and the direction is also measured from `(0, 0)` towards `(x, y)`.\n * - Any arbitrary ordered pair of numbers.\n *\n * There are other things a 2D vector can be used to represent, such as\n * momentum vectors, complex numbers and so on, however these are the most\n * common uses in three.js.\n *\n * Iterating through a vector instance will yield its components `(x, y)` in\n * the corresponding order.\n * ```js\n * const a = new THREE.Vector2( 0, 1 );\n *\n * //no arguments; will be initialised to (0, 0)\n * const b = new THREE.Vector2( );\n *\n * const d = a.distanceTo( b );\n * ```\n */\nclass Vector2 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tVector2.prototype.isVector2 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 2D vector.\n\t *\n\t * @param {number} [x=0] - The x value of this vector.\n\t * @param {number} [y=0] - The y value of this vector.\n\t */\n\tconstructor( x = 0, y = 0 ) {\n\n\t\t/**\n\t\t * The x value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.x = x;\n\n\t\t/**\n\t\t * The y value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.y = y;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector2#x}.\n\t *\n\t * @type {number}\n\t */\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector2#y}.\n\t *\n\t * @type {number}\n\t */\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\t/**\n\t * Sets the vector components.\n\t *\n\t * @param {number} x - The value of the x component.\n\t * @param {number} y - The value of the y component.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the same value.\n\t *\n\t * @param {number} scalar - The value to set for all vector components.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's x component to the given value\n\t *\n\t * @param {number} x - The value to set.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's y component to the given value\n\t *\n\t * @param {number} y - The value to set.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Allows to set a vector component with an index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y.\n\t * @param {number} value - The value to set.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the value of the vector component which matches the given index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y.\n\t * @return {number} A vector component value.\n\t */\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new vector with copied values from this instance.\n\t *\n\t * @return {Vector2} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\t/**\n\t * Copies the values of the given vector to this instance.\n\t *\n\t * @param {Vector2} v - The vector to copy.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector to this instance.\n\t *\n\t * @param {Vector2} v - The vector to add.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to all components of this instance.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector2} a - The first vector.\n\t * @param {Vector2} b - The second vector.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector scaled by the given factor to this instance.\n\t *\n\t * @param {Vector2} v - The vector.\n\t * @param {number} s - The factor that scales `v`.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vector from this instance.\n\t *\n\t * @param {Vector2} v - The vector to subtract.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given scalar value from all components of this instance.\n\t *\n\t * @param {number} s - The scalar to subtract.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector2} a - The first vector.\n\t * @param {Vector2} b - The second vector.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vector with this instance.\n\t *\n\t * @param {Vector2} v - The vector to multiply.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with all components of this instance.\n\t *\n\t * @param {number} scalar - The scalar to multiply.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this instance by the given vector.\n\t *\n\t * @param {Vector2} v - The vector to divide.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this vector by the given scalar.\n\t *\n\t * @param {number} scalar - The scalar to divide.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\t/**\n\t * Multiplies this vector (with an implicit 1 as the 3rd component) by\n\t * the given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The matrix to apply.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x or y value is greater than the given vector's x or y\n\t * value, replace that value with the corresponding min value.\n\t *\n\t * @param {Vector2} v - The vector.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x or y value is less than the given vector's x or y\n\t * value, replace that value with the corresponding max value.\n\t *\n\t * @param {Vector2} v - The vector.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x or y value is greater than the max vector's x or y\n\t * value, it is replaced by the corresponding value.\n\t * If this vector's x or y value is less than the min vector's x or y value,\n\t * it is replaced by the corresponding value.\n\t *\n\t * @param {Vector2} min - The minimum x and y values.\n\t * @param {Vector2} max - The maximum x and y values in the desired range.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = clamp( this.x, min.x, max.x );\n\t\tthis.y = clamp( this.y, min.y, max.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x or y values are greater than the max value, they are\n\t * replaced by the max value.\n\t * If this vector's x or y values are less than the min value, they are\n\t * replaced by the min value.\n\t *\n\t * @param {number} minVal - The minimum value the components will be clamped to.\n\t * @param {number} maxVal - The maximum value the components will be clamped to.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = clamp( this.x, minVal, maxVal );\n\t\tthis.y = clamp( this.y, minVal, maxVal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's length is greater than the max value, it is replaced by\n\t * the max value.\n\t * If this vector's length is less than the min value, it is replaced by the\n\t * min value.\n\t *\n\t * @param {number} min - The minimum value the vector length will be clamped to.\n\t * @param {number} max - The maximum value the vector length will be clamped to.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded down to the nearest integer value.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded up to the nearest integer value.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded to the nearest integer value\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded towards zero (up if negative,\n\t * down if positive) to an integer value.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this vector - i.e. sets x = -x and y = -y.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of the given vector with this instance.\n\t *\n\t * @param {Vector2} v - The vector to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\t/**\n\t * Calculates the cross product of the given vector with this instance.\n\t *\n\t * @param {Vector2} v - The vector to compute the cross product with.\n\t * @return {number} The result of the cross product.\n\t */\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\t/**\n\t * Computes the square of the Euclidean length (straight-line length) from\n\t * (0, 0) to (x, y). If you are comparing the lengths of vectors, you should\n\t * compare the length squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @return {number} The square length of this vector.\n\t */\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) from (0, 0) to (x, y).\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\t/**\n\t * Computes the Manhattan length of this vector.\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\t/**\n\t * Converts this vector to a unit vector - that is, sets it equal to a vector\n\t * with the same direction as this one, but with a vector length of `1`.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\t/**\n\t * Computes the angle in radians of this vector with respect to the positive x-axis.\n\t *\n\t * @return {number} The angle in radians.\n\t */\n\tangle() {\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\t/**\n\t * Returns the angle between the given vector and this instance in radians.\n\t *\n\t * @param {Vector2} v - The vector to compute the angle with.\n\t * @return {number} The angle in radians.\n\t */\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, -1, 1 ) );\n\n\t}\n\n\t/**\n\t * Computes the distance from the given vector to this instance.\n\t *\n\t * @param {Vector2} v - The vector to compute the distance to.\n\t * @return {number} The distance.\n\t */\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\t/**\n\t * Computes the squared distance from the given vector to this instance.\n\t * If you are just comparing the distance with another distance, you should compare\n\t * the distance squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @param {Vector2} v - The vector to compute the squared distance to.\n\t * @return {number} The squared distance.\n\t */\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\t/**\n\t * Computes the Manhattan distance from the given vector to this instance.\n\t *\n\t * @param {Vector2} v - The vector to compute the Manhattan distance to.\n\t * @return {number} The Manhattan distance.\n\t */\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\t/**\n\t * Sets this vector to a vector with the same direction as this one, but\n\t * with the specified length.\n\t *\n\t * @param {number} length - The new length of this vector.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vector and this instance, where\n\t * alpha is the percent distance along the line - alpha = 0 will be this\n\t * vector, and alpha = 1 will be the given one.\n\t *\n\t * @param {Vector2} v - The vector to interpolate towards.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vectors, where alpha is the percent\n\t * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n\t * be the second one. The result is stored in this instance.\n\t *\n\t * @param {Vector2} v1 - The first vector.\n\t * @param {Vector2} v2 - The second vector.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this vector is equal with the given one.\n\t *\n\t * @param {Vector2} v - The vector to test for equality.\n\t * @return {boolean} Whether this vector is equal with the given one.\n\t */\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\t/**\n\t * Sets this vector's x value to be `array[ offset ]` and y\n\t * value to be `array[ offset + 1 ]`.\n\t *\n\t * @param {Array<number>} array - An array holding the vector component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this vector to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the vector components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The vector components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this vector from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates this vector around the given center by the given angle.\n\t *\n\t * @param {Vector2} center - The point around which to rotate.\n\t * @param {number} angle - The angle to rotate, in radians.\n\t * @return {Vector2} A reference to this vector.\n\t */\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets each component of this vector to a pseudo-random value between `0` and\n\t * `1`, excluding `1`.\n\t *\n\t * @return {Vector2} A reference to this vector.\n\t */\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\n/**\n * Class for representing a Quaternion. Quaternions are used in three.js to represent rotations.\n *\n * Iterating through a vector instance will yield its components `(x, y, z, w)` in\n * the corresponding order.\n *\n * Note that three.js expects Quaternions to be normalized.\n * ```js\n * const quaternion = new THREE.Quaternion();\n * quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );\n *\n * const vector = new THREE.Vector3( 1, 0, 0 );\n * vector.applyQuaternion( quaternion );\n * ```\n */\nclass Quaternion {\n\n\t/**\n\t * Constructs a new quaternion.\n\t *\n\t * @param {number} [x=0] - The x value of this quaternion.\n\t * @param {number} [y=0] - The y value of this quaternion.\n\t * @param {number} [z=0] - The z value of this quaternion.\n\t * @param {number} [w=1] - The w value of this quaternion.\n\t */\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\t/**\n\t * Interpolates between two quaternions via SLERP. This implementation assumes the\n\t * quaternion data are managed in flat arrays.\n\t *\n\t * @param {Array<number>} dst - The destination array.\n\t * @param {number} dstOffset - An offset into the destination array.\n\t * @param {Array<number>} src0 - The source array of the first quaternion.\n\t * @param {number} srcOffset0 - An offset into the first source array.\n\t * @param {Array<number>} src1 - The source array of the second quaternion.\n\t * @param {number} srcOffset1 - An offset into the second source array.\n\t * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate.\n\t * @see {@link Quaternion#slerp}\n\t */\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tlet x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet dot = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1;\n\n\t\t\tif ( dot < 0 ) {\n\n\t\t\t\tx1 = - x1;\n\t\t\t\ty1 = - y1;\n\t\t\t\tz1 = - z1;\n\t\t\t\tw1 = - w1;\n\n\t\t\t\tdot = - dot;\n\n\t\t\t}\n\n\t\t\tlet s = 1 - t;\n\n\t\t\tif ( dot < 0.9995 ) {\n\n\t\t\t\t// slerp\n\n\t\t\t\tconst theta = Math.acos( dot );\n\t\t\t\tconst sin = Math.sin( theta );\n\n\t\t\t\ts = Math.sin( s * theta ) / sin;\n\t\t\t\tt = Math.sin( t * theta ) / sin;\n\n\t\t\t\tx0 = x0 * s + x1 * t;\n\t\t\t\ty0 = y0 * s + y1 * t;\n\t\t\t\tz0 = z0 * s + z1 * t;\n\t\t\t\tw0 = w0 * s + w1 * t;\n\n\t\t\t} else {\n\n\t\t\t\t// for small angles, lerp then normalize\n\n\t\t\t\tx0 = x0 * s + x1 * t;\n\t\t\t\ty0 = y0 * s + y1 * t;\n\t\t\t\tz0 = z0 * s + z1 * t;\n\t\t\t\tw0 = w0 * s + w1 * t;\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\t/**\n\t * Multiplies two quaternions. This implementation assumes the quaternion data are managed\n\t * in flat arrays.\n\t *\n\t * @param {Array<number>} dst - The destination array.\n\t * @param {number} dstOffset - An offset into the destination array.\n\t * @param {Array<number>} src0 - The source array of the first quaternion.\n\t * @param {number} srcOffset0 - An offset into the first source array.\n\t * @param {Array<number>} src1 - The source array of the second quaternion.\n\t * @param {number} srcOffset1 - An offset into the second source array.\n\t * @return {Array<number>} The destination array.\n\t * @see {@link Quaternion#multiplyQuaternions}.\n\t */\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\t/**\n\t * The x value of this quaternion.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * The y value of this quaternion.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * The z value of this quaternion.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * The w value of this quaternion.\n\t *\n\t * @type {number}\n\t * @default 1\n\t */\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * Sets the quaternion components.\n\t *\n\t * @param {number} x - The x value of this quaternion.\n\t * @param {number} y - The y value of this quaternion.\n\t * @param {number} z - The z value of this quaternion.\n\t * @param {number} w - The w value of this quaternion.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new quaternion with copied values from this instance.\n\t *\n\t * @return {Quaternion} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\t/**\n\t * Copies the values of the given quaternion to this instance.\n\t *\n\t * @param {Quaternion} quaternion - The quaternion to copy.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this quaternion from the rotation specified by the given\n\t * Euler angles.\n\t *\n\t * @param {Euler} euler - The Euler angles.\n\t * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tsetFromEuler( euler, update = true ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\twarn( 'Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this quaternion from the given axis and angle.\n\t *\n\t * @param {Vector3} axis - The normalized axis.\n\t * @param {number} angle - The angle in radians.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this quaternion from the given rotation matrix.\n\t *\n\t * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this quaternion to the rotation required to rotate the direction vector\n\t * `vFrom` to the direction vector `vTo`.\n\t *\n\t * @param {Vector3} vFrom - The first (normalized) direction vector.\n\t * @param {Vector3} vTo - The second (normalized) direction vector.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < 1e-8 ) { // the epsilon value has been discussed in #31286\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\t/**\n\t * Returns the angle between this quaternion and the given one in radians.\n\t *\n\t * @param {Quaternion} q - The quaternion to compute the angle with.\n\t * @return {number} The angle in radians.\n\t */\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), -1, 1 ) ) );\n\n\t}\n\n\t/**\n\t * Rotates this quaternion by a given angular step to the given quaternion.\n\t * The method ensures that the final quaternion will not overshoot `q`.\n\t *\n\t * @param {Quaternion} q - The target quaternion.\n\t * @param {number} step - The angular step in radians.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this quaternion to the identity quaternion; that is, to the\n\t * quaternion that represents \"no rotation\".\n\t *\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\t/**\n\t * Inverts this quaternion via {@link Quaternion#conjugate}. The\n\t * quaternion is assumed to have unit length.\n\t *\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tinvert() {\n\n\t\treturn this.conjugate();\n\n\t}\n\n\t/**\n\t * Returns the rotational conjugate of this quaternion. The conjugate of a\n\t * quaternion represents the same rotation in the opposite direction about\n\t * the rotational axis.\n\t *\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tconjugate() {\n\n\t\tthis._x *= -1;\n\t\tthis._y *= -1;\n\t\tthis._z *= -1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of this quaternion and the given one.\n\t *\n\t * @param {Quaternion} v - The quaternion to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\t/**\n\t * Computes the squared Euclidean length (straight-line length) of this quaternion,\n\t * considered as a 4 dimensional vector. This can be useful if you are comparing the\n\t * lengths of two quaternions, as this is a slightly more efficient calculation than\n\t * {@link Quaternion#length}.\n\t *\n\t * @return {number} The squared Euclidean length.\n\t */\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) of this quaternion,\n\t * considered as a 4 dimensional vector.\n\t *\n\t * @return {number} The Euclidean length.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\t/**\n\t * Normalizes this quaternion - that is, calculated the quaternion that performs\n\t * the same rotation as this one, but has a length equal to `1`.\n\t *\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies this quaternion by the given one.\n\t *\n\t * @param {Quaternion} q - The quaternion.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\t/**\n\t * Pre-multiplies this quaternion by the given one.\n\t *\n\t * @param {Quaternion} q - The quaternion.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\t/**\n\t * Multiplies the given quaternions and stores the result in this instance.\n\t *\n\t * @param {Quaternion} a - The first quaternion.\n\t * @param {Quaternion} b - The second quaternion.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Performs a spherical linear interpolation between this quaternion and the target quaternion.\n\t *\n\t * @param {Quaternion} qb - The target quaternion.\n\t * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tslerp( qb, t ) {\n\n\t\tlet x = qb._x, y = qb._y, z = qb._z, w = qb._w;\n\n\t\tlet dot = this.dot( qb );\n\n\t\tif ( dot < 0 ) {\n\n\t\t\tx = - x;\n\t\t\ty = - y;\n\t\t\tz = - z;\n\t\t\tw = - w;\n\n\t\t\tdot = - dot;\n\n\t\t}\n\n\t\tlet s = 1 - t;\n\n\t\tif ( dot < 0.9995 ) {\n\n\t\t\t// slerp\n\n\t\t\tconst theta = Math.acos( dot );\n\t\t\tconst sin = Math.sin( theta );\n\n\t\t\ts = Math.sin( s * theta ) / sin;\n\t\t\tt = Math.sin( t * theta ) / sin;\n\n\t\t\tthis._x = this._x * s + x * t;\n\t\t\tthis._y = this._y * s + y * t;\n\t\t\tthis._z = this._z * s + z * t;\n\t\t\tthis._w = this._w * s + w * t;\n\n\t\t\tthis._onChangeCallback();\n\n\t\t} else {\n\n\t\t\t// for small angles, lerp then normalize\n\n\t\t\tthis._x = this._x * s + x * t;\n\t\t\tthis._y = this._y * s + y * t;\n\t\t\tthis._z = this._z * s + z * t;\n\t\t\tthis._w = this._w * s + w * t;\n\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Performs a spherical linear interpolation between the given quaternions\n\t * and stores the result in this quaternion.\n\t *\n\t * @param {Quaternion} qa - The source quaternion.\n\t * @param {Quaternion} qb - The target quaternion.\n\t * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\t/**\n\t * Sets this quaternion to a uniformly random, normalized quaternion.\n\t *\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\trandom() {\n\n\t\t// Ken Shoemake\n\t\t// Uniform random rotations\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\n\n\t\tconst theta1 = 2 * Math.PI * Math.random();\n\t\tconst theta2 = 2 * Math.PI * Math.random();\n\n\t\tconst x0 = Math.random();\n\t\tconst r1 = Math.sqrt( 1 - x0 );\n\t\tconst r2 = Math.sqrt( x0 );\n\n\t\treturn this.set(\n\t\t\tr1 * Math.sin( theta1 ),\n\t\t\tr1 * Math.cos( theta1 ),\n\t\t\tr2 * Math.sin( theta2 ),\n\t\t\tr2 * Math.cos( theta2 ),\n\t\t);\n\n\t}\n\n\t/**\n\t * Returns `true` if this quaternion is equal with the given one.\n\t *\n\t * @param {Quaternion} quaternion - The quaternion to test for equality.\n\t * @return {boolean} Whether this quaternion is equal with the given one.\n\t */\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\t/**\n\t * Sets this quaternion's components from the given array.\n\t *\n\t * @param {Array<number>} array - An array holding the quaternion component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this quaternion to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the quaternion components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The quaternion components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this quaternion from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding quaternion data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Quaternion} A reference to this quaternion.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * This methods defines the serialization result of this class. Returns the\n\t * numerical elements of this quaternion in an array of format `[x, y, z, w]`.\n\t *\n\t * @return {Array<number>} The serialized quaternion.\n\t */\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\n/**\n * Class representing a 3D vector. A 3D vector is an ordered triplet of numbers\n * (labeled x, y and z), which can be used to represent a number of things, such as:\n *\n * - A point in 3D space.\n * - A direction and length in 3D space. In three.js the length will\n * always be the Euclidean distance(straight-line distance) from `(0, 0, 0)` to `(x, y, z)`\n * and the direction is also measured from `(0, 0, 0)` towards `(x, y, z)`.\n * - Any arbitrary ordered triplet of numbers.\n *\n * There are other things a 3D vector can be used to represent, such as\n * momentum vectors and so on, however these are the most\n * common uses in three.js.\n *\n * Iterating through a vector instance will yield its components `(x, y, z)` in\n * the corresponding order.\n * ```js\n * const a = new THREE.Vector3( 0, 1, 0 );\n *\n * //no arguments; will be initialised to (0, 0, 0)\n * const b = new THREE.Vector3( );\n *\n * const d = a.distanceTo( b );\n * ```\n */\nclass Vector3 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tVector3.prototype.isVector3 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 3D vector.\n\t *\n\t * @param {number} [x=0] - The x value of this vector.\n\t * @param {number} [y=0] - The y value of this vector.\n\t * @param {number} [z=0] - The z value of this vector.\n\t */\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\t/**\n\t\t * The x value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.x = x;\n\n\t\t/**\n\t\t * The y value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.y = y;\n\n\t\t/**\n\t\t * The z value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.z = z;\n\n\t}\n\n\t/**\n\t * Sets the vector components.\n\t *\n\t * @param {number} x - The value of the x component.\n\t * @param {number} y - The value of the y component.\n\t * @param {number} z - The value of the z component.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the same value.\n\t *\n\t * @param {number} scalar - The value to set for all vector components.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's x component to the given value.\n\t *\n\t * @param {number} x - The value to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's y component to the given value.\n\t *\n\t * @param {number} y - The value to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's z component to the given value.\n\t *\n\t * @param {number} z - The value to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Allows to set a vector component with an index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z.\n\t * @param {number} value - The value to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the value of the vector component which matches the given index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z.\n\t * @return {number} A vector component value.\n\t */\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new vector with copied values from this instance.\n\t *\n\t * @return {Vector3} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\t/**\n\t * Copies the values of the given vector to this instance.\n\t *\n\t * @param {Vector3} v - The vector to copy.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector to this instance.\n\t *\n\t * @param {Vector3} v - The vector to add.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to all components of this instance.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector3} a - The first vector.\n\t * @param {Vector3} b - The second vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector scaled by the given factor to this instance.\n\t *\n\t * @param {Vector3|Vector4} v - The vector.\n\t * @param {number} s - The factor that scales `v`.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vector from this instance.\n\t *\n\t * @param {Vector3} v - The vector to subtract.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given scalar value from all components of this instance.\n\t *\n\t * @param {number} s - The scalar to subtract.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector3} a - The first vector.\n\t * @param {Vector3} b - The second vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vector with this instance.\n\t *\n\t * @param {Vector3} v - The vector to multiply.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with all components of this instance.\n\t *\n\t * @param {number} scalar - The scalar to multiply.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector3} a - The first vector.\n\t * @param {Vector3} b - The second vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given Euler rotation to this vector.\n\t *\n\t * @param {Euler} euler - The Euler angles.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$5.setFromEuler( euler ) );\n\n\t}\n\n\t/**\n\t * Applies a rotation specified by an axis and an angle to this vector.\n\t *\n\t * @param {Vector3} axis - A normalized vector representing the rotation axis.\n\t * @param {number} angle - The angle in radians.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$5.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\t/**\n\t * Multiplies this vector with the given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The 3x3 matrix.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies this vector by the given normal matrix and normalizes\n\t * the result.\n\t *\n\t * @param {Matrix3} m - The normal matrix.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\t/**\n\t * Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and\n\t * divides by perspective.\n\t *\n\t * @param {Matrix4} m - The matrix to apply.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given Quaternion to this vector.\n\t *\n\t * @param {Quaternion} q - The Quaternion.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Projects this vector from world space into the camera's normalized\n\t * device coordinate (NDC) space.\n\t *\n\t * @param {Camera} camera - The camera.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\t/**\n\t * Unprojects this vector from the camera's normalized device coordinate (NDC)\n\t * space into world space.\n\t *\n\t * @param {Camera} camera - The camera.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\t/**\n\t * Transforms the direction of this vector by a matrix (the upper left 3 x 3\n\t * subset of the given 4x4 matrix and then normalizes the result.\n\t *\n\t * @param {Matrix4} m - The matrix.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\t/**\n\t * Divides this instance by the given vector.\n\t *\n\t * @param {Vector3} v - The vector to divide.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this vector by the given scalar.\n\t *\n\t * @param {number} scalar - The scalar to divide.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\t/**\n\t * If this vector's x, y or z value is greater than the given vector's x, y or z\n\t * value, replace that value with the corresponding min value.\n\t *\n\t * @param {Vector3} v - The vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y or z value is less than the given vector's x, y or z\n\t * value, replace that value with the corresponding max value.\n\t *\n\t * @param {Vector3} v - The vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y or z value is greater than the max vector's x, y or z\n\t * value, it is replaced by the corresponding value.\n\t * If this vector's x, y or z value is less than the min vector's x, y or z value,\n\t * it is replaced by the corresponding value.\n\t *\n\t * @param {Vector3} min - The minimum x, y and z values.\n\t * @param {Vector3} max - The maximum x, y and z values in the desired range.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = clamp( this.x, min.x, max.x );\n\t\tthis.y = clamp( this.y, min.y, max.y );\n\t\tthis.z = clamp( this.z, min.z, max.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y or z values are greater than the max value, they are\n\t * replaced by the max value.\n\t * If this vector's x, y or z values are less than the min value, they are\n\t * replaced by the min value.\n\t *\n\t * @param {number} minVal - The minimum value the components will be clamped to.\n\t * @param {number} maxVal - The maximum value the components will be clamped to.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = clamp( this.x, minVal, maxVal );\n\t\tthis.y = clamp( this.y, minVal, maxVal );\n\t\tthis.z = clamp( this.z, minVal, maxVal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's length is greater than the max value, it is replaced by\n\t * the max value.\n\t * If this vector's length is less than the min value, it is replaced by the\n\t * min value.\n\t *\n\t * @param {number} min - The minimum value the vector length will be clamped to.\n\t * @param {number} max - The maximum value the vector length will be clamped to.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded down to the nearest integer value.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded up to the nearest integer value.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded to the nearest integer value\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded towards zero (up if negative,\n\t * down if positive) to an integer value.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this vector - i.e. sets x = -x, y = -y and z = -z.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of the given vector with this instance.\n\t *\n\t * @param {Vector3} v - The vector to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t/**\n\t * Computes the square of the Euclidean length (straight-line length) from\n\t * (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should\n\t * compare the length squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @return {number} The square length of this vector.\n\t */\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\t/**\n\t * Computes the Manhattan length of this vector.\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\t/**\n\t * Converts this vector to a unit vector - that is, sets it equal to a vector\n\t * with the same direction as this one, but with a vector length of `1`.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\t/**\n\t * Sets this vector to a vector with the same direction as this one, but\n\t * with the specified length.\n\t *\n\t * @param {number} length - The new length of this vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vector and this instance, where\n\t * alpha is the percent distance along the line - alpha = 0 will be this\n\t * vector, and alpha = 1 will be the given one.\n\t *\n\t * @param {Vector3} v - The vector to interpolate towards.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vectors, where alpha is the percent\n\t * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n\t * be the second one. The result is stored in this instance.\n\t *\n\t * @param {Vector3} v1 - The first vector.\n\t * @param {Vector3} v2 - The second vector.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the cross product of the given vector with this instance.\n\t *\n\t * @param {Vector3} v - The vector to compute the cross product with.\n\t * @return {Vector3} The result of the cross product.\n\t */\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\t/**\n\t * Calculates the cross product of the given vectors and stores the result\n\t * in this instance.\n\t *\n\t * @param {Vector3} a - The first vector.\n\t * @param {Vector3} b - The second vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Projects this vector onto the given one.\n\t *\n\t * @param {Vector3} v - The vector to project to.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\t/**\n\t * Projects this vector onto a plane by subtracting this\n\t * vector projected onto the plane's normal from this vector.\n\t *\n\t * @param {Vector3} planeNormal - The plane normal.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\n\n\t}\n\n\t/**\n\t * Reflects this vector off a plane orthogonal to the given normal vector.\n\t *\n\t * @param {Vector3} normal - The (normalized) normal vector.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\treflect( normal ) {\n\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\t/**\n\t * Returns the angle between the given vector and this instance in radians.\n\t *\n\t * @param {Vector3} v - The vector to compute the angle with.\n\t * @return {number} The angle in radians.\n\t */\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, -1, 1 ) );\n\n\t}\n\n\t/**\n\t * Computes the distance from the given vector to this instance.\n\t *\n\t * @param {Vector3} v - The vector to compute the distance to.\n\t * @return {number} The distance.\n\t */\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\t/**\n\t * Computes the squared distance from the given vector to this instance.\n\t * If you are just comparing the distance with another distance, you should compare\n\t * the distance squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @param {Vector3} v - The vector to compute the squared distance to.\n\t * @return {number} The squared distance.\n\t */\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\t/**\n\t * Computes the Manhattan distance from the given vector to this instance.\n\t *\n\t * @param {Vector3} v - The vector to compute the Manhattan distance to.\n\t * @return {number} The Manhattan distance.\n\t */\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\t/**\n\t * Sets the vector components from the given spherical coordinates.\n\t *\n\t * @param {Spherical} s - The spherical coordinates.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\t/**\n\t * Sets the vector components from the given spherical coordinates.\n\t *\n\t * @param {number} radius - The radius.\n\t * @param {number} phi - The phi angle in radians.\n\t * @param {number} theta - The theta angle in radians.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components from the given cylindrical coordinates.\n\t *\n\t * @param {Cylindrical} c - The cylindrical coordinates.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\t/**\n\t * Sets the vector components from the given cylindrical coordinates.\n\t *\n\t * @param {number} radius - The radius.\n\t * @param {number} theta - The theta angle in radians.\n\t * @param {number} y - The y value.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the position elements of the\n\t * given transformation matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the scale elements of the\n\t * given transformation matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components from the specified matrix column.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @param {number} index - The column index.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\t/**\n\t * Sets the vector components from the specified matrix column.\n\t *\n\t * @param {Matrix3} m - The 3x3 matrix.\n\t * @param {number} index - The column index.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\t/**\n\t * Sets the vector components from the given Euler angles.\n\t *\n\t * @param {Euler} e - The Euler angles to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components from the RGB components of the\n\t * given color.\n\t *\n\t * @param {Color} c - The color to set.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this vector is equal with the given one.\n\t *\n\t * @param {Vector3} v - The vector to test for equality.\n\t * @return {boolean} Whether this vector is equal with the given one.\n\t */\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\t/**\n\t * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`\n\t * and z value to be `array[ offset + 2 ]`.\n\t *\n\t * @param {Array<number>} array - An array holding the vector component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this vector to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the vector components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The vector components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this vector from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Vector3} A reference to this vector.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets each component of this vector to a pseudo-random value between `0` and\n\t * `1`, excluding `1`.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this vector to a uniformly random point on a unit sphere.\n\t *\n\t * @return {Vector3} A reference to this vector.\n\t */\n\trandomDirection() {\n\n\t\t// https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst theta = Math.random() * Math.PI * 2;\n\t\tconst u = Math.random() * 2 - 1;\n\t\tconst c = Math.sqrt( 1 - u * u );\n\n\t\tthis.x = c * Math.cos( theta );\n\t\tthis.y = u;\n\t\tthis.z = c * Math.sin( theta );\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$c = /*@__PURE__*/ new Vector3();\nconst _quaternion$5 = /*@__PURE__*/ new Quaternion();\n\n/**\n * Represents a 3x3 matrix.\n *\n * A Note on Row-Major and Column-Major Ordering:\n *\n * The constructor and {@link Matrix3#set} method take arguments in\n * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)\n * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.\n * This means that calling:\n * ```js\n * const m = new THREE.Matrix();\n * m.set( 11, 12, 13,\n * 21, 22, 23,\n * 31, 32, 33 );\n * ```\n * will result in the elements array containing:\n * ```js\n * m.elements = [ 11, 21, 31,\n * 12, 22, 32,\n * 13, 23, 33 ];\n * ```\n * and internally all calculations are performed using column-major ordering.\n * However, as the actual ordering makes no difference mathematically and\n * most people are used to thinking about matrices in row-major order, the\n * three.js documentation shows matrices in row-major order. Just bear in\n * mind that if you are reading the source code, you'll have to take the\n * transpose of any matrices outlined here to make sense of the calculations.\n */\nclass Matrix3 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 3x3 matrix. The arguments are supposed to be\n\t * in row-major order. If no arguments are provided, the constructor\n\t * initializes the matrix as an identity matrix.\n\t *\n\t * @param {number} [n11] - 1-1 matrix element.\n\t * @param {number} [n12] - 1-2 matrix element.\n\t * @param {number} [n13] - 1-3 matrix element.\n\t * @param {number} [n21] - 2-1 matrix element.\n\t * @param {number} [n22] - 2-2 matrix element.\n\t * @param {number} [n23] - 2-3 matrix element.\n\t * @param {number} [n31] - 3-1 matrix element.\n\t * @param {number} [n32] - 3-2 matrix element.\n\t * @param {number} [n33] - 3-3 matrix element.\n\t */\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\t/**\n\t\t * A column-major list of matrix values.\n\t\t *\n\t\t * @type {Array<number>}\n\t\t */\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix.The arguments are supposed to be\n\t * in row-major order.\n\t *\n\t * @param {number} [n11] - 1-1 matrix element.\n\t * @param {number} [n12] - 1-2 matrix element.\n\t * @param {number} [n13] - 1-3 matrix element.\n\t * @param {number} [n21] - 2-1 matrix element.\n\t * @param {number} [n22] - 2-2 matrix element.\n\t * @param {number} [n23] - 2-3 matrix element.\n\t * @param {number} [n31] - 3-1 matrix element.\n\t * @param {number} [n32] - 3-2 matrix element.\n\t * @param {number} [n33] - 3-3 matrix element.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix to the 3x3 identity matrix.\n\t *\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given matrix to this instance.\n\t *\n\t * @param {Matrix3} m - The matrix to copy.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Extracts the basis of this matrix into the three axis vectors provided.\n\t *\n\t * @param {Vector3} xAxis - The basis's x axis.\n\t * @param {Vector3} yAxis - The basis's y axis.\n\t * @param {Vector3} zAxis - The basis's z axis.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Set this matrix to the upper 3x3 matrix of the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Post-multiplies this matrix by the given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The matrix to multiply with.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\t/**\n\t * Pre-multiplies this matrix by the given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The matrix to multiply with.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\t/**\n\t * Multiples the given 3x3 matrices and stores the result\n\t * in this matrix.\n\t *\n\t * @param {Matrix3} a - The first matrix.\n\t * @param {Matrix3} b - The second matrix.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies every component of the matrix by the given scalar.\n\t *\n\t * @param {number} s - The scalar.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes and returns the determinant of this matrix.\n\t *\n\t * @return {number} The determinant.\n\t */\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\t/**\n\t * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).\n\t * You can not invert with a determinant of zero. If you attempt this, the method produces\n\t * a zero matrix instead.\n\t *\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Transposes this matrix in place.\n\t *\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the normal matrix which is the inverse transpose of the upper\n\t * left 3x3 portion of the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} matrix4 - The 4x4 matrix.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\t/**\n\t * Transposes this matrix into the supplied array, and returns itself unchanged.\n\t *\n\t * @param {Array<number>} r - An array to store the transposed matrix elements.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the UV transform matrix from offset, repeat, rotation, and center.\n\t *\n\t * @param {number} tx - Offset x.\n\t * @param {number} ty - Offset y.\n\t * @param {number} sx - Repeat x.\n\t * @param {number} sy - Repeat y.\n\t * @param {number} rotation - Rotation, in radians. Positive values rotate counterclockwise.\n\t * @param {number} cx - Center x of rotation.\n\t * @param {number} cy - Center y of rotation\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Scales this matrix with the given scalar values.\n\t *\n\t * @param {number} sx - The amount to scale in the X axis.\n\t * @param {number} sy - The amount to scale in the Y axis.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates this matrix by the given angle.\n\t *\n\t * @param {number} theta - The rotation in radians.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Translates this matrix by the given scalar values.\n\t *\n\t * @param {number} tx - The amount to translate in the X axis.\n\t * @param {number} ty - The amount to translate in the Y axis.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\t/**\n\t * Sets this matrix as a 2D translation transform.\n\t *\n\t * @param {number|Vector2} x - The amount to translate in the X axis or alternatively a translation vector.\n\t * @param {number} y - The amount to translate in the Y axis.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a 2D rotational transformation.\n\t *\n\t * @param {number} theta - The rotation in radians.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a 2D scale transform.\n\t *\n\t * @param {number} x - The amount to scale in the X axis.\n\t * @param {number} y - The amount to scale in the Y axis.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this matrix is equal with the given one.\n\t *\n\t * @param {Matrix3} matrix - The matrix to test for equality.\n\t * @return {boolean} Whether this matrix is equal with the given one.\n\t */\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix from the given array.\n\t *\n\t * @param {Array<number>} array - The matrix elements in column-major order.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Matrix3} A reference to this matrix.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the elements of this matrix to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the matrix elements in column-major order.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The matrix elements in column-major order.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Returns a matrix with copied values from this instance.\n\t *\n\t * @return {Matrix3} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nconst LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(\n\t0.4123908, 0.3575843, 0.1804808,\n\t0.2126390, 0.7151687, 0.0721923,\n\t0.0193308, 0.1191948, 0.9505322\n);\n\nconst XYZ_TO_LINEAR_REC709 = /*@__PURE__*/ new Matrix3().set(\n\t3.2409699, -1.5373832, -0.4986108,\n\t-0.9692436, 1.8759675, 0.0415551,\n\t0.0556301, -0.203977, 1.0569715\n);\n\nfunction createColorManagement() {\n\n\tconst ColorManagement = {\n\n\t\tenabled: true,\n\n\t\tworkingColorSpace: LinearSRGBColorSpace,\n\n\t\t/**\n\t\t * Implementations of supported color spaces.\n\t\t *\n\t\t * Required:\n\t\t *\t- primaries: chromaticity coordinates [ rx ry gx gy bx by ]\n\t\t *\t- whitePoint: reference white [ x y ]\n\t\t *\t- transfer: transfer function (pre-defined)\n\t\t *\t- toXYZ: Matrix3 RGB to XYZ transform\n\t\t *\t- fromXYZ: Matrix3 XYZ to RGB transform\n\t\t *\t- luminanceCoefficients: RGB luminance coefficients\n\t\t *\n\t\t * Optional:\n\t\t * - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }\n\t\t * - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }\n\t\t *\n\t\t * Reference:\n\t\t * - https://www.russellcottrell.com/photo/matrixCalculator.htm\n\t\t */\n\t\tspaces: {},\n\n\t\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\t\treturn color;\n\n\t\t\t}\n\n\t\t\tif ( this.spaces[ sourceColorSpace ].transfer === SRGBTransfer ) {\n\n\t\t\t\tcolor.r = SRGBToLinear( color.r );\n\t\t\t\tcolor.g = SRGBToLinear( color.g );\n\t\t\t\tcolor.b = SRGBToLinear( color.b );\n\n\t\t\t}\n\n\t\t\tif ( this.spaces[ sourceColorSpace ].primaries !== this.spaces[ targetColorSpace ].primaries ) {\n\n\t\t\t\tcolor.applyMatrix3( this.spaces[ sourceColorSpace ].toXYZ );\n\t\t\t\tcolor.applyMatrix3( this.spaces[ targetColorSpace ].fromXYZ );\n\n\t\t\t}\n\n\t\t\tif ( this.spaces[ targetColorSpace ].transfer === SRGBTransfer ) {\n\n\t\t\t\tcolor.r = LinearToSRGB( color.r );\n\t\t\t\tcolor.g = LinearToSRGB( color.g );\n\t\t\t\tcolor.b = LinearToSRGB( color.b );\n\n\t\t\t}\n\n\t\t\treturn color;\n\n\t\t},\n\n\t\tworkingToColorSpace: function ( color, targetColorSpace ) {\n\n\t\t\treturn this.convert( color, this.workingColorSpace, targetColorSpace );\n\n\t\t},\n\n\t\tcolorSpaceToWorking: function ( color, sourceColorSpace ) {\n\n\t\t\treturn this.convert( color, sourceColorSpace, this.workingColorSpace );\n\n\t\t},\n\n\t\tgetPrimaries: function ( colorSpace ) {\n\n\t\t\treturn this.spaces[ colorSpace ].primaries;\n\n\t\t},\n\n\t\tgetTransfer: function ( colorSpace ) {\n\n\t\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\t\treturn this.spaces[ colorSpace ].transfer;\n\n\t\t},\n\n\t\tgetToneMappingMode: function ( colorSpace ) {\n\n\t\t\treturn this.spaces[ colorSpace ].outputColorSpaceConfig.toneMappingMode || 'standard';\n\n\t\t},\n\n\t\tgetLuminanceCoefficients: function ( target, colorSpace = this.workingColorSpace ) {\n\n\t\t\treturn target.fromArray( this.spaces[ colorSpace ].luminanceCoefficients );\n\n\t\t},\n\n\t\tdefine: function ( colorSpaces ) {\n\n\t\t\tObject.assign( this.spaces, colorSpaces );\n\n\t\t},\n\n\t\t// Internal APIs\n\n\t\t_getMatrix: function ( targetMatrix, sourceColorSpace, targetColorSpace ) {\n\n\t\t\treturn targetMatrix\n\t\t\t\t.copy( this.spaces[ sourceColorSpace ].toXYZ )\n\t\t\t\t.multiply( this.spaces[ targetColorSpace ].fromXYZ );\n\n\t\t},\n\n\t\t_getDrawingBufferColorSpace: function ( colorSpace ) {\n\n\t\t\treturn this.spaces[ colorSpace ].outputColorSpaceConfig.drawingBufferColorSpace;\n\n\t\t},\n\n\t\t_getUnpackColorSpace: function ( colorSpace = this.workingColorSpace ) {\n\n\t\t\treturn this.spaces[ colorSpace ].workingColorSpaceConfig.unpackColorSpace;\n\n\t\t},\n\n\t\t// Deprecated\n\n\t\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\t\twarnOnce( 'ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().' ); // @deprecated, r177\n\n\t\t\treturn ColorManagement.workingToColorSpace( color, targetColorSpace );\n\n\t\t},\n\n\t\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\t\twarnOnce( 'ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().' ); // @deprecated, r177\n\n\t\t\treturn ColorManagement.colorSpaceToWorking( color, sourceColorSpace );\n\n\t\t},\n\n\t};\n\n\t/******************************************************************************\n\t * sRGB definitions\n\t */\n\n\tconst REC709_PRIMARIES = [ 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 ];\n\tconst REC709_LUMINANCE_COEFFICIENTS = [ 0.2126, 0.7152, 0.0722 ];\n\tconst D65 = [ 0.3127, 0.3290 ];\n\n\tColorManagement.define( {\n\n\t\t[ LinearSRGBColorSpace ]: {\n\t\t\tprimaries: REC709_PRIMARIES,\n\t\t\twhitePoint: D65,\n\t\t\ttransfer: LinearTransfer,\n\t\t\ttoXYZ: LINEAR_REC709_TO_XYZ,\n\t\t\tfromXYZ: XYZ_TO_LINEAR_REC709,\n\t\t\tluminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,\n\t\t\tworkingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace },\n\t\t\toutputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }\n\t\t},\n\n\t\t[ SRGBColorSpace ]: {\n\t\t\tprimaries: REC709_PRIMARIES,\n\t\t\twhitePoint: D65,\n\t\t\ttransfer: SRGBTransfer,\n\t\t\ttoXYZ: LINEAR_REC709_TO_XYZ,\n\t\t\tfromXYZ: XYZ_TO_LINEAR_REC709,\n\t\t\tluminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,\n\t\t\toutputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }\n\t\t},\n\n\t} );\n\n\treturn ColorManagement;\n\n}\n\nconst ColorManagement = /*@__PURE__*/ createColorManagement();\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nlet _canvas;\n\n/**\n * A class containing utility functions for images.\n *\n * @hideconstructor\n */\nclass ImageUtils {\n\n\t/**\n\t * Returns a data URI containing a representation of the given image.\n\t *\n\t * @param {(HTMLImageElement|HTMLCanvasElement)} image - The image object.\n\t * @param {string} [type='image/png'] - Indicates the image format.\n\t * @return {string} The data URI.\n\t */\n\tstatic getDataURL( image, type = 'image/png' ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\treturn canvas.toDataURL( type );\n\n\t}\n\n\t/**\n\t * Converts the given sRGB image data to linear color space.\n\t *\n\t * @param {(HTMLImageElement|HTMLCanvasElement|ImageBitmap|Object)} image - The image object.\n\t * @return {HTMLCanvasElement|Object} The converted image.\n\t */\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\twarn( 'ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet _sourceId = 0;\n\n/**\n * Represents the data source of a texture.\n *\n * The main purpose of this class is to decouple the data definition from the texture\n * definition so the same data can be used with multiple texture instances.\n */\nclass Source {\n\n\t/**\n\t * Constructs a new video texture.\n\t *\n\t * @param {any} [data=null] - The data definition of a texture.\n\t */\n\tconstructor( data = null ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSource = true;\n\n\t\t/**\n\t\t * The ID of the source.\n\t\t *\n\t\t * @name Source#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\t/**\n\t\t * The UUID of the source.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * The data definition of a texture.\n\t\t *\n\t\t * @type {any}\n\t\t */\n\t\tthis.data = data;\n\n\t\t/**\n\t\t * This property is only relevant when {@link Source#needsUpdate} is set to `true` and\n\t\t * provides more control on how texture data should be processed. When `dataReady` is set\n\t\t * to `false`, the engine performs the memory allocation (if necessary) but does not transfer\n\t\t * the data into the GPU memory.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.dataReady = true;\n\n\t\t/**\n\t\t * This starts at `0` and counts how many times {@link Source#needsUpdate} is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t * @default 0\n\t\t */\n\t\tthis.version = 0;\n\n\t}\n\n\t/**\n\t * Returns the dimensions of the source into the given target vector.\n\t *\n\t * @param {(Vector2|Vector3)} target - The target object the result is written into.\n\t * @return {(Vector2|Vector3)} The dimensions of the source.\n\t */\n\tgetSize( target ) {\n\n\t\tconst data = this.data;\n\n\t\tif ( ( typeof HTMLVideoElement !== 'undefined' ) && ( data instanceof HTMLVideoElement ) ) {\n\n\t\t\ttarget.set( data.videoWidth, data.videoHeight, 0 );\n\n\t\t} else if ( ( typeof VideoFrame !== 'undefined' ) && ( data instanceof VideoFrame ) ) {\n\n\t\t\ttarget.set( data.displayWidth, data.displayHeight, 0 );\n\n\t\t} else if ( data !== null ) {\n\n\t\t\ttarget.set( data.width, data.height, data.depth || 0 );\n\n\t\t} else {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * When the property is set to `true`, the engine allocates the memory\n\t * for the texture (if necessary) and triggers the actual texture upload\n\t * to the GPU next time the source is used.\n\t *\n\t * @type {boolean}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\t/**\n\t * Serializes the source into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized source.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\twarn( 'Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet _textureId = 0;\n\nconst _tempVec3 = /*@__PURE__*/ new Vector3();\n\n/**\n * Base class for all textures.\n *\n * Note: After the initial use of a texture, its dimensions, format, and type\n * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one.\n *\n * @augments EventDispatcher\n */\nclass Texture extends EventDispatcher {\n\n\t/**\n\t * Constructs a new texture.\n\t *\n\t * @param {?Object} [image=Texture.DEFAULT_IMAGE] - The image holding the texture data.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {string} [colorSpace=NoColorSpace] - The color space.\n\t */\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isTexture = true;\n\n\t\t/**\n\t\t * The ID of the texture.\n\t\t *\n\t\t * @name Texture#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\t/**\n\t\t * The UUID of the texture.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * The name of the texture.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The data definition of a texture. A reference to the data source can be\n\t\t * shared across textures. This is often useful in context of spritesheets\n\t\t * where multiple textures render the same data but with different texture\n\t\t * transformations.\n\t\t *\n\t\t * @type {Source}\n\t\t */\n\t\tthis.source = new Source( image );\n\n\t\t/**\n\t\t * An array holding user-defined mipmaps.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.mipmaps = [];\n\n\t\t/**\n\t\t * How the texture is applied to the object. The value `UVMapping`\n\t\t * is the default, where texture or uv coordinates are used to apply the map.\n\t\t *\n\t\t * @type {(UVMapping|CubeReflectionMapping|CubeRefractionMapping|EquirectangularReflectionMapping|EquirectangularRefractionMapping|CubeUVReflectionMapping)}\n\t\t * @default UVMapping\n\t\t*/\n\t\tthis.mapping = mapping;\n\n\t\t/**\n\t\t * Lets you select the uv attribute to map the texture to. `0` for `uv`,\n\t\t * `1` for `uv1`, `2` for `uv2` and `3` for `uv3`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.channel = 0;\n\n\t\t/**\n\t\t * This defines how the texture is wrapped horizontally and corresponds to\n\t\t * *U* in UV mapping.\n\t\t *\n\t\t * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}\n\t\t * @default ClampToEdgeWrapping\n\t\t */\n\t\tthis.wrapS = wrapS;\n\n\t\t/**\n\t\t * This defines how the texture is wrapped horizontally and corresponds to\n\t\t * *V* in UV mapping.\n\t\t *\n\t\t * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}\n\t\t * @default ClampToEdgeWrapping\n\t\t */\n\t\tthis.wrapT = wrapT;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers more than one pixel.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default LinearFilter\n\t\t */\n\t\tthis.magFilter = magFilter;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers less than one pixel.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default LinearMipmapLinearFilter\n\t\t */\n\t\tthis.minFilter = minFilter;\n\n\t\t/**\n\t\t * The number of samples taken along the axis through the pixel that has the\n\t\t * highest density of texels. By default, this value is `1`. A higher value\n\t\t * gives a less blurry result than a basic mipmap, at the cost of more\n\t\t * texture samples being used.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Texture.DEFAULT_ANISOTROPY\n\t\t */\n\t\tthis.anisotropy = anisotropy;\n\n\t\t/**\n\t\t * The format of the texture.\n\t\t *\n\t\t * @type {number}\n\t\t * @default RGBAFormat\n\t\t */\n\t\tthis.format = format;\n\n\t\t/**\n\t\t * The default internal format is derived from {@link Texture#format} and {@link Texture#type} and\n\t\t * defines how the texture data is going to be stored on the GPU.\n\t\t *\n\t\t * This property allows to overwrite the default format.\n\t\t *\n\t\t * @type {?string}\n\t\t * @default null\n\t\t */\n\t\tthis.internalFormat = null;\n\n\t\t/**\n\t\t * The data type of the texture.\n\t\t *\n\t\t * @type {number}\n\t\t * @default UnsignedByteType\n\t\t */\n\t\tthis.type = type;\n\n\t\t/**\n\t\t * How much a single repetition of the texture is offset from the beginning,\n\t\t * in each direction U and V. Typical range is `0.0` to `1.0`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (0,0)\n\t\t */\n\t\tthis.offset = new Vector2( 0, 0 );\n\n\t\t/**\n\t\t * How many times the texture is repeated across the surface, in each\n\t\t * direction U and V. If repeat is set greater than `1` in either direction,\n\t\t * the corresponding wrap parameter should also be set to `RepeatWrapping`\n\t\t * or `MirroredRepeatWrapping` to achieve the desired tiling effect.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.repeat = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The point around which rotation occurs. A value of `(0.5, 0.5)` corresponds\n\t\t * to the center of the texture. Default is `(0, 0)`, the lower left.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (0,0)\n\t\t */\n\t\tthis.center = new Vector2( 0, 0 );\n\n\t\t/**\n\t\t * How much the texture is rotated around the center point, in radians.\n\t\t * Positive values are counter-clockwise.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.rotation = 0;\n\n\t\t/**\n\t\t * Whether to update the texture's uv-transformation {@link Texture#matrix}\n\t\t * from the properties {@link Texture#offset}, {@link Texture#repeat},\n\t\t * {@link Texture#rotation}, and {@link Texture#center}.\n\t\t *\n\t\t * Set this to `false` if you are specifying the uv-transform matrix directly.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.matrixAutoUpdate = true;\n\n\t\t/**\n\t\t * The uv-transformation matrix of the texture.\n\t\t *\n\t\t * @type {Matrix3}\n\t\t */\n\t\tthis.matrix = new Matrix3();\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Set this to `false` if you are creating mipmaps manually.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.generateMipmaps = true;\n\n\t\t/**\n\t\t * If set to `true`, the alpha channel, if present, is multiplied into the\n\t\t * color channels when the texture is uploaded to the GPU.\n\t\t *\n\t\t * Note that this property has no effect when using `ImageBitmap`. You need to\n\t\t * configure premultiply alpha on bitmap creation instead.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.premultiplyAlpha = false;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Note that this property has no effect when using `ImageBitmap`. You need to\n\t\t * configure the flip on bitmap creation instead.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.flipY = true;\n\n\t\t/**\n\t\t * Specifies the alignment requirements for the start of each pixel row in memory.\n\t\t * The allowable values are `1` (byte-alignment), `2` (rows aligned to even-numbered bytes),\n\t\t * `4` (word-alignment), and `8` (rows start on double-word boundaries).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 4\n\t\t */\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\t/**\n\t\t * Textures containing color data should be annotated with `SRGBColorSpace` or `LinearSRGBColorSpace`.\n\t\t *\n\t\t * @type {string}\n\t\t * @default NoColorSpace\n\t\t */\n\t\tthis.colorSpace = colorSpace;\n\n\t\t/**\n\t\t * An object that can be used to store custom data about the texture. It\n\t\t * should not hold references to functions as these will not be cloned.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.userData = {};\n\n\t\t/**\n\t\t * This can be used to only update a subregion or specific rows of the texture (for example, just the\n\t\t * first 3 rows). Use the `addUpdateRange()` function to add ranges to this array.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.updateRanges = [];\n\n\t\t/**\n\t\t * This starts at `0` and counts how many times {@link Texture#needsUpdate} is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t * @default 0\n\t\t */\n\t\tthis.version = 0;\n\n\t\t/**\n\t\t * A callback function, called when the texture is updated (e.g., when\n\t\t * {@link Texture#needsUpdate} has been set to true and then the texture is used).\n\t\t *\n\t\t * @type {?Function}\n\t\t * @default null\n\t\t */\n\t\tthis.onUpdate = null;\n\n\t\t/**\n\t\t * An optional back reference to the textures render target.\n\t\t *\n\t\t * @type {?(RenderTarget|WebGLRenderTarget)}\n\t\t * @default null\n\t\t */\n\t\tthis.renderTarget = null;\n\n\t\t/**\n\t\t * Indicates whether a texture belongs to a render target or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default false\n\t\t */\n\t\tthis.isRenderTargetTexture = false;\n\n\t\t/**\n\t\t * Indicates if a texture should be handled like a texture array.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default false\n\t\t */\n\t\tthis.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;\n\n\t\t/**\n\t\t * Indicates whether this texture should be processed by `PMREMGenerator` or not\n\t\t * (only relevant for render target textures).\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t * @default 0\n\t\t */\n\t\tthis.pmremVersion = 0;\n\n\t\t/**\n\t\t * Whether the texture should use one of the 16 bit integer formats which are normalized\n\t\t * to [0, 1] or [-1, 1] (depending on signed/unsigned) when sampled.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.normalized = false;\n\n\t}\n\n\t/**\n\t * The width of the texture in pixels.\n\t */\n\tget width() {\n\n\t\treturn this.source.getSize( _tempVec3 ).x;\n\n\t}\n\n\t/**\n\t * The height of the texture in pixels.\n\t */\n\tget height() {\n\n\t\treturn this.source.getSize( _tempVec3 ).y;\n\n\t}\n\n\t/**\n\t * The depth of the texture in pixels.\n\t */\n\tget depth() {\n\n\t\treturn this.source.getSize( _tempVec3 ).z;\n\n\t}\n\n\t/**\n\t * The image object holding the texture data.\n\t *\n\t * @type {?Object}\n\t */\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\t/**\n\t * Updates the texture transformation matrix from the properties {@link Texture#offset},\n\t * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.\n\t */\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\t/**\n\t * Adds a range of data in the data texture to be updated on the GPU.\n\t *\n\t * @param {number} start - Position at which to start update.\n\t * @param {number} count - The number of components to update.\n\t */\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\t/**\n\t * Clears the update ranges.\n\t */\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\t/**\n\t * Returns a new texture with copied values from this instance.\n\t *\n\t * @return {Texture} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given texture to this instance.\n\t *\n\t * @param {Texture} source - The texture to copy.\n\t * @return {Texture} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.renderTarget = source.renderTarget;\n\t\tthis.isRenderTargetTexture = source.isRenderTargetTexture;\n\t\tthis.isArrayTexture = source.isArrayTexture;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this texture's properties based on `values`.\n\t * @param {Object} values - A container with texture parameters.\n\t */\n\tsetValues( values ) {\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\twarn( `Texture.setValues(): parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\twarn( `Texture.setValues(): property '${ key }' does not exist.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( ( currentValue && newValue ) && ( currentValue.isVector2 && newValue.isVector2 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else if ( ( currentValue && newValue ) && ( currentValue.isVector3 && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else if ( ( currentValue && newValue ) && ( currentValue.isMatrix3 && newValue.isMatrix3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Serializes the texture into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized texture.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tnormalized: this.normalized,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t *\n\t * @fires Texture#dispose\n\t */\n\tdispose() {\n\n\t\t/**\n\t\t * Fires when the texture has been disposed of.\n\t\t *\n\t\t * @event Texture#dispose\n\t\t * @type {Object}\n\t\t */\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\t/**\n\t * Transforms the given uv vector with the textures uv transformation matrix.\n\t *\n\t * @param {Vector2} uv - The uv vector.\n\t * @return {Vector2} The transformed uv vector.\n\t */\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\t/**\n\t * Setting this property to `true` indicates the engine the texture\n\t * must be updated in the next render. This triggers a texture upload\n\t * to the GPU and ensures correct texture parameter configuration.\n\t *\n\t * @type {boolean}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Setting this property to `true` indicates the engine the PMREM\n\t * must be regenerated.\n\t *\n\t * @type {boolean}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsPMREMUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.pmremVersion ++;\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * The default image for all textures.\n *\n * @static\n * @type {?Image}\n * @default null\n */\nTexture.DEFAULT_IMAGE = null;\n\n/**\n * The default mapping for all textures.\n *\n * @static\n * @type {number}\n * @default UVMapping\n */\nTexture.DEFAULT_MAPPING = UVMapping;\n\n/**\n * The default anisotropy value for all textures.\n *\n * @static\n * @type {number}\n * @default 1\n */\nTexture.DEFAULT_ANISOTROPY = 1;\n\n/**\n * Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers\n * (labeled x, y, z and w), which can be used to represent a number of things, such as:\n *\n * - A point in 4D space.\n * - A direction and length in 4D space. In three.js the length will\n * always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)`\n * and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`.\n * - Any arbitrary ordered quadruplet of numbers.\n *\n * There are other things a 4D vector can be used to represent, however these\n * are the most common uses in *three.js*.\n *\n * Iterating through a vector instance will yield its components `(x, y, z, w)` in\n * the corresponding order.\n * ```js\n * const a = new THREE.Vector4( 0, 1, 0, 0 );\n *\n * //no arguments; will be initialised to (0, 0, 0, 1)\n * const b = new THREE.Vector4( );\n *\n * const d = a.dot( b );\n * ```\n */\nclass Vector4 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tVector4.prototype.isVector4 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 4D vector.\n\t *\n\t * @param {number} [x=0] - The x value of this vector.\n\t * @param {number} [y=0] - The y value of this vector.\n\t * @param {number} [z=0] - The z value of this vector.\n\t * @param {number} [w=1] - The w value of this vector.\n\t */\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\t/**\n\t\t * The x value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.x = x;\n\n\t\t/**\n\t\t * The y value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.y = y;\n\n\t\t/**\n\t\t * The z value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.z = z;\n\n\t\t/**\n\t\t * The w value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.w = w;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#z}.\n\t *\n\t * @type {number}\n\t */\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#w}.\n\t *\n\t * @type {number}\n\t */\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\t/**\n\t * Sets the vector components.\n\t *\n\t * @param {number} x - The value of the x component.\n\t * @param {number} y - The value of the y component.\n\t * @param {number} z - The value of the z component.\n\t * @param {number} w - The value of the w component.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the same value.\n\t *\n\t * @param {number} scalar - The value to set for all vector components.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's x component to the given value\n\t *\n\t * @param {number} x - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's y component to the given value\n\t *\n\t * @param {number} y - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's z component to the given value\n\t *\n\t * @param {number} z - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's w component to the given value\n\t *\n\t * @param {number} w - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Allows to set a vector component with an index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @param {number} value - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the value of the vector component which matches the given index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @return {number} A vector component value.\n\t */\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new vector with copied values from this instance.\n\t *\n\t * @return {Vector4} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\t/**\n\t * Copies the values of the given vector to this instance.\n\t *\n\t * @param {Vector3|Vector4} v - The vector to copy.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector to this instance.\n\t *\n\t * @param {Vector4} v - The vector to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to all components of this instance.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector scaled by the given factor to this instance.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @param {number} s - The factor that scales `v`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vector from this instance.\n\t *\n\t * @param {Vector4} v - The vector to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given scalar value from all components of this instance.\n\t *\n\t * @param {number} s - The scalar to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with all components of this instance.\n\t *\n\t * @param {number} scalar - The scalar to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies this vector with the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this instance by the given vector.\n\t *\n\t * @param {Vector4} v - The vector to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\t\tthis.w /= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this vector by the given scalar.\n\t *\n\t * @param {number} scalar - The scalar to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the quaternion's axis and w to the angle.\n\t *\n\t * @param {Quaternion} q - The Quaternion to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the axis of rotation and w to the angle.\n\t *\n\t * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the position elements of the\n\t * given transformation matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\t\tthis.w = e[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding min value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is less than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding max value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w\n\t * value, it is replaced by the corresponding value.\n\t * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value,\n\t * it is replaced by the corresponding value.\n\t *\n\t * @param {Vector4} min - The minimum x, y and z values.\n\t * @param {Vector4} max - The maximum x, y and z values in the desired range.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = clamp( this.x, min.x, max.x );\n\t\tthis.y = clamp( this.y, min.y, max.y );\n\t\tthis.z = clamp( this.z, min.z, max.z );\n\t\tthis.w = clamp( this.w, min.w, max.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w values are greater than the max value, they are\n\t * replaced by the max value.\n\t * If this vector's x, y, z or w values are less than the min value, they are\n\t * replaced by the min value.\n\t *\n\t * @param {number} minVal - The minimum value the components will be clamped to.\n\t * @param {number} maxVal - The maximum value the components will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = clamp( this.x, minVal, maxVal );\n\t\tthis.y = clamp( this.y, minVal, maxVal );\n\t\tthis.z = clamp( this.z, minVal, maxVal );\n\t\tthis.w = clamp( this.w, minVal, maxVal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's length is greater than the max value, it is replaced by\n\t * the max value.\n\t * If this vector's length is less than the min value, it is replaced by the\n\t * min value.\n\t *\n\t * @param {number} min - The minimum value the vector length will be clamped to.\n\t * @param {number} max - The maximum value the vector length will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded down to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded up to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded to the nearest integer value\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded towards zero (up if negative,\n\t * down if positive) to an integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\t/**\n\t * Computes the square of the Euclidean length (straight-line length) from\n\t * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should\n\t * compare the length squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @return {number} The square length of this vector.\n\t */\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\t/**\n\t * Computes the Manhattan length of this vector.\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\t/**\n\t * Converts this vector to a unit vector - that is, sets it equal to a vector\n\t * with the same direction as this one, but with a vector length of `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\t/**\n\t * Sets this vector to a vector with the same direction as this one, but\n\t * with the specified length.\n\t *\n\t * @param {number} length - The new length of this vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vector and this instance, where\n\t * alpha is the percent distance along the line - alpha = 0 will be this\n\t * vector, and alpha = 1 will be the given one.\n\t *\n\t * @param {Vector4} v - The vector to interpolate towards.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vectors, where alpha is the percent\n\t * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n\t * be the second one. The result is stored in this instance.\n\t *\n\t * @param {Vector4} v1 - The first vector.\n\t * @param {Vector4} v2 - The second vector.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this vector is equal with the given one.\n\t *\n\t * @param {Vector4} v - The vector to test for equality.\n\t * @return {boolean} Whether this vector is equal with the given one.\n\t */\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\t/**\n\t * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`,\n\t * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`.\n\t *\n\t * @param {Array<number>} array - An array holding the vector component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this vector to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the vector components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The vector components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this vector from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets each component of this vector to a pseudo-random value between `0` and\n\t * `1`, excluding `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/**\n * A render target is a buffer where the video card draws pixels for a scene\n * that is being rendered in the background. It is used in different effects,\n * such as applying postprocessing to a rendered image before displaying it\n * on the screen.\n *\n * @augments EventDispatcher\n */\nclass RenderTarget extends EventDispatcher {\n\n\t/**\n\t * Render target options.\n\t *\n\t * @typedef {Object} RenderTarget~Options\n\t * @property {boolean} [generateMipmaps=false] - Whether to generate mipmaps or not.\n\t * @property {number} [magFilter=LinearFilter] - The mag filter.\n\t * @property {number} [minFilter=LinearFilter] - The min filter.\n\t * @property {number} [format=RGBAFormat] - The texture format.\n\t * @property {number} [type=UnsignedByteType] - The texture type.\n\t * @property {?string} [internalFormat=null] - The texture's internal format.\n\t * @property {number} [wrapS=ClampToEdgeWrapping] - The texture's uv wrapping mode.\n\t * @property {number} [wrapT=ClampToEdgeWrapping] - The texture's uv wrapping mode.\n\t * @property {number} [anisotropy=1] - The texture's anisotropy value.\n\t * @property {string} [colorSpace=NoColorSpace] - The texture's color space.\n\t * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not.\n\t * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not.\n\t * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not.\n\t * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not.\n\t * @property {?Texture} [depthTexture=null] - Reference to a depth texture.\n\t * @property {number} [samples=0] - The MSAA samples count.\n\t * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.\n\t * @property {number} [depth=1] - The texture depth.\n\t * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering.\n\t */\n\n\t/**\n\t * Constructs a new render target.\n\t *\n\t * @param {number} [width=1] - The width of the render target.\n\t * @param {number} [height=1] - The height of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tresolveDepthBuffer: true,\n\t\t\tresolveStencilBuffer: true,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0,\n\t\t\tcount: 1,\n\t\t\tdepth: 1,\n\t\t\tmultiview: false\n\t\t}, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isRenderTarget = true;\n\n\t\t/**\n\t\t * The width of the render target.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.width = width;\n\n\t\t/**\n\t\t * The height of the render target.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.height = height;\n\n\t\t/**\n\t\t * The depth of the render target.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.depth = options.depth;\n\n\t\t/**\n\t\t * A rectangular area inside the render target's viewport. Fragments that are\n\t\t * outside the area will be discarded.\n\t\t *\n\t\t * @type {Vector4}\n\t\t * @default (0,0,width,height)\n\t\t */\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\n\t\t/**\n\t\t * Indicates whether the scissor test should be enabled when rendering into\n\t\t * this render target or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.scissorTest = false;\n\n\t\t/**\n\t\t * A rectangular area representing the render target's viewport.\n\t\t *\n\t\t * @type {Vector4}\n\t\t * @default (0,0,width,height)\n\t\t */\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\t/**\n\t\t * An array of textures. Each color attachment is represented as a separate texture.\n\t\t * Has at least a single entry for the default color attachment.\n\t\t *\n\t\t * @type {Array<Texture>}\n\t\t */\n\t\tthis.textures = [];\n\n\t\tconst image = { width: width, height: height, depth: options.depth };\n\t\tconst texture = new Texture( image );\n\n\t\tconst count = options.count;\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.textures[ i ] = texture.clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\t\t\tthis.textures[ i ].renderTarget = this;\n\n\t\t}\n\n\t\tthis._setTextureOptions( options );\n\n\t\t/**\n\t\t * Whether to allocate a depth buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.depthBuffer = options.depthBuffer;\n\n\t\t/**\n\t\t * Whether to allocate a stencil buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\t/**\n\t\t * Whether to resolve the depth buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.resolveDepthBuffer = options.resolveDepthBuffer;\n\n\t\t/**\n\t\t * Whether to resolve the stencil buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.resolveStencilBuffer = options.resolveStencilBuffer;\n\n\t\tthis._depthTexture = null;\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\t/**\n\t\t * The number of MSAA samples.\n\t\t *\n\t\t * A value of `0` disables MSAA.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.samples = options.samples;\n\n\t\t/**\n\t\t * Whether to this target is used in multiview rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.multiview = options.multiview;\n\n\t}\n\n\t_setTextureOptions( options = {} ) {\n\n\t\tconst values = {\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\tflipY: false,\n\t\t\tinternalFormat: null\n\t\t};\n\n\t\tif ( options.mapping !== undefined ) values.mapping = options.mapping;\n\t\tif ( options.wrapS !== undefined ) values.wrapS = options.wrapS;\n\t\tif ( options.wrapT !== undefined ) values.wrapT = options.wrapT;\n\t\tif ( options.wrapR !== undefined ) values.wrapR = options.wrapR;\n\t\tif ( options.magFilter !== undefined ) values.magFilter = options.magFilter;\n\t\tif ( options.minFilter !== undefined ) values.minFilter = options.minFilter;\n\t\tif ( options.format !== undefined ) values.format = options.format;\n\t\tif ( options.type !== undefined ) values.type = options.type;\n\t\tif ( options.anisotropy !== undefined ) values.anisotropy = options.anisotropy;\n\t\tif ( options.colorSpace !== undefined ) values.colorSpace = options.colorSpace;\n\t\tif ( options.flipY !== undefined ) values.flipY = options.flipY;\n\t\tif ( options.generateMipmaps !== undefined ) values.generateMipmaps = options.generateMipmaps;\n\t\tif ( options.internalFormat !== undefined ) values.internalFormat = options.internalFormat;\n\n\t\tfor ( let i = 0; i < this.textures.length; i ++ ) {\n\n\t\t\tconst texture = this.textures[ i ];\n\t\t\ttexture.setValues( values );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * The texture representing the default color attachment.\n\t *\n\t * @type {Texture}\n\t */\n\tget texture() {\n\n\t\treturn this.textures[ 0 ];\n\n\t}\n\n\tset texture( value ) {\n\n\t\tthis.textures[ 0 ] = value;\n\n\t}\n\n\tset depthTexture( current ) {\n\n\t\tif ( this._depthTexture !== null ) this._depthTexture.renderTarget = null;\n\t\tif ( current !== null ) current.renderTarget = this;\n\n\t\tthis._depthTexture = current;\n\n\t}\n\n\t/**\n\t * Instead of saving the depth in a renderbuffer, a texture\n\t * can be used instead which is useful for further processing\n\t * e.g. in context of post-processing.\n\t *\n\t * @type {?DepthTexture}\n\t * @default null\n\t */\n\tget depthTexture() {\n\n\t\treturn this._depthTexture;\n\n\t}\n\n\t/**\n\t * Sets the size of this render target.\n\t *\n\t * @param {number} width - The width.\n\t * @param {number} height - The height.\n\t * @param {number} [depth=1] - The depth.\n\t */\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.textures.length; i < il; i ++ ) {\n\n\t\t\t\tthis.textures[ i ].image.width = width;\n\t\t\t\tthis.textures[ i ].image.height = height;\n\t\t\t\tthis.textures[ i ].image.depth = depth;\n\n\t\t\t\tif ( this.textures[ i ].isData3DTexture !== true ) { // Fix for #31693\n\n\t\t\t\t\t// TODO: Reconsider setting isArrayTexture flag here and in the ctor of Texture.\n\t\t\t\t\t// Maybe a method `isArrayTexture()` or just a getter could replace a flag since\n\t\t\t\t\t// both are evaluated on each call?\n\n\t\t\t\t\tthis.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\t/**\n\t * Returns a new render target with copied values from this instance.\n\t *\n\t * @return {RenderTarget} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the settings of the given render target. This is a structural copy so\n\t * no resources are shared between render targets after the copy. That includes\n\t * all MRT textures and the depth texture.\n\t *\n\t * @param {RenderTarget} source - The render target to copy.\n\t * @return {RenderTarget} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.textures.length = 0;\n\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\n\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\t\t\tthis.textures[ i ].renderTarget = this;\n\n\t\t\t// ensure image object is not shared, see #20328\n\n\t\t\tconst image = Object.assign( {}, source.textures[ i ].image );\n\t\t\tthis.textures[ i ].source = new Source( image );\n\n\t\t}\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tthis.resolveDepthBuffer = source.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = source.resolveStencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\t\tthis.multiview = source.multiview;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t *\n\t * @fires RenderTarget#dispose\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\n/**\n * A render target used in context of {@link WebGLRenderer}.\n *\n * @augments RenderTarget\n */\nclass WebGLRenderTarget extends RenderTarget {\n\n\t/**\n\t * Constructs a new 3D render target.\n\t *\n\t * @param {number} [width=1] - The width of the render target.\n\t * @param {number} [height=1] - The height of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\n/**\n * Creates an array of textures directly from raw buffer data.\n *\n * @augments Texture\n */\nclass DataArrayTexture extends Texture {\n\n\t/**\n\t * Constructs a new data array texture.\n\t *\n\t * @param {?TypedArray} [data=null] - The buffer data.\n\t * @param {number} [width=1] - The width of the texture.\n\t * @param {number} [height=1] - The height of the texture.\n\t * @param {number} [depth=1] - The depth of the texture.\n\t */\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isDataArrayTexture = true;\n\n\t\t/**\n\t\t * The image definition of a data texture.\n\t\t *\n\t\t * @type {{data:TypedArray,width:number,height:number,depth:number}}\n\t\t */\n\t\tthis.image = { data, width, height, depth };\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers more than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.magFilter = NearestFilter;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers less than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.minFilter = NearestFilter;\n\n\t\t/**\n\t\t * This defines how the texture is wrapped in the depth and corresponds to\n\t\t * *W* in UVW mapping.\n\t\t *\n\t\t * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}\n\t\t * @default ClampToEdgeWrapping\n\t\t */\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flipY = false;\n\n\t\t/**\n\t\t * Specifies the alignment requirements for the start of each pixel row in memory.\n\t\t *\n\t\t * Overwritten and set to `1` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default 1\n\t\t */\n\t\tthis.unpackAlignment = 1;\n\n\t\t/**\n\t\t * A set of all layers which need to be updated in the texture.\n\t\t *\n\t\t * @type {Set<number>}\n\t\t */\n\t\tthis.layerUpdates = new Set();\n\n\t}\n\n\t/**\n\t * Describes that a specific layer of the texture needs to be updated.\n\t * Normally when {@link Texture#needsUpdate} is set to `true`, the\n\t * entire data texture array is sent to the GPU. Marking specific\n\t * layers will only transmit subsets of all mipmaps associated with a\n\t * specific depth in the array which is often much more performant.\n\t *\n\t * @param {number} layerIndex - The layer index that should be updated.\n\t */\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\t/**\n\t * Resets the layer updates registry.\n\t */\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\n/**\n * An array render target used in context of {@link WebGLRenderer}.\n *\n * @augments WebGLRenderTarget\n */\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\t/**\n\t * Constructs a new array render target.\n\t *\n\t * @param {number} [width=1] - The width of the render target.\n\t * @param {number} [height=1] - The height of the render target.\n\t * @param {number} [depth=1] - The height of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\t/**\n\t\t * Overwritten with a different texture type.\n\t\t *\n\t\t * @type {DataArrayTexture}\n\t\t */\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\t\tthis._setTextureOptions( options );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\n/**\n * Creates a three-dimensional texture from raw data, with parameters to\n * divide it into width, height, and depth.\n *\n * @augments Texture\n */\nclass Data3DTexture extends Texture {\n\n\t/**\n\t * Constructs a new data array texture.\n\t *\n\t * @param {?TypedArray} [data=null] - The buffer data.\n\t * @param {number} [width=1] - The width of the texture.\n\t * @param {number} [height=1] - The height of the texture.\n\t * @param {number} [depth=1] - The depth of the texture.\n\t */\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in Data3DTexture directly.\n\t\t//\n\t\t//\tconst texture = new THREE.Data3DTexture( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isData3DTexture = true;\n\n\t\t/**\n\t\t * The image definition of a data texture.\n\t\t *\n\t\t * @type {{data:TypedArray,width:number,height:number,depth:number}}\n\t\t */\n\t\tthis.image = { data, width, height, depth };\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers more than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.magFilter = NearestFilter;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers less than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.minFilter = NearestFilter;\n\n\t\t/**\n\t\t * This defines how the texture is wrapped in the depth and corresponds to\n\t\t * *W* in UVW mapping.\n\t\t *\n\t\t * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}\n\t\t * @default ClampToEdgeWrapping\n\t\t */\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flipY = false;\n\n\t\t/**\n\t\t * Specifies the alignment requirements for the start of each pixel row in memory.\n\t\t *\n\t\t * Overwritten and set to `1` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default 1\n\t\t */\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\n/**\n * A 3D render target used in context of {@link WebGLRenderer}.\n *\n * @augments WebGLRenderTarget\n */\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\t/**\n\t * Constructs a new 3D render target.\n\t *\n\t * @param {number} [width=1] - The width of the render target.\n\t * @param {number} [height=1] - The height of the render target.\n\t * @param {number} [depth=1] - The height of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\t/**\n\t\t * Overwritten with a different texture type.\n\t\t *\n\t\t * @type {Data3DTexture}\n\t\t */\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\t\tthis._setTextureOptions( options );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\n/**\n * Represents a 4x4 matrix.\n *\n * The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.\n * For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices)\n *\n * This allows a 3D vector representing a point in 3D space to undergo\n * transformations such as translation, rotation, shear, scale, reflection,\n * orthogonal or perspective projection and so on, by being multiplied by the\n * matrix. This is known as `applying` the matrix to the vector.\n *\n * A Note on Row-Major and Column-Major Ordering:\n *\n * The constructor and {@link Matrix3#set} method take arguments in\n * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)\n * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.\n * This means that calling:\n * ```js\n * const m = new THREE.Matrix4();\n * m.set( 11, 12, 13, 14,\n * 21, 22, 23, 24,\n * 31, 32, 33, 34,\n * 41, 42, 43, 44 );\n * ```\n * will result in the elements array containing:\n * ```js\n * m.elements = [ 11, 21, 31, 41,\n * 12, 22, 32, 42,\n * 13, 23, 33, 43,\n * 14, 24, 34, 44 ];\n * ```\n * and internally all calculations are performed using column-major ordering.\n * However, as the actual ordering makes no difference mathematically and\n * most people are used to thinking about matrices in row-major order, the\n * three.js documentation shows matrices in row-major order. Just bear in\n * mind that if you are reading the source code, you'll have to take the\n * transpose of any matrices outlined here to make sense of the calculations.\n */\nclass Matrix4 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 4x4 matrix. The arguments are supposed to be\n\t * in row-major order. If no arguments are provided, the constructor\n\t * initializes the matrix as an identity matrix.\n\t *\n\t * @param {number} [n11] - 1-1 matrix element.\n\t * @param {number} [n12] - 1-2 matrix element.\n\t * @param {number} [n13] - 1-3 matrix element.\n\t * @param {number} [n14] - 1-4 matrix element.\n\t * @param {number} [n21] - 2-1 matrix element.\n\t * @param {number} [n22] - 2-2 matrix element.\n\t * @param {number} [n23] - 2-3 matrix element.\n\t * @param {number} [n24] - 2-4 matrix element.\n\t * @param {number} [n31] - 3-1 matrix element.\n\t * @param {number} [n32] - 3-2 matrix element.\n\t * @param {number} [n33] - 3-3 matrix element.\n\t * @param {number} [n34] - 3-4 matrix element.\n\t * @param {number} [n41] - 4-1 matrix element.\n\t * @param {number} [n42] - 4-2 matrix element.\n\t * @param {number} [n43] - 4-3 matrix element.\n\t * @param {number} [n44] - 4-4 matrix element.\n\t */\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\t/**\n\t\t * A column-major list of matrix values.\n\t\t *\n\t\t * @type {Array<number>}\n\t\t */\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix.The arguments are supposed to be\n\t * in row-major order.\n\t *\n\t * @param {number} [n11] - 1-1 matrix element.\n\t * @param {number} [n12] - 1-2 matrix element.\n\t * @param {number} [n13] - 1-3 matrix element.\n\t * @param {number} [n14] - 1-4 matrix element.\n\t * @param {number} [n21] - 2-1 matrix element.\n\t * @param {number} [n22] - 2-2 matrix element.\n\t * @param {number} [n23] - 2-3 matrix element.\n\t * @param {number} [n24] - 2-4 matrix element.\n\t * @param {number} [n31] - 3-1 matrix element.\n\t * @param {number} [n32] - 3-2 matrix element.\n\t * @param {number} [n33] - 3-3 matrix element.\n\t * @param {number} [n34] - 3-4 matrix element.\n\t * @param {number} [n41] - 4-1 matrix element.\n\t * @param {number} [n42] - 4-2 matrix element.\n\t * @param {number} [n43] - 4-3 matrix element.\n\t * @param {number} [n44] - 4-4 matrix element.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix to the 4x4 identity matrix.\n\t *\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a matrix with copied values from this instance.\n\t *\n\t * @return {Matrix4} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\t/**\n\t * Copies the values of the given matrix to this instance.\n\t *\n\t * @param {Matrix4} m - The matrix to copy.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the translation component of the given matrix\n\t * into this matrix's translation component.\n\t *\n\t * @param {Matrix4} m - The matrix to copy the translation component.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The 3x3 matrix.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Extracts the basis of this matrix into the three axis vectors provided.\n\t *\n\t * @param {Vector3} xAxis - The basis's x axis.\n\t * @param {Vector3} yAxis - The basis's y axis.\n\t * @param {Vector3} zAxis - The basis's z axis.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\tif ( this.determinant() === 0 ) {\n\n\t\t\txAxis.set( 1, 0, 0 );\n\t\t\tyAxis.set( 0, 1, 0 );\n\t\t\tzAxis.set( 0, 0, 1 );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given basis vectors to this matrix.\n\t *\n\t * @param {Vector3} xAxis - The basis's x axis.\n\t * @param {Vector3} yAxis - The basis's y axis.\n\t * @param {Vector3} zAxis - The basis's z axis.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Extracts the rotation component of the given matrix\n\t * into this matrix's rotation component.\n\t *\n\t * Note: This method does not support reflection matrices.\n\t *\n\t * @param {Matrix4} m - The matrix.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\textractRotation( m ) {\n\n\t\tif ( m.determinant() === 0 ) {\n\n\t\t\treturn this.identity();\n\n\t\t}\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$7.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$7.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$7.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the rotation component (the upper left 3x3 matrix) of this matrix to\n\t * the rotation specified by the given Euler angles. The rest of\n\t * the matrix is set to the identity. Depending on the {@link Euler#order},\n\t * there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)\n\t * for a complete list.\n\t *\n\t * @param {Euler} euler - The Euler angles.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the rotation component of this matrix to the rotation specified by\n\t * the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)\n\t * The rest of the matrix is set to the identity.\n\t *\n\t * @param {Quaternion} q - The Quaternion.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\t/**\n\t * Sets the rotation component of the transformation matrix, looking from `eye` towards\n\t * `target`, and oriented by the up-direction.\n\t *\n\t * @param {Vector3} eye - The eye vector.\n\t * @param {Vector3} target - The target vector.\n\t * @param {Vector3} up - The up vector.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Post-multiplies this matrix by the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The matrix to multiply with.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\t/**\n\t * Pre-multiplies this matrix by the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The matrix to multiply with.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\t/**\n\t * Multiples the given 4x4 matrices and stores the result\n\t * in this matrix.\n\t *\n\t * @param {Matrix4} a - The first matrix.\n\t * @param {Matrix4} b - The second matrix.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies every component of the matrix by the given scalar.\n\t *\n\t * @param {number} s - The scalar.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes and returns the determinant of this matrix.\n\t *\n\t * Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).\n\t *\n\t * @return {number} The determinant.\n\t */\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\tconst t11 = n23 * n34 - n24 * n33;\n\t\tconst t12 = n22 * n34 - n24 * n32;\n\t\tconst t13 = n22 * n33 - n23 * n32;\n\n\t\tconst t21 = n21 * n34 - n24 * n31;\n\t\tconst t22 = n21 * n33 - n23 * n31;\n\t\tconst t23 = n21 * n32 - n22 * n31;\n\n\t\treturn n11 * ( n42 * t11 - n43 * t12 + n44 * t13 ) -\n\t\t\tn12 * ( n41 * t11 - n43 * t21 + n44 * t22 ) +\n\t\t\tn13 * ( n41 * t12 - n42 * t21 + n44 * t23 ) -\n\t\t\tn14 * ( n41 * t13 - n42 * t22 + n43 * t23 );\n\n\t}\n\n\t/**\n\t * Transposes this matrix in place.\n\t *\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the position component for this matrix from the given vector,\n\t * without affecting the rest of the matrix.\n\t *\n\t * @param {number|Vector3} x - The x component of the vector or alternatively the vector object.\n\t * @param {number} y - The y component of the vector.\n\t * @param {number} z - The z component of the vector.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).\n\t * You can not invert with a determinant of zero. If you attempt this, the method produces\n\t * a zero matrix instead.\n\t *\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tinvert() {\n\n\t\t// based on https://github.com/toji/gl-matrix\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt1 = n11 * n22 - n21 * n12,\n\t\t\tt2 = n11 * n32 - n31 * n12,\n\t\t\tt3 = n11 * n42 - n41 * n12,\n\t\t\tt4 = n21 * n32 - n31 * n22,\n\t\t\tt5 = n21 * n42 - n41 * n22,\n\t\t\tt6 = n31 * n42 - n41 * n32,\n\t\t\tt7 = n13 * n24 - n23 * n14,\n\t\t\tt8 = n13 * n34 - n33 * n14,\n\t\t\tt9 = n13 * n44 - n43 * n14,\n\t\t\tt10 = n23 * n34 - n33 * n24,\n\t\t\tt11 = n23 * n44 - n43 * n24,\n\t\t\tt12 = n33 * n44 - n43 * n34;\n\n\t\tconst det = t1 * t12 - t2 * t11 + t3 * t10 + t4 * t9 - t5 * t8 + t6 * t7;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = ( n22 * t12 - n32 * t11 + n42 * t10 ) * detInv;\n\t\tte[ 1 ] = ( n31 * t11 - n21 * t12 - n41 * t10 ) * detInv;\n\t\tte[ 2 ] = ( n24 * t6 - n34 * t5 + n44 * t4 ) * detInv;\n\t\tte[ 3 ] = ( n33 * t5 - n23 * t6 - n43 * t4 ) * detInv;\n\n\t\tte[ 4 ] = ( n32 * t9 - n12 * t12 - n42 * t8 ) * detInv;\n\t\tte[ 5 ] = ( n11 * t12 - n31 * t9 + n41 * t8 ) * detInv;\n\t\tte[ 6 ] = ( n34 * t3 - n14 * t6 - n44 * t2 ) * detInv;\n\t\tte[ 7 ] = ( n13 * t6 - n33 * t3 + n43 * t2 ) * detInv;\n\n\t\tte[ 8 ] = ( n12 * t11 - n22 * t9 + n42 * t7 ) * detInv;\n\t\tte[ 9 ] = ( n21 * t9 - n11 * t11 - n41 * t7 ) * detInv;\n\t\tte[ 10 ] = ( n14 * t5 - n24 * t3 + n44 * t1 ) * detInv;\n\t\tte[ 11 ] = ( n23 * t3 - n13 * t5 - n43 * t1 ) * detInv;\n\n\t\tte[ 12 ] = ( n22 * t8 - n12 * t10 - n32 * t7 ) * detInv;\n\t\tte[ 13 ] = ( n11 * t10 - n21 * t8 + n31 * t7 ) * detInv;\n\t\tte[ 14 ] = ( n24 * t2 - n14 * t4 - n34 * t1 ) * detInv;\n\t\tte[ 15 ] = ( n13 * t4 - n23 * t2 + n33 * t1 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the columns of this matrix by the given vector.\n\t *\n\t * @param {Vector3} v - The scale vector.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Gets the maximum scale value of the three axes.\n\t *\n\t * @return {number} The maximum scale.\n\t */\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\t/**\n\t * Sets this matrix as a translation transform from the given vector.\n\t *\n\t * @param {number|Vector3} x - The amount to translate in the X axis or alternatively a translation vector.\n\t * @param {number} y - The amount to translate in the Y axis.\n\t * @param {number} z - The amount to translate in the z axis.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a rotational transformation around the X axis by\n\t * the given angle.\n\t *\n\t * @param {number} theta - The rotation in radians.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a rotational transformation around the Y axis by\n\t * the given angle.\n\t *\n\t * @param {number} theta - The rotation in radians.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a rotational transformation around the Z axis by\n\t * the given angle.\n\t *\n\t * @param {number} theta - The rotation in radians.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a rotational transformation around the given axis by\n\t * the given angle.\n\t *\n\t * This is a somewhat controversial but mathematically sound alternative to\n\t * rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).\n\t *\n\t * @param {Vector3} axis - The normalized rotation axis.\n\t * @param {number} angle - The rotation in radians.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a scale transformation.\n\t *\n\t * @param {number} x - The amount to scale in the X axis.\n\t * @param {number} y - The amount to scale in the Y axis.\n\t * @param {number} z - The amount to scale in the Z axis.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix as a shear transformation.\n\t *\n\t * @param {number} xy - The amount to shear X by Y.\n\t * @param {number} xz - The amount to shear X by Z.\n\t * @param {number} yx - The amount to shear Y by X.\n\t * @param {number} yz - The amount to shear Y by Z.\n\t * @param {number} zx - The amount to shear Z by X.\n\t * @param {number} zy - The amount to shear Z by Y.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this matrix to the transformation composed of the given position,\n\t * rotation (Quaternion) and scale.\n\t *\n\t * @param {Vector3} position - The position vector.\n\t * @param {Quaternion} quaternion - The rotation as a Quaternion.\n\t * @param {Vector3} scale - The scale vector.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Decomposes this matrix into its position, rotation and scale components\n\t * and provides the result in the given objects.\n\t *\n\t * Note: Not all matrices are decomposable in this way. For example, if an\n\t * object has a non-uniformly scaled parent, then the object's world matrix\n\t * may not be decomposable, and this method may not be appropriate.\n\t *\n\t * @param {Vector3} position - The position vector.\n\t * @param {Quaternion} quaternion - The rotation as a Quaternion.\n\t * @param {Vector3} scale - The scale vector.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\tconst det = this.determinant();\n\n\t\tif ( det === 0 ) {\n\n\t\t\tscale.set( 1, 1, 1 );\n\t\t\tquaternion.identity();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tlet sx = _v1$7.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$7.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$7.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determinant is negative, we need to invert one scale\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Creates a perspective projection matrix. This is used internally by\n\t * {@link PerspectiveCamera#updateProjectionMatrix}.\n\n\t * @param {number} left - Left boundary of the viewing frustum at the near plane.\n\t * @param {number} right - Right boundary of the viewing frustum at the near plane.\n\t * @param {number} top - Top boundary of the viewing frustum at the near plane.\n\t * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.\n\t * @param {number} near - The distance from the camera to the near plane.\n\t * @param {number} far - The distance from the camera to the far plane.\n\t * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.\n\t * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( reversedDepth ) {\n\n\t\t\tc = near / ( far - near );\n\t\t\td = ( far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\t\td = ( -2 * far * near ) / ( far - near );\n\n\t\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tc = - far / ( far - near );\n\t\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = -1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Creates a orthographic projection matrix. This is used internally by\n\t * {@link OrthographicCamera#updateProjectionMatrix}.\n\n\t * @param {number} left - Left boundary of the viewing frustum at the near plane.\n\t * @param {number} right - Right boundary of the viewing frustum at the near plane.\n\t * @param {number} top - Top boundary of the viewing frustum at the near plane.\n\t * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.\n\t * @param {number} near - The distance from the camera to the near plane.\n\t * @param {number} far - The distance from the camera to the far plane.\n\t * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.\n\t * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = 2 / ( right - left );\n\t\tconst y = 2 / ( top - bottom );\n\n\t\tconst a = - ( right + left ) / ( right - left );\n\t\tconst b = - ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( reversedDepth ) {\n\n\t\t\tc = 1 / ( far - near );\n\t\t\td = far / ( far - near );\n\n\t\t} else {\n\n\t\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tc = -2 / ( far - near );\n\t\t\t\td = - ( far + near ) / ( far - near );\n\n\t\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tc = -1 / ( far - near );\n\t\t\t\td = - near / ( far - near );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\t\tte[ 0 ] = x;\t\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = a;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = y;\t\tte[ 9 ] = 0; \t\tte[ 13 ] = b;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = c;\t\tte[ 14 ] = d;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this matrix is equal with the given one.\n\t *\n\t * @param {Matrix4} matrix - The matrix to test for equality.\n\t * @return {boolean} Whether this matrix is equal with the given one.\n\t */\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix from the given array.\n\t *\n\t * @param {Array<number>} array - The matrix elements in column-major order.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Matrix4} A reference to this matrix.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the elements of this matrix to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the matrix elements in column-major order.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The matrix elements in column-major order.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix$2 = /*@__PURE__*/ new Matrix4();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\n/**\n * A class representing Euler angles.\n *\n * Euler angles describe a rotational transformation by rotating an object on\n * its various axes in specified amounts per axis, and a specified axis\n * order.\n *\n * Iterating through an instance will yield its components (x, y, z,\n * order) in the corresponding order.\n *\n * ```js\n * const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' );\n * const b = new THREE.Vector3( 1, 0, 1 );\n * b.applyEuler(a);\n * ```\n */\nclass Euler {\n\n\t/**\n\t * Constructs a new euler instance.\n\t *\n\t * @param {number} [x=0] - The angle of the x axis in radians.\n\t * @param {number} [y=0] - The angle of the y axis in radians.\n\t * @param {number} [z=0] - The angle of the z axis in radians.\n\t * @param {string} [order=Euler.DEFAULT_ORDER] - A string representing the order that the rotations are applied.\n\t */\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\t/**\n\t * The angle of the x axis in radians.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * The angle of the y axis in radians.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * The angle of the z axis in radians.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * A string representing the order that the rotations are applied.\n\t *\n\t * @type {string}\n\t * @default 'XYZ'\n\t */\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\t/**\n\t * Sets the Euler components.\n\t *\n\t * @param {number} x - The angle of the x axis in radians.\n\t * @param {number} y - The angle of the y axis in radians.\n\t * @param {number} z - The angle of the z axis in radians.\n\t * @param {string} [order] - A string representing the order that the rotations are applied.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new Euler instance with copied values from this instance.\n\t *\n\t * @return {Euler} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\t/**\n\t * Copies the values of the given Euler instance to this instance.\n\t *\n\t * @param {Euler} euler - The Euler instance to copy.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the angles of this Euler instance from a pure rotation matrix.\n\t *\n\t * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).\n\t * @param {string} [order] - A string representing the order that the rotations are applied.\n\t * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, -1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\twarn( 'Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the angles of this Euler instance from a normalized quaternion.\n\t *\n\t * @param {Quaternion} q - A normalized Quaternion.\n\t * @param {string} [order] - A string representing the order that the rotations are applied.\n\t * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix$2.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$2, order, update );\n\n\t}\n\n\t/**\n\t * Sets the angles of this Euler instance from the given vector.\n\t *\n\t * @param {Vector3} v - The vector.\n\t * @param {string} [order] - A string representing the order that the rotations are applied.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\t/**\n\t * Resets the euler angle with a new order by creating a quaternion from this\n\t * euler angle and then setting this euler angle with the quaternion and the\n\t * new order.\n\t *\n\t * Warning: This discards revolution information.\n\t *\n\t * @param {string} [newOrder] - A string representing the new order that the rotations are applied.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\treorder( newOrder ) {\n\n\t\t_quaternion$4.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$4, newOrder );\n\n\t}\n\n\t/**\n\t * Returns `true` if this Euler instance is equal with the given one.\n\t *\n\t * @param {Euler} euler - The Euler instance to test for equality.\n\t * @return {boolean} Whether this Euler instance is equal with the given one.\n\t */\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\t/**\n\t * Sets this Euler instance's components to values from the given array. The first three\n\t * entries of the array are assign to the x,y and z components. An optional fourth entry\n\t * defines the Euler order.\n\t *\n\t * @param {Array<number,number,number,?string>} array - An array holding the Euler component values.\n\t * @return {Euler} A reference to this Euler instance.\n\t */\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this Euler instance to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number,number,number,string>} [array=[]] - The target array holding the Euler components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number,number,number,string>} The Euler components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\n/**\n * The default Euler angle order.\n *\n * @static\n * @type {string}\n * @default 'XYZ'\n */\nEuler.DEFAULT_ORDER = 'XYZ';\n\n/**\n * A layers object assigns an 3D object to 1 or more of 32\n * layers numbered `0` to `31` - internally the layers are stored as a\n * bit mask], and by default all 3D objects are a member of layer `0`.\n *\n * This can be used to control visibility - an object must share a layer with\n * a camera to be visible when that camera's view is\n * rendered.\n *\n * All classes that inherit from {@link Object3D} have an `layers` property which\n * is an instance of this class.\n */\nclass Layers {\n\n\t/**\n\t * Constructs a new layers instance, with membership\n\t * initially set to layer `0`.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * A bit mask storing which of the 32 layers this layers object is currently\n\t\t * a member of.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\t/**\n\t * Sets membership to the given layer, and remove membership all other layers.\n\t *\n\t * @param {number} layer - The layer to set.\n\t */\n\tset( layer ) {\n\n\t\tthis.mask = ( 1 << layer | 0 ) >>> 0;\n\n\t}\n\n\t/**\n\t * Adds membership of the given layer.\n\t *\n\t * @param {number} layer - The layer to enable.\n\t */\n\tenable( layer ) {\n\n\t\tthis.mask |= 1 << layer | 0;\n\n\t}\n\n\t/**\n\t * Adds membership to all layers.\n\t */\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\t/**\n\t * Toggles the membership of the given layer.\n\t *\n\t * @param {number} layer - The layer to toggle.\n\t */\n\ttoggle( layer ) {\n\n\t\tthis.mask ^= 1 << layer | 0;\n\n\t}\n\n\t/**\n\t * Removes membership of the given layer.\n\t *\n\t * @param {number} layer - The layer to enable.\n\t */\n\tdisable( layer ) {\n\n\t\tthis.mask &= ~ ( 1 << layer | 0 );\n\n\t}\n\n\t/**\n\t * Removes the membership from all layers.\n\t */\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\t/**\n\t * Returns `true` if this and the given layers object have at least one\n\t * layer in common.\n\t *\n\t * @param {Layers} layers - The layers to test.\n\t * @return {boolean } Whether this and the given layers object have at least one layer in common or not.\n\t */\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given layer is enabled.\n\t *\n\t * @param {number} layer - The layer to test.\n\t * @return {boolean } Whether the given layer is enabled or not.\n\t */\n\tisEnabled( layer ) {\n\n\t\treturn ( this.mask & ( 1 << layer | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$4 = /*@__PURE__*/ new Vector3();\nconst _scale$3 = /*@__PURE__*/ new Vector3();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\n/**\n * Fires when the object has been added to its parent object.\n *\n * @event Object3D#added\n * @type {Object}\n */\nconst _addedEvent = { type: 'added' };\n\n/**\n * Fires when the object has been removed from its parent object.\n *\n * @event Object3D#removed\n * @type {Object}\n */\nconst _removedEvent = { type: 'removed' };\n\n/**\n * Fires when a new child object has been added.\n *\n * @event Object3D#childadded\n * @type {Object}\n */\nconst _childaddedEvent = { type: 'childadded', child: null };\n\n/**\n * Fires when a child object has been removed.\n *\n * @event Object3D#childremoved\n * @type {Object}\n */\nconst _childremovedEvent = { type: 'childremoved', child: null };\n\n/**\n * This is the base class for most objects in three.js and provides a set of\n * properties and methods for manipulating objects in 3D space.\n *\n * @augments EventDispatcher\n */\nclass Object3D extends EventDispatcher {\n\n\t/**\n\t * Constructs a new 3D object.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isObject3D = true;\n\n\t\t/**\n\t\t * The ID of the 3D object.\n\t\t *\n\t\t * @name Object3D#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\t/**\n\t\t * The UUID of the 3D object.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * The name of the 3D object.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The type property is used for detecting the object type\n\t\t * in context of serialization/deserialization.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.type = 'Object3D';\n\n\t\t/**\n\t\t * A reference to the parent object.\n\t\t *\n\t\t * @type {?Object3D}\n\t\t * @default null\n\t\t */\n\t\tthis.parent = null;\n\n\t\t/**\n\t\t * An array holding the child 3D objects of this instance.\n\t\t *\n\t\t * @type {Array<Object3D>}\n\t\t */\n\t\tthis.children = [];\n\n\t\t/**\n\t\t * Defines the `up` direction of the 3D object which influences\n\t\t * the orientation via methods like {@link Object3D#lookAt}.\n\t\t *\n\t\t * The default values for all 3D objects is defined by `Object3D.DEFAULT_UP`.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\t/**\n\t\t\t * Represents the object's local position.\n\t\t\t *\n\t\t\t * @name Object3D#position\n\t\t\t * @type {Vector3}\n\t\t\t * @default (0,0,0)\n\t\t\t */\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\t/**\n\t\t\t * Represents the object's local rotation as Euler angles, in radians.\n\t\t\t *\n\t\t\t * @name Object3D#rotation\n\t\t\t * @type {Euler}\n\t\t\t * @default (0,0,0)\n\t\t\t */\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\t/**\n\t\t\t * Represents the object's local rotation as Quaternions.\n\t\t\t *\n\t\t\t * @name Object3D#quaternion\n\t\t\t * @type {Quaternion}\n\t\t\t */\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\t/**\n\t\t\t * Represents the object's local scale.\n\t\t\t *\n\t\t\t * @name Object3D#scale\n\t\t\t * @type {Vector3}\n\t\t\t * @default (1,1,1)\n\t\t\t */\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\t/**\n\t\t\t * Represents the object's model-view matrix.\n\t\t\t *\n\t\t\t * @name Object3D#modelViewMatrix\n\t\t\t * @type {Matrix4}\n\t\t\t */\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\t/**\n\t\t\t * Represents the object's normal matrix.\n\t\t\t *\n\t\t\t * @name Object3D#normalMatrix\n\t\t\t * @type {Matrix3}\n\t\t\t */\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\t/**\n\t\t * Represents the object's transformation matrix in local space.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.matrix = new Matrix4();\n\n\t\t/**\n\t\t * Represents the object's transformation matrix in world space.\n\t\t * If the 3D object has no parent, then it's identical to the local transformation matrix\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\t/**\n\t\t * When set to `true`, the engine automatically computes the local matrix from position,\n\t\t * rotation and scale every frame. If set to `false`, the app is responsible for recomputing\n\t\t * the local matrix by calling `updateMatrix()`.\n\t\t *\n\t\t * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\n\t\t/**\n\t\t * When set to `true`, the engine automatically computes the world matrix from the current local\n\t\t * matrix and the object's transformation hierarchy. If set to `false`, the app is responsible for\n\t\t * recomputing the world matrix by directly updating the `matrixWorld` property.\n\t\t *\n\t\t * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\n\t\t/**\n\t\t * When set to `true`, it calculates the world matrix in that frame and resets this property\n\t\t * to `false`.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t/**\n\t\t * The layer membership of the 3D object. The 3D object is only visible if it has\n\t\t * at least one layer in common with the camera in use. This property can also be\n\t\t * used to filter out unwanted objects in ray-intersection tests when using {@link Raycaster}.\n\t\t *\n\t\t * @type {Layers}\n\t\t */\n\t\tthis.layers = new Layers();\n\n\t\t/**\n\t\t * When set to `true`, the 3D object gets rendered.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.visible = true;\n\n\t\t/**\n\t\t * When set to `true`, the 3D object gets rendered into shadow maps.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.castShadow = false;\n\n\t\t/**\n\t\t * When set to `true`, the 3D object is affected by shadows in the scene.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.receiveShadow = false;\n\n\t\t/**\n\t\t * When set to `true`, the 3D object is honored by view frustum culling.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.frustumCulled = true;\n\n\t\t/**\n\t\t * This value allows the default rendering order of scene graph objects to be\n\t\t * overridden although opaque and transparent objects remain sorted independently.\n\t\t * When this property is set for an instance of {@link Group},all descendants\n\t\t * objects will be sorted and rendered together. Sorting is from lowest to highest\n\t\t * render order.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.renderOrder = 0;\n\n\t\t/**\n\t\t * An array holding the animation clips of the 3D object.\n\t\t *\n\t\t * @type {Array<AnimationClip>}\n\t\t */\n\t\tthis.animations = [];\n\n\t\t/**\n\t\t * Custom depth material to be used when rendering to the depth map. Can only be used\n\t\t * in context of meshes. When shadow-casting with a {@link DirectionalLight} or {@link SpotLight},\n\t\t * if you are modifying vertex positions in the vertex shader you must specify a custom depth\n\t\t * material for proper shadows.\n\t\t *\n\t\t * Only relevant in context of {@link WebGLRenderer}.\n\t\t *\n\t\t * @type {(Material|undefined)}\n\t\t * @default undefined\n\t\t */\n\t\tthis.customDepthMaterial = undefined;\n\n\t\t/**\n\t\t * Same as {@link Object3D#customDepthMaterial}, but used with {@link PointLight}.\n\t\t *\n\t\t * Only relevant in context of {@link WebGLRenderer}.\n\t\t *\n\t\t * @type {(Material|undefined)}\n\t\t * @default undefined\n\t\t */\n\t\tthis.customDistanceMaterial = undefined;\n\n\t\t/**\n\t\t * Whether the 3D object is supposed to be static or not. If set to `true`, it means\n\t\t * the 3D object is not going to be changed after the initial renderer. This includes\n\t\t * geometry and material settings. A static 3D object can be processed by the renderer\n\t\t * slightly faster since certain state checks can be bypassed.\n\t\t *\n\t\t * Only relevant in context of {@link WebGPURenderer}.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.static = false;\n\n\t\t/**\n\t\t * An object that can be used to store custom data about the 3D object. It\n\t\t * should not hold references to functions as these will not be cloned.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.userData = {};\n\n\t\t/**\n\t\t * The pivot point for rotation and scale transformations.\n\t\t * When set, rotation and scale are applied around this point\n\t\t * instead of the object's origin.\n\t\t *\n\t\t * @type {?Vector3}\n\t\t * @default null\n\t\t */\n\t\tthis.pivot = null;\n\n\t}\n\n\t/**\n\t * A callback that is executed immediately before a 3D object is rendered to a shadow map.\n\t *\n\t * @param {Renderer|WebGLRenderer} renderer - The renderer.\n\t * @param {Object3D} object - The 3D object.\n\t * @param {Camera} camera - The camera that is used to render the scene.\n\t * @param {Camera} shadowCamera - The shadow camera.\n\t * @param {BufferGeometry} geometry - The 3D object's geometry.\n\t * @param {Material} depthMaterial - The depth material.\n\t * @param {Object} group - The geometry group data.\n\t */\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\t/**\n\t * A callback that is executed immediately after a 3D object is rendered to a shadow map.\n\t *\n\t * @param {Renderer|WebGLRenderer} renderer - The renderer.\n\t * @param {Object3D} object - The 3D object.\n\t * @param {Camera} camera - The camera that is used to render the scene.\n\t * @param {Camera} shadowCamera - The shadow camera.\n\t * @param {BufferGeometry} geometry - The 3D object's geometry.\n\t * @param {Material} depthMaterial - The depth material.\n\t * @param {Object} group - The geometry group data.\n\t */\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\t/**\n\t * A callback that is executed immediately before a 3D object is rendered.\n\t *\n\t * @param {Renderer|WebGLRenderer} renderer - The renderer.\n\t * @param {Object3D} object - The 3D object.\n\t * @param {Camera} camera - The camera that is used to render the scene.\n\t * @param {BufferGeometry} geometry - The 3D object's geometry.\n\t * @param {Material} material - The 3D object's material.\n\t * @param {Object} group - The geometry group data.\n\t */\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\t/**\n\t * A callback that is executed immediately after a 3D object is rendered.\n\t *\n\t * @param {Renderer|WebGLRenderer} renderer - The renderer.\n\t * @param {Object3D} object - The 3D object.\n\t * @param {Camera} camera - The camera that is used to render the scene.\n\t * @param {BufferGeometry} geometry - The 3D object's geometry.\n\t * @param {Material} material - The 3D object's material.\n\t * @param {Object} group - The geometry group data.\n\t */\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\t/**\n\t * Applies the given transformation matrix to the object and updates the object's position,\n\t * rotation and scale.\n\t *\n\t * @param {Matrix4} matrix - The transformation matrix.\n\t */\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\t/**\n\t * Applies a rotation represented by given the quaternion to the 3D object.\n\t *\n\t * @param {Quaternion} q - The quaternion.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given rotation represented as an axis/angle couple to the 3D object.\n\t *\n\t * @param {Vector3} axis - The (normalized) axis vector.\n\t * @param {number} angle - The angle in radians.\n\t */\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\t/**\n\t * Sets the given rotation represented as Euler angles to the 3D object.\n\t *\n\t * @param {Euler} euler - The Euler angles.\n\t */\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\t/**\n\t * Sets the given rotation represented as rotation matrix to the 3D object.\n\t *\n\t * @param {Matrix4} m - Although a 4x4 matrix is expected, the upper 3x3 portion must be\n\t * a pure rotation matrix (i.e, unscaled).\n\t */\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\t/**\n\t * Sets the given rotation represented as a Quaternion to the 3D object.\n\t *\n\t * @param {Quaternion} q - The Quaternion\n\t */\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\t/**\n\t * Rotates the 3D object along an axis in local space.\n\t *\n\t * @param {Vector3} axis - The (normalized) axis vector.\n\t * @param {number} angle - The angle in radians.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the 3D object along an axis in world space.\n\t *\n\t * @param {Vector3} axis - The (normalized) axis vector.\n\t * @param {number} angle - The angle in radians.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the 3D object around its X axis in local space.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\t/**\n\t * Rotates the 3D object around its Y axis in local space.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\t/**\n\t * Rotates the 3D object around its Z axis in local space.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\t/**\n\t * Translate the 3D object by a distance along the given axis in local space.\n\t *\n\t * @param {Vector3} axis - The (normalized) axis vector.\n\t * @param {number} distance - The distance in world units.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$6.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$6.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Translate the 3D object by a distance along its X-axis in local space.\n\t *\n\t * @param {number} distance - The distance in world units.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\t/**\n\t * Translate the 3D object by a distance along its Y-axis in local space.\n\t *\n\t * @param {number} distance - The distance in world units.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\t/**\n\t * Translate the 3D object by a distance along its Z-axis in local space.\n\t *\n\t * @param {number} distance - The distance in world units.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\t/**\n\t * Converts the given vector from this 3D object's local space to world space.\n\t *\n\t * @param {Vector3} vector - The vector to convert.\n\t * @return {Vector3} The converted vector.\n\t */\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\t/**\n\t * Converts the given vector from this 3D object's world space to local space.\n\t *\n\t * @param {Vector3} vector - The vector to convert.\n\t * @return {Vector3} The converted vector.\n\t */\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\t/**\n\t * Rotates the object to face a point in world space.\n\t *\n\t * This method does not support objects having non-uniformly-scaled parent(s).\n\t *\n\t * @param {number|Vector3} x - The x coordinate in world space. Alternatively, a vector representing a position in world space\n\t * @param {number} [y] - The y coordinate in world space.\n\t * @param {number} [z] - The z coordinate in world space.\n\t */\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$4.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$4, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$4, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Adds the given 3D object as a child to this 3D object. An arbitrary number of\n\t * objects may be added. Any current parent on an object passed in here will be\n\t * removed, since an object can have at most one parent.\n\t *\n\t * @fires Object3D#added\n\t * @fires Object3D#childadded\n\t * @param {Object3D} object - The 3D object to add.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\terror( 'Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tobject.removeFromParent();\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t\t_childaddedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t\t_childaddedEvent.child = null;\n\n\t\t} else {\n\n\t\t\terror( 'Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes the given 3D object as child from this 3D object.\n\t * An arbitrary number of objects may be removed.\n\t *\n\t * @fires Object3D#removed\n\t * @fires Object3D#childremoved\n\t * @param {Object3D} object - The 3D object to remove.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== -1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t\t_childremovedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childremovedEvent );\n\t\t\t_childremovedEvent.child = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes this 3D object from its current parent.\n\t *\n\t * @fires Object3D#removed\n\t * @fires Object3D#childremoved\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes all child objects.\n\t *\n\t * @fires Object3D#removed\n\t * @fires Object3D#childremoved\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\t/**\n\t * Adds the given 3D object as a child of this 3D object, while maintaining the object's world\n\t * transform. This method does not support scene graphs having non-uniformly-scaled nodes(s).\n\t *\n\t * @fires Object3D#added\n\t * @fires Object3D#childadded\n\t * @param {Object3D} object - The 3D object to attach.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tobject.removeFromParent();\n\t\tobject.parent = this;\n\t\tthis.children.push( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t_childaddedEvent.child = object;\n\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t_childaddedEvent.child = null;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Searches through the 3D object and its children, starting with the 3D object\n\t * itself, and returns the first with a matching ID.\n\t *\n\t * @param {number} id - The id.\n\t * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n\t */\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\t/**\n\t * Searches through the 3D object and its children, starting with the 3D object\n\t * itself, and returns the first with a matching name.\n\t *\n\t * @param {string} name - The name.\n\t * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n\t */\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\t/**\n\t * Searches through the 3D object and its children, starting with the 3D object\n\t * itself, and returns the first with a matching property value.\n\t *\n\t * @param {string} name - The name of the property.\n\t * @param {any} value - The value.\n\t * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n\t */\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\t/**\n\t * Searches through the 3D object and its children, starting with the 3D object\n\t * itself, and returns all 3D objects with a matching property value.\n\t *\n\t * @param {string} name - The name of the property.\n\t * @param {any} value - The value.\n\t * @param {Array<Object3D>} result - The method stores the result in this array.\n\t * @return {Array<Object3D>} The found 3D objects.\n\t */\n\tgetObjectsByProperty( name, value, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/**\n\t * Returns a vector representing the position of the 3D object in world space.\n\t *\n\t * @param {Vector3} target - The target vector the result is stored to.\n\t * @return {Vector3} The 3D object's position in world space.\n\t */\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\t/**\n\t * Returns a Quaternion representing the position of the 3D object in world space.\n\t *\n\t * @param {Quaternion} target - The target Quaternion the result is stored to.\n\t * @return {Quaternion} The 3D object's rotation in world space.\n\t */\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$4, target, _scale$3 );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns a vector representing the scale of the 3D object in world space.\n\t *\n\t * @param {Vector3} target - The target vector the result is stored to.\n\t * @return {Vector3} The 3D object's scale in world space.\n\t */\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$4, _quaternion$3, target );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns a vector representing the (\"look\") direction of the 3D object in world space.\n\t *\n\t * @param {Vector3} target - The target vector the result is stored to.\n\t * @return {Vector3} The 3D object's direction in world space.\n\t */\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\t/**\n\t * Abstract method to get intersections between a casted ray and this\n\t * 3D object. Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}\n\t * implement this method in order to use raycasting.\n\t *\n\t * @abstract\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - An array holding the result of the method.\n\t */\n\traycast( /* raycaster, intersects */ ) {}\n\n\t/**\n\t * Executes the callback on this 3D object and all descendants.\n\t *\n\t * Note: Modifying the scene graph inside the callback is discouraged.\n\t *\n\t * @param {Function} callback - A callback function that allows to process the current 3D object.\n\t */\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Like {@link Object3D#traverse}, but the callback will only be executed for visible 3D objects.\n\t * Descendants of invisible 3D objects are not traversed.\n\t *\n\t * Note: Modifying the scene graph inside the callback is discouraged.\n\t *\n\t * @param {Function} callback - A callback function that allows to process the current 3D object.\n\t */\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Like {@link Object3D#traverse}, but the callback will only be executed for all ancestors.\n\t *\n\t * Note: Modifying the scene graph inside the callback is discouraged.\n\t *\n\t * @param {Function} callback - A callback function that allows to process the current 3D object.\n\t */\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Updates the transformation matrix in local space by computing it from the current\n\t * position, rotation and scale values.\n\t */\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tconst pivot = this.pivot;\n\n\t\tif ( pivot !== null ) {\n\n\t\t\tconst px = pivot.x, py = pivot.y, pz = pivot.z;\n\t\t\tconst te = this.matrix.elements;\n\n\t\t\tte[ 12 ] += px - te[ 0 ] * px - te[ 4 ] * py - te[ 8 ] * pz;\n\t\t\tte[ 13 ] += py - te[ 1 ] * px - te[ 5 ] * py - te[ 9 ] * pz;\n\t\t\tte[ 14 ] += pz - te[ 2 ] * px - te[ 6 ] * py - te[ 10 ] * pz;\n\n\t\t}\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t/**\n\t * Updates the transformation matrix in world space of this 3D objects and its descendants.\n\t *\n\t * To ensure correct results, this method also recomputes the 3D object's transformation matrix in\n\t * local space. The computation of the local and world matrix can be controlled with the\n\t * {@link Object3D#matrixAutoUpdate} and {@link Object3D#matrixWorldAutoUpdate} flags which are both\n\t * `true` by default. Set these flags to `false` if you need more control over the update matrix process.\n\t *\n\t * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even\n\t * when {@link Object3D#matrixWorldNeedsUpdate} is `false`.\n\t */\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\tif ( this.parent === null ) {\n\n\t\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// make sure descendants are updated if required\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tchild.updateMatrixWorld( force );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * An alternative version of {@link Object3D#updateMatrixWorld} with more control over the\n\t * update of ancestor and descendant nodes.\n\t *\n\t * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.\n\t * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.\n\t */\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldAutoUpdate === true ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// make sure descendants are updated\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Serializes the 3D object into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized 3D object.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( this.static !== false ) object.static = this.static;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.pivot !== null ) object.pivot = this.pivot.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\tif ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );\n\t\tif ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.geometryInfo = this._geometryInfo.map( info => ( {\n\t\t\t\t...info,\n\t\t\t\tboundingBox: info.boundingBox ? info.boundingBox.toJSON() : undefined,\n\t\t\t\tboundingSphere: info.boundingSphere ? info.boundingSphere.toJSON() : undefined\n\t\t\t} ) );\n\t\t\tobject.instanceInfo = this._instanceInfo.map( info => ( { ...info } ) );\n\n\t\t\tobject.availableInstanceIds = this._availableInstanceIds.slice();\n\t\t\tobject.availableGeometryIds = this._availableGeometryIds.slice();\n\n\t\t\tobject.nextIndexStart = this._nextIndexStart;\n\t\t\tobject.nextVertexStart = this._nextVertexStart;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.maxInstanceCount = this._maxInstanceCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tobject.indirectTexture = this._indirectTexture.toJSON( meta );\n\n\t\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\t\tobject.colorsTexture = this._colorsTexture.toJSON( meta );\n\n\t\t\t}\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = this.boundingSphere.toJSON();\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = this.boundingBox.toJSON();\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new 3D object with copied values from this instance.\n\t *\n\t * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are also cloned.\n\t * @return {Object3D} A clone of this instance.\n\t */\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\t/**\n\t * Copies the values of the given 3D object to this instance.\n\t *\n\t * @param {Object3D} source - The 3D object to copy.\n\t * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are cloned.\n\t * @return {Object3D} A reference to this instance.\n\t */\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.pivot = ( source.pivot !== null ) ? source.pivot.clone() : null;\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.static = source.static;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * The default up direction for objects, also used as the default\n * position for {@link DirectionalLight} and {@link HemisphereLight}.\n *\n * @static\n * @type {Vector3}\n * @default (0,1,0)\n */\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\n\n/**\n * The default setting for {@link Object3D#matrixAutoUpdate} for\n * newly created 3D objects.\n *\n * @static\n * @type {boolean}\n * @default true\n */\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\n\n/**\n * The default setting for {@link Object3D#matrixWorldAutoUpdate} for\n * newly created 3D objects.\n *\n * @static\n * @type {boolean}\n * @default true\n */\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\n/**\n * This is almost identical to an {@link Object3D}. Its purpose is to\n * make working with groups of objects syntactically clearer.\n *\n * ```js\n * // Create a group and add the two cubes.\n * // These cubes can now be rotated / scaled etc as a group.\n * const group = new THREE.Group();\n *\n * group.add( meshA );\n * group.add( meshB );\n *\n * scene.add( group );\n * ```\n *\n * @augments Object3D\n */\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\n/**\n * Class for representing a XR controller with its\n * different coordinate systems.\n *\n * @private\n */\nclass WebXRController {\n\n\t/**\n\t * Constructs a new XR controller.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * A group representing the target ray space\n\t\t * of the XR controller.\n\t\t *\n\t\t * @private\n\t\t * @type {?Group}\n\t\t * @default null\n\t\t */\n\t\tthis._targetRay = null;\n\n\t\t/**\n\t\t * A group representing the grip space\n\t\t * of the XR controller.\n\t\t *\n\t\t * @private\n\t\t * @type {?Group}\n\t\t * @default null\n\t\t */\n\t\tthis._grip = null;\n\n\t\t/**\n\t\t * A group representing the hand space\n\t\t * of the XR controller.\n\t\t *\n\t\t * @private\n\t\t * @type {?Group}\n\t\t * @default null\n\t\t */\n\t\tthis._hand = null;\n\n\t}\n\n\t/**\n\t * Returns a group representing the hand space of the XR controller.\n\t *\n\t * @return {Group} A group representing the hand space of the XR controller.\n\t */\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\t/**\n\t * Returns a group representing the target ray space of the XR controller.\n\t *\n\t * @return {Group} A group representing the target ray space of the XR controller.\n\t */\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\t/**\n\t * Returns a group representing the grip space of the XR controller.\n\t *\n\t * @return {Group} A group representing the grip space of the XR controller.\n\t */\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\t\t\tthis._grip.eventsEnabled = false;\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\t/**\n\t * Dispatches the given event to the groups representing\n\t * the different coordinate spaces of the XR controller.\n\t *\n\t * @param {Object} event - The event to dispatch.\n\t * @return {WebXRController} A reference to this instance.\n\t */\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Connects the controller with the given XR input source.\n\t *\n\t * @param {XRInputSource} inputSource - The input source.\n\t * @return {WebXRController} A reference to this instance.\n\t */\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Disconnects the controller from the given XR input source.\n\t *\n\t * @param {XRInputSource} inputSource - The input source.\n\t * @return {WebXRController} A reference to this instance.\n\t */\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Updates the controller with the given input source, XR frame and reference space.\n\t * This updates the transformations of the groups that represent the different\n\t * coordinate systems of the controller.\n\t *\n\t * @param {XRInputSource} inputSource - The input source.\n\t * @param {XRFrame} frame - The XR frame.\n\t * @param {XRReferenceSpace} referenceSpace - The reference space.\n\t * @return {WebXRController} A reference to this instance.\n\t */\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// grip update event if enabled\n\t\t\t\t\t\tif ( grip.eventsEnabled ) {\n\n\t\t\t\t\t\t\tgrip.dispatchEvent( {\n\t\t\t\t\t\t\t\ttype: 'gripUpdated',\n\t\t\t\t\t\t\t\tdata: inputSource,\n\t\t\t\t\t\t\t\ttarget: this\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a group representing the hand joint for the given input joint.\n\t *\n\t * @private\n\t * @param {Group} hand - The group representing the hand space.\n\t * @param {XRJointSpace} inputjoint - The hand joint data.\n\t * @return {Group} A group representing the hand joint for the given input joint.\n\t */\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\n/**\n * A Color instance is represented by RGB components in the linear <i>working\n * color space</i>, which defaults to `LinearSRGBColorSpace`. Inputs\n * conventionally using `SRGBColorSpace` (such as hexadecimals and CSS\n * strings) are converted to the working color space automatically.\n *\n * ```js\n * // converted automatically from SRGBColorSpace to LinearSRGBColorSpace\n * const color = new THREE.Color().setHex( 0x112233 );\n * ```\n * Source color spaces may be specified explicitly, to ensure correct conversions.\n * ```js\n * // assumed already LinearSRGBColorSpace; no conversion\n * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5 );\n *\n * // converted explicitly from SRGBColorSpace to LinearSRGBColorSpace\n * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5, SRGBColorSpace );\n * ```\n * If THREE.ColorManagement is disabled, no conversions occur. For details,\n * see <i>Color management</i>. Iterating through a Color instance will yield\n * its components (r, g, b) in the corresponding order. A Color can be initialised\n * in any of the following ways:\n * ```js\n * //empty constructor - will default white\n * const color1 = new THREE.Color();\n *\n * //Hexadecimal color (recommended)\n * const color2 = new THREE.Color( 0xff0000 );\n *\n * //RGB string\n * const color3 = new THREE.Color(\"rgb(255, 0, 0)\");\n * const color4 = new THREE.Color(\"rgb(100%, 0%, 0%)\");\n *\n * //X11 color name - all 140 color names are supported.\n * //Note the lack of CamelCase in the name\n * const color5 = new THREE.Color( 'skyblue' );\n * //HSL string\n * const color6 = new THREE.Color(\"hsl(0, 100%, 50%)\");\n *\n * //Separate RGB values between 0 and 1\n * const color7 = new THREE.Color( 1, 0, 0 );\n * ```\n */\nclass Color {\n\n\t/**\n\t * Constructs a new color.\n\t *\n\t * Note that standard method of specifying color in three.js is with a hexadecimal triplet,\n\t * and that method is used throughout the rest of the documentation.\n\t *\n\t * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are\n\t * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.\n\t * @param {number} [g] - The green component.\n\t * @param {number} [b] - The blue component.\n\t */\n\tconstructor( r, g, b ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isColor = true;\n\n\t\t/**\n\t\t * The red component.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.r = 1;\n\n\t\t/**\n\t\t * The green component.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.g = 1;\n\n\t\t/**\n\t\t * The blue component.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\t/**\n\t * Sets the colors's components from the given values.\n\t *\n\t * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are\n\t * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.\n\t * @param {number} [g] - The green component.\n\t * @param {number} [b] - The blue component.\n\t * @return {Color} A reference to this color.\n\t */\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the colors's components to the given scalar value.\n\t *\n\t * @param {number} scalar - The scalar value.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this color from a hexadecimal value.\n\t *\n\t * @param {number} hex - The hexadecimal value.\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.colorSpaceToWorking( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this color from RGB values.\n\t *\n\t * @param {number} r - Red channel value between `0.0` and `1.0`.\n\t * @param {number} g - Green channel value between `0.0` and `1.0`.\n\t * @param {number} b - Blue channel value between `0.0` and `1.0`.\n\t * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.colorSpaceToWorking( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this color from RGB values.\n\t *\n\t * @param {number} h - Hue value between `0.0` and `1.0`.\n\t * @param {number} s - Saturation value between `0.0` and `1.0`.\n\t * @param {number} l - Lightness value between `0.0` and `1.0`.\n\t * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.colorSpaceToWorking( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,\n\t * `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or\n\t * any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) -\n\t * all 140 color names are supported).\n\t *\n\t * @param {string} style - Color as a CSS-style string.\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\twarn( 'Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\twarn( 'Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\twarn( 'Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets this color from a color name. Faster than {@link Color#setStyle} if\n\t * you don't need the other CSS-style formats.\n\t *\n\t * For convenience, the list of names is exposed in `Color.NAMES` as a hash.\n\t * ```js\n\t * Color.NAMES.aliceblue // returns 0xF0F8FF\n\t * ```\n\t *\n\t * @param {string} style - The color name.\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\twarn( 'Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new color with copied values from this instance.\n\t *\n\t * @return {Color} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\t/**\n\t * Copies the values of the given color to this instance.\n\t *\n\t * @param {Color} color - The color to copy.\n\t * @return {Color} A reference to this color.\n\t */\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the given color into this color, and then converts this color from\n\t * `SRGBColorSpace` to `LinearSRGBColorSpace`.\n\t *\n\t * @param {Color} color - The color to copy/convert.\n\t * @return {Color} A reference to this color.\n\t */\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the given color into this color, and then converts this color from\n\t * `LinearSRGBColorSpace` to `SRGBColorSpace`.\n\t *\n\t * @param {Color} color - The color to copy/convert.\n\t * @return {Color} A reference to this color.\n\t */\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.\n\t *\n\t * @return {Color} A reference to this color.\n\t */\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`.\n\t *\n\t * @return {Color} A reference to this color.\n\t */\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the hexadecimal value of this color.\n\t *\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {number} The hexadecimal value.\n\t */\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.workingToColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\t/**\n\t * Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').\n\t *\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {string} The hexadecimal value as a string.\n\t */\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( -6 );\n\n\t}\n\n\t/**\n\t * Converts the colors RGB values into the HSL format and stores them into the\n\t * given target object.\n\t *\n\t * @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result.\n\t * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n\t * @return {{h:number,s:number,l:number}} The HSL representation of this color.\n\t */\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.workingToColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns the RGB values of this color and stores them into the given target object.\n\t *\n\t * @param {Color} target - The target color that is used to store the method's result.\n\t * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n\t * @return {Color} The RGB representation of this color.\n\t */\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.workingToColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`.\n\t *\n\t * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n\t * @return {string} The CSS representation of this color.\n\t */\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.workingToColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\t/**\n\t * Adds the given HSL values to this color's values.\n\t * Internally, this converts the color's RGB values to HSL, adds HSL\n\t * and then converts the color back to RGB.\n\t *\n\t * @param {number} h - Hue value between `0.0` and `1.0`.\n\t * @param {number} s - Saturation value between `0.0` and `1.0`.\n\t * @param {number} l - Lightness value between `0.0` and `1.0`.\n\t * @return {Color} A reference to this color.\n\t */\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\t/**\n\t * Adds the RGB values of the given color to the RGB values of this color.\n\t *\n\t * @param {Color} color - The color to add.\n\t * @return {Color} A reference to this color.\n\t */\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the RGB values of the given colors and stores the result in this instance.\n\t *\n\t * @param {Color} color1 - The first color.\n\t * @param {Color} color2 - The second color.\n\t * @return {Color} A reference to this color.\n\t */\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to the RGB values of this color.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Color} A reference to this color.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the RGB values of the given color from the RGB values of this color.\n\t *\n\t * @param {Color} color - The color to subtract.\n\t * @return {Color} A reference to this color.\n\t */\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the RGB values of the given color with the RGB values of this color.\n\t *\n\t * @param {Color} color - The color to multiply.\n\t * @return {Color} A reference to this color.\n\t */\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with the RGB values of this color.\n\t *\n\t * @param {number} s - The scalar to multiply.\n\t * @return {Color} A reference to this color.\n\t */\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates this color's RGB values toward the RGB values of the\n\t * given color. The alpha argument can be thought of as the ratio between\n\t * the two colors, where `0.0` is this color and `1.0` is the first argument.\n\t *\n\t * @param {Color} color - The color to converge on.\n\t * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n\t * @return {Color} A reference to this color.\n\t */\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given colors and stores the result in this instance.\n\t * The alpha argument can be thought of as the ratio between the two colors, where `0.0`\n\t * is the first and `1.0` is the second color.\n\t *\n\t * @param {Color} color1 - The first color.\n\t * @param {Color} color2 - The second color.\n\t * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n\t * @return {Color} A reference to this color.\n\t */\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates this color's HSL values toward the HSL values of the\n\t * given color. It differs from {@link Color#lerp} by not interpolating straight\n\t * from one color to the other, but instead going through all the hues in between\n\t * those two colors. The alpha argument can be thought of as the ratio between\n\t * the two colors, where 0.0 is this color and 1.0 is the first argument.\n\t *\n\t * @param {Color} color - The color to converge on.\n\t * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n\t * @return {Color} A reference to this color.\n\t */\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the color's RGB components from the given 3D vector.\n\t *\n\t * @param {Vector3} v - The vector to set.\n\t * @return {Color} A reference to this color.\n\t */\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Transforms this color with the given 3x3 matrix.\n\t *\n\t * @param {Matrix3} m - The matrix.\n\t * @return {Color} A reference to this color.\n\t */\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this color is equal with the given one.\n\t *\n\t * @param {Color} c - The color to test for equality.\n\t * @return {boolean} Whether this bounding color is equal with the given one.\n\t */\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\t/**\n\t * Sets this color's RGB components from the given array.\n\t *\n\t * @param {Array<number>} array - An array holding the RGB values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Color} A reference to this color.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the RGB components of this color to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the color components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The color components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this color from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding color data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Color} A reference to this color.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * This methods defines the serialization result of this class. Returns the color\n\t * as a hexadecimal value.\n\t *\n\t * @return {number} The hexadecimal value.\n\t */\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\n/**\n * A dictionary with X11 color names.\n *\n * Note that multiple words such as Dark Orange become the string 'darkorange'.\n *\n * @static\n * @type {Object}\n */\nColor.NAMES = _colorKeywords;\n\n/**\n * This class can be used to define an exponential squared fog,\n * which gives a clear view near the camera and a faster than exponentially\n * densening fog farther from the camera.\n *\n * ```js\n * const scene = new THREE.Scene();\n * scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );\n * ```\n */\nclass FogExp2 {\n\n\t/**\n\t * Constructs a new fog.\n\t *\n\t * @param {number|Color} color - The fog's color.\n\t * @param {number} [density=0.00025] - Defines how fast the fog will grow dense.\n\t */\n\tconstructor( color, density = 0.00025 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isFogExp2 = true;\n\n\t\t/**\n\t\t * The name of the fog.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The fog's color.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.color = new Color( color );\n\n\t\t/**\n\t\t * Defines how fast the fog will grow dense.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.00025\n\t\t */\n\t\tthis.density = density;\n\n\t}\n\n\t/**\n\t * Returns a new fog with copied values from this instance.\n\t *\n\t * @return {FogExp2} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\t/**\n\t * Serializes the fog into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized fog\n\t */\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\n/**\n * This class can be used to define a linear fog that grows linearly denser\n * with the distance.\n *\n * ```js\n * const scene = new THREE.Scene();\n * scene.fog = new THREE.Fog( 0xcccccc, 10, 15 );\n * ```\n */\nclass Fog {\n\n\t/**\n\t * Constructs a new fog.\n\t *\n\t * @param {number|Color} color - The fog's color.\n\t * @param {number} [near=1] - The minimum distance to start applying fog.\n\t * @param {number} [far=1000] - The maximum distance at which fog stops being calculated and applied.\n\t */\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isFog = true;\n\n\t\t/**\n\t\t * The name of the fog.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The fog's color.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.color = new Color( color );\n\n\t\t/**\n\t\t * The minimum distance to start applying fog. Objects that are less than\n\t\t * `near` units from the active camera won't be affected by fog.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.near = near;\n\n\t\t/**\n\t\t * The maximum distance at which fog stops being calculated and applied.\n\t\t * Objects that are more than `far` units away from the active camera won't\n\t\t * be affected by fog.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1000\n\t\t */\n\t\tthis.far = far;\n\n\t}\n\n\t/**\n\t * Returns a new fog with copied values from this instance.\n\t *\n\t * @return {Fog} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\t/**\n\t * Serializes the fog into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized fog\n\t */\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\n/**\n * Scenes allow you to set up what is to be rendered and where by three.js.\n * This is where you place 3D objects like meshes, lines or lights.\n *\n * @augments Object3D\n */\nclass Scene extends Object3D {\n\n\t/**\n\t * Constructs a new scene.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\t/**\n\t\t * Defines the background of the scene. Valid inputs are:\n\t\t *\n\t\t * - A color for defining a uniform colored background.\n\t\t * - A texture for defining a (flat) textured background.\n\t\t * - Cube textures or equirectangular textures for defining a skybox.\n\t\t *\n\t\t * @type {?(Color|Texture)}\n\t\t * @default null\n\t\t */\n\t\tthis.background = null;\n\n\t\t/**\n\t\t * Sets the environment map for all physical materials in the scene. However,\n\t\t * it's not possible to overwrite an existing texture assigned to the `envMap`\n\t\t * material property.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.environment = null;\n\n\t\t/**\n\t\t * A fog instance defining the type of fog that affects everything\n\t\t * rendered in the scene.\n\t\t *\n\t\t * @type {?(Fog|FogExp2)}\n\t\t * @default null\n\t\t */\n\t\tthis.fog = null;\n\n\t\t/**\n\t\t * Sets the blurriness of the background. Only influences environment maps\n\t\t * assigned to {@link Scene#background}. Valid input is a float between `0`\n\t\t * and `1`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.backgroundBlurriness = 0;\n\n\t\t/**\n\t\t * Attenuates the color of the background. Only applies to background textures.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.backgroundIntensity = 1;\n\n\t\t/**\n\t\t * The rotation of the background in radians. Only influences environment maps\n\t\t * assigned to {@link Scene#background}.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.backgroundRotation = new Euler();\n\n\t\t/**\n\t\t * Attenuates the color of the environment. Only influences environment maps\n\t\t * assigned to {@link Scene#environment}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.environmentIntensity = 1;\n\n\t\t/**\n\t\t * The rotation of the environment map in radians. Only influences physical materials\n\t\t * in the scene when {@link Scene#environment} is used.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.environmentRotation = new Euler();\n\n\t\t/**\n\t\t * Forces everything in the scene to be rendered with the defined material. It is possible\n\t\t * to exclude materials from override by setting {@link Material#allowOverride} to `false`.\n\t\t *\n\t\t * @type {?Material}\n\t\t * @default null\n\t\t */\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\t\tthis.backgroundRotation.copy( source.backgroundRotation );\n\n\t\tthis.environmentIntensity = source.environmentIntensity;\n\t\tthis.environmentRotation.copy( source.environmentRotation );\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\n\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\nconst _v3$2 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nconst _v40 = /*@__PURE__*/ new Vector4();\nconst _v41 = /*@__PURE__*/ new Vector4();\nconst _v42 = /*@__PURE__*/ new Vector4();\n\n/**\n * A geometric triangle as defined by three vectors representing its three corners.\n */\nclass Triangle {\n\n\t/**\n\t * Constructs a new triangle.\n\t *\n\t * @param {Vector3} [a=(0,0,0)] - The first corner of the triangle.\n\t * @param {Vector3} [b=(0,0,0)] - The second corner of the triangle.\n\t * @param {Vector3} [c=(0,0,0)] - The third corner of the triangle.\n\t */\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\t/**\n\t\t * The first corner of the triangle.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.a = a;\n\n\t\t/**\n\t\t * The second corner of the triangle.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.b = b;\n\n\t\t/**\n\t\t * The third corner of the triangle.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.c = c;\n\n\t}\n\n\t/**\n\t * Computes the normal vector of a triangle.\n\t *\n\t * @param {Vector3} a - The first corner of the triangle.\n\t * @param {Vector3} b - The second corner of the triangle.\n\t * @param {Vector3} c - The third corner of the triangle.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The triangle's normal.\n\t */\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$2.subVectors( a, b );\n\t\ttarget.cross( _v0$2 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t/**\n\t * Computes a barycentric coordinates from the given vector.\n\t * Returns `null` if the triangle is degenerate.\n\t *\n\t * @param {Vector3} point - A point in 3D space.\n\t * @param {Vector3} a - The first corner of the triangle.\n\t * @param {Vector3} b - The second corner of the triangle.\n\t * @param {Vector3} c - The third corner of the triangle.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The barycentric coordinates for the given point\n\t */\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\n\t\t_v0$2.subVectors( c, a );\n\t\t_v1$5.subVectors( b, a );\n\t\t_v2$4.subVectors( point, a );\n\n\t\tconst dot00 = _v0$2.dot( _v0$2 );\n\t\tconst dot01 = _v0$2.dot( _v1$5 );\n\t\tconst dot02 = _v0$2.dot( _v2$4 );\n\t\tconst dot11 = _v1$5.dot( _v1$5 );\n\t\tconst dot12 = _v1$5.dot( _v2$4 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point, when projected onto the plane of the\n\t * triangle, lies within the triangle.\n\t *\n\t * @param {Vector3} point - The point in 3D space to test.\n\t * @param {Vector3} a - The first corner of the triangle.\n\t * @param {Vector3} b - The second corner of the triangle.\n\t * @param {Vector3} c - The third corner of the triangle.\n\t * @return {boolean} Whether the given point, when projected onto the plane of the\n\t * triangle, lies within the triangle or not.\n\t */\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\n\n\t}\n\n\t/**\n\t * Computes the value barycentrically interpolated for the given point on the\n\t * triangle. Returns `null` if the triangle is degenerate.\n\t *\n\t * @param {Vector3} point - Position of interpolated point.\n\t * @param {Vector3} p1 - The first corner of the triangle.\n\t * @param {Vector3} p2 - The second corner of the triangle.\n\t * @param {Vector3} p3 - The third corner of the triangle.\n\t * @param {Vector3} v1 - Value to interpolate of first vertex.\n\t * @param {Vector3} v2 - Value to interpolate of second vertex.\n\t * @param {Vector3} v3 - Value to interpolate of third vertex.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The interpolated value.\n\t */\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$2.x );\n\t\ttarget.addScaledVector( v2, _v3$2.y );\n\t\ttarget.addScaledVector( v3, _v3$2.z );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Computes the value barycentrically interpolated for the given attribute and indices.\n\t *\n\t * @param {BufferAttribute} attr - The attribute to interpolate.\n\t * @param {number} i1 - Index of first vertex.\n\t * @param {number} i2 - Index of second vertex.\n\t * @param {number} i3 - Index of third vertex.\n\t * @param {Vector3} barycoord - The barycoordinate value to use to interpolate.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The interpolated attribute value.\n\t */\n\tstatic getInterpolatedAttribute( attr, i1, i2, i3, barycoord, target ) {\n\n\t\t_v40.setScalar( 0 );\n\t\t_v41.setScalar( 0 );\n\t\t_v42.setScalar( 0 );\n\n\t\t_v40.fromBufferAttribute( attr, i1 );\n\t\t_v41.fromBufferAttribute( attr, i2 );\n\t\t_v42.fromBufferAttribute( attr, i3 );\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( _v40, barycoord.x );\n\t\ttarget.addScaledVector( _v41, barycoord.y );\n\t\ttarget.addScaledVector( _v42, barycoord.z );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns `true` if the triangle is oriented towards the given direction.\n\t *\n\t * @param {Vector3} a - The first corner of the triangle.\n\t * @param {Vector3} b - The second corner of the triangle.\n\t * @param {Vector3} c - The third corner of the triangle.\n\t * @param {Vector3} direction - The (normalized) direction vector.\n\t * @return {boolean} Whether the triangle is oriented towards the given direction or not.\n\t */\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$2.subVectors( c, b );\n\t\t_v1$5.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn _v0$2.cross( _v1$5 ).dot( direction ) < 0;\n\n\t}\n\n\t/**\n\t * Sets the triangle's vertices by copying the given values.\n\t *\n\t * @param {Vector3} a - The first corner of the triangle.\n\t * @param {Vector3} b - The second corner of the triangle.\n\t * @param {Vector3} c - The third corner of the triangle.\n\t * @return {Triangle} A reference to this triangle.\n\t */\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the triangle's vertices by copying the given array values.\n\t *\n\t * @param {Array<Vector3>} points - An array with 3D points.\n\t * @param {number} i0 - The array index representing the first corner of the triangle.\n\t * @param {number} i1 - The array index representing the second corner of the triangle.\n\t * @param {number} i2 - The array index representing the third corner of the triangle.\n\t * @return {Triangle} A reference to this triangle.\n\t */\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the triangle's vertices by copying the given attribute values.\n\t *\n\t * @param {BufferAttribute} attribute - A buffer attribute with 3D points data.\n\t * @param {number} i0 - The attribute index representing the first corner of the triangle.\n\t * @param {number} i1 - The attribute index representing the second corner of the triangle.\n\t * @param {number} i2 - The attribute index representing the third corner of the triangle.\n\t * @return {Triangle} A reference to this triangle.\n\t */\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new triangle with copied values from this instance.\n\t *\n\t * @return {Triangle} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given triangle to this instance.\n\t *\n\t * @param {Triangle} triangle - The triangle to copy.\n\t * @return {Triangle} A reference to this triangle.\n\t */\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the area of the triangle.\n\t *\n\t * @return {number} The triangle's area.\n\t */\n\tgetArea() {\n\n\t\t_v0$2.subVectors( this.c, this.b );\n\t\t_v1$5.subVectors( this.a, this.b );\n\n\t\treturn _v0$2.cross( _v1$5 ).length() * 0.5;\n\n\t}\n\n\t/**\n\t * Computes the midpoint of the triangle.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The triangle's midpoint.\n\t */\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\t/**\n\t * Computes the normal of the triangle.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The triangle's normal.\n\t */\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\t/**\n\t * Computes a plane the triangle lies within.\n\t *\n\t * @param {Plane} target - The target vector that is used to store the method's result.\n\t * @return {Plane} The plane the triangle lies within.\n\t */\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\t/**\n\t * Computes a barycentric coordinates from the given vector.\n\t * Returns `null` if the triangle is degenerate.\n\t *\n\t * @param {Vector3} point - A point in 3D space.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The barycentric coordinates for the given point\n\t */\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\t/**\n\t * Computes the value barycentrically interpolated for the given point on the\n\t * triangle. Returns `null` if the triangle is degenerate.\n\t *\n\t * @param {Vector3} point - Position of interpolated point.\n\t * @param {Vector3} v1 - Value to interpolate of first vertex.\n\t * @param {Vector3} v2 - Value to interpolate of second vertex.\n\t * @param {Vector3} v3 - Value to interpolate of third vertex.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The interpolated value.\n\t */\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point, when projected onto the plane of the\n\t * triangle, lies within the triangle.\n\t *\n\t * @param {Vector3} point - The point in 3D space to test.\n\t * @return {boolean} Whether the given point, when projected onto the plane of the\n\t * triangle, lies within the triangle or not.\n\t */\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\t/**\n\t * Returns `true` if the triangle is oriented towards the given direction.\n\t *\n\t * @param {Vector3} direction - The (normalized) direction vector.\n\t * @return {boolean} Whether the triangle is oriented towards the given direction or not.\n\t */\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\t/**\n\t * Returns `true` if this triangle intersects with the given box.\n\t *\n\t * @param {Box3} box - The box to intersect.\n\t * @return {boolean} Whether this triangle intersects with the given box or not.\n\t */\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\t/**\n\t * Returns the closest point on the triangle to the given point.\n\t *\n\t * @param {Vector3} p - The point to compute the closest point for.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The closest point on the triangle.\n\t */\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\t/**\n\t * Returns `true` if this triangle is equal with the given one.\n\t *\n\t * @param {Triangle} triangle - The triangle to test for equality.\n\t * @return {boolean} Whether this triangle is equal with the given one.\n\t */\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\n/**\n * Represents an axis-aligned bounding box (AABB) in 3D space.\n */\nclass Box3 {\n\n\t/**\n\t * Constructs a new bounding box.\n\t *\n\t * @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box.\n\t * @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box.\n\t */\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBox3 = true;\n\n\t\t/**\n\t\t * The lower boundary of the box.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.min = min;\n\n\t\t/**\n\t\t * The upper boundary of the box.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.max = max;\n\n\t}\n\n\t/**\n\t * Sets the lower and upper boundaries of this box.\n\t * Please note that this method only copies the values from the given objects.\n\t *\n\t * @param {Vector3} min - The lower boundary of the box.\n\t * @param {Vector3} max - The upper boundary of the box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the upper and lower bounds of this box so it encloses the position data\n\t * in the given array.\n\t *\n\t * @param {Array<number>} array - An array holding 3D position data.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the upper and lower bounds of this box so it encloses the position data\n\t * in the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the upper and lower bounds of this box so it encloses the position data\n\t * in the given array.\n\t *\n\t * @param {Array<Vector3>} points - An array holding 3D position data as instances of {@link Vector3}.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Centers this box on the given center vector and sets this box's width, height and\n\t * depth to the given size values.\n\t *\n\t * @param {Vector3} center - The center of the box.\n\t * @param {Vector3} size - The x, y and z dimensions of the box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the world-axis-aligned bounding box for the given 3D object\n\t * (including its children), accounting for the object's, and children's,\n\t * world transforms. The function may result in a larger box than strictly necessary.\n\t *\n\t * @param {Object3D} object - The 3D object to compute the bounding box for.\n\t * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest\n\t * world-axis-aligned bounding box at the expense of more computation.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\t/**\n\t * Returns a new box with copied values from this instance.\n\t *\n\t * @return {Box3} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given box to this instance.\n\t *\n\t * @param {Box3} box - The box to copy.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Makes this box empty which means in encloses a zero space in 3D.\n\t *\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns true if this box includes zero points within its bounds.\n\t * Note that a box with equal lower and upper bounds still includes one\n\t * point, the one both bounds share.\n\t *\n\t * @return {boolean} Whether this box is empty or not.\n\t */\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\t/**\n\t * Returns the center point of this box.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The center point.\n\t */\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\t/**\n\t * Returns the dimensions of this box.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The size.\n\t */\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\t/**\n\t * Expands the boundaries of this box to include the given point.\n\t *\n\t * @param {Vector3} point - The point that should be included by the bounding box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands this box equilaterally by the given vector. The width of this\n\t * box will be expanded by the x component of the vector in both\n\t * directions. The height of this box will be expanded by the y component of\n\t * the vector in both directions. The depth of this box will be\n\t * expanded by the z component of the vector in both directions.\n\t *\n\t * @param {Vector3} vector - The vector that should expand the bounding box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands each dimension of the box by the given scalar. If negative, the\n\t * dimensions of the box will be contracted.\n\t *\n\t * @param {number} scalar - The scalar value that should expand the bounding box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands the boundaries of this box to include the given 3D object and\n\t * its children, accounting for the object's, and children's, world\n\t * transforms. The function may result in a larger box than strictly\n\t * necessary (unless the precise parameter is set to true).\n\t *\n\t * @param {Object3D} object - The 3D object that should expand the bounding box.\n\t * @param {boolean} precise - If set to `true`, the method expands the bounding box\n\t * as little as necessary at the expense of more computation.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point lies within or on the boundaries of this box.\n\t *\n\t * @param {Vector3} point - The point to test.\n\t * @return {boolean} Whether the bounding box contains the given point or not.\n\t */\n\tcontainsPoint( point ) {\n\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y &&\n\t\t\tpoint.z >= this.min.z && point.z <= this.max.z;\n\n\t}\n\n\t/**\n\t * Returns `true` if this bounding box includes the entirety of the given bounding box.\n\t * If this box and the given one are identical, this function also returns `true`.\n\t *\n\t * @param {Box3} box - The bounding box to test.\n\t * @return {boolean} Whether the bounding box contains the given bounding box or not.\n\t */\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\t/**\n\t * Returns a point as a proportion of this box's width, height and depth.\n\t *\n\t * @param {Vector3} point - A point in 3D space.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} A point as a proportion of this box's width, height and depth.\n\t */\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding box intersects with this bounding box.\n\t *\n\t * @param {Box3} box - The bounding box to test.\n\t * @return {boolean} Whether the given bounding box intersects with this bounding box.\n\t */\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y &&\n\t\t\tbox.max.z >= this.min.z && box.min.z <= this.max.z;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding sphere intersects with this bounding box.\n\t *\n\t * @param {Sphere} sphere - The bounding sphere to test.\n\t * @return {boolean} Whether the given bounding sphere intersects with this bounding box.\n\t */\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given plane intersects with this bounding box.\n\t *\n\t * @param {Plane} plane - The plane to test.\n\t * @return {boolean} Whether the given plane intersects with this bounding box.\n\t */\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given triangle intersects with this bounding box.\n\t *\n\t * @param {Triangle} triangle - The triangle to test.\n\t * @return {boolean} Whether the given triangle intersects with this bounding box.\n\t */\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$1.subVectors( triangle.a, _center );\n\t\t_v1$4.subVectors( triangle.b, _center );\n\t\t_v2$3.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$4, _v0$1 );\n\t\t_f1.subVectors( _v2$3, _v1$4 );\n\t\t_f2.subVectors( _v0$1, _v2$3 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$1, _v1$4, _v2$3, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$1, _v1$4, _v2$3, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$1, _v1$4, _v2$3, _extents );\n\n\t}\n\n\t/**\n\t * Clamps the given point within the bounds of this box.\n\t *\n\t * @param {Vector3} point - The point to clamp.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The clamped point.\n\t */\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\t/**\n\t * Returns the euclidean distance from any edge of this box to the specified point. If\n\t * the given point lies inside of this box, the distance will be `0`.\n\t *\n\t * @param {Vector3} point - The point to compute the distance to.\n\t * @return {number} The euclidean distance.\n\t */\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$b ).distanceTo( point );\n\n\t}\n\n\t/**\n\t * Returns a bounding sphere that encloses this bounding box.\n\t *\n\t * @param {Sphere} target - The target sphere that is used to store the method's result.\n\t * @return {Sphere} The bounding sphere that encloses this bounding box.\n\t */\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Computes the intersection of this bounding box and the given one, setting the upper\n\t * bound of this box to the lesser of the two boxes' upper bounds and the\n\t * lower bound of this box to the greater of the two boxes' lower bounds. If\n\t * there's no overlap, makes this box empty.\n\t *\n\t * @param {Box3} box - The bounding box to intersect with.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the union of this box and another and the given one, setting the upper\n\t * bound of this box to the greater of the two boxes' upper bounds and the\n\t * lower bound of this box to the lesser of the two boxes' lower bounds.\n\t *\n\t * @param {Box3} box - The bounding box that will be unioned with this instance.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Transforms this bounding box by the given 4x4 transformation matrix.\n\t *\n\t * @param {Matrix4} matrix - The transformation matrix.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given offset to both the upper and lower bounds of this bounding box,\n\t * effectively moving it in 3D space.\n\t *\n\t * @param {Vector3} offset - The offset that should be used to translate the bounding box.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this bounding box is equal with the given one.\n\t *\n\t * @param {Box3} box - The box to test for equality.\n\t * @return {boolean} Whether this bounding box is equal with the given one.\n\t */\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n\t/**\n\t * Returns a serialized structure of the bounding box.\n\t *\n\t * @return {Object} Serialized structure with fields representing the object state.\n\t */\n\ttoJSON() {\n\n\t\treturn {\n\t\t\tmin: this.min.toArray(),\n\t\t\tmax: this.max.toArray()\n\t\t};\n\n\t}\n\n\t/**\n\t * Returns a serialized structure of the bounding box.\n\t *\n\t * @param {Object} json - The serialized json to set the box from.\n\t * @return {Box3} A reference to this bounding box.\n\t */\n\tfromJSON( json ) {\n\n\t\tthis.min.fromArray( json.min );\n\t\tthis.max.fromArray( json.max );\n\t\treturn this;\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < -27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < -14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= -8388609; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n/**\n * Returns a half precision floating point value (FP16) from the given single\n * precision floating point value (FP32).\n *\n * @param {number} val - A single precision floating point value.\n * @return {number} The FP16 value.\n */\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) warn( 'DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, -65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n/**\n * Returns a single precision floating point value (FP32) from the given half\n * precision floating point value (FP16).\n *\n * @param {number} val - A half precision floating point value.\n * @return {number} The FP32 value.\n */\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\n/**\n * A class containing utility functions for data.\n *\n * @hideconstructor\n */\nclass DataUtils {\n\n\t/**\n\t * Returns a half precision floating point value (FP16) from the given single\n\t * precision floating point value (FP32).\n\t *\n\t * @param {number} val - A single precision floating point value.\n\t * @return {number} The FP16 value.\n\t */\n\tstatic toHalfFloat( val ) {\n\n\t\treturn toHalfFloat( val );\n\n\t}\n\n\t/**\n\t * Returns a single precision floating point value (FP32) from the given half\n\t * precision floating point value (FP16).\n\t *\n\t * @param {number} val - A half precision floating point value.\n\t * @return {number} The FP32 value.\n\t */\n\tstatic fromHalfFloat( val ) {\n\n\t\treturn fromHalfFloat( val );\n\n\t}\n\n}\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nlet _id$2 = 0;\n\n/**\n * This class stores data for an attribute (such as vertex positions, face\n * indices, normals, colors, UVs, and any custom attributes ) associated with\n * a geometry, which allows for more efficient passing of data to the GPU.\n *\n * When working with vector-like data, the `fromBufferAttribute( attribute, index )`\n * helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}.\n */\nclass BufferAttribute extends EventDispatcher {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {TypedArray} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tsuper();\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBufferAttribute = true;\n\n\t\t/**\n\t\t * The ID of the buffer attribute.\n\t\t *\n\t\t * @name BufferAttribute#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\n\n\t\t/**\n\t\t * The name of the buffer attribute.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The array holding the attribute data. It should have `itemSize * numVertices`\n\t\t * elements, where `numVertices` is the number of vertices in the associated geometry.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.array = array;\n\n\t\t/**\n\t\t * The number of values of the array that should be associated with a particular vertex.\n\t\t * For instance, if this attribute is storing a 3-component vector (such as a position,\n\t\t * normal, or color), then the value should be `3`.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.itemSize = itemSize;\n\n\t\t/**\n\t\t * Represents the number of items this buffer attribute stores. It is internally computed\n\t\t * by dividing the `array` length by the `itemSize`.\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\n\t\t/**\n\t\t * Applies to integer data only. Indicates how the underlying data in the buffer maps to\n\t\t * the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`,\n\t\t * and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to\n\t\t * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted\n\t\t * to floats unmodified, i.e. `65535` becomes `65535.0f`.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tthis.normalized = normalized;\n\n\t\t/**\n\t\t * Defines the intended usage pattern of the data store for optimization purposes.\n\t\t *\n\t\t * Note: After the initial use of a buffer, its usage cannot be changed. Instead,\n\t\t * instantiate a new one and set the desired usage before the next render.\n\t\t *\n\t\t * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)}\n\t\t * @default StaticDrawUsage\n\t\t */\n\t\tthis.usage = StaticDrawUsage;\n\n\t\t/**\n\t\t * This can be used to only update some components of stored vectors (for example, just the\n\t\t * component related to color). Use the `addUpdateRange()` function to add ranges to this array.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.updateRanges = [];\n\n\t\t/**\n\t\t * Configures the bound GPU type for use in shaders.\n\t\t *\n\t\t * Note: this only has an effect for integer arrays and is not configurable for float arrays.\n\t\t * For lower precision float types, use `Float16BufferAttribute`.\n\t\t *\n\t\t * @type {(FloatType|IntType)}\n\t\t * @default FloatType\n\t\t */\n\t\tthis.gpuType = FloatType;\n\n\t\t/**\n\t\t * A version number, incremented every time the `needsUpdate` is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.version = 0;\n\n\t}\n\n\t/**\n\t * A callback function that is executed after the renderer has transferred the attribute\n\t * array data to the GPU.\n\t */\n\tonUploadCallback() {}\n\n\t/**\n\t * Flag to indicate that this attribute has changed and should be re-sent to\n\t * the GPU. Set this to `true` when you modify the value of the array.\n\t *\n\t * @type {number}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\t/**\n\t * Sets the usage of this buffer attribute.\n\t *\n\t * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set.\n\t * @return {BufferAttribute} A reference to this buffer attribute.\n\t */\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds a range of data in the data array to be updated on the GPU.\n\t *\n\t * @param {number} start - Position at which to start update.\n\t * @param {number} count - The number of components to update.\n\t */\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\t/**\n\t * Clears the update ranges.\n\t */\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\t/**\n\t * Copies the values of the given buffer attribute to this instance.\n\t *\n\t * @param {BufferAttribute} source - The buffer attribute to copy.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies a vector from the given buffer attribute to this one. The start\n\t * and destination position in the attribute buffers are represented by the\n\t * given indices.\n\t *\n\t * @param {number} index1 - The destination index into this buffer attribute.\n\t * @param {BufferAttribute} attribute - The buffer attribute to copy from.\n\t * @param {number} index2 - The source index into the given buffer attribute.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the given array data into this buffer attribute.\n\t *\n\t * @param {(TypedArray|Array)} array - The array to copy.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 3x3 matrix to the given attribute. Works with\n\t * item size `2` and `3`.\n\t *\n\t * @param {Matrix3} m - The matrix to apply.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$a.fromBufferAttribute( this, i );\n\t\t\t\t_vector$a.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$a.x, _vector$a.y, _vector$a.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 4x4 matrix to the given attribute. Only works with\n\t * item size `3`.\n\t *\n\t * @param {Matrix4} m - The matrix to apply.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$a.fromBufferAttribute( this, i );\n\n\t\t\t_vector$a.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$a.x, _vector$a.y, _vector$a.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 3x3 normal matrix to the given attribute. Only works with\n\t * item size `3`.\n\t *\n\t * @param {Matrix3} m - The normal matrix to apply.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$a.fromBufferAttribute( this, i );\n\n\t\t\t_vector$a.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$a.x, _vector$a.y, _vector$a.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 4x4 matrix to the given attribute. Only works with\n\t * item size `3` and with direction vectors.\n\t *\n\t * @param {Matrix4} m - The matrix to apply.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$a.fromBufferAttribute( this, i );\n\n\t\t\t_vector$a.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$a.x, _vector$a.y, _vector$a.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given array data in the buffer attribute.\n\t *\n\t * @param {(TypedArray|Array)} value - The array data to set.\n\t * @param {number} [offset=0] - The offset in this buffer attribute's array.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the given component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} component - The component index.\n\t * @return {number} The returned value.\n\t */\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\t/**\n\t * Sets the given value to the given component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} component - The component index.\n\t * @param {number} value - The value to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the x component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The x component.\n\t */\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\t/**\n\t * Sets the x component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The y component.\n\t */\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\t/**\n\t * Sets the y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} y - The value to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The z component.\n\t */\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\t/**\n\t * Sets the z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} z - The value to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The w component.\n\t */\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\t/**\n\t * Sets the w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} w - The value to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x and y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y and z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @param {number} z - The value for the z component to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y, z and w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @param {number} z - The value for the z component to set.\n\t * @param {number} w - The value for the w component to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given callback function that is executed after the Renderer has transferred\n\t * the attribute array data to the GPU. Can be used to perform clean-up operations after\n\t * the upload when attribute data are not needed anymore on the CPU side.\n\t *\n\t * @param {Function} callback - The `onUpload()` callback.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new buffer attribute with copied values from this instance.\n\t *\n\t * @return {BufferAttribute} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\t/**\n\t * Serializes the buffer attribute into JSON.\n\t *\n\t * @return {Object} A JSON object representing the serialized buffer attribute.\n\t */\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\n\t\treturn data;\n\n\t}\n\n\t/**\n\t * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `Int8` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Int8BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Int8Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `UInt8` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Uint8Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `UInt8Clamped` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Uint8ClampedArray)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `Int16` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Int16BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Int16Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `UInt16` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Uint16Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `Int32` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Int32BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Int32Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `UInt32` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Uint32Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `Float16` buffer attribute with\n * a plain `Array` instance.\n *\n * This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array`\n * browser support is still problematic.\n *\n * @augments BufferAttribute\n */\nclass Float16BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Uint16Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Convenient class that can be used when creating a `Float32` buffer attribute with\n * a plain `Array` instance.\n *\n * @augments BufferAttribute\n */\nclass Float32BufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new buffer attribute.\n\t *\n\t * @param {(Array<number>|Float32Array)} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nconst _box$3 = /*@__PURE__*/ new Box3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\n\n/**\n * An analytical 3D sphere defined by a center and radius. This class is mainly\n * used as a Bounding Sphere for 3D objects.\n */\nclass Sphere {\n\n\t/**\n\t * Constructs a new sphere.\n\t *\n\t * @param {Vector3} [center=(0,0,0)] - The center of the sphere\n\t * @param {number} [radius=-1] - The radius of the sphere.\n\t */\n\tconstructor( center = new Vector3(), radius = -1 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSphere = true;\n\n\t\t/**\n\t\t * The center of the sphere\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.center = center;\n\n\t\t/**\n\t\t * The radius of the sphere.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.radius = radius;\n\n\t}\n\n\t/**\n\t * Sets the sphere's components by copying the given values.\n\t *\n\t * @param {Vector3} center - The center.\n\t * @param {number} radius - The radius.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the minimum bounding sphere for list of points.\n\t * If the optional center point is given, it is used as the sphere's\n\t * center. Otherwise, the center of the axis-aligned bounding box\n\t * encompassing the points is calculated.\n\t *\n\t * @param {Array<Vector3>} points - A list of points in 3D space.\n\t * @param {Vector3} [optionalCenter] - The center of the sphere.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$3.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given sphere to this instance.\n\t *\n\t * @param {Sphere} sphere - The sphere to copy.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if the sphere is empty (the radius set to a negative number).\n\t *\n\t * Spheres with a radius of `0` contain only their center point and are not\n\t * considered to be empty.\n\t *\n\t * @return {boolean} Whether this sphere is empty or not.\n\t */\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\t/**\n\t * Makes this sphere empty which means in encloses a zero space in 3D.\n\t *\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = -1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this sphere contains the given point inclusive of\n\t * the surface of the sphere.\n\t *\n\t * @param {Vector3} point - The point to check.\n\t * @return {boolean} Whether this sphere contains the given point or not.\n\t */\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\t/**\n\t * Returns the closest distance from the boundary of the sphere to the\n\t * given point. If the sphere contains the point, the distance will\n\t * be negative.\n\t *\n\t * @param {Vector3} point - The point to compute the distance to.\n\t * @return {number} The distance to the point.\n\t */\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\t/**\n\t * Returns `true` if this sphere intersects with the given one.\n\t *\n\t * @param {Sphere} sphere - The sphere to test.\n\t * @return {boolean} Whether this sphere intersects with the given one or not.\n\t */\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\t/**\n\t * Returns `true` if this sphere intersects with the given box.\n\t *\n\t * @param {Box3} box - The box to test.\n\t * @return {boolean} Whether this sphere intersects with the given box or not.\n\t */\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\t/**\n\t * Returns `true` if this sphere intersects with the given plane.\n\t *\n\t * @param {Plane} plane - The plane to test.\n\t * @return {boolean} Whether this sphere intersects with the given plane or not.\n\t */\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\t/**\n\t * Clamps a point within the sphere. If the point is outside the sphere, it\n\t * will clamp it to the closest point on the edge of the sphere. Points\n\t * already inside the sphere will not be affected.\n\t *\n\t * @param {Vector3} point - The plane to clamp.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The clamped point.\n\t */\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns a bounding box that encloses this sphere.\n\t *\n\t * @param {Box3} target - The target box that is used to store the method's result.\n\t * @return {Box3} The bounding box that encloses this sphere.\n\t */\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Transforms this sphere with the given 4x4 transformation matrix.\n\t *\n\t * @param {Matrix4} matrix - The transformation matrix.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Translates the sphere's center by the given offset.\n\t *\n\t * @param {Vector3} offset - The offset.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands the boundaries of this sphere to include the given point.\n\t *\n\t * @param {Vector3} point - The point to include.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$3.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$3.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$3, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands this sphere to enclose both the original sphere and the given sphere.\n\t *\n\t * @param {Sphere} sphere - The sphere to include.\n\t * @return {Sphere} A reference to this sphere.\n\t */\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$2.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$3.copy( sphere.center ).add( _v2$2 ) );\n\n\t\t\tthis.expandByPoint( _v1$3.copy( sphere.center ).sub( _v2$2 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this sphere is equal with the given one.\n\t *\n\t * @param {Sphere} sphere - The sphere to test for equality.\n\t * @return {boolean} Whether this bounding sphere is equal with the given one.\n\t */\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\t/**\n\t * Returns a new sphere with copied values from this instance.\n\t *\n\t * @return {Sphere} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Returns a serialized structure of the bounding sphere.\n\t *\n\t * @return {Object} Serialized structure with fields representing the object state.\n\t */\n\ttoJSON() {\n\n\t\treturn {\n\t\t\tradius: this.radius,\n\t\t\tcenter: this.center.toArray()\n\t\t};\n\n\t}\n\n\t/**\n\t * Returns a serialized structure of the bounding sphere.\n\t *\n\t * @param {Object} json - The serialized json to set the sphere from.\n\t * @return {Sphere} A reference to this bounding sphere.\n\t */\n\tfromJSON( json ) {\n\n\t\tthis.radius = json.radius;\n\t\tthis.center.fromArray( json.center );\n\t\treturn this;\n\n\t}\n\n}\n\nlet _id$1 = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$9 = /*@__PURE__*/ new Vector3();\n\n/**\n * A representation of mesh, line, or point geometry. Includes vertex\n * positions, face indices, normals, colors, UVs, and custom attributes\n * within buffers, reducing the cost of passing all this data to the GPU.\n *\n * ```js\n * const geometry = new THREE.BufferGeometry();\n * // create a simple square shape. We duplicate the top left and bottom right\n * // vertices because each vertex needs to appear once per triangle.\n * const vertices = new Float32Array( [\n * \t-1.0, -1.0, 1.0, // v0\n * \t 1.0, -1.0, 1.0, // v1\n * \t 1.0, 1.0, 1.0, // v2\n *\n * \t 1.0, 1.0, 1.0, // v3\n * \t-1.0, 1.0, 1.0, // v4\n * \t-1.0, -1.0, 1.0 // v5\n * ] );\n * // itemSize = 3 because there are 3 values (components) per vertex\n * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\n * const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );\n * const mesh = new THREE.Mesh( geometry, material );\n * ```\n *\n * @augments EventDispatcher\n */\nclass BufferGeometry extends EventDispatcher {\n\n\t/**\n\t * Constructs a new geometry.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBufferGeometry = true;\n\n\t\t/**\n\t\t * The ID of the geometry.\n\t\t *\n\t\t * @name BufferGeometry#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _id$1 ++ } );\n\n\t\t/**\n\t\t * The UUID of the geometry.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * The name of the geometry.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\t/**\n\t\t * Allows for vertices to be re-used across multiple triangles; this is\n\t\t * called using \"indexed triangles\". Each triangle is associated with the\n\t\t * indices of three vertices. This attribute therefore stores the index of\n\t\t * each vertex for each triangular face. If this attribute is not set, the\n\t\t * renderer assumes that each three contiguous positions represent a single triangle.\n\t\t *\n\t\t * @type {?BufferAttribute}\n\t\t * @default null\n\t\t */\n\t\tthis.index = null;\n\n\t\t/**\n\t\t * A (storage) buffer attribute which was generated with a compute shader and\n\t\t * now defines indirect draw calls.\n\t\t *\n\t\t * Can only be used with {@link WebGPURenderer} and a WebGPU backend.\n\t\t *\n\t\t * @type {?BufferAttribute}\n\t\t * @default null\n\t\t */\n\t\tthis.indirect = null;\n\n\t\t/**\n\t\t * The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.\n\t\t *\n\t\t * Can only be used with {@link WebGPURenderer} and a WebGPU backend.\n\t\t *\n\t\t * @type {number|Array<number>}\n\t\t * @default 0\n\t\t */\n\t\tthis.indirectOffset = 0;\n\n\t\t/**\n\t\t * This dictionary has as id the name of the attribute to be set and as value\n\t\t * the buffer attribute to set it to. Rather than accessing this property directly,\n\t\t * use `setAttribute()` and `getAttribute()` to access attributes of this geometry.\n\t\t *\n\t\t * @type {Object<string,(BufferAttribute|InterleavedBufferAttribute)>}\n\t\t */\n\t\tthis.attributes = {};\n\n\t\t/**\n\t\t * This dictionary holds the morph targets of the geometry.\n\t\t *\n\t\t * Note: Once the geometry has been rendered, the morph attribute data cannot\n\t\t * be changed. You will have to call `dispose()`, and create a new geometry instance.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.morphAttributes = {};\n\n\t\t/**\n\t\t * Used to control the morph target behavior; when set to `true`, the morph\n\t\t * target data is treated as relative offsets, rather than as absolute\n\t\t * positions/normals.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.morphTargetsRelative = false;\n\n\t\t/**\n\t\t * Split the geometry into groups, each of which will be rendered in a\n\t\t * separate draw call. This allows an array of materials to be used with the geometry.\n\t\t *\n\t\t * Use `addGroup()` and `clearGroups()` to edit groups, rather than modifying this array directly.\n\t\t *\n\t\t * Every vertex and index must belong to exactly one group \u2014 groups must not share vertices or\n\t\t * indices, and must not leave vertices or indices unused.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.groups = [];\n\n\t\t/**\n\t\t * Bounding box for the geometry which can be calculated with `computeBoundingBox()`.\n\t\t *\n\t\t * @type {?Box3}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingBox = null;\n\n\t\t/**\n\t\t * Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`.\n\t\t *\n\t\t * @type {?Sphere}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingSphere = null;\n\n\t\t/**\n\t\t * Determines the part of the geometry to render. This should not be set directly,\n\t\t * instead use `setDrawRange()`.\n\t\t *\n\t\t * @type {{start:number,count:number}}\n\t\t */\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\t/**\n\t\t * An object that can be used to store custom data about the geometry.\n\t\t * It should not hold references to functions as these will not be cloned.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.userData = {};\n\n\t}\n\n\t/**\n\t * Returns the index of this geometry.\n\t *\n\t * @return {?BufferAttribute} The index. Returns `null` if no index is defined.\n\t */\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\t/**\n\t * Sets the given index to this geometry.\n\t *\n\t * @param {Array<number>|BufferAttribute} index - The index to set.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given indirect attribute to this geometry.\n\t *\n\t * @param {BufferAttribute} indirect - The attribute holding indirect draw calls.\n\t * @param {number|Array<number>} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tsetIndirect( indirect, indirectOffset = 0 ) {\n\n\t\tthis.indirect = indirect;\n\t\tthis.indirectOffset = indirectOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the indirect attribute of this geometry.\n\t *\n\t * @return {?BufferAttribute} The indirect attribute. Returns `null` if no indirect attribute is defined.\n\t */\n\tgetIndirect() {\n\n\t\treturn this.indirect;\n\n\t}\n\n\t/**\n\t * Returns the buffer attribute for the given name.\n\t *\n\t * @param {string} name - The attribute name.\n\t * @return {BufferAttribute|InterleavedBufferAttribute|undefined} The buffer attribute.\n\t * Returns `undefined` if not attribute has been found.\n\t */\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\t/**\n\t * Sets the given attribute for the given name.\n\t *\n\t * @param {string} name - The attribute name.\n\t * @param {BufferAttribute|InterleavedBufferAttribute} attribute - The attribute to set.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Deletes the attribute for the given name.\n\t *\n\t * @param {string} name - The attribute name to delete.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this geometry has an attribute for the given name.\n\t *\n\t * @param {string} name - The attribute name.\n\t * @return {boolean} Whether this geometry has an attribute for the given name or not.\n\t */\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\t/**\n\t * Adds a group to this geometry.\n\t *\n\t * @param {number} start - The first element in this draw call. That is the first\n\t * vertex for non-indexed geometry, otherwise the first triangle index.\n\t * @param {number} count - Specifies how many vertices (or indices) are part of this group.\n\t * @param {number} [materialIndex=0] - The material array index to use.\n\t */\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Clears all groups.\n\t */\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\t/**\n\t * Sets the draw range for this geometry.\n\t *\n\t * @param {number} start - The first vertex for non-indexed geometry, otherwise the first triangle index.\n\t * @param {number} count - For non-indexed BufferGeometry, `count` is the number of vertices to render.\n\t * For indexed BufferGeometry, `count` is the number of indices to render.\n\t */\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\t/**\n\t * Applies the given 4x4 transformation matrix to the geometry.\n\t *\n\t * @param {Matrix4} matrix - The matrix to apply.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the rotation represented by the Quaternion to the geometry.\n\t *\n\t * @param {Quaternion} q - The Quaternion to apply.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the geometry about the X axis. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the geometry about the Y axis. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the geometry about the Z axis. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {number} angle - The angle in radians.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Translates the geometry. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#position} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {number} x - The x offset.\n\t * @param {number} y - The y offset.\n\t * @param {number} z - The z offset.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Scales the geometry. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#scale} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {number} x - The x scale.\n\t * @param {number} y - The y scale.\n\t * @param {number} z - The z scale.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Rotates the geometry to face a point in 3D space. This is typically done as a one time\n\t * operation, and not during a loop. Use {@link Object3D#lookAt} for typical\n\t * real-time mesh rotation.\n\t *\n\t * @param {Vector3} vector - The target point.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Center the geometry based on its bounding box.\n\t *\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Defines a geometry by creating a `position` attribute based on the given array of points. The array\n\t * can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is\n\t * set to `0`.\n\t *\n\t * If the method is used with an existing `position` attribute, the vertex data are overwritten with the\n\t * data from the array. The length of the array must match the vertex count.\n\t *\n\t * @param {Array<Vector2>|Array<Vector3>} points - The points.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tsetFromPoints( points ) {\n\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute === undefined ) {\n\n\t\t\tconst position = [];\n\n\t\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\t\tconst point = points[ i ];\n\t\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\t} else {\n\n\t\t\tconst l = Math.min( points.length, positionAttribute.count ); // make sure data do not exceed buffer size\n\n\t\t\tfor ( let i = 0; i < l; i ++ ) {\n\n\t\t\t\tconst point = points[ i ];\n\t\t\t\tpositionAttribute.setXYZ( i, point.x, point.y, point.z || 0 );\n\n\t\t\t}\n\n\t\t\tif ( points.length > positionAttribute.count ) {\n\n\t\t\t\twarn( 'BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.' );\n\n\t\t\t}\n\n\t\t\tpositionAttribute.needsUpdate = true;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the bounding box of the geometry, and updates the `boundingBox` member.\n\t * The bounding box is not computed by the engine; it must be computed by your app.\n\t * You may need to recompute the bounding box if the geometry vertices are modified.\n\t */\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\terror( 'BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$9.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$9 );\n\n\t\t\t\t\t\t_vector$9.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$9 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\terror( 'BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bounding sphere of the geometry, and updates the `boundingSphere` member.\n\t * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.\n\t * You may need to recompute the bounding sphere if the geometry vertices are modified.\n\t */\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\terror( 'BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$2.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$9.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$9 );\n\n\t\t\t\t\t\t_vector$9.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$9 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$2.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$9.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$9 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$9.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$9.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$9 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\terror( 'BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Calculates and adds a tangent attribute to this geometry.\n\t *\n\t * The computation is only supported for indexed geometries and if position, normal, and uv attributes\n\t * are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by\n\t * {@link BufferGeometryUtils#computeMikkTSpaceTangents} instead.\n\t */\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\terror( 'BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst positionAttribute = attributes.position;\n\t\tconst normalAttribute = attributes.normal;\n\t\tconst uvAttribute = attributes.uv;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\n\n\t\t}\n\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromBufferAttribute( positionAttribute, a );\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\n\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: index.count\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindex.getX( j + 0 ),\n\t\t\t\t\tindex.getX( j + 1 ),\n\t\t\t\t\tindex.getX( j + 2 )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromBufferAttribute( normalAttribute, v );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? -1 : 1.0;\n\n\t\t\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( index.getX( j + 0 ) );\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\n\t\t\t\thandleVertex( index.getX( j + 2 ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes vertex normals for the given vertex data. For indexed geometries, the method sets\n\t * each vertex normal to be the average of the face normals of the faces that share that vertex.\n\t * For non-indexed geometries, vertices are not shared, and the method sets each vertex normal\n\t * to be the same as the face normal.\n\t */\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Ensures every normal vector in a geometry will have a magnitude of `1`. This will\n\t * correct lighting on the geometry surfaces.\n\t */\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$9.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Return a new non-index version of this indexed geometry. If the geometry\n\t * is already non-indexed, the method is a NOOP.\n\t *\n\t * @return {BufferGeometry} The non-indexed version of this indexed geometry.\n\t */\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\twarn( 'BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\t/**\n\t * Serializes the geometry into JSON.\n\t *\n\t * @return {Object} A JSON object representing the serialized geometry.\n\t */\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = boundingSphere.toJSON();\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\t/**\n\t * Returns a new geometry with copied values from this instance.\n\t *\n\t * @return {BufferGeometry} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given geometry to this instance.\n\t *\n\t * @param {BufferGeometry} source - The geometry to copy.\n\t * @return {BufferGeometry} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone() );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t *\n\t * @fires BufferGeometry#dispose\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\n/**\n * \"Interleaved\" means that multiple attributes, possibly of different types,\n * (e.g., position, normal, uv, color) are packed into a single array buffer.\n *\n * An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html)\n */\nclass InterleavedBuffer {\n\n\t/**\n\t * Constructs a new interleaved buffer.\n\t *\n\t * @param {TypedArray} array - A typed array with a shared buffer storing attribute data.\n\t * @param {number} stride - The number of typed-array elements per vertex.\n\t */\n\tconstructor( array, stride ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInterleavedBuffer = true;\n\n\t\t/**\n\t\t * A typed array with a shared buffer storing attribute data.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.array = array;\n\n\t\t/**\n\t\t * The number of typed-array elements per vertex.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.stride = stride;\n\n\t\t/**\n\t\t * The total number of elements in the array\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\t/**\n\t\t * Defines the intended usage pattern of the data store for optimization purposes.\n\t\t *\n\t\t * Note: After the initial use of a buffer, its usage cannot be changed. Instead,\n\t\t * instantiate a new one and set the desired usage before the next render.\n\t\t *\n\t\t * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)}\n\t\t * @default StaticDrawUsage\n\t\t */\n\t\tthis.usage = StaticDrawUsage;\n\n\t\t/**\n\t\t * This can be used to only update some components of stored vectors (for example, just the\n\t\t * component related to color). Use the `addUpdateRange()` function to add ranges to this array.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.updateRanges = [];\n\n\t\t/**\n\t\t * A version number, incremented every time the `needsUpdate` is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.version = 0;\n\n\t\t/**\n\t\t * The UUID of the interleaved buffer.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\t/**\n\t * A callback function that is executed after the renderer has transferred the attribute array\n\t * data to the GPU.\n\t */\n\tonUploadCallback() {}\n\n\t/**\n\t * Flag to indicate that this attribute has changed and should be re-sent to\n\t * the GPU. Set this to `true` when you modify the value of the array.\n\t *\n\t * @type {number}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\t/**\n\t * Sets the usage of this interleaved buffer.\n\t *\n\t * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set.\n\t * @return {InterleavedBuffer} A reference to this interleaved buffer.\n\t */\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds a range of data in the data array to be updated on the GPU.\n\t *\n\t * @param {number} start - Position at which to start update.\n\t * @param {number} count - The number of components to update.\n\t */\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\t/**\n\t * Clears the update ranges.\n\t */\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\t/**\n\t * Copies the values of the given interleaved buffer to this instance.\n\t *\n\t * @param {InterleavedBuffer} source - The interleaved buffer to copy.\n\t * @return {InterleavedBuffer} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies a vector from the given interleaved buffer to this one. The start\n\t * and destination position in the attribute buffers are represented by the\n\t * given indices.\n\t *\n\t * @param {number} index1 - The destination index into this interleaved buffer.\n\t * @param {InterleavedBuffer} interleavedBuffer - The interleaved buffer to copy from.\n\t * @param {number} index2 - The source index into the given interleaved buffer.\n\t * @return {InterleavedBuffer} A reference to this instance.\n\t */\n\tcopyAt( index1, interleavedBuffer, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= interleavedBuffer.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = interleavedBuffer.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given array data in the interleaved buffer.\n\t *\n\t * @param {(TypedArray|Array)} value - The array data to set.\n\t * @param {number} [offset=0] - The offset in this interleaved buffer's array.\n\t * @return {InterleavedBuffer} A reference to this instance.\n\t */\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new interleaved buffer with copied values from this instance.\n\t *\n\t * @param {Object} [data] - An object with shared array buffers that allows to retain shared structures.\n\t * @return {InterleavedBuffer} A clone of this instance.\n\t */\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\t/**\n\t * Sets the given callback function that is executed after the Renderer has transferred\n\t * the array data to the GPU. Can be used to perform clean-up operations after\n\t * the upload when data are not needed anymore on the CPU side.\n\t *\n\t * @param {Function} callback - The `onUpload()` callback.\n\t * @return {InterleavedBuffer} A reference to this instance.\n\t */\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Serializes the interleaved buffer into JSON.\n\t *\n\t * @param {Object} [data] - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized interleaved buffer.\n\t */\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$8 = /*@__PURE__*/ new Vector3();\n\n/**\n * An alternative version of a buffer attribute with interleaved data. Interleaved\n * attributes share a common interleaved data storage ({@link InterleavedBuffer}) and refer with\n * different offsets into the buffer.\n */\nclass InterleavedBufferAttribute {\n\n\t/**\n\t * Constructs a new interleaved buffer attribute.\n\t *\n\t * @param {InterleavedBuffer} interleavedBuffer - The buffer holding the interleaved data.\n\t * @param {number} itemSize - The item size.\n\t * @param {number} offset - The attribute offset into the buffer.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\t/**\n\t\t * The name of the buffer attribute.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The buffer holding the interleaved data.\n\t\t *\n\t\t * @type {InterleavedBuffer}\n\t\t */\n\t\tthis.data = interleavedBuffer;\n\n\t\t/**\n\t\t * The item size, see {@link BufferAttribute#itemSize}.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.itemSize = itemSize;\n\n\t\t/**\n\t\t * The attribute offset into the buffer.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.offset = offset;\n\n\t\t/**\n\t\t * Whether the data are normalized or not, see {@link BufferAttribute#normalized}\n\t\t *\n\t\t * @type {InterleavedBuffer}\n\t\t */\n\t\tthis.normalized = normalized;\n\n\t}\n\n\t/**\n\t * The item count of this buffer attribute.\n\t *\n\t * @type {number}\n\t * @readonly\n\t */\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\t/**\n\t * The array holding the interleaved buffer attribute data.\n\t *\n\t * @type {TypedArray}\n\t */\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\t/**\n\t * Flag to indicate that this attribute has changed and should be re-sent to\n\t * the GPU. Set this to `true` when you modify the value of the array.\n\t *\n\t * @type {number}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\t/**\n\t * Applies the given 4x4 matrix to the given attribute. Only works with\n\t * item size `3`.\n\t *\n\t * @param {Matrix4} m - The matrix to apply.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 3x3 normal matrix to the given attribute. Only works with\n\t * item size `3`.\n\t *\n\t * @param {Matrix3} m - The normal matrix to apply.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Applies the given 4x4 matrix to the given attribute. Only works with\n\t * item size `3` and with direction vectors.\n\t *\n\t * @param {Matrix4} m - The matrix to apply.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the given component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} component - The component index.\n\t * @return {number} The returned value.\n\t */\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.data.stride + this.offset + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\t/**\n\t * Sets the given value to the given component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} component - The component index.\n\t * @param {number} value - The value to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} y - The value to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} z - The value to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} w - The value to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the x component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The x component.\n\t */\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\t/**\n\t * Returns the y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The y component.\n\t */\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\t/**\n\t * Returns the z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The z component.\n\t */\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\t/**\n\t * Returns the w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @return {number} The w component.\n\t */\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\t/**\n\t * Sets the x and y component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y and z component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @param {number} z - The value for the z component to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y, z and w component of the vector at the given index.\n\t *\n\t * @param {number} index - The index into the buffer attribute.\n\t * @param {number} x - The value for the x component to set.\n\t * @param {number} y - The value for the y component to set.\n\t * @param {number} z - The value for the z component to set.\n\t * @param {number} w - The value for the w component to set.\n\t * @return {InterleavedBufferAttribute} A reference to this instance.\n\t */\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new buffer attribute with copied values from this instance.\n\t *\n\t * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data.\n\t *\n\t * @param {Object} [data] - An object with interleaved buffers that allows to retain the interleaved property.\n\t * @return {BufferAttribute|InterleavedBufferAttribute} A clone of this instance.\n\t */\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tlog( 'InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Serializes the buffer attribute into JSON.\n\t *\n\t * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data.\n\t *\n\t * @param {Object} [data] - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized buffer attribute.\n\t */\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tlog( 'InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nlet _materialId = 0;\n\n/**\n * Abstract base class for materials.\n *\n * Materials define the appearance of renderable 3D objects.\n *\n * @abstract\n * @augments EventDispatcher\n */\nclass Material extends EventDispatcher {\n\n\t/**\n\t * Constructs a new material.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMaterial = true;\n\n\t\t/**\n\t\t * The ID of the material.\n\t\t *\n\t\t * @name Material#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\t/**\n\t\t * The UUID of the material.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * The name of the material.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The type property is used for detecting the object type\n\t\t * in context of serialization/deserialization.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.type = 'Material';\n\n\t\t/**\n\t\t * Defines the blending type of the material.\n\t\t *\n\t\t * It must be set to `CustomBlending` if custom blending properties like\n\t\t * {@link Material#blendSrc}, {@link Material#blendDst} or {@link Material#blendEquation}\n\t\t * should have any effect.\n\t\t *\n\t\t * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending)}\n\t\t * @default NormalBlending\n\t\t */\n\t\tthis.blending = NormalBlending;\n\n\t\t/**\n\t\t * Defines which side of faces will be rendered - front, back or both.\n\t\t *\n\t\t * @type {(FrontSide|BackSide|DoubleSide)}\n\t\t * @default FrontSide\n\t\t */\n\t\tthis.side = FrontSide;\n\n\t\t/**\n\t\t * If set to `true`, vertex colors should be used.\n\t\t *\n\t\t * The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or\n\t\t * four (RGBA) component color buffer attribute is used.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.vertexColors = false;\n\n\t\t/**\n\t\t * Defines how transparent the material is.\n\t\t * A value of `0.0` indicates fully transparent, `1.0` is fully opaque.\n\t\t *\n\t\t * If the {@link Material#transparent} is not set to `true`,\n\t\t * the material will remain fully opaque and this value will only affect its color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.opacity = 1;\n\n\t\t/**\n\t\t * Defines whether this material is transparent. This has an effect on\n\t\t * rendering as transparent objects need special treatment and are rendered\n\t\t * after non-transparent objects.\n\t\t *\n\t\t * When set to true, the extent to which the material is transparent is\n\t\t * controlled by {@link Material#opacity}.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.transparent = false;\n\n\t\t/**\n\t\t * Enables alpha hashed transparency, an alternative to {@link Material#transparent} or\n\t\t * {@link Material#alphaTest}. The material will not be rendered if opacity is lower than\n\t\t * a random threshold. Randomization introduces some grain or noise, but approximates alpha\n\t\t * blending without the associated problems of sorting. Using TAA can reduce the resulting noise.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.alphaHash = false;\n\n\t\t/**\n\t\t * Defines the blending source factor.\n\t\t *\n\t\t * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}\n\t\t * @default SrcAlphaFactor\n\t\t */\n\t\tthis.blendSrc = SrcAlphaFactor;\n\n\t\t/**\n\t\t * Defines the blending destination factor.\n\t\t *\n\t\t * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}\n\t\t * @default OneMinusSrcAlphaFactor\n\t\t */\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\n\t\t/**\n\t\t * Defines the blending equation.\n\t\t *\n\t\t * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)}\n\t\t * @default AddEquation\n\t\t */\n\t\tthis.blendEquation = AddEquation;\n\n\t\t/**\n\t\t * Defines the blending source alpha factor.\n\t\t *\n\t\t * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}\n\t\t * @default null\n\t\t */\n\t\tthis.blendSrcAlpha = null;\n\n\t\t/**\n\t\t * Defines the blending destination alpha factor.\n\t\t *\n\t\t * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}\n\t\t * @default null\n\t\t */\n\t\tthis.blendDstAlpha = null;\n\n\t\t/**\n\t\t * Defines the blending equation of the alpha channel.\n\t\t *\n\t\t * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)}\n\t\t * @default null\n\t\t */\n\t\tthis.blendEquationAlpha = null;\n\n\t\t/**\n\t\t * Represents the RGB values of the constant blend color.\n\t\t *\n\t\t * This property has only an effect when using custom blending with `ConstantColor` or `OneMinusConstantColor`.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\n\t\t/**\n\t\t * Represents the alpha value of the constant blend color.\n\t\t *\n\t\t * This property has only an effect when using custom blending with `ConstantAlpha` or `OneMinusConstantAlpha`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.blendAlpha = 0;\n\n\t\t/**\n\t\t * Defines the depth function.\n\t\t *\n\t\t * @type {(NeverDepth|AlwaysDepth|LessDepth|LessEqualDepth|EqualDepth|GreaterEqualDepth|GreaterDepth|NotEqualDepth)}\n\t\t * @default LessEqualDepth\n\t\t */\n\t\tthis.depthFunc = LessEqualDepth;\n\n\t\t/**\n\t\t * Whether to have depth test enabled when rendering this material.\n\t\t * When the depth test is disabled, the depth write will also be implicitly disabled.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.depthTest = true;\n\n\t\t/**\n\t\t * Whether rendering this material has any effect on the depth buffer.\n\t\t *\n\t\t * When drawing 2D overlays it can be useful to disable the depth writing in\n\t\t * order to layer several things together without creating z-index artifacts.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.depthWrite = true;\n\n\t\t/**\n\t\t * The bit mask to use when writing to the stencil buffer.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0xff\n\t\t */\n\t\tthis.stencilWriteMask = 0xff;\n\n\t\t/**\n\t\t * The stencil comparison function to use.\n\t\t *\n\t\t * @type {NeverStencilFunc|LessStencilFunc|EqualStencilFunc|LessEqualStencilFunc|GreaterStencilFunc|NotEqualStencilFunc|GreaterEqualStencilFunc|AlwaysStencilFunc}\n\t\t * @default AlwaysStencilFunc\n\t\t */\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\n\t\t/**\n\t\t * The value to use when performing stencil comparisons or stencil operations.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.stencilRef = 0;\n\n\t\t/**\n\t\t * The bit mask to use when comparing against the stencil buffer.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0xff\n\t\t */\n\t\tthis.stencilFuncMask = 0xff;\n\n\t\t/**\n\t\t * Which stencil operation to perform when the comparison function returns `false`.\n\t\t *\n\t\t * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp}\n\t\t * @default KeepStencilOp\n\t\t */\n\t\tthis.stencilFail = KeepStencilOp;\n\n\t\t/**\n\t\t * Which stencil operation to perform when the comparison function returns\n\t\t * `true` but the depth test fails.\n\t\t *\n\t\t * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp}\n\t\t * @default KeepStencilOp\n\t\t */\n\t\tthis.stencilZFail = KeepStencilOp;\n\n\t\t/**\n\t\t * Which stencil operation to perform when the comparison function returns\n\t\t * `true` and the depth test passes.\n\t\t *\n\t\t * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp}\n\t\t * @default KeepStencilOp\n\t\t */\n\t\tthis.stencilZPass = KeepStencilOp;\n\n\t\t/**\n\t\t * Whether stencil operations are performed against the stencil buffer. In\n\t\t * order to perform writes or comparisons against the stencil buffer this\n\t\t * value must be `true`.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.stencilWrite = false;\n\n\t\t/**\n\t\t * User-defined clipping planes specified as THREE.Plane objects in world\n\t\t * space. These planes apply to the objects this material is attached to.\n\t\t * Points in space whose signed distance to the plane is negative are clipped\n\t\t * (not rendered). This requires {@link WebGLRenderer#localClippingEnabled} to\n\t\t * be `true`.\n\t\t *\n\t\t * @type {?Array<Plane>}\n\t\t * @default null\n\t\t */\n\t\tthis.clippingPlanes = null;\n\n\t\t/**\n\t\t * Changes the behavior of clipping planes so that only their intersection is\n\t\t * clipped, rather than their union.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clipIntersection = false;\n\n\t\t/**\n\t\t * Defines whether to clip shadows according to the clipping planes specified\n\t\t * on this material.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clipShadows = false;\n\n\t\t/**\n\t\t * Defines which side of faces cast shadows. If `null`, the side casting shadows\n\t\t * is determined as follows:\n\t\t *\n\t\t * - When {@link Material#side} is set to `FrontSide`, the back side cast shadows.\n\t\t * - When {@link Material#side} is set to `BackSide`, the front side cast shadows.\n\t\t * - When {@link Material#side} is set to `DoubleSide`, both sides cast shadows.\n\t\t *\n\t\t * @type {?(FrontSide|BackSide|DoubleSide)}\n\t\t * @default null\n\t\t */\n\t\tthis.shadowSide = null;\n\n\t\t/**\n\t\t * Whether to render the material's color.\n\t\t *\n\t\t * This can be used in conjunction with {@link Object3D#renderOder} to create invisible\n\t\t * objects that occlude other objects.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.colorWrite = true;\n\n\t\t/**\n\t\t * Override the renderer's default precision for this material.\n\t\t *\n\t\t * @type {?('highp'|'mediump'|'lowp')}\n\t\t * @default null\n\t\t */\n\t\tthis.precision = null;\n\n\t\t/**\n\t\t * Whether to use polygon offset or not. When enabled, each fragment's depth value will\n\t\t * be offset after it is interpolated from the depth values of the appropriate vertices.\n\t\t * The offset is added before the depth test is performed and before the value is written\n\t\t * into the depth buffer.\n\t\t *\n\t\t * Can be useful for rendering hidden-line images, for applying decals to surfaces, and for\n\t\t * rendering solids with highlighted edges.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.polygonOffset = false;\n\n\t\t/**\n\t\t * Specifies a scale factor that is used to create a variable depth offset for each polygon.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.polygonOffsetFactor = 0;\n\n\t\t/**\n\t\t * Is multiplied by an implementation-specific value to create a constant depth offset.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\t/**\n\t\t * Whether to apply dithering to the color to remove the appearance of banding.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.dithering = false;\n\n\t\t/**\n\t\t * Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts\n\t\t * (meaning when the renderer was created with *antialias* parameter set to `true`). Enabling this\n\t\t * will smooth aliasing on clip plane edges and alphaTest-clipped edges.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.alphaToCoverage = false;\n\n\t\t/**\n\t\t * Whether to premultiply the alpha (transparency) value.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.premultipliedAlpha = false;\n\n\t\t/**\n\t\t * Whether double-sided, transparent objects should be rendered with a single pass or not.\n\t\t *\n\t\t * The engine renders double-sided, transparent objects with two draw calls (back faces first,\n\t\t * then front faces) to mitigate transparency artifacts. There are scenarios however where this\n\t\t * approach produces no quality gains but still doubles draw calls e.g. when rendering flat\n\t\t * vegetation like grass sprites. In these cases, set the `forceSinglePass` flag to `true` to\n\t\t * disable the two pass rendering to avoid performance issues.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.forceSinglePass = false;\n\n\t\t/**\n\t\t * Whether it's possible to override the material with {@link Scene#overrideMaterial} or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.allowOverride = true;\n\n\t\t/**\n\t\t * Defines whether 3D objects using this material are visible.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.visible = true;\n\n\t\t/**\n\t\t * Defines whether this material is tone mapped according to the renderer's tone mapping setting.\n\t\t *\n\t\t * It is ignored when rendering to a render target or using post processing or when using\n\t\t * `WebGPURenderer`. In all these cases, all materials are honored by tone mapping.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.toneMapped = true;\n\n\t\t/**\n\t\t * An object that can be used to store custom data about the Material. It\n\t\t * should not hold references to functions as these will not be cloned.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.userData = {};\n\n\t\t/**\n\t\t * This starts at `0` and counts how many times {@link Material#needsUpdate} is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t * @default 0\n\t\t */\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\t/**\n\t * Sets the alpha value to be used when running an alpha test. The material\n\t * will not be rendered if the opacity is lower than this value.\n\t *\n\t * @type {number}\n\t * @readonly\n\t * @default 0\n\t */\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\t/**\n\t * An optional callback that is executed immediately before the material is used to render a 3D object.\n\t *\n\t * This method can only be used when rendering with {@link WebGLRenderer}.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {Scene} scene - The scene.\n\t * @param {Camera} camera - The camera that is used to render the scene.\n\t * @param {BufferGeometry} geometry - The 3D object's geometry.\n\t * @param {Object3D} object - The 3D object.\n\t * @param {Object} group - The geometry group data.\n\t */\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\t/**\n\t * An optional callback that is executed immediately before the shader\n\t * program is compiled. This function is called with the shader source code\n\t * as a parameter. Useful for the modification of built-in materials.\n\t *\n\t * This method can only be used when rendering with {@link WebGLRenderer}. The\n\t * recommended approach when customizing materials is to use `WebGPURenderer` with the new\n\t * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).\n\t *\n\t * @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.\n\t * @param {WebGLRenderer} renderer - A reference to the renderer.\n\t */\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\t/**\n\t * In case {@link Material#onBeforeCompile} is used, this callback can be used to identify\n\t * values of settings used in `onBeforeCompile()`, so three.js can reuse a cached\n\t * shader or recompile the shader for this material as needed.\n\t *\n\t * This method can only be used when rendering with {@link WebGLRenderer}.\n\t *\n\t * @return {string} The custom program cache key.\n\t */\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\t/**\n\t * This method can be used to set default values from parameter objects.\n\t * It is a generic implementation so it can be used with different types\n\t * of materials.\n\t *\n\t * @param {Object} [values] - The material values to set.\n\t */\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\twarn( `Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\twarn( `Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Serializes the material into JSON.\n\t *\n\t * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n\t * @return {Object} A JSON object representing the serialized material.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.sheenColorMap && this.sheenColorMap.isTexture ) {\n\n\t\t\tdata.sheenColorMap = this.sheenColorMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture ) {\n\n\t\t\tdata.sheenRoughnessMap = this.sheenRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.dispersion !== undefined ) data.dispersion = this.dispersion;\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\t\tif ( this.allowOverride === false ) data.allowOverride = false;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\t/**\n\t * Returns a new material with copied values from this instance.\n\t *\n\t * @return {Material} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given material to this instance.\n\t *\n\t * @param {Material} source - The material to copy.\n\t * @return {Material} A reference to this instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\t\tthis.allowOverride = source.allowOverride;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t *\n\t * @fires Material#dispose\n\t */\n\tdispose() {\n\n\t\t/**\n\t\t * Fires when the material has been disposed of.\n\t\t *\n\t\t * @event Material#dispose\n\t\t * @type {Object}\n\t\t */\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\t/**\n\t * Setting this property to `true` indicates the engine the material\n\t * needs to be recompiled.\n\t *\n\t * @type {boolean}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\n/**\n * A material for rendering instances of {@link Sprite}.\n *\n * ```js\n * const map = new THREE.TextureLoader().load( 'textures/sprite.png' );\n * const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } );\n *\n * const sprite = new THREE.Sprite( material );\n * sprite.scale.set(200, 200, 1)\n * scene.add( sprite );\n * ```\n *\n * @augments Material\n */\nclass SpriteMaterial extends Material {\n\n\t/**\n\t * Constructs a new sprite material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff );\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The rotation of the sprite in radians.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.rotation = 0;\n\n\t\t/**\n\t\t * Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only).\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sizeAttenuation = true;\n\n\t\t/**\n\t\t * Overwritten since sprite materials are transparent\n\t\t * by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.transparent = true;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\n/**\n * A sprite is a plane that always faces towards the camera, generally with a\n * partially transparent texture applied.\n *\n * Sprites do not cast shadows, setting {@link Object3D#castShadow} to `true` will\n * have no effect.\n *\n * ```js\n * const map = new THREE.TextureLoader().load( 'sprite.png' );\n * const material = new THREE.SpriteMaterial( { map: map } );\n *\n * const sprite = new THREE.Sprite( material );\n * scene.add( sprite );\n * ```\n *\n * @augments Object3D\n */\nclass Sprite extends Object3D {\n\n\t/**\n\t * Constructs a new sprite.\n\t *\n\t * @param {(SpriteMaterial|SpriteNodeMaterial)} [material] - The sprite material.\n\t */\n\tconstructor( material = new SpriteMaterial() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t-0.5, -0.5, 0, 0, 0,\n\t\t\t\t0.5, -0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t-0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\t/**\n\t\t * The sprite geometry.\n\t\t *\n\t\t * @type {BufferGeometry}\n\t\t */\n\t\tthis.geometry = _geometry;\n\n\t\t/**\n\t\t * The sprite material.\n\t\t *\n\t\t * @type {(SpriteMaterial|SpriteNodeMaterial)}\n\t\t */\n\t\tthis.material = material;\n\n\t\t/**\n\t\t * The sprite's anchor point, and the point around which the sprite rotates.\n\t\t * A value of `(0.5, 0.5)` corresponds to the midpoint of the sprite. A value\n\t\t * of `(0, 0)` corresponds to the lower left corner of the sprite.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (0.5,0.5)\n\t\t */\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t\t/**\n\t\t * The number of instances of this sprite.\n\t\t * Can only be used with {@link WebGPURenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.count = 1;\n\n\t}\n\n\t/**\n\t * Computes intersection points between a casted ray and this sprite.\n\t *\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - The target array that holds the intersection points.\n\t */\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\terror( 'Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA$1.set( -0.5, -0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB$1.set( 0.5, -0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC$1.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA$1, _vB$1, _vC$1, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB$1.set( -0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA$1, _vC$1, _vB$1, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA$1, _vB$1, _vC$1, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\n/**\n * A component for providing a basic Level of Detail (LOD) mechanism.\n *\n * Every LOD level is associated with an object, and rendering can be switched\n * between them at the distances specified. Typically you would create, say,\n * three meshes, one for far away (low detail), one for mid range (medium\n * detail) and one for close up (high detail).\n *\n * ```js\n * const lod = new THREE.LOD();\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n *\n * //Create spheres with 3 levels of detail and create new LOD levels for them\n * for( let i = 0; i < 3; i++ ) {\n *\n * \tconst geometry = new THREE.IcosahedronGeometry( 10, 3 - i );\n * \tconst mesh = new THREE.Mesh( geometry, material );\n * \tlod.addLevel( mesh, i * 75 );\n *\n * }\n *\n * scene.add( lod );\n * ```\n *\n * @augments Object3D\n */\nclass LOD extends Object3D {\n\n\t/**\n\t * Constructs a new LOD.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLOD = true;\n\n\t\t/**\n\t\t * The current LOD index.\n\t\t *\n\t\t * @private\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\t/**\n\t\t\t * This array holds the LOD levels.\n\t\t\t *\n\t\t\t * @name LOD#levels\n\t\t\t * @type {Array<{object:Object3D,distance:number,hysteresis:number}>}\n\t\t\t */\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t}\n\t\t} );\n\n\t\t/**\n\t\t * Whether the LOD object is updated automatically by the renderer per frame\n\t\t * or not. If set to `false`, you have to call {@link LOD#update} in the\n\t\t * render loop by yourself.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds a mesh that will display at a certain distance and greater. Typically\n\t * the further away the distance, the lower the detail on the mesh.\n\t *\n\t * @param {Object3D} object - The 3D object to display at this level.\n\t * @param {number} [distance=0] - The distance at which to display this level of detail.\n\t * @param {number} [hysteresis=0] - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance.\n\t * @return {LOD} A reference to this instance.\n\t */\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes an existing level, based on the distance from the camera.\n\t * Returns `true` when the level has been removed. Otherwise `false`.\n\t *\n\t * @param {number} distance - Distance of the level to remove.\n\t * @return {boolean} Whether the level has been removed or not.\n\t */\n\tremoveLevel( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0; i < levels.length; i ++ ) {\n\n\t\t\tif ( levels[ i ].distance === distance ) {\n\n\t\t\t\tconst removedElements = levels.splice( i, 1 );\n\t\t\t\tthis.remove( removedElements[ 0 ].object );\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\t/**\n\t * Returns the currently active LOD level index.\n\t *\n\t * @return {number} The current active LOD level index.\n\t */\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\t/**\n\t * Returns a reference to the first 3D object that is greater than\n\t * the given distance.\n\t *\n\t * @param {number} distance - The LOD distance.\n\t * @return {?Object3D} The found 3D object. `null` if no 3D object has been found.\n\t */\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t/**\n\t * Computes intersection points between a casted ray and this LOD.\n\t *\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - The target array that holds the intersection points.\n\t */\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Updates the LOD by computing which LOD level should be visible according\n\t * to the current distance of the given camera.\n\t *\n\t * @param {Camera} camera - The camera the scene is rendered with.\n\t */\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _vector$7 = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\n/**\n * A ray that emits from an origin in a certain direction. The class is used by\n * {@link Raycaster} to assist with raycasting. Raycasting is used for\n * mouse picking (working out what objects in the 3D space the mouse is over)\n * amongst other things.\n */\nclass Ray {\n\n\t/**\n\t * Constructs a new ray.\n\t *\n\t * @param {Vector3} [origin=(0,0,0)] - The origin of the ray.\n\t * @param {Vector3} [direction=(0,0,-1)] - The (normalized) direction of the ray.\n\t */\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, -1 ) ) {\n\n\t\t/**\n\t\t * The origin of the ray.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.origin = origin;\n\n\t\t/**\n\t\t * The (normalized) direction of the ray.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.direction = direction;\n\n\t}\n\n\t/**\n\t * Sets the ray's components by copying the given values.\n\t *\n\t * @param {Vector3} origin - The origin.\n\t * @param {Vector3} direction - The direction.\n\t * @return {Ray} A reference to this ray.\n\t */\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given ray to this instance.\n\t *\n\t * @param {Ray} ray - The ray to copy.\n\t * @return {Ray} A reference to this ray.\n\t */\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a vector that is located at a given distance along this ray.\n\t *\n\t * @param {number} t - The distance along the ray to retrieve a position for.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} A position on the ray.\n\t */\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\t/**\n\t * Adjusts the direction of the ray to point at the given vector in world space.\n\t *\n\t * @param {Vector3} v - The target position.\n\t * @return {Ray} A reference to this ray.\n\t */\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Shift the origin of this ray along its direction by the given distance.\n\t *\n\t * @param {number} t - The distance along the ray to interpolate.\n\t * @return {Ray} A reference to this ray.\n\t */\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$7 ) );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the point along this ray that is closest to the given point.\n\t *\n\t * @param {Vector3} point - A point in 3D space to get the closet location on the ray for.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The closest point on this ray.\n\t */\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\t/**\n\t * Returns the distance of the closest approach between this ray and the given point.\n\t *\n\t * @param {Vector3} point - A point in 3D space to compute the distance to.\n\t * @return {number} The distance.\n\t */\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\t/**\n\t * Returns the squared distance of the closest approach between this ray and the given point.\n\t *\n\t * @param {Vector3} point - A point in 3D space to compute the distance to.\n\t * @return {number} The squared distance.\n\t */\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$7.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$7.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$7.distanceToSquared( point );\n\n\t}\n\n\t/**\n\t * Returns the squared distance between this ray and the given line segment.\n\t *\n\t * @param {Vector3} v0 - The start point of the line segment.\n\t * @param {Vector3} v1 - The end point of the line segment.\n\t * @param {Vector3} [optionalPointOnRay] - When provided, it receives the point on this ray that is closest to the segment.\n\t * @param {Vector3} [optionalPointOnSegment] - When provided, it receives the point on the line segment that is closest to this ray.\n\t * @return {number} The squared distance.\n\t */\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\t/**\n\t * Intersects this ray with the given sphere, returning the intersection\n\t * point or `null` if there is no intersection.\n\t *\n\t * @param {Sphere} sphere - The sphere to intersect.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The intersection point.\n\t */\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$7.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$7.dot( this.direction );\n\t\tconst d2 = _vector$7.dot( _vector$7 ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\t/**\n\t * Returns `true` if this ray intersects with the given sphere.\n\t *\n\t * @param {Sphere} sphere - The sphere to intersect.\n\t * @return {boolean} Whether this ray intersects with the given sphere or not.\n\t */\n\tintersectsSphere( sphere ) {\n\n\t\tif ( sphere.radius < 0 ) return false; // handle empty spheres, see #31187\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\t/**\n\t * Computes the distance from the ray's origin to the given plane. Returns `null` if the ray\n\t * does not intersect with the plane.\n\t *\n\t * @param {Plane} plane - The plane to compute the distance to.\n\t * @return {?number} Whether this ray intersects with the given sphere or not.\n\t */\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\t/**\n\t * Intersects this ray with the given plane, returning the intersection\n\t * point or `null` if there is no intersection.\n\t *\n\t * @param {Plane} plane - The plane to intersect.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The intersection point.\n\t */\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\t/**\n\t * Returns `true` if this ray intersects with the given plane.\n\t *\n\t * @param {Plane} plane - The plane to intersect.\n\t * @return {boolean} Whether this ray intersects with the given plane or not.\n\t */\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\t/**\n\t * Intersects this ray with the given bounding box, returning the intersection\n\t * point or `null` if there is no intersection.\n\t *\n\t * @param {Box3} box - The box to intersect.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The intersection point.\n\t */\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\t/**\n\t * Returns `true` if this ray intersects with the given box.\n\t *\n\t * @param {Box3} box - The box to intersect.\n\t * @return {boolean} Whether this ray intersects with the given box or not.\n\t */\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$7 ) !== null;\n\n\t}\n\n\t/**\n\t * Intersects this ray with the given triangle, returning the intersection\n\t * point or `null` if there is no intersection.\n\t *\n\t * @param {Vector3} a - The first vertex of the triangle.\n\t * @param {Vector3} b - The second vertex of the triangle.\n\t * @param {Vector3} c - The third vertex of the triangle.\n\t * @param {boolean} backfaceCulling - Whether to use backface culling or not.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {?Vector3} The intersection point.\n\t */\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = -1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\t/**\n\t * Transforms this ray with the given 4x4 transformation matrix.\n\t *\n\t * @param {Matrix4} matrix4 - The transformation matrix.\n\t * @return {Ray} A reference to this ray.\n\t */\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this ray is equal with the given one.\n\t *\n\t * @param {Ray} ray - The ray to test for equality.\n\t * @return {boolean} Whether this ray is equal with the given one.\n\t */\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\t/**\n\t * Returns a new ray with copied values from this instance.\n\t *\n\t * @return {Ray} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * A material for drawing geometries in a simple shaded (flat or wireframe) way.\n *\n * This material is not affected by lights.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshBasicMaterial\n */\nclass MeshBasicMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh basic material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The light map. Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.lightMap = null;\n\n\t\t/**\n\t\t * Intensity of the baked light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The red channel of this texture is used as the ambient occlusion map.\n\t\t * Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.aoMap = null;\n\n\t\t/**\n\t\t * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`\n\t\t * disables ambient occlusion. Where intensity is `1` and the AO map's\n\t\t * red channel is also `1`, ambient light is fully occluded on a surface.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Specular map used by the material.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.specularMap = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The environment map.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.envMap = null;\n\n\t\t/**\n\t\t * The rotation of the environment map in radians.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.envMapRotation = new Euler();\n\n\t\t/**\n\t\t * How to combine the result of the surface's color with the environment map, if any.\n\t\t *\n\t\t * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to\n\t\t * blend between the two colors.\n\t\t *\n\t\t * @type {(MultiplyOperation|MixOperation|AddOperation)}\n\t\t * @default MultiplyOperation\n\t\t */\n\t\tthis.combine = MultiplyOperation;\n\n\t\t/**\n\t\t * How much the environment map affects the surface.\n\t\t * The valid range is between `0` (no reflections) and `1` (full reflections).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.reflectivity = 1;\n\n\t\t/**\n\t\t * The index of refraction (IOR) of air (approximately 1) divided by the\n\t\t * index of refraction of the material. It is used with environment mapping\n\t\t * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}.\n\t\t * The refraction ratio should not exceed `1`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.98\n\t\t */\n\t\tthis.refractionRatio = 0.98;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of wireframe ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of wireframe joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$6 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\n/**\n * Class representing triangular polygon mesh based objects.\n *\n * ```js\n * const geometry = new THREE.BoxGeometry( 1, 1, 1 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const mesh = new THREE.Mesh( geometry, material );\n * scene.add( mesh );\n * ```\n *\n * @augments Object3D\n */\nclass Mesh extends Object3D {\n\n\t/**\n\t * Constructs a new mesh.\n\t *\n\t * @param {BufferGeometry} [geometry] - The mesh geometry.\n\t * @param {Material|Array<Material>} [material] - The mesh material.\n\t */\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\t/**\n\t\t * The mesh geometry.\n\t\t *\n\t\t * @type {BufferGeometry}\n\t\t */\n\t\tthis.geometry = geometry;\n\n\t\t/**\n\t\t * The mesh material.\n\t\t *\n\t\t * @type {Material|Array<Material>}\n\t\t * @default MeshBasicMaterial\n\t\t */\n\t\tthis.material = material;\n\n\t\t/**\n\t\t * A dictionary representing the morph targets in the geometry. The key is the\n\t\t * morph targets name, the value its attribute index. This member is `undefined`\n\t\t * by default and only set when morph targets are detected in the geometry.\n\t\t *\n\t\t * @type {Object<string,number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetDictionary = undefined;\n\n\t\t/**\n\t\t * An array of weights typically in the range `[0,1]` that specify how much of the morph\n\t\t * is applied. This member is `undefined` by default and only set when morph targets are\n\t\t * detected in the geometry.\n\t\t *\n\t\t * @type {Array<number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetInfluences = undefined;\n\n\t\t/**\n\t\t * The number of instances of this mesh.\n\t\t * Can only be used with {@link WebGPURenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.count = 1;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the values of {@link Mesh#morphTargetDictionary} and {@link Mesh#morphTargetInfluences}\n\t * to make sure existing morph targets can influence this 3D object.\n\t */\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns the local-space position of the vertex at the given index, taking into\n\t * account the current animation state of both morph targets and skinning.\n\t *\n\t * @param {number} index - The vertex index.\n\t * @param {Vector3} target - The target object that is used to store the method's result.\n\t * @return {Vector3} The vertex position in local space.\n\t */\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Computes intersection points between a casted ray and this line.\n\t *\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - The target array that holds the intersection points.\n\t */\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA );\n\tobject.getVertexPosition( b, _vB );\n\tobject.getVertexPosition( c, _vC );\n\n\tconst intersection = checkIntersection$1( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tconst barycoord = new Vector3();\n\t\tTriangle.getBarycoord( _intersectionPoint, _vA, _vB, _vC, barycoord );\n\n\t\tif ( uv ) {\n\n\t\t\tintersection.uv = Triangle.getInterpolatedAttribute( uv, a, b, c, barycoord, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\tintersection.uv1 = Triangle.getInterpolatedAttribute( uv1, a, b, c, barycoord, new Vector2() );\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\tintersection.normal = Triangle.getInterpolatedAttribute( normal, a, b, c, barycoord, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( -1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA, _vB, _vC, face.normal );\n\n\t\tintersection.face = face;\n\t\tintersection.barycoord = barycoord;\n\n\t}\n\n\treturn intersection;\n\n}\n\nconst _baseVector = /*@__PURE__*/ new Vector4();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector4 = /*@__PURE__*/ new Vector4();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\n/**\n * A mesh that has a {@link Skeleton} that can then be used to animate the\n * vertices of the geometry with skinning/skeleton animation.\n *\n * Next to a valid skeleton, the skinned mesh requires skin indices and weights\n * as buffer attributes in its geometry. These attribute define which bones affect a single\n * vertex to a certain extend.\n *\n * Typically skinned meshes are not created manually but loaders like {@link GLTFLoader}\n * or {@link FBXLoader } import respective models.\n *\n * @augments Mesh\n * @demo scenes/bones-browser.html\n */\nclass SkinnedMesh extends Mesh {\n\n\t/**\n\t * Constructs a new skinned mesh.\n\t *\n\t * @param {BufferGeometry} [geometry] - The mesh geometry.\n\t * @param {Material|Array<Material>} [material] - The mesh material.\n\t */\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\t/**\n\t\t * `AttachedBindMode` means the skinned mesh shares the same world space as the skeleton.\n\t\t * This is not true when using `DetachedBindMode` which is useful when sharing a skeleton\n\t\t * across multiple skinned meshes.\n\t\t *\n\t\t * @type {(AttachedBindMode|DetachedBindMode)}\n\t\t * @default AttachedBindMode\n\t\t */\n\t\tthis.bindMode = AttachedBindMode;\n\n\t\t/**\n\t\t * The base matrix that is used for the bound bone transforms.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.bindMatrix = new Matrix4();\n\n\t\t/**\n\t\t * The base matrix that is used for resetting the bound bone transforms.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\t/**\n\t\t * The bounding box of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingBox}.\n\t\t *\n\t\t * @type {?Box3}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingBox = null;\n\n\t\t/**\n\t\t * The bounding sphere of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingSphere}.\n\t\t *\n\t\t * @type {?Sphere}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\t/**\n\t * Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}.\n\t * The bounding box is not automatically computed by the engine; this method must be called by your app.\n\t * If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect\n\t * the current animation state.\n\t */\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}.\n\t * The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting\n\t * and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed\n\t * per frame in order to reflect the current animation state.\n\t */\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$5.copy( this.boundingSphere );\n\t\t_sphere$5.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$5 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Binds the given skeleton to the skinned mesh.\n\t *\n\t * @param {Skeleton} skeleton - The skeleton to bind.\n\t * @param {Matrix4} [bindMatrix] - The bind matrix. If no bind matrix is provided,\n\t * the skinned mesh's world matrix will be used instead.\n\t */\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\t/**\n\t * This method sets the skinned mesh in the rest pose).\n\t */\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\t/**\n\t * Normalizes the skin weights which are defined as a buffer attribute\n\t * in the skinned mesh's geometry.\n\t */\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\twarn( 'SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Applies the bone transform associated with the given index to the given\n\t * vector. Can be used to transform positions or direction vectors by providing\n\t * a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector.\n\t *\n\t * @param {number} index - The vertex index.\n\t * @param {Vector3|Vector4} target - The target object that is used to store the method's result.\n\t * @return {Vector3|Vector4} The updated vertex attribute data.\n\t */\n\tapplyBoneTransform( index, target ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\tif ( target.isVector4 ) {\n\n\t\t\t_baseVector.copy( target );\n\t\t\ttarget.set( 0, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_baseVector.set( ...target, 1 );\n\t\t\ttarget.set( 0, 0, 0 );\n\n\t\t}\n\n\t\t_baseVector.applyMatrix4( this.bindMatrix );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\ttarget.addScaledVector( _vector4.copy( _baseVector ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( target.isVector4 ) {\n\n\t\t\t// ensure the homogenous coordinate remains unchanged after vector operations\n\t\t\ttarget.w = _baseVector.w;\n\n\t\t}\n\n\t\treturn target.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n}\n\n/**\n * A bone which is part of a {@link Skeleton}. The skeleton in turn is used by\n * the {@link SkinnedMesh}.\n *\n * ```js\n * const root = new THREE.Bone();\n * const child = new THREE.Bone();\n *\n * root.add( child );\n * child.position.y = 5;\n * ```\n *\n * @augments Object3D\n */\nclass Bone extends Object3D {\n\n\t/**\n\t * Constructs a new bone.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\n/**\n * Creates a texture directly from raw buffer data.\n *\n * The interpretation of the data depends on type and format: If the type is\n * `UnsignedByteType`, a `Uint8Array` will be useful for addressing the\n * texel data. If the format is `RGBAFormat`, data needs four values for\n * one texel; Red, Green, Blue and Alpha (typically the opacity).\n *\n * @augments Texture\n */\nclass DataTexture extends Texture {\n\n\t/**\n\t * Constructs a new data texture.\n\t *\n\t * @param {?TypedArray} [data=null] - The buffer data.\n\t * @param {number} [width=1] - The width of the texture.\n\t * @param {number} [height=1] - The height of the texture.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=NearestFilter] - The mag filter value.\n\t * @param {number} [minFilter=NearestFilter] - The min filter value.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {string} [colorSpace=NoColorSpace] - The color space.\n\t */\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isDataTexture = true;\n\n\t\t/**\n\t\t * The image definition of a data texture.\n\t\t *\n\t\t * @type {{data:TypedArray,width:number,height:number}}\n\t\t */\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flipY = false;\n\n\t\t/**\n\t\t * Specifies the alignment requirements for the start of each pixel row in memory.\n\t\t *\n\t\t * Overwritten and set to `1` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default 1\n\t\t */\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\n\n/**\n * Class for representing the armatures in `three.js`. The skeleton\n * is defined by a hierarchy of bones.\n *\n * ```js\n * const bones = [];\n *\n * const shoulder = new THREE.Bone();\n * const elbow = new THREE.Bone();\n * const hand = new THREE.Bone();\n *\n * shoulder.add( elbow );\n * elbow.add( hand );\n *\n * bones.push( shoulder , elbow, hand);\n *\n * shoulder.position.y = -5;\n * elbow.position.y = 0;\n * hand.position.y = 5;\n *\n * const armSkeleton = new THREE.Skeleton( bones );\n * ```\n */\nclass Skeleton {\n\n\t/**\n\t * Constructs a new skeleton.\n\t *\n\t * @param {Array<Bone>} [bones] - An array of bones.\n\t * @param {Array<Matrix4>} [boneInverses] - An array of bone inverse matrices.\n\t * If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}.\n\t */\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * An array of bones defining the skeleton.\n\t\t *\n\t\t * @type {Array<Bone>}\n\t\t */\n\t\tthis.bones = bones.slice( 0 );\n\n\t\t/**\n\t\t * An array of bone inverse matrices.\n\t\t *\n\t\t * @type {Array<Matrix4>}\n\t\t */\n\t\tthis.boneInverses = boneInverses;\n\n\t\t/**\n\t\t * An array buffer holding the bone data.\n\t\t * Input data for {@link Skeleton#boneTexture}.\n\t\t *\n\t\t * @type {?Float32Array}\n\t\t * @default null\n\t\t */\n\t\tthis.boneMatrices = null;\n\n\t\t/**\n\t\t * An array buffer holding the bone data of the previous frame.\n\t\t * Required for computing velocity. Maintained in {@link SkinningNode}.\n\t\t *\n\t\t * @type {?Float32Array}\n\t\t * @default null\n\t\t */\n\t\tthis.previousBoneMatrices = null;\n\n\t\t/**\n\t\t * A texture holding the bone data for use\n\t\t * in the vertex shader.\n\t\t *\n\t\t * @type {?DataTexture}\n\t\t * @default null\n\t\t */\n\t\tthis.boneTexture = null;\n\n\t\tthis.init();\n\n\t}\n\n\t/**\n\t * Initializes the skeleton. This method gets automatically called by the constructor\n\t * but depending on how the skeleton is created it might be necessary to call this method\n\t * manually.\n\t */\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\twarn( 'Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bone inverse matrices. This method resets {@link Skeleton#boneInverses}\n\t * and fills it with new matrices.\n\t */\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Resets the skeleton to the base pose.\n\t */\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Resets the skeleton to the base pose.\n\t */\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new skeleton with copied values from this instance.\n\t *\n\t * @return {Skeleton} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\t/**\n\t * Computes a data texture for passing bone data to the vertex shader.\n\t *\n\t * @return {Skeleton} A reference of this instance.\n\t */\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Searches through the skeleton's bone array and returns the first with a\n\t * matching name.\n\t *\n\t * @param {string} name - The name of the bone.\n\t * @return {Bone|undefined} The found bone. `undefined` if no bone has been found.\n\t */\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Setups the skeleton by the given JSON and bones.\n\t *\n\t * @param {Object} json - The skeleton as serialized JSON.\n\t * @param {Object<string, Bone>} bones - An array of bones.\n\t * @return {Skeleton} A reference of this instance.\n\t */\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\twarn( 'Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Serializes the skeleton into JSON.\n\t *\n\t * @return {Object} A JSON object representing the serialized skeleton.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * An instanced version of a buffer attribute.\n *\n * @augments BufferAttribute\n */\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\t/**\n\t * Constructs a new instanced buffer attribute.\n\t *\n\t * @param {TypedArray} array - The array holding the attribute data.\n\t * @param {number} itemSize - The item size.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t * @param {number} [meshPerAttribute=1] - How often a value of this buffer attribute should be repeated.\n\t */\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\t/**\n\t\t * Defines how often a value of this buffer attribute should be repeated. A\n\t\t * value of one means that each value of the instanced attribute is used for\n\t\t * a single instance. A value of two means that each value is used for two\n\t\t * consecutive instances (and so on).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\n\n/**\n * A special version of a mesh with instanced rendering support. Use\n * this class if you have to render a large number of objects with the same\n * geometry and material(s) but with different world transformations. The usage\n * of 'InstancedMesh' will help you to reduce the number of draw calls and thus\n * improve the overall rendering performance in your application.\n *\n * @augments Mesh\n */\nclass InstancedMesh extends Mesh {\n\n\t/**\n\t * Constructs a new instanced mesh.\n\t *\n\t * @param {BufferGeometry} [geometry] - The mesh geometry.\n\t * @param {Material|Array<Material>} [material] - The mesh material.\n\t * @param {number} count - The number of instances.\n\t */\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInstancedMesh = true;\n\n\t\t/**\n\t\t * Represents the local transformation of all instances. You have to set its\n\t\t * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data\n\t\t * via {@link InstancedMesh#setMatrixAt}.\n\t\t *\n\t\t * @type {InstancedBufferAttribute}\n\t\t */\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\n\t\t/**\n\t\t * Represents the local transformation of all instances of the previous frame.\n\t\t * Required for computing velocity. Maintained in {@link InstanceNode}.\n\t\t *\n\t\t * @type {?InstancedBufferAttribute}\n\t\t * @default null\n\t\t */\n\t\tthis.previousInstanceMatrix = null;\n\n\t\t/**\n\t\t * Represents the color of all instances. You have to set its\n\t\t * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data\n\t\t * via {@link InstancedMesh#setColorAt}.\n\t\t *\n\t\t * @type {?InstancedBufferAttribute}\n\t\t * @default null\n\t\t */\n\t\tthis.instanceColor = null;\n\n\t\t/**\n\t\t * Represents the morph target weights of all instances. You have to set its\n\t\t * {@link Texture#needsUpdate} flag to true if you modify instanced data\n\t\t * via {@link InstancedMesh#setMorphAt}.\n\t\t *\n\t\t * @type {?DataTexture}\n\t\t * @default null\n\t\t */\n\t\tthis.morphTexture = null;\n\n\t\t/**\n\t\t * The number of instances.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.count = count;\n\n\t\t/**\n\t\t * The bounding box of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingBox}.\n\t\t *\n\t\t * @type {?Box3}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingBox = null;\n\n\t\t/**\n\t\t * The bounding sphere of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingSphere}.\n\t\t *\n\t\t * @type {?Sphere}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.\n\t * The bounding box is not automatically computed by the engine; this method must be called by your app.\n\t * You may need to recompute the bounding box if an instance is transformed via {@link InstancedMesh#setMatrixAt}.\n\t */\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}\n\t * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.\n\t * You may need to recompute the bounding sphere if an instance is transformed via {@link InstancedMesh#setMatrixAt}.\n\t */\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$4.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$4 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();\n\n\t\tif ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Gets the color of the defined instance.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Color} color - The target object that is used to store the method's result.\n\t * @return {Color} A reference to the target color.\n\t */\n\tgetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\treturn color.setRGB( 1, 1, 1 );\n\n\t\t} else {\n\n\t\t\treturn color.fromArray( this.instanceColor.array, index * 3 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Gets the local transformation matrix of the defined instance.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Matrix4} matrix - The target object that is used to store the method's result.\n\t * @return {Matrix4} A reference to the target matrix.\n\t */\n\tgetMatrixAt( index, matrix ) {\n\n\t\treturn matrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\t/**\n\t * Gets the morph target weights of the defined instance.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Mesh} object - The target object that is used to store the method's result.\n\t */\n\tgetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\n\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\n\n\t\t}\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of\n\t * {@link InstancedMesh#instanceColor} to `true` after updating all the colors.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Color} color - The instance color.\n\t * @return {InstancedMesh} A reference to this instanced mesh.\n\t */\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of\n\t * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Matrix4} matrix - The local transformation.\n\t * @return {InstancedMesh} A reference to this instanced mesh.\n\t */\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of\n\t * {@link InstancedMesh#morphTexture} to `true` after updating all the influences.\n\t *\n\t * @param {number} index - The instance index.\n\t * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights\n\t * of a single instance.\n\t * @return {InstancedMesh} A reference to this instanced mesh.\n\t */\n\tsetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\n\n\t\tif ( this.morphTexture === null ) {\n\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\n\n\t\t}\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tlet morphInfluencesSum = 0;\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t}\n\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tconst dataIndex = len * index;\n\n\t\tarray[ dataIndex ] = morphBaseInfluence;\n\n\t\tarray.set( objectInfluences, dataIndex + 1 );\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\tif ( this.morphTexture !== null ) {\n\n\t\t\tthis.morphTexture.dispose();\n\t\t\tthis.morphTexture = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\n/**\n * A two dimensional surface that extends infinitely in 3D space, represented\n * in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)\n * by a unit length normal vector and a constant.\n */\nclass Plane {\n\n\t/**\n\t * Constructs a new plane.\n\t *\n\t * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.\n\t * @param {number} [constant=0] - The signed distance from the origin to the plane.\n\t */\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPlane = true;\n\n\t\t/**\n\t\t * A unit length vector defining the normal of the plane.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.normal = normal;\n\n\t\t/**\n\t\t * The signed distance from the origin to the plane.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.constant = constant;\n\n\t}\n\n\t/**\n\t * Sets the plane components by copying the given values.\n\t *\n\t * @param {Vector3} normal - The normal.\n\t * @param {number} constant - The constant.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the plane components by defining `x`, `y`, `z` as the\n\t * plane normal and `w` as the constant.\n\t *\n\t * @param {number} x - The value for the normal's x component.\n\t * @param {number} y - The value for the normal's y component.\n\t * @param {number} z - The value for the normal's z component.\n\t * @param {number} w - The constant value.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the plane from the given normal and coplanar point (that is a point\n\t * that lies onto the plane).\n\t *\n\t * @param {Vector3} normal - The normal.\n\t * @param {Vector3} point - A coplanar point.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the plane from three coplanar points. The winding order is\n\t * assumed to be counter-clockwise, and determines the direction of\n\t * the plane normal.\n\t *\n\t * @param {Vector3} a - The first coplanar point.\n\t * @param {Vector3} b - The second coplanar point.\n\t * @param {Vector3} c - The third coplanar point.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given plane to this instance.\n\t *\n\t * @param {Plane} plane - The plane to copy.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Normalizes the plane normal and adjusts the constant accordingly.\n\t *\n\t * @return {Plane} A reference to this plane.\n\t */\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Negates both the plane normal and the constant.\n\t *\n\t * @return {Plane} A reference to this plane.\n\t */\n\tnegate() {\n\n\t\tthis.constant *= -1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the signed distance from the given point to this plane.\n\t *\n\t * @param {Vector3} point - The point to compute the distance for.\n\t * @return {number} The signed distance.\n\t */\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\t/**\n\t * Returns the signed distance from the given sphere to this plane.\n\t *\n\t * @param {Sphere} sphere - The sphere to compute the distance for.\n\t * @return {number} The signed distance.\n\t */\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\t/**\n\t * Projects a the given point onto the plane.\n\t *\n\t * @param {Vector3} point - The point to project.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The projected point on the plane.\n\t */\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\t/**\n\t * Returns the intersection point of the passed line and the plane. Returns\n\t * `null` if the line does not intersect. Returns the line's starting point if\n\t * the line is coplanar with the plane.\n\t *\n\t * @param {Line3} line - The line to compute the intersection for.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.\n\t * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.\n\t */\n\tintersectLine( line, target, clampToLine = true ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( ( clampToLine === true ) && ( t < 0 || t > 1 ) ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given line segment intersects with (passes through) the plane.\n\t *\n\t * @param {Line3} line - The line to test.\n\t * @return {boolean} Whether the given line segment intersects with the plane or not.\n\t */\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding box intersects with the plane.\n\t *\n\t * @param {Box3} box - The bounding box to test.\n\t * @return {boolean} Whether the given bounding box intersects with the plane or not.\n\t */\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding sphere intersects with the plane.\n\t *\n\t * @param {Sphere} sphere - The bounding sphere to test.\n\t * @return {boolean} Whether the given bounding sphere intersects with the plane or not.\n\t */\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\t/**\n\t * Returns a coplanar vector to the plane, by calculating the\n\t * projection of the normal at the origin onto the plane.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The coplanar point.\n\t */\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\t/**\n\t * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.\n\t *\n\t * The optional normal matrix can be pre-computed like so:\n\t * ```js\n\t * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\n\t * ```\n\t *\n\t * @param {Matrix4} matrix - The transformation matrix.\n\t * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.\n\t * @return {Plane} A reference to this plane.\n\t */\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Translates the plane by the distance defined by the given offset vector.\n\t * Note that this only affects the plane constant and will not affect the normal vector.\n\t *\n\t * @param {Vector3} offset - The offset vector.\n\t * @return {Plane} A reference to this plane.\n\t */\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this plane is equal with the given one.\n\t *\n\t * @param {Plane} plane - The plane to test for equality.\n\t * @return {boolean} Whether this plane is equal with the given one.\n\t */\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\t/**\n\t * Returns a new plane with copied values from this instance.\n\t *\n\t * @return {Plane} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\nconst _defaultSpriteCenter = /*@__PURE__*/ new Vector2( 0.5, 0.5 );\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\n/**\n * Frustums are used to determine what is inside the camera's field of view.\n * They help speed up the rendering process - objects which lie outside a camera's\n * frustum can safely be excluded from rendering.\n *\n * This class is mainly intended for use internally by a renderer.\n */\nclass Frustum {\n\n\t/**\n\t * Constructs a new frustum.\n\t *\n\t * @param {Plane} [p0] - The first plane that encloses the frustum.\n\t * @param {Plane} [p1] - The second plane that encloses the frustum.\n\t * @param {Plane} [p2] - The third plane that encloses the frustum.\n\t * @param {Plane} [p3] - The fourth plane that encloses the frustum.\n\t * @param {Plane} [p4] - The fifth plane that encloses the frustum.\n\t * @param {Plane} [p5] - The sixth plane that encloses the frustum.\n\t */\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\t/**\n\t\t * This array holds the planes that enclose the frustum.\n\t\t *\n\t\t * @type {Array<Plane>}\n\t\t */\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\t/**\n\t * Sets the frustum planes by copying the given planes.\n\t *\n\t * @param {Plane} [p0] - The first plane that encloses the frustum.\n\t * @param {Plane} [p1] - The second plane that encloses the frustum.\n\t * @param {Plane} [p2] - The third plane that encloses the frustum.\n\t * @param {Plane} [p3] - The fourth plane that encloses the frustum.\n\t * @param {Plane} [p4] - The fifth plane that encloses the frustum.\n\t * @param {Plane} [p5] - The sixth plane that encloses the frustum.\n\t * @return {Frustum} A reference to this frustum.\n\t */\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given frustum to this instance.\n\t *\n\t * @param {Frustum} frustum - The frustum to copy.\n\t * @return {Frustum} A reference to this frustum.\n\t */\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the frustum planes from the given projection matrix.\n\t *\n\t * @param {Matrix4} m - The projection matrix.\n\t * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system.\n\t * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n\t * @return {Frustum} A reference to this frustum.\n\t */\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\n\t\tif ( reversedDepth ) {\n\n\t\t\tplanes[ 4 ].setComponents( me2, me6, me10, me14 ).normalize(); // far\n\t\t\tplanes[ 5 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); // near\n\n\t\t} else {\n\n\t\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); // far\n\n\t\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); // near\n\n\t\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize(); // near\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if the 3D object's bounding sphere is intersecting this frustum.\n\t *\n\t * Note that the 3D object must have a geometry so that the bounding sphere can be calculated.\n\t *\n\t * @param {Object3D} object - The 3D object to test.\n\t * @return {boolean} Whether the 3D object's bounding sphere is intersecting this frustum or not.\n\t */\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$3.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$3 );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given sprite is intersecting this frustum.\n\t *\n\t * @param {Sprite} sprite - The sprite to test.\n\t * @return {boolean} Whether the sprite is intersecting this frustum or not.\n\t */\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$3.center.set( 0, 0, 0 );\n\n\t\tconst offset = _defaultSpriteCenter.distanceTo( sprite.center );\n\n\t\t_sphere$3.radius = 0.7071067811865476 + offset;\n\t\t_sphere$3.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$3 );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding sphere is intersecting this frustum.\n\t *\n\t * @param {Sphere} sphere - The bounding sphere to test.\n\t * @return {boolean} Whether the bounding sphere is intersecting this frustum or not.\n\t */\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding box is intersecting this frustum.\n\t *\n\t * @param {Box3} box - The bounding box to test.\n\t * @return {boolean} Whether the bounding box is intersecting this frustum or not.\n\t */\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$6 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point lies within the frustum.\n\t *\n\t * @param {Vector3} point - The point to test.\n\t * @return {boolean} Whether the point lies within this frustum or not.\n\t */\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Returns a new frustum with copied values from this instance.\n\t *\n\t * @return {Frustum} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _frustum$1 = /*@__PURE__*/ new Frustum();\n\n/**\n * FrustumArray is used to determine if an object is visible in at least one camera\n * from an array of cameras. This is particularly useful for multi-view renderers.\n*/\nclass FrustumArray {\n\n\t/**\n\t * Constructs a new frustum array.\n\t *\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * The coordinate system to use.\n\t\t *\n\t\t * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem}\n\t\t * @default WebGLCoordinateSystem\n\t\t */\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\t/**\n\t * Returns `true` if the 3D object's bounding sphere is intersecting any frustum\n\t * from the camera array.\n\t *\n\t * @param {Object3D} object - The 3D object to test.\n\t * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.\n\t * @return {boolean} Whether the 3D object is visible in any camera.\n\t */\n\tintersectsObject( object, cameraArray ) {\n\n\t\tif ( ! cameraArray.isArrayCamera || cameraArray.cameras.length === 0 ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < cameraArray.cameras.length; i ++ ) {\n\n\t\t\tconst camera = cameraArray.cameras[ i ];\n\n\t\t\t_projScreenMatrix$1.multiplyMatrices(\n\t\t\t\tcamera.projectionMatrix,\n\t\t\t\tcamera.matrixWorldInverse\n\t\t\t);\n\n\t\t\t_frustum$1.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t\tif ( _frustum$1.intersectsObject( object ) ) {\n\n\t\t\t\treturn true; // Object is visible in at least one camera\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false; // Not visible in any camera\n\n\t}\n\n\t/**\n\t * Returns `true` if the given sprite is intersecting any frustum\n\t * from the camera array.\n\t *\n\t * @param {Sprite} sprite - The sprite to test.\n\t * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.\n\t * @return {boolean} Whether the sprite is visible in any camera.\n\t */\n\tintersectsSprite( sprite, cameraArray ) {\n\n\t\tif ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < cameraArray.cameras.length; i ++ ) {\n\n\t\t\tconst camera = cameraArray.cameras[ i ];\n\n\t\t\t_projScreenMatrix$1.multiplyMatrices(\n\t\t\t\tcamera.projectionMatrix,\n\t\t\t\tcamera.matrixWorldInverse\n\t\t\t);\n\n\t\t\t_frustum$1.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t\tif ( _frustum$1.intersectsSprite( sprite ) ) {\n\n\t\t\t\treturn true; // Sprite is visible in at least one camera\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false; // Not visible in any camera\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding sphere is intersecting any frustum\n\t * from the camera array.\n\t *\n\t * @param {Sphere} sphere - The bounding sphere to test.\n\t * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.\n\t * @return {boolean} Whether the sphere is visible in any camera.\n\t */\n\tintersectsSphere( sphere, cameraArray ) {\n\n\t\tif ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < cameraArray.cameras.length; i ++ ) {\n\n\t\t\tconst camera = cameraArray.cameras[ i ];\n\n\t\t\t_projScreenMatrix$1.multiplyMatrices(\n\t\t\t\tcamera.projectionMatrix,\n\t\t\t\tcamera.matrixWorldInverse\n\t\t\t);\n\n\t\t\t_frustum$1.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t\tif ( _frustum$1.intersectsSphere( sphere ) ) {\n\n\t\t\t\treturn true; // Sphere is visible in at least one camera\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false; // Not visible in any camera\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding box is intersecting any frustum\n\t * from the camera array.\n\t *\n\t * @param {Box3} box - The bounding box to test.\n\t * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.\n\t * @return {boolean} Whether the box is visible in any camera.\n\t */\n\tintersectsBox( box, cameraArray ) {\n\n\t\tif ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < cameraArray.cameras.length; i ++ ) {\n\n\t\t\tconst camera = cameraArray.cameras[ i ];\n\n\t\t\t_projScreenMatrix$1.multiplyMatrices(\n\t\t\t\tcamera.projectionMatrix,\n\t\t\t\tcamera.matrixWorldInverse\n\t\t\t);\n\n\t\t\t_frustum$1.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t\tif ( _frustum$1.intersectsBox( box ) ) {\n\n\t\t\t\treturn true; // Box is visible in at least one camera\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false; // Not visible in any camera\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point lies within any frustum\n\t * from the camera array.\n\t *\n\t * @param {Vector3} point - The point to test.\n\t * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.\n\t * @return {boolean} Whether the point is visible in any camera.\n\t */\n\tcontainsPoint( point, cameraArray ) {\n\n\t\tif ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < cameraArray.cameras.length; i ++ ) {\n\n\t\t\tconst camera = cameraArray.cameras[ i ];\n\n\t\t\t_projScreenMatrix$1.multiplyMatrices(\n\t\t\t\tcamera.projectionMatrix,\n\t\t\t\tcamera.matrixWorldInverse\n\t\t\t);\n\n\t\t\t_frustum$1.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t\tif ( _frustum$1.containsPoint( point ) ) {\n\n\t\t\t\treturn true; // Point is visible in at least one camera\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false; // Not visible in any camera\n\n\t}\n\n\t/**\n\t * Returns a new frustum array with copied values from this instance.\n\t *\n\t * @return {FrustumArray} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new FrustumArray();\n\n\t}\n\n}\n\nfunction ascIdSort( a, b ) {\n\n\treturn a - b;\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( start, count, z, index ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: -1,\n\t\t\t\tcount: -1,\n\t\t\t\tz: -1,\n\t\t\t\tindex: -1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = start;\n\t\titem.count = count;\n\t\titem.z = z;\n\t\titem.index = index;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _frustumArray = /*@__PURE__*/ new FrustumArray();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _forward$1 = /*@__PURE__*/ new Vector3();\nconst _temp = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\n// safely copies array contents to a potentially smaller array\nfunction copyArrayContents( src, target ) {\n\n\tif ( src.constructor !== target.constructor ) {\n\n\t\t// if arrays are of a different type (eg due to index size increasing) then data must be per-element copied\n\t\tconst len = Math.min( src.length, target.length );\n\t\tfor ( let i = 0; i < len; i ++ ) {\n\n\t\t\ttarget[ i ] = src[ i ];\n\n\t\t}\n\n\t} else {\n\n\t\t// if the arrays use the same data layout we can use a fast block copy\n\t\tconst len = Math.min( src.length, target.length );\n\t\ttarget.set( new src.constructor( src.buffer, 0, len ) );\n\n\t}\n\n}\n\n/**\n * A special version of a mesh with multi draw batch rendering support. Use\n * this class if you have to render a large number of objects with the same\n * material but with different geometries or world transformations. The usage of\n * `BatchedMesh` will help you to reduce the number of draw calls and thus improve the overall\n * rendering performance in your application.\n *\n * ```js\n * const box = new THREE.BoxGeometry( 1, 1, 1 );\n * const sphere = new THREE.SphereGeometry( 1, 12, 12 );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n *\n * // initialize and add geometries into the batched mesh\n * const batchedMesh = new BatchedMesh( 10, 5000, 10000, material );\n * const boxGeometryId = batchedMesh.addGeometry( box );\n * const sphereGeometryId = batchedMesh.addGeometry( sphere );\n *\n * // create instances of those geometries\n * const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId );\n * const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId );\n *\n * const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId );\n * const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId );\n *\n * // position the geometries\n * batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 );\n * batchedMesh.setMatrixAt( boxInstancedId2, boxMatrix2 );\n *\n * batchedMesh.setMatrixAt( sphereInstancedId1, sphereMatrix1 );\n * batchedMesh.setMatrixAt( sphereInstancedId2, sphereMatrix2 );\n *\n * scene.add( batchedMesh );\n * ```\n *\n * @augments Mesh\n */\nclass BatchedMesh extends Mesh {\n\n\t/**\n\t * Constructs a new batched mesh.\n\t *\n\t * @param {number} maxInstanceCount - The maximum number of individual instances planned to be added and rendered.\n\t * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries.\n\t * @param {number} [maxIndexCount=maxVertexCount*2] - The maximum number of indices to be used by all unique geometries\n\t * @param {Material|Array<Material>} [material] - The mesh material.\n\t */\n\tconstructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBatchedMesh = true;\n\n\t\t/**\n\t\t * When set ot `true`, the individual objects of a batch are frustum culled.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.perObjectFrustumCulled = true;\n\n\t\t/**\n\t\t * When set to `true`, the individual objects of a batch are sorted to improve overdraw-related artifacts.\n\t\t * If the material is marked as \"transparent\" objects are rendered back to front and if not then they are\n\t\t * rendered front to back.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sortObjects = true;\n\n\t\t/**\n\t\t * The bounding box of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingBox}.\n\t\t *\n\t\t * @type {?Box3}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingBox = null;\n\n\t\t/**\n\t\t * The bounding sphere of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingSphere}.\n\t\t *\n\t\t * @type {?Sphere}\n\t\t * @default null\n\t\t */\n\t\tthis.boundingSphere = null;\n\n\t\t/**\n\t\t * Takes a sort a function that is run before render. The function takes a list of instances to\n\t\t * sort and a camera. The objects in the list include a \"z\" field to perform a depth-ordered\n\t\t * sort with.\n\t\t *\n\t\t * @type {?Function}\n\t\t * @default null\n\t\t */\n\t\tthis.customSort = null;\n\n\t\t// stores visible, active, and geometry id per instance and reserved buffer ranges for geometries\n\t\tthis._instanceInfo = [];\n\t\tthis._geometryInfo = [];\n\n\t\t// instance, geometry ids that have been set as inactive, and are available to be overwritten\n\t\tthis._availableInstanceIds = [];\n\t\tthis._availableGeometryIds = [];\n\n\t\t// used to track where the next point is that geometry should be inserted\n\t\tthis._nextIndexStart = 0;\n\t\tthis._nextVertexStart = 0;\n\t\tthis._geometryCount = 0;\n\n\t\t// flags\n\t\tthis._visibilityChanged = true;\n\t\tthis._geometryInitialized = false;\n\n\t\t// cached user options\n\t\tthis._maxInstanceCount = maxInstanceCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\t// buffers for multi draw\n\t\tthis._multiDrawCounts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawCount = 0;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\t\tthis._indirectTexture = null;\n\t\tthis._colorsTexture = null;\n\n\t\tthis._initMatricesTexture();\n\t\tthis._initIndirectTexture();\n\n\t}\n\n\t/**\n\t * The maximum number of individual instances that can be stored in the batch.\n\t *\n\t * @type {number}\n\t * @readonly\n\t */\n\tget maxInstanceCount() {\n\n\t\treturn this._maxInstanceCount;\n\n\t}\n\n\t/**\n\t * The instance count.\n\t *\n\t * @type {number}\n\t * @readonly\n\t */\n\tget instanceCount() {\n\n\t\treturn this._instanceInfo.length - this._availableInstanceIds.length;\n\n\t}\n\n\t/**\n\t * The number of unused vertices.\n\t *\n\t * @type {number}\n\t * @readonly\n\t */\n\tget unusedVertexCount() {\n\n\t\treturn this._maxVertexCount - this._nextVertexStart;\n\n\t}\n\n\t/**\n\t * The number of unused indices.\n\t *\n\t * @type {number}\n\t * @readonly\n\t */\n\tget unusedIndexCount() {\n\n\t\treturn this._maxIndexCount - this._nextIndexStart;\n\n\t}\n\n\t_initMatricesTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initIndirectTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\tconst indirectArray = new Uint32Array( size * size );\n\t\tconst indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );\n\n\t\tthis._indirectTexture = indirectTexture;\n\n\t}\n\n\t_initColorsTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\t// 4 floats per RGBA pixel initialized to white\n\t\tconst colorsArray = new Float32Array( size * size * 4 ).fill( 1 );\n\t\tconst colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );\n\t\tcolorsTexture.colorSpace = ColorManagement.workingColorSpace;\n\n\t\tthis._colorsTexture = colorsTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\t// Reserve last u16 index for primitive restart.\n\t\t\t\tconst indexArray = maxVertexCount > 65535\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'THREE.BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `THREE.BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Validates the instance defined by the given ID.\n\t *\n\t * @param {number} instanceId - The instance to validate.\n\t */\n\tvalidateInstanceId( instanceId ) {\n\n\t\tconst instanceInfo = this._instanceInfo;\n\t\tif ( instanceId < 0 || instanceId >= instanceInfo.length || instanceInfo[ instanceId ].active === false ) {\n\n\t\t\tthrow new Error( `THREE.BatchedMesh: Invalid instanceId ${instanceId}. Instance is either out of range or has been deleted.` );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Validates the geometry defined by the given ID.\n\t *\n\t * @param {number} geometryId - The geometry to validate.\n\t */\n\tvalidateGeometryId( geometryId ) {\n\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tif ( geometryId < 0 || geometryId >= geometryInfoList.length || geometryInfoList[ geometryId ].active === false ) {\n\n\t\t\tthrow new Error( `THREE.BatchedMesh: Invalid geometryId ${geometryId}. Geometry is either out of range or has been deleted.` );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Takes a sort a function that is run before render. The function takes a list of instances to\n\t * sort and a camera. The objects in the list include a \"z\" field to perform a depth-ordered sort with.\n\t *\n\t * @param {Function} func - The custom sort function.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the bounding box, updating {@link BatchedMesh#boundingBox}.\n\t * Bounding boxes aren't computed by default. They need to be explicitly computed,\n\t * otherwise they are `null`.\n\t */\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst instanceInfo = this._instanceInfo;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( instanceInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = instanceInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingBox.union( _box$1 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Computes the bounding sphere, updating {@link BatchedMesh#boundingSphere}.\n\t * Bounding spheres aren't computed by default. They need to be explicitly computed,\n\t * otherwise they are `null`.\n\t */\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\t\tconst instanceInfo = this._instanceInfo;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( instanceInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = instanceInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Adds a new instance to the batch using the geometry of the given ID and returns\n\t * a new id referring to the new instance to be used by other functions.\n\t *\n\t * @param {number} geometryId - The ID of a previously added geometry via {@link BatchedMesh#addGeometry}.\n\t * @return {number} The instance ID.\n\t */\n\taddInstance( geometryId ) {\n\n\t\tconst atCapacity = this._instanceInfo.length >= this.maxInstanceCount;\n\n\t\t// ensure we're not over geometry\n\t\tif ( atCapacity && this._availableInstanceIds.length === 0 ) {\n\n\t\t\tthrow new Error( 'THREE.BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\tconst instanceInfo = {\n\t\t\tvisible: true,\n\t\t\tactive: true,\n\t\t\tgeometryIndex: geometryId,\n\t\t};\n\n\t\tlet drawId = null;\n\n\t\t// Prioritize using previously freed instance ids\n\t\tif ( this._availableInstanceIds.length > 0 ) {\n\n\t\t\tthis._availableInstanceIds.sort( ascIdSort );\n\n\t\t\tdrawId = this._availableInstanceIds.shift();\n\t\t\tthis._instanceInfo[ drawId ] = instanceInfo;\n\n\t\t} else {\n\n\t\t\tdrawId = this._instanceInfo.length;\n\t\t\tthis._instanceInfo.push( instanceInfo );\n\n\t\t}\n\n\t\tconst matricesTexture = this._matricesTexture;\n\t\t_matrix$1.identity().toArray( matricesTexture.image.data, drawId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tif ( colorsTexture ) {\n\n\t\t\t_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );\n\t\t\tcolorsTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tthis._visibilityChanged = true;\n\t\treturn drawId;\n\n\t}\n\n\t/**\n\t * Adds the given geometry to the batch and returns the associated\n\t * geometry id referring to it to be used in other functions.\n\t *\n\t * @param {BufferGeometry} geometry - The geometry to add.\n\t * @param {number} [reservedVertexCount=-1] - Optional parameter specifying the amount of\n\t * vertex buffer space to reserve for the added geometry. This is necessary if it is planned\n\t * to set a new geometry at this index at a later time that is larger than the original geometry.\n\t * Defaults to the length of the given geometry vertex buffer.\n\t * @param {number} [reservedIndexCount=-1] - Optional parameter specifying the amount of index\n\t * buffer space to reserve for the added geometry. This is necessary if it is planned to set a\n\t * new geometry at this index at a later time that is larger than the original geometry. Defaults to\n\t * the length of the given geometry index buffer.\n\t * @return {number} The geometry ID.\n\t */\n\taddGeometry( geometry, reservedVertexCount = -1, reservedIndexCount = -1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst geometryInfo = {\n\t\t\t// geometry information\n\t\t\tvertexStart: -1,\n\t\t\tvertexCount: -1,\n\t\t\treservedVertexCount: -1,\n\n\t\t\tindexStart: -1,\n\t\t\tindexCount: -1,\n\t\t\treservedIndexCount: -1,\n\n\t\t\t// draw range information\n\t\t\tstart: -1,\n\t\t\tcount: -1,\n\n\t\t\t// state\n\t\t\tboundingBox: null,\n\t\t\tboundingSphere: null,\n\t\t\tactive: true,\n\t\t};\n\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tgeometryInfo.vertexStart = this._nextVertexStart;\n\t\tgeometryInfo.reservedVertexCount = reservedVertexCount === -1 ? geometry.getAttribute( 'position' ).count : reservedVertexCount;\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tgeometryInfo.indexStart = this._nextIndexStart;\n\t\t\tgeometryInfo.reservedIndexCount = reservedIndexCount === -1 ? index.count : reservedIndexCount;\n\n\t\t}\n\n\t\tif (\n\t\t\tgeometryInfo.indexStart !== -1 &&\n\t\t\tgeometryInfo.indexStart + geometryInfo.reservedIndexCount > this._maxIndexCount ||\n\t\t\tgeometryInfo.vertexStart + geometryInfo.reservedVertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\t// update id\n\t\tlet geometryId;\n\t\tif ( this._availableGeometryIds.length > 0 ) {\n\n\t\t\tthis._availableGeometryIds.sort( ascIdSort );\n\n\t\t\tgeometryId = this._availableGeometryIds.shift();\n\t\t\tgeometryInfoList[ geometryId ] = geometryInfo;\n\n\n\t\t} else {\n\n\t\t\tgeometryId = this._geometryCount;\n\t\t\tthis._geometryCount ++;\n\t\t\tgeometryInfoList.push( geometryInfo );\n\n\t\t}\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\t// increment the next geometry position\n\t\tthis._nextIndexStart = geometryInfo.indexStart + geometryInfo.reservedIndexCount;\n\t\tthis._nextVertexStart = geometryInfo.vertexStart + geometryInfo.reservedVertexCount;\n\n\t\treturn geometryId;\n\n\t}\n\n\t/**\n\t * Replaces the geometry at the given ID with the provided geometry. Throws an error if there\n\t * is not enough space reserved for geometry. Calling this will change all instances that are\n\t * rendering that geometry.\n\t *\n\t * @param {number} geometryId - The ID of the geometry that should be replaced with the given geometry.\n\t * @param {BufferGeometry} geometry - The new geometry.\n\t * @return {number} The geometry ID.\n\t */\n\tsetGeometryAt( geometryId, geometry ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'THREE.BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst geometryInfo = this._geometryInfo[ geometryId ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > geometryInfo.reservedIndexCount ||\n\t\t\tgeometry.attributes.position.count > geometryInfo.reservedVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'THREE.BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry buffer data over\n\t\tconst vertexStart = geometryInfo.vertexStart;\n\t\tconst reservedVertexCount = geometryInfo.reservedVertexCount;\n\t\tgeometryInfo.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = reservedVertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, reservedVertexCount * itemSize );\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = geometryInfo.indexStart;\n\t\t\tconst reservedIndexCount = geometryInfo.reservedIndexCount;\n\t\t\tgeometryInfo.indexCount = geometry.getIndex().count;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedIndexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\t\t\tdstIndex.addUpdateRange( indexStart, geometryInfo.reservedIndexCount );\n\n\t\t}\n\n\t\t// update the draw range\n\t\tgeometryInfo.start = hasIndex ? geometryInfo.indexStart : geometryInfo.vertexStart;\n\t\tgeometryInfo.count = hasIndex ? geometryInfo.indexCount : geometryInfo.vertexCount;\n\n\t\t// store the bounding boxes\n\t\tgeometryInfo.boundingBox = null;\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tgeometryInfo.boundingBox = geometry.boundingBox.clone();\n\n\t\t}\n\n\t\tgeometryInfo.boundingSphere = null;\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tgeometryInfo.boundingSphere = geometry.boundingSphere.clone();\n\n\t\t}\n\n\t\tthis._visibilityChanged = true;\n\t\treturn geometryId;\n\n\t}\n\n\t/**\n\t * Deletes the geometry defined by the given ID from this batch. Any instances referencing\n\t * this geometry will also be removed as a side effect.\n\t *\n\t * @param {number} geometryId - The ID of the geometry to remove from the batch.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tdeleteGeometry( geometryId ) {\n\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tif ( geometryId >= geometryInfoList.length || geometryInfoList[ geometryId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t// delete any instances associated with this geometry\n\t\tconst instanceInfo = this._instanceInfo;\n\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( instanceInfo[ i ].active && instanceInfo[ i ].geometryIndex === geometryId ) {\n\n\t\t\t\tthis.deleteInstance( i );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometryInfoList[ geometryId ].active = false;\n\t\tthis._availableGeometryIds.push( geometryId );\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Deletes an existing instance from the batch using the given ID.\n\t *\n\t * @param {number} instanceId - The ID of the instance to remove from the batch.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tdeleteInstance( instanceId ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\tthis._instanceInfo[ instanceId ].active = false;\n\t\tthis._availableInstanceIds.push( instanceId );\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Repacks the sub geometries in BatchedMesh to remove any unused space remaining from\n\t * previously deleted geometry, freeing up space to add new geometry.\n\t *\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\toptimize() {\n\n\t\t// track the next indices to copy data to\n\t\tlet nextVertexStart = 0;\n\t\tlet nextIndexStart = 0;\n\n\t\t// Iterate over all geometry ranges in order sorted from earliest in the geometry buffer to latest\n\t\t// in the geometry buffer. Because draw range objects can be reused there is no guarantee of their order.\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tconst indices = geometryInfoList\n\t\t\t.map( ( e, i ) => i )\n\t\t\t.sort( ( a, b ) => {\n\n\t\t\t\treturn geometryInfoList[ a ].vertexStart - geometryInfoList[ b ].vertexStart;\n\n\t\t\t} );\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( let i = 0, l = geometryInfoList.length; i < l; i ++ ) {\n\n\t\t\t// if a geometry range is inactive then don't copy anything\n\t\t\tconst index = indices[ i ];\n\t\t\tconst geometryInfo = geometryInfoList[ index ];\n\t\t\tif ( geometryInfo.active === false ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// if a geometry contains an index buffer then shift it, as well\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\tif ( geometryInfo.indexStart !== nextIndexStart ) {\n\n\t\t\t\t\tconst { indexStart, vertexStart, reservedIndexCount } = geometryInfo;\n\t\t\t\t\tconst index = geometry.index;\n\t\t\t\t\tconst array = index.array;\n\n\t\t\t\t\t// shift the index pointers based on how the vertex data will shift\n\t\t\t\t\t// adjusting the index must happen first so the original vertex start value is available\n\t\t\t\t\tconst elementDelta = nextVertexStart - vertexStart;\n\t\t\t\t\tfor ( let j = indexStart; j < indexStart + reservedIndexCount; j ++ ) {\n\n\t\t\t\t\t\tarray[ j ] = array[ j ] + elementDelta;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tindex.array.copyWithin( nextIndexStart, indexStart, indexStart + reservedIndexCount );\n\t\t\t\t\tindex.addUpdateRange( nextIndexStart, reservedIndexCount );\n\t\t\t\t\tindex.needsUpdate = true;\n\n\t\t\t\t\tgeometryInfo.indexStart = nextIndexStart;\n\n\t\t\t\t}\n\n\t\t\t\tnextIndexStart += geometryInfo.reservedIndexCount;\n\n\t\t\t}\n\n\t\t\t// if a geometry needs to be moved then copy attribute data to overwrite unused space\n\t\t\tif ( geometryInfo.vertexStart !== nextVertexStart ) {\n\n\t\t\t\tconst { vertexStart, reservedVertexCount } = geometryInfo;\n\t\t\t\tconst attributes = geometry.attributes;\n\t\t\t\tfor ( const key in attributes ) {\n\n\t\t\t\t\tconst attribute = attributes[ key ];\n\t\t\t\t\tconst { array, itemSize } = attribute;\n\t\t\t\t\tarray.copyWithin( nextVertexStart * itemSize, vertexStart * itemSize, ( vertexStart + reservedVertexCount ) * itemSize );\n\t\t\t\t\tattribute.addUpdateRange( nextVertexStart * itemSize, reservedVertexCount * itemSize );\n\t\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tgeometryInfo.vertexStart = nextVertexStart;\n\n\t\t\t}\n\n\t\t\tnextVertexStart += geometryInfo.reservedVertexCount;\n\t\t\tgeometryInfo.start = geometry.index ? geometryInfo.indexStart : geometryInfo.vertexStart;\n\n\t\t}\n\n\t\tthis._nextIndexStart = nextIndexStart;\n\t\tthis._nextVertexStart = nextVertexStart;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the bounding box for the given geometry.\n\t *\n\t * @param {number} geometryId - The ID of the geometry to return the bounding box for.\n\t * @param {Box3} target - The target object that is used to store the method's result.\n\t * @return {?Box3} The geometry's bounding box. Returns `null` if no geometry has been found for the given ID.\n\t */\n\tgetBoundingBoxAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst geometry = this.geometry;\n\t\tconst geometryInfo = this._geometryInfo[ geometryId ];\n\t\tif ( geometryInfo.boundingBox === null ) {\n\n\t\t\tconst box = new Box3();\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tfor ( let i = geometryInfo.start, l = geometryInfo.start + geometryInfo.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tgeometryInfo.boundingBox = box;\n\n\t\t}\n\n\t\ttarget.copy( geometryInfo.boundingBox );\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns the bounding sphere for the given geometry.\n\t *\n\t * @param {number} geometryId - The ID of the geometry to return the bounding sphere for.\n\t * @param {Sphere} target - The target object that is used to store the method's result.\n\t * @return {?Sphere} The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID.\n\t */\n\tgetBoundingSphereAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst geometry = this.geometry;\n\t\tconst geometryInfo = this._geometryInfo[ geometryId ];\n\t\tif ( geometryInfo.boundingSphere === null ) {\n\n\t\t\tconst sphere = new Sphere();\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = geometryInfo.start, l = geometryInfo.start + geometryInfo.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tgeometryInfo.boundingSphere = sphere;\n\n\t\t}\n\n\t\ttarget.copy( geometryInfo.boundingSphere );\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Sets the given local transformation matrix to the defined instance.\n\t * Negatively scaled matrices are not supported.\n\t *\n\t * @param {number} instanceId - The ID of an instance to set the matrix of.\n\t * @param {Matrix4} matrix - A 4x4 matrix representing the local transformation of a single instance.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tsetMatrixAt( instanceId, matrix ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tmatrix.toArray( matricesArray, instanceId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the local transformation matrix of the defined instance.\n\t *\n\t * @param {number} instanceId - The ID of an instance to get the matrix of.\n\t * @param {Matrix4} matrix - The target object that is used to store the method's result.\n\t * @return {Matrix4} The instance's local transformation matrix.\n\t */\n\tgetMatrixAt( instanceId, matrix ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\t\treturn matrix.fromArray( this._matricesTexture.image.data, instanceId * 16 );\n\n\t}\n\n\t/**\n\t * Sets the given color to the defined instance.\n\t *\n\t * @param {number} instanceId - The ID of an instance to set the color of.\n\t * @param {Color|Vector4} color - The color to set the instance to. Use a `Vector4` to also define alpha.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tsetColorAt( instanceId, color ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\tif ( this._colorsTexture === null ) {\n\n\t\t\tthis._initColorsTexture();\n\n\t\t}\n\n\t\tcolor.toArray( this._colorsTexture.image.data, instanceId * 4 );\n\t\tthis._colorsTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the color of the defined instance.\n\t *\n\t * @param {number} instanceId - The ID of an instance to get the color of.\n\t * @param {Color|Vector4} color - The target object that is used to store the method's result.\n\t * @return {Color|Vector4} The instance's color. Use a `Vector4` to also retrieve alpha.\n\t */\n\tgetColorAt( instanceId, color ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\t\tif ( this._colorsTexture === null ) {\n\n\t\t\tif ( color.isVector4 ) {\n\n\t\t\t\treturn color.set( 1, 1, 1, 1 );\n\n\t\t\t} else {\n\n\t\t\t\treturn color.setRGB( 1, 1, 1 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn color.fromArray( this._colorsTexture.image.data, instanceId * 4 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the visibility of the instance.\n\t *\n\t * @param {number} instanceId - The id of the instance to set the visibility of.\n\t * @param {boolean} visible - Whether the instance is visible or not.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tsetVisibleAt( instanceId, visible ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\tif ( this._instanceInfo[ instanceId ].visible === visible ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis._instanceInfo[ instanceId ].visible = visible;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the visibility state of the defined instance.\n\t *\n\t * @param {number} instanceId - The ID of an instance to get the visibility state of.\n\t * @return {boolean} Whether the instance is visible or not.\n\t */\n\tgetVisibleAt( instanceId ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\treturn this._instanceInfo[ instanceId ].visible;\n\n\t}\n\n\t/**\n\t * Sets the geometry ID of the instance at the given index.\n\t *\n\t * @param {number} instanceId - The ID of the instance to set the geometry ID of.\n\t * @param {number} geometryId - The geometry ID to be use by the instance.\n\t * @return {BatchedMesh} A reference to this batched mesh.\n\t */\n\tsetGeometryIdAt( instanceId, geometryId ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\t\tthis.validateGeometryId( geometryId );\n\n\t\tthis._instanceInfo[ instanceId ].geometryIndex = geometryId;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the geometry ID of the defined instance.\n\t *\n\t * @param {number} instanceId - The ID of an instance to get the geometry ID of.\n\t * @return {number} The instance's geometry ID.\n\t */\n\tgetGeometryIdAt( instanceId ) {\n\n\t\tthis.validateInstanceId( instanceId );\n\n\t\treturn this._instanceInfo[ instanceId ].geometryIndex;\n\n\t}\n\n\t/**\n\t * Get the range representing the subset of triangles related to the attached geometry,\n\t * indicating the starting offset and count, or `null` if invalid.\n\t *\n\t * @param {number} geometryId - The id of the geometry to get the range of.\n\t * @param {Object} [target] - The target object that is used to store the method's result.\n\t * @return {{\n\t * \tvertexStart:number,vertexCount:number,reservedVertexCount:number,\n\t * \tindexStart:number,indexCount:number,reservedIndexCount:number,\n\t * \tstart:number,count:number\n\t * }} The result object with range data.\n\t */\n\tgetGeometryRangeAt( geometryId, target = {} ) {\n\n\t\tthis.validateGeometryId( geometryId );\n\n\t\tconst geometryInfo = this._geometryInfo[ geometryId ];\n\t\ttarget.vertexStart = geometryInfo.vertexStart;\n\t\ttarget.vertexCount = geometryInfo.vertexCount;\n\t\ttarget.reservedVertexCount = geometryInfo.reservedVertexCount;\n\n\t\ttarget.indexStart = geometryInfo.indexStart;\n\t\ttarget.indexCount = geometryInfo.indexCount;\n\t\ttarget.reservedIndexCount = geometryInfo.reservedIndexCount;\n\n\t\ttarget.start = geometryInfo.start;\n\t\ttarget.count = geometryInfo.count;\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Resizes the necessary buffers to support the provided number of instances.\n\t * If the provided arguments shrink the number of instances but there are not enough\n\t * unused Ids at the end of the list then an error is thrown.\n\t *\n\t * @param {number} maxInstanceCount - The max number of individual instances that can be added and rendered by the batch.\n\t*/\n\tsetInstanceCount( maxInstanceCount ) {\n\n\t\t// shrink the available instances as much as possible\n\t\tconst availableInstanceIds = this._availableInstanceIds;\n\t\tconst instanceInfo = this._instanceInfo;\n\t\tavailableInstanceIds.sort( ascIdSort );\n\t\twhile ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length - 1 ) {\n\n\t\t\tinstanceInfo.pop();\n\t\t\tavailableInstanceIds.pop();\n\n\t\t}\n\n\t\t// throw an error if it can't be shrunk to the desired size\n\t\tif ( maxInstanceCount < instanceInfo.length ) {\n\n\t\t\tthrow new Error( `BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );\n\n\t\t}\n\n\t\t// copy the multi draw counts\n\t\tconst multiDrawCounts = new Int32Array( maxInstanceCount );\n\t\tconst multiDrawStarts = new Int32Array( maxInstanceCount );\n\t\tcopyArrayContents( this._multiDrawCounts, multiDrawCounts );\n\t\tcopyArrayContents( this._multiDrawStarts, multiDrawStarts );\n\n\t\tthis._multiDrawCounts = multiDrawCounts;\n\t\tthis._multiDrawStarts = multiDrawStarts;\n\t\tthis._maxInstanceCount = maxInstanceCount;\n\n\t\t// update texture data for instance sampling\n\t\tconst indirectTexture = this._indirectTexture;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst colorsTexture = this._colorsTexture;\n\n\t\tindirectTexture.dispose();\n\t\tthis._initIndirectTexture();\n\t\tcopyArrayContents( indirectTexture.image.data, this._indirectTexture.image.data );\n\n\t\tmatricesTexture.dispose();\n\t\tthis._initMatricesTexture();\n\t\tcopyArrayContents( matricesTexture.image.data, this._matricesTexture.image.data );\n\n\t\tif ( colorsTexture ) {\n\n\t\t\tcolorsTexture.dispose();\n\t\t\tthis._initColorsTexture();\n\t\t\tcopyArrayContents( colorsTexture.image.data, this._colorsTexture.image.data );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Resizes the available space in the batch's vertex and index buffer attributes to the provided sizes.\n\t * If the provided arguments shrink the geometry buffers but there is not enough unused space at the\n\t * end of the geometry attributes then an error is thrown.\n\t *\n\t * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries to resize to.\n\t * @param {number} maxIndexCount - The maximum number of indices to be used by all unique geometries to resize to.\n\t*/\n\tsetGeometrySize( maxVertexCount, maxIndexCount ) {\n\n\t\t// Check if we can shrink to the requested vertex attribute size\n\t\tconst validRanges = [ ...this._geometryInfo ].filter( info => info.active );\n\t\tconst requiredVertexLength = Math.max( ...validRanges.map( range => range.vertexStart + range.reservedVertexCount ) );\n\t\tif ( requiredVertexLength > maxVertexCount ) {\n\n\t\t\tthrow new Error( `BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );\n\n\t\t}\n\n\t\t// Check if we can shrink to the requested index attribute size\n\t\tif ( this.geometry.index ) {\n\n\t\t\tconst requiredIndexLength = Math.max( ...validRanges.map( range => range.indexStart + range.reservedIndexCount ) );\n\t\t\tif ( requiredIndexLength > maxIndexCount ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\t// dispose of the previous geometry\n\t\tconst oldGeometry = this.geometry;\n\t\toldGeometry.dispose();\n\n\t\t// recreate the geometry needed based on the previous variant\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tif ( this._geometryInitialized ) {\n\n\t\t\tthis._geometryInitialized = false;\n\t\t\tthis.geometry = new BufferGeometry();\n\t\t\tthis._initializeGeometry( oldGeometry );\n\n\t\t}\n\n\t\t// copy data from the previous geometry\n\t\tconst geometry = this.geometry;\n\t\tif ( oldGeometry.index ) {\n\n\t\t\tcopyArrayContents( oldGeometry.index.array, geometry.index.array );\n\n\t\t}\n\n\t\tfor ( const key in oldGeometry.attributes ) {\n\n\t\t\tcopyArrayContents( oldGeometry.attributes[ key ].array, geometry.attributes[ key ].array );\n\n\t\t}\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst instanceInfo = this._instanceInfo;\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( ! instanceInfo[ i ].visible || ! instanceInfo[ i ].active ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst geometryId = instanceInfo[ i ].geometryIndex;\n\t\t\tconst geometryInfo = geometryInfoList[ geometryId ];\n\t\t\t_mesh.geometry.setDrawRange( geometryInfo.start, geometryInfo.count );\n\n\t\t\t// get the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._geometryInfo = source._geometryInfo.map( info => ( {\n\t\t\t...info,\n\n\t\t\tboundingBox: info.boundingBox !== null ? info.boundingBox.clone() : null,\n\t\t\tboundingSphere: info.boundingSphere !== null ? info.boundingSphere.clone() : null,\n\t\t} ) );\n\t\tthis._instanceInfo = source._instanceInfo.map( info => ( { ...info } ) );\n\n\t\tthis._availableInstanceIds = source._availableInstanceIds.slice();\n\t\tthis._availableGeometryIds = source._availableGeometryIds.slice();\n\n\t\tthis._nextIndexStart = source._nextIndexStart;\n\t\tthis._nextVertexStart = source._nextVertexStart;\n\t\tthis._geometryCount = source._geometryCount;\n\n\t\tthis._maxInstanceCount = source._maxInstanceCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._indirectTexture = source._indirectTexture.clone();\n\t\tthis._indirectTexture.image.data = this._indirectTexture.image.data.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.data.slice();\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture = source._colorsTexture.clone();\n\t\t\tthis._colorsTexture.image.data = this._colorsTexture.image.data.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\n\t\tthis._indirectTexture.dispose();\n\t\tthis._indirectTexture = null;\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture.dispose();\n\t\t\tthis._colorsTexture = null;\n\n\t\t}\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tlet bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\n\t\t// the \"wireframe\" attribute implicitly creates a line attribute in the renderer, which is double\n\t\t// the vertices to draw (3 lines per triangle) so we multiply the draw counts / starts and make\n\t\t// assumptions about the index buffer byte size.\n\t\tlet multiDrawMultiplier = 1;\n\t\tif ( material.wireframe ) {\n\n\t\t\tmultiDrawMultiplier = 2;\n\t\t\tbytesPerElement = geometry.attributes.position.count > 65535 ? 4 : 2;\n\n\t\t}\n\n\t\tconst instanceInfo = this._instanceInfo;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst geometryInfoList = this._geometryInfo;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\tconst indirectTexture = this._indirectTexture;\n\t\tconst indirectArray = indirectTexture.image.data;\n\n\t\tconst frustum = camera.isArrayCamera ? _frustumArray : _frustum;\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled && ! camera.isArrayCamera ) {\n\n\t\t\t_matrix$1\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_matrix$1,\n\t\t\t\tcamera.coordinateSystem,\n\t\t\t\tcamera.reversedDepth\n\t\t\t);\n\n\t\t}\n\n\t\tlet multiDrawCount = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_matrix$1.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _matrix$1 );\n\t\t\t_forward$1.set( 0, 0, -1 ).transformDirection( camera.matrixWorld ).transformDirection( _matrix$1 );\n\n\t\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( instanceInfo[ i ].visible && instanceInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = instanceInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! frustum.intersectsSphere( _sphere$2, camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst geometryInfo = geometryInfoList[ geometryId ];\n\t\t\t\t\t\tconst z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward$1 );\n\t\t\t\t\t\t_renderList.push( geometryInfo.start, geometryInfo.count, z, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ multiDrawCount ] = item.start * bytesPerElement * multiDrawMultiplier;\n\t\t\t\tmultiDrawCounts[ multiDrawCount ] = item.count * multiDrawMultiplier;\n\t\t\t\tindirectArray[ multiDrawCount ] = item.index;\n\t\t\t\tmultiDrawCount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( instanceInfo[ i ].visible && instanceInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = instanceInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\t\t\t\tculled = ! frustum.intersectsSphere( _sphere$2, camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst geometryInfo = geometryInfoList[ geometryId ];\n\t\t\t\t\t\tmultiDrawStarts[ multiDrawCount ] = geometryInfo.start * bytesPerElement * multiDrawMultiplier;\n\t\t\t\t\t\tmultiDrawCounts[ multiDrawCount ] = geometryInfo.count * multiDrawMultiplier;\n\t\t\t\t\t\tindirectArray[ multiDrawCount ] = i;\n\t\t\t\t\t\tmultiDrawCount ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tindirectTexture.needsUpdate = true;\n\t\tthis._multiDrawCount = multiDrawCount;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\n\n\t}\n\n}\n\n/**\n * A material for rendering line primitives.\n *\n * Materials define the appearance of renderable 3D objects.\n *\n * ```js\n * const material = new THREE.LineBasicMaterial( { color: 0xffffff } );\n * ```\n *\n * @augments Material\n */\nclass LineBasicMaterial extends Material {\n\n\t/**\n\t * Constructs a new line basic material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff );\n\n\t\t/**\n\t\t * Sets the color of the lines using data from a texture. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * Controls line thickness or lines.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}. WebGL and WebGPU\n\t\t * ignore this setting and always render line primitives with a\n\t\t * width of one pixel.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.linewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of line ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('butt'|'round'|'square')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.linecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of line joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.linejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _vStart = /*@__PURE__*/ new Vector3();\nconst _vEnd = /*@__PURE__*/ new Vector3();\n\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nconst _intersectPointOnRay = /*@__PURE__*/ new Vector3();\nconst _intersectPointOnSegment = /*@__PURE__*/ new Vector3();\n\n/**\n * A continuous line. The line are rendered by connecting consecutive\n * vertices with straight lines.\n *\n * ```js\n * const material = new THREE.LineBasicMaterial( { color: 0x0000ff } );\n *\n * const points = [];\n * points.push( new THREE.Vector3( - 10, 0, 0 ) );\n * points.push( new THREE.Vector3( 0, 10, 0 ) );\n * points.push( new THREE.Vector3( 10, 0, 0 ) );\n *\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const line = new THREE.Line( geometry, material );\n * scene.add( line );\n * ```\n *\n * @augments Object3D\n */\nclass Line extends Object3D {\n\n\t/**\n\t * Constructs a new line.\n\t *\n\t * @param {BufferGeometry} [geometry] - The line geometry.\n\t * @param {Material|Array<Material>} [material] - The line material.\n\t */\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\t/**\n\t\t * The line geometry.\n\t\t *\n\t\t * @type {BufferGeometry}\n\t\t */\n\t\tthis.geometry = geometry;\n\n\t\t/**\n\t\t * The line material.\n\t\t *\n\t\t * @type {Material|Array<Material>}\n\t\t * @default LineBasicMaterial\n\t\t */\n\t\tthis.material = material;\n\n\t\t/**\n\t\t * A dictionary representing the morph targets in the geometry. The key is the\n\t\t * morph targets name, the value its attribute index. This member is `undefined`\n\t\t * by default and only set when morph targets are detected in the geometry.\n\t\t *\n\t\t * @type {Object<string,number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetDictionary = undefined;\n\n\t\t/**\n\t\t * An array of weights typically in the range `[0,1]` that specify how much of the morph\n\t\t * is applied. This member is `undefined` by default and only set when morph targets are\n\t\t * detected in the geometry.\n\t\t *\n\t\t * @type {Array<number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetInfluences = undefined;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes an array of distance values which are necessary for rendering dashed lines.\n\t * For each vertex in the geometry, the method calculates the cumulative length from the\n\t * current point to the very beginning of the line.\n\t *\n\t * @return {Line} A reference to this line.\n\t */\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_vStart.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_vEnd.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _vStart.distanceTo( _vEnd );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\twarn( 'Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes intersection points between a casted ray and this line.\n\t *\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - The target array that holds the intersection points.\n\t */\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b, i );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst a = index.getX( end - 1 );\n\t\t\t\tconst b = index.getX( start );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b, end - 1 );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1, i );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start, end - 1 );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the values of {@link Line#morphTargetDictionary} and {@link Line#morphTargetInfluences}\n\t * to make sure existing morph targets can influence this 3D object.\n\t */\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, raycaster, ray, thresholdSq, a, b, i ) {\n\n\tconst positionAttribute = object.geometry.attributes.position;\n\n\t_vStart.fromBufferAttribute( positionAttribute, a );\n\t_vEnd.fromBufferAttribute( positionAttribute, b );\n\n\tconst distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );\n\n\tif ( distSq > thresholdSq ) return;\n\n\t_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\treturn {\n\n\t\tdistance: distance,\n\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t// point: raycaster.ray.at( distance ),\n\t\tpoint: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),\n\t\tindex: i,\n\t\tface: null,\n\t\tfaceIndex: null,\n\t\tbarycoord: null,\n\t\tobject: object\n\n\t};\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\n/**\n * A series of lines drawn between pairs of vertices.\n *\n * @augments Line\n */\nclass LineSegments extends Line {\n\n\t/**\n\t * Constructs a new line segments.\n\t *\n\t * @param {BufferGeometry} [geometry] - The line geometry.\n\t * @param {Material|Array<Material>} [material] - The line material.\n\t */\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\twarn( 'LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A continuous line. This is nearly the same as {@link Line} the only difference\n * is that the last vertex is connected with the first vertex in order to close\n * the line to form a loop.\n *\n * @augments Line\n */\nclass LineLoop extends Line {\n\n\t/**\n\t * Constructs a new line loop.\n\t *\n\t * @param {BufferGeometry} [geometry] - The line geometry.\n\t * @param {Material|Array<Material>} [material] - The line material.\n\t */\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\n/**\n * A material for rendering point primitives.\n *\n * Materials define the appearance of renderable 3D objects.\n *\n * ```js\n * const vertices = [];\n *\n * for ( let i = 0; i < 10000; i ++ ) {\n * \tconst x = THREE.MathUtils.randFloatSpread( 2000 );\n * \tconst y = THREE.MathUtils.randFloatSpread( 2000 );\n * \tconst z = THREE.MathUtils.randFloatSpread( 2000 );\n *\n * \tvertices.push( x, y, z );\n * }\n *\n * const geometry = new THREE.BufferGeometry();\n * geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );\n * const material = new THREE.PointsMaterial( { color: 0x888888 } );\n * const points = new THREE.Points( geometry, material );\n * scene.add( points );\n * ```\n *\n * @augments Material\n */\nclass PointsMaterial extends Material {\n\n\t/**\n\t * Constructs a new points material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff );\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * Defines the size of the points in pixels.\n\t\t *\n\t\t * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.size = 1;\n\n\t\t/**\n\t\t * Specifies whether size of individual points is attenuated by the camera depth (perspective camera only).\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sizeAttenuation = true;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$3 = /*@__PURE__*/ new Vector3();\n\n/**\n * A class for displaying points or point clouds.\n *\n * @augments Object3D\n */\nclass Points extends Object3D {\n\n\t/**\n\t * Constructs a new point cloud.\n\t *\n\t * @param {BufferGeometry} [geometry] - The points geometry.\n\t * @param {Material|Array<Material>} [material] - The points material.\n\t */\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\t/**\n\t\t * The points geometry.\n\t\t *\n\t\t * @type {BufferGeometry}\n\t\t */\n\t\tthis.geometry = geometry;\n\n\t\t/**\n\t\t * The line material.\n\t\t *\n\t\t * @type {Material|Array<Material>}\n\t\t * @default PointsMaterial\n\t\t */\n\t\tthis.material = material;\n\n\t\t/**\n\t\t * A dictionary representing the morph targets in the geometry. The key is the\n\t\t * morph targets name, the value its attribute index. This member is `undefined`\n\t\t * by default and only set when morph targets are detected in the geometry.\n\t\t *\n\t\t * @type {Object<string,number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetDictionary = undefined;\n\n\t\t/**\n\t\t * An array of weights typically in the range `[0,1]` that specify how much of the morph\n\t\t * is applied. This member is `undefined` by default and only set when morph targets are\n\t\t * detected in the geometry.\n\t\t *\n\t\t * @type {Array<number>|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.morphTargetInfluences = undefined;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes intersection points between a casted ray and this point cloud.\n\t *\n\t * @param {Raycaster} raycaster - The raycaster.\n\t * @param {Array<Object>} intersects - The target array that holds the intersection points.\n\t */\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$3.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$3, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$3.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$3, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the values of {@link Points#morphTargetDictionary} and {@link Points#morphTargetInfluences}\n\t * to make sure existing morph targets can influence this 3D object.\n\t */\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tfaceIndex: null,\n\t\t\tbarycoord: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * A texture for use with a video.\n *\n * ```js\n * // assuming you have created a HTML video element with id=\"video\"\n * const video = document.getElementById( 'video' );\n * const texture = new THREE.VideoTexture( video );\n * ```\n *\n * Note: When using video textures with {@link WebGPURenderer}, {@link Texture#colorSpace} must be\n * set to THREE.SRGBColorSpace.\n *\n * Note: After the initial use of a texture, its dimensions, format, and type\n * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one.\n *\n * @augments Texture\n */\nclass VideoTexture extends Texture {\n\n\t/**\n\t * Constructs a new video texture.\n\t *\n\t * @param {HTMLVideoElement} video - The video element to use as a data source for the texture.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t */\n\tconstructor( video, mapping, wrapS, wrapT, magFilter = LinearFilter, minFilter = LinearFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isVideoTexture = true;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\t/**\n\t\t * The video frame request callback identifier, which is a positive integer.\n\t\t *\n\t\t * Value of 0 represents no scheduled rVFC.\n\t\t *\n\t\t * @private\n\t\t * @type {number}\n\t\t */\n\t\tthis._requestVideoFrameCallbackId = 0;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tscope._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tthis._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\t/**\n\t * This method is called automatically by the renderer and sets {@link Texture#needsUpdate}\n\t * to `true` every time a new frame is available.\n\t *\n\t * Only relevant if `requestVideoFrameCallback` is not supported in the browser.\n\t */\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this._requestVideoFrameCallbackId !== 0 ) {\n\n\t\t\tthis.source.data.cancelVideoFrameCallback( this._requestVideoFrameCallbackId );\n\n\t\t\tthis._requestVideoFrameCallbackId = 0;\n\n\t\t}\n\n\t\tsuper.dispose();\n\n\t}\n\n}\n\n/**\n * This class can be used as an alternative way to define video data. Instead of using\n * an instance of `HTMLVideoElement` like with `VideoTexture`, `VideoFrameTexture` expects each frame is\n * defined manually via {@link VideoFrameTexture#setFrame}. A typical use case for this module is when\n * video frames are decoded with the WebCodecs API.\n *\n * ```js\n * const texture = new THREE.VideoFrameTexture();\n * texture.setFrame( frame );\n * ```\n *\n * @augments VideoTexture\n */\nclass VideoFrameTexture extends VideoTexture {\n\n\t/**\n\t * Constructs a new video frame texture.\n\t *\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t */\n\tconstructor( mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( {}, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isVideoFrameTexture = true;\n\n\t}\n\n\t/**\n\t * This method overwritten with an empty implementation since\n\t * this type of texture is updated via `setFrame()`.\n\t */\n\tupdate() {}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this ); // restoring Texture.clone()\n\n\t}\n\n\t/**\n\t * Sets the current frame of the video. This will automatically update the texture\n\t * so the data can be used for rendering.\n\t *\n\t * @param {VideoFrame} frame - The video frame.\n\t */\n\tsetFrame( frame ) {\n\n\t\tthis.image = frame;\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * This class can only be used in combination with `copyFramebufferToTexture()` methods\n * of renderers. It extracts the contents of the current bound framebuffer and provides it\n * as a texture for further usage.\n *\n * ```js\n * const pixelRatio = window.devicePixelRatio;\n * const textureSize = 128 * pixelRatio;\n *\n * const frameTexture = new FramebufferTexture( textureSize, textureSize );\n *\n * // calculate start position for copying part of the frame data\n * const vector = new Vector2();\n * vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );\n * vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );\n *\n * renderer.render( scene, camera );\n *\n * // copy part of the rendered frame into the framebuffer texture\n * renderer.copyFramebufferToTexture( frameTexture, vector );\n * ```\n *\n * @augments Texture\n */\nclass FramebufferTexture extends Texture {\n\n\t/**\n\t * Constructs a new framebuffer texture.\n\t *\n\t * @param {number} [width] - The width of the texture.\n\t * @param {number} [height] - The height of the texture.\n\t */\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isFramebufferTexture = true;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers more than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default to disable filtering.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.magFilter = NearestFilter;\n\n\t\t/**\n\t\t * How the texture is sampled when a texel covers less than one pixel.\n\t\t *\n\t\t * Overwritten and set to `NearestFilter` by default to disable filtering.\n\t\t *\n\t\t * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}\n\t\t * @default NearestFilter\n\t\t */\n\t\tthis.minFilter = NearestFilter;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Creates a texture based on data in compressed form.\n *\n * These texture are usually loaded with {@link CompressedTextureLoader}.\n *\n * @augments Texture\n */\nclass CompressedTexture extends Texture {\n\n\t/**\n\t * Constructs a new compressed texture.\n\t *\n\t * @param {Array<Object>} mipmaps - This array holds for all mipmaps (including the bases mip)\n\t * the data and dimensions.\n\t * @param {number} width - The width of the texture.\n\t * @param {number} height - The height of the texture.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {string} [colorSpace=NoColorSpace] - The color space.\n\t */\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCompressedTexture = true;\n\n\t\t/**\n\t\t * The image property of a compressed texture just defines its dimensions.\n\t\t *\n\t\t * @type {{width:number,height:number}}\n\t\t */\n\t\tthis.image = { width: width, height: height };\n\n\t\t/**\n\t\t * This array holds for all mipmaps (including the bases mip) the data and dimensions.\n\t\t *\n\t\t * @type {Array<Object>}\n\t\t */\n\t\tthis.mipmaps = mipmaps;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default since it is not possible to\n\t\t * flip compressed textures.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t * @readonly\n\t\t */\n\t\tthis.flipY = false;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default since it is not\n\t\t * possible to generate mipmaps for compressed data. Mipmaps\n\t\t * must be embedded in the compressed texture file.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t * @readonly\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\n/**\n * Creates a texture 2D array based on data in compressed form.\n *\n * These texture are usually loaded with {@link CompressedTextureLoader}.\n *\n * @augments CompressedTexture\n */\nclass CompressedArrayTexture extends CompressedTexture {\n\n\t/**\n\t * Constructs a new compressed array texture.\n\t *\n\t * @param {Array<Object>} mipmaps - This array holds for all mipmaps (including the bases mip)\n\t * the data and dimensions.\n\t * @param {number} width - The width of the texture.\n\t * @param {number} height - The height of the texture.\n\t * @param {number} depth - The depth of the texture.\n\t * @param {number} [format=RGBAFormat] - The min filter value.\n\t * @param {number} [type=UnsignedByteType] - The min filter value.\n\t */\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCompressedArrayTexture = true;\n\n\t\t/**\n\t\t * The image property of a compressed texture just defines its dimensions.\n\t\t *\n\t\t * @name CompressedArrayTexture#image\n\t\t * @type {{width:number,height:number,depth:number}}\n\t\t */\n\t\tthis.image.depth = depth;\n\n\t\t/**\n\t\t * This defines how the texture is wrapped in the depth and corresponds to\n\t\t * *W* in UVW mapping.\n\t\t *\n\t\t * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}\n\t\t * @default ClampToEdgeWrapping\n\t\t */\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\t/**\n\t\t * A set of all layers which need to be updated in the texture.\n\t\t *\n\t\t * @type {Set<number>}\n\t\t */\n\t\tthis.layerUpdates = new Set();\n\n\t}\n\n\t/**\n\t * Describes that a specific layer of the texture needs to be updated.\n\t * Normally when {@link Texture#needsUpdate} is set to `true`, the\n\t * entire compressed texture array is sent to the GPU. Marking specific\n\t * layers will only transmit subsets of all mipmaps associated with a\n\t * specific depth in the array which is often much more performant.\n\t *\n\t * @param {number} layerIndex - The layer index that should be updated.\n\t */\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\t/**\n\t * Resets the layer updates registry.\n\t */\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\n/**\n * Creates a cube texture based on data in compressed form.\n *\n * These texture are usually loaded with {@link CompressedTextureLoader}.\n *\n * @augments CompressedTexture\n */\nclass CompressedCubeTexture extends CompressedTexture {\n\n\t/**\n\t * Constructs a new compressed texture.\n\t *\n\t * @param {Array<CompressedTexture>} images - An array of compressed textures.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t */\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCompressedCubeTexture = true;\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\n/**\n * Creates a cube texture made up of six images.\n *\n * ```js\n * const loader = new THREE.CubeTextureLoader();\n * loader.setPath( 'textures/cube/pisa/' );\n *\n * const textureCube = loader.load( [\n * \t'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png'\n * ] );\n *\n * const material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } );\n * ```\n *\n * @augments Texture\n */\nclass CubeTexture extends Texture {\n\n\t/**\n\t * Constructs a new cube texture.\n\t *\n\t * @param {Array<Image>} [images=[]] - An array holding a image for each side of a cube.\n\t * @param {number} [mapping=CubeReflectionMapping] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {string} [colorSpace=NoColorSpace] - The color space value.\n\t */\n\tconstructor( images = [], mapping = CubeReflectionMapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubeTexture = true;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flipY = false;\n\n\t}\n\n\t/**\n\t * Alias for {@link CubeTexture#image}.\n\t *\n\t * @type {Array<Image>}\n\t */\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\n/**\n * Creates a texture from a canvas element.\n *\n * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate}\n * to `true` immediately since a canvas can directly be used for rendering.\n *\n * @augments Texture\n */\nclass CanvasTexture extends Texture {\n\n\t/**\n\t * Constructs a new texture.\n\t *\n\t * @param {HTMLCanvasElement} [canvas] - The HTML canvas element.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t */\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Creates a texture from an HTML element.\n *\n * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate}\n * to `true` immediately and listens for the parent canvas's paint events to trigger updates.\n *\n * @augments Texture\n */\nclass HTMLTexture extends Texture {\n\n\t/**\n\t * Constructs a new texture.\n\t *\n\t * @param {HTMLElement} [element] - The HTML element.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n\t * @param {number} [format=RGBAFormat] - The texture format.\n\t * @param {number} [type=UnsignedByteType] - The texture type.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t */\n\tconstructor( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( element, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isHTMLTexture = true;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t\tconst parent = element ? element.parentNode : null;\n\n\t\tif ( parent !== null && 'requestPaint' in parent ) {\n\n\t\t\tparent.onpaint = () => {\n\n\t\t\t\tthis.needsUpdate = true;\n\n\t\t\t};\n\n\t\t\tparent.requestPaint();\n\n\t\t}\n\n\t}\n\n\tdispose() {\n\n\t\tconst parent = this.image ? this.image.parentNode : null;\n\n\t\tif ( parent !== null && 'onpaint' in parent ) {\n\n\t\t\tparent.onpaint = null;\n\n\t\t}\n\n\t\tsuper.dispose();\n\n\t}\n\n}\n\n/**\n * This class can be used to automatically save the depth information of a\n * rendering into a texture.\n *\n * @augments Texture\n */\nclass DepthTexture extends Texture {\n\n\t/**\n\t * Constructs a new depth texture.\n\t *\n\t * @param {number} width - The width of the texture.\n\t * @param {number} height - The height of the texture.\n\t * @param {number} [type=UnsignedIntType] - The texture type.\n\t * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=LinearFilter] - The mag filter value.\n\t * @param {number} [minFilter=LinearFilter] - The min filter value.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {number} [format=DepthFormat] - The texture format.\n\t * @param {number} [depth=1] - The depth of the texture.\n\t */\n\tconstructor( width, height, type = UnsignedIntType, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, format = DepthFormat, depth = 1 ) {\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tconst image = { width: width, height: height, depth: depth };\n\n\t\tsuper( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isDepthTexture = true;\n\n\t\t/**\n\t\t * If set to `true`, the texture is flipped along the vertical axis when\n\t\t * uploaded to the GPU.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flipY = false;\n\n\t\t/**\n\t\t * Whether to generate mipmaps (if possible) for a texture.\n\t\t *\n\t\t * Overwritten and set to `false` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.generateMipmaps = false;\n\n\t\t/**\n\t\t * Code corresponding to the depth compare function.\n\t\t *\n\t\t * @type {?(NeverCompare|LessCompare|EqualCompare|LessEqualCompare|GreaterCompare|NotEqualCompare|GreaterEqualCompare|AlwaysCompare)}\n\t\t * @default null\n\t\t */\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.source = new Source( Object.assign( {}, source.image ) ); // see #30540\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * This class can be used to automatically save the depth information of a\n * cube rendering into a cube texture with depth format. Used for PointLight shadows.\n *\n * @augments DepthTexture\n */\nclass CubeDepthTexture extends DepthTexture {\n\n\t/**\n\t * Constructs a new cube depth texture.\n\t *\n\t * @param {number} size - The size (width and height) of each cube face.\n\t * @param {number} [type=UnsignedIntType] - The texture type.\n\t * @param {number} [mapping=CubeReflectionMapping] - The texture mapping.\n\t * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n\t * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n\t * @param {number} [magFilter=NearestFilter] - The mag filter value.\n\t * @param {number} [minFilter=NearestFilter] - The min filter value.\n\t * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n\t * @param {number} [format=DepthFormat] - The texture format.\n\t */\n\tconstructor( size, type = UnsignedIntType, mapping = CubeReflectionMapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, format = DepthFormat ) {\n\n\t\t// Create 6 identical image descriptors for the cube faces\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\t// Call DepthTexture constructor with width, height\n\t\tsuper( size, size, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format );\n\n\t\t// Replace the single image with the array of 6 images\n\t\tthis.image = images;\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubeDepthTexture = true;\n\n\t\t/**\n\t\t * Set to true for cube texture handling in WebGLTextures.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubeTexture = true;\n\n\t}\n\n\t/**\n\t * Alias for {@link CubeDepthTexture#image}.\n\t *\n\t * @type {Array<Image>}\n\t */\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\n/**\n * Represents a texture created externally with the same renderer context.\n *\n * This may be a texture from a protected media stream, device camera feed,\n * or other data feeds like a depth sensor.\n *\n * Note that this class is only supported in {@link WebGLRenderer}, and in\n * the {@link WebGPURenderer} WebGPU backend.\n *\n * @augments Texture\n */\nclass ExternalTexture extends Texture {\n\n\t/**\n\t * Creates a new raw texture.\n\t *\n\t * @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.\n\t */\n\tconstructor( sourceTexture = null ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * The external source texture.\n\t\t *\n\t\t * @type {?(WebGLTexture|GPUTexture)}\n\t\t * @default null\n\t\t */\n\t\tthis.sourceTexture = sourceTexture;\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isExternalTexture = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sourceTexture = source.sourceTexture;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A geometry class for a rectangular cuboid with a given width, height, and depth.\n * On creation, the cuboid is centred on the origin, with each edge parallel to one\n * of the axes.\n *\n * ```js\n * const geometry = new THREE.BoxGeometry( 1, 1, 1 );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n * const cube = new THREE.Mesh( geometry, material );\n * scene.add( cube );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#BoxGeometry\n */\nclass BoxGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new box geometry.\n\t *\n\t * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis.\n\t * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis.\n\t * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis.\n\t * @param {number} [widthSegments=1] - Number of segmented rectangular faces along the width of the sides.\n\t * @param {number} [heightSegments=1] - Number of segmented rectangular faces along the height of the sides.\n\t * @param {number} [depthSegments=1] - Number of segmented rectangular faces along the depth of the sides.\n\t */\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, -1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, -1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', -1, -1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : -1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {BoxGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing a capsule.\n *\n * ```js\n * const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n * const capsule = new THREE.Mesh( geometry, material );\n * scene.add( capsule );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#CapsuleGeometry\n */\nclass CapsuleGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new capsule geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the capsule.\n\t * @param {number} [height=1] - Height of the middle section.\n\t * @param {number} [capSegments=4] - Number of curve segments used to build each cap.\n\t * @param {number} [radialSegments=8] - Number of segmented faces around the circumference of the capsule. Must be an integer >= 3.\n\t * @param {number} [heightSegments=1] - Number of rows of faces along the height of the middle section. Must be an integer >= 1.\n\t */\n\tconstructor( radius = 1, height = 1, capSegments = 4, radialSegments = 8, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t};\n\n\t\theight = Math.max( 0, height );\n\t\tcapSegments = Math.max( 1, Math.floor( capSegments ) );\n\t\tradialSegments = Math.max( 3, Math.floor( radialSegments ) );\n\t\theightSegments = Math.max( 1, Math.floor( heightSegments ) );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst halfHeight = height / 2;\n\t\tconst capArcLength = ( Math.PI / 2 ) * radius;\n\t\tconst cylinderPartLength = height;\n\t\tconst totalArcLength = 2 * capArcLength + cylinderPartLength;\n\n\t\tconst numVerticalSegments = capSegments * 2 + heightSegments;\n\t\tconst verticesPerRow = radialSegments + 1;\n\n\t\tconst normal = new Vector3();\n\t\tconst vertex = new Vector3();\n\n\t\t// generate vertices, normals, and uvs\n\n\t\tfor ( let iy = 0; iy <= numVerticalSegments; iy ++ ) {\n\n\t\t\tlet currentArcLength = 0;\n\t\t\tlet profileY = 0;\n\t\t\tlet profileRadius = 0;\n\t\t\tlet normalYComponent = 0;\n\n\t\t\tif ( iy <= capSegments ) {\n\n\t\t\t\t// bottom cap\n\t\t\t\tconst segmentProgress = iy / capSegments;\n\t\t\t\tconst angle = ( segmentProgress * Math.PI ) / 2;\n\t\t\t\tprofileY = - halfHeight - radius * Math.cos( angle );\n\t\t\t\tprofileRadius = radius * Math.sin( angle );\n\t\t\t\tnormalYComponent = - radius * Math.cos( angle );\n\t\t\t\tcurrentArcLength = segmentProgress * capArcLength;\n\n\t\t\t} else if ( iy <= capSegments + heightSegments ) {\n\n\t\t\t\t// middle section\n\t\t\t\tconst segmentProgress = ( iy - capSegments ) / heightSegments;\n\t\t\t\tprofileY = - halfHeight + segmentProgress * height;\n\t\t\t\tprofileRadius = radius;\n\t\t\t\tnormalYComponent = 0;\n\t\t\t\tcurrentArcLength = capArcLength + segmentProgress * cylinderPartLength;\n\n\t\t\t} else {\n\n\t\t\t\t// top cap\n\t\t\t\tconst segmentProgress =\n\t\t\t\t\t( iy - capSegments - heightSegments ) / capSegments;\n\t\t\t\tconst angle = ( segmentProgress * Math.PI ) / 2;\n\t\t\t\tprofileY = halfHeight + radius * Math.sin( angle );\n\t\t\t\tprofileRadius = radius * Math.cos( angle );\n\t\t\t\tnormalYComponent = radius * Math.sin( angle );\n\t\t\t\tcurrentArcLength =\n\t\t\t\t\tcapArcLength + cylinderPartLength + segmentProgress * capArcLength;\n\n\t\t\t}\n\n\t\t\tconst v = Math.max( 0, Math.min( 1, currentArcLength / totalArcLength ) );\n\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / radialSegments;\n\n\t\t\t} else if ( iy === numVerticalSegments ) {\n\n\t\t\t\tuOffset = -0.5 / radialSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= radialSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / radialSegments;\n\t\t\t\tconst theta = u * Math.PI * 2;\n\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - profileRadius * cosTheta;\n\t\t\t\tvertex.y = profileY;\n\t\t\t\tvertex.z = profileRadius * sinTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.set(\n\t\t\t\t\t- profileRadius * cosTheta,\n\t\t\t\t\tnormalYComponent,\n\t\t\t\t\tprofileRadius * sinTheta\n\t\t\t\t);\n\t\t\t\tnormal.normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, v );\n\n\t\t\t}\n\n\t\t\tif ( iy > 0 ) {\n\n\t\t\t\tconst prevIndexRow = ( iy - 1 ) * verticesPerRow;\n\t\t\t\tfor ( let ix = 0; ix < radialSegments; ix ++ ) {\n\n\t\t\t\t\tconst i1 = prevIndexRow + ix;\n\t\t\t\t\tconst i2 = prevIndexRow + ix + 1;\n\t\t\t\t\tconst i3 = iy * verticesPerRow + ix;\n\t\t\t\t\tconst i4 = iy * verticesPerRow + ix + 1;\n\n\t\t\t\t\tindices.push( i1, i2, i3 );\n\t\t\t\t\tindices.push( i2, i4, i3 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {CapsuleGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.height, data.capSegments, data.radialSegments, data.heightSegments );\n\n\t}\n\n}\n\n/**\n * A simple shape of Euclidean geometry. It is constructed from a\n * number of triangular segments that are oriented around a central point and\n * extend as far out as a given radius. It is built counter-clockwise from a\n * start angle and a given central angle. It can also be used to create\n * regular polygons, where the number of segments determines the number of\n * sides.\n *\n * ```js\n * const geometry = new THREE.CircleGeometry( 5, 32 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const circle = new THREE.Mesh( geometry, material );\n * scene.add( circle )\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#CircleGeometry\n */\nclass CircleGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new circle geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the circle.\n\t * @param {number} [segments=32] - Number of segments (triangles), minimum = `3`.\n\t * @param {number} [thetaStart=0] - Start angle for first segment in radians.\n\t * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta,\n\t * of the circular sector in radians. The default value results in a complete circle.\n\t */\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {CircleGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing a cylinder.\n *\n * ```js\n * const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const cylinder = new THREE.Mesh( geometry, material );\n * scene.add( cylinder );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#CylinderGeometry\n */\nclass CylinderGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new cylinder geometry.\n\t *\n\t * @param {number} [radiusTop=1] - Radius of the cylinder at the top.\n\t * @param {number} [radiusBottom=1] - Radius of the cylinder at the bottom.\n\t * @param {number} [height=1] - Height of the cylinder.\n\t * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cylinder.\n\t * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cylinder.\n\t * @param {boolean} [openEnded=false] - Whether the base of the cylinder is open or capped.\n\t * @param {number} [thetaStart=0] - Start angle for first segment, in radians.\n\t * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians.\n\t * The default value results in a complete cylinder.\n\t */\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tif ( radiusTop > 0 || y !== 0 ) {\n\n\t\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\t\tgroupCount += 3;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( radiusBottom > 0 || y !== heightSegments - 1 ) {\n\n\t\t\t\t\t\tindices.push( b, c, d );\n\t\t\t\t\t\tgroupCount += 3;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : -1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {CylinderGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing a cone.\n *\n * ```js\n * const geometry = new THREE.ConeGeometry( 5, 20, 32 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const cone = new THREE.Mesh(geometry, material );\n * scene.add( cone );\n * ```\n *\n * @augments CylinderGeometry\n * @demo scenes/geometry-browser.html#ConeGeometry\n */\nclass ConeGeometry extends CylinderGeometry {\n\n\t/**\n\t * Constructs a new cone geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the cone base.\n\t * @param {number} [height=1] - Height of the cone.\n\t * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cone.\n\t * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cone.\n\t * @param {boolean} [openEnded=false] - Whether the base of the cone is open or capped.\n\t * @param {number} [thetaStart=0] - Start angle for first segment, in radians.\n\t * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians.\n\t * The default value results in a complete cone.\n\t */\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {ConeGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\n/**\n * A polyhedron is a solid in three dimensions with flat faces. This class\n * will take an array of vertices, project them onto a sphere, and then\n * divide them up to the desired level of detail.\n *\n * @augments BufferGeometry\n */\nclass PolyhedronGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new polyhedron geometry.\n\t *\n\t * @param {Array<number>} [vertices] - A flat array of vertices describing the base shape.\n\t * @param {Array<number>} [indices] - A flat array of indices describing the base shape.\n\t * @param {number} [radius=1] - The radius of the shape.\n\t * @param {number} [detail=0] - How many levels to subdivide the geometry. The more detail, the smoother the shape.\n\t */\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {PolyhedronGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.detail );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing a dodecahedron.\n *\n * ```js\n * const geometry = new THREE.DodecahedronGeometry();\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const dodecahedron = new THREE.Mesh( geometry, material );\n * scene.add( dodecahedron );\n * ```\n *\n * @augments PolyhedronGeometry\n * @demo scenes/geometry-browser.html#DodecahedronGeometry\n */\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\t/**\n\t * Constructs a new dodecahedron geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the dodecahedron.\n\t * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a dodecahedron.\n\t */\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (\u00B11, \u00B11, \u00B11)\n\t\t\t-1, -1, -1,\t-1, -1, 1,\n\t\t\t-1, 1, -1, -1, 1, 1,\n\t\t\t1, -1, -1, 1, -1, 1,\n\t\t\t1, 1, -1, 1, 1, 1,\n\n\t\t\t// (0, \u00B11/\u03C6, \u00B1\u03C6)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (\u00B11/\u03C6, \u00B1\u03C6, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (\u00B1\u03C6, 0, \u00B11/\u03C6)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {DodecahedronGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\n/**\n * Can be used as a helper object to view the edges of a geometry.\n *\n * ```js\n * const geometry = new THREE.BoxGeometry();\n * const edges = new THREE.EdgesGeometry( geometry );\n * const line = new THREE.LineSegments( edges );\n * scene.add( line );\n * ```\n *\n * Note: It is not yet possible to serialize/deserialize instances of this class.\n *\n * @augments BufferGeometry\n */\nclass EdgesGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new edges geometry.\n\t *\n\t * @param {?BufferGeometry} [geometry=null] - The geometry.\n\t * @param {number} [thresholdAngle=1] - An edge is only rendered if the angle (in degrees)\n\t * between the face normals of the adjoining faces exceeds this value.\n\t */\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * An abstract base class for creating an analytic curve object that contains methods\n * for interpolation.\n *\n * @abstract\n */\nclass Curve {\n\n\t/**\n\t * Constructs a new curve.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * The type property is used for detecting the object type\n\t\t * in context of serialization/deserialization.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.type = 'Curve';\n\n\t\t/**\n\t\t * This value determines the amount of divisions when calculating the\n\t\t * cumulative segment lengths of a curve via {@link Curve#getLengths}. To ensure\n\t\t * precision when using methods like {@link Curve#getSpacedPoints}, it is\n\t\t * recommended to increase the value of this property if the curve is very large.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 200\n\t\t */\n\t\tthis.arcLengthDivisions = 200;\n\n\t\t/**\n\t\t * Must be set to `true` if the curve parameters have changed.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.needsUpdate = false;\n\n\t\t/**\n\t\t * An internal cache that holds precomputed curve length values.\n\t\t *\n\t\t * @private\n\t\t * @type {?Array<number>}\n\t\t * @default null\n\t\t */\n\t\tthis.cacheArcLengths = null;\n\n\t}\n\n\t/**\n\t * This method returns a vector in 2D or 3D space (depending on the curve definition)\n\t * for the given interpolation factor.\n\t *\n\t * @abstract\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.\n\t */\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\twarn( 'Curve: .getPoint() not implemented.' );\n\n\t}\n\n\t/**\n\t * This method returns a vector in 2D or 3D space (depending on the curve definition)\n\t * for the given interpolation factor. Unlike {@link Curve#getPoint}, this method honors the length\n\t * of the curve which equidistant samples.\n\t *\n\t * @param {number} u - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.\n\t */\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t/**\n\t * This method samples the curve via {@link Curve#getPoint} and returns an array of points representing\n\t * the curve shape.\n\t *\n\t * @param {number} [divisions=5] - The number of divisions.\n\t * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.\n\t */\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\t/**\n\t * This method samples the curve via {@link Curve#getPointAt} and returns an array of points representing\n\t * the curve shape. Unlike {@link Curve#getPoints}, this method returns equi-spaced points across the entire\n\t * curve.\n\t *\n\t * @param {number} [divisions=5] - The number of divisions.\n\t * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.\n\t */\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t/**\n\t * Returns the total arc length of the curve.\n\t *\n\t * @return {number} The length of the curve.\n\t */\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t/**\n\t * Returns an array of cumulative segment lengths of the curve.\n\t *\n\t * @param {number} [divisions=this.arcLengthDivisions] - The number of divisions.\n\t * @return {Array<number>} An array holding the cumulative segment lengths.\n\t */\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\t/**\n\t * Update the cumulative segment distance cache. The method must be called\n\t * every time curve parameters are changed. If an updated curve is part of a\n\t * composed curve like {@link CurvePath}, this method must be called on the\n\t * composed curve, too.\n\t */\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t/**\n\t * Given an interpolation factor in the range `[0,1]`, this method returns an updated\n\t * interpolation factor in the same range that can be ued to sample equidistant points\n\t * from a curve.\n\t *\n\t * @param {number} u - The interpolation factor.\n\t * @param {?number} distance - An optional distance on the curve.\n\t * @return {number} The updated interpolation factor.\n\t */\n\tgetUtoTmapping( u, distance = null ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t/**\n\t * Returns a unit vector tangent for the given interpolation factor.\n\t * If the derived curve does not implement its tangent derivation,\n\t * two points a small delta apart will be used to find its gradient\n\t * which seems to give a reasonable approximation.\n\t *\n\t * @param {number} t - The interpolation factor.\n\t * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {(Vector2|Vector3)} The tangent vector.\n\t */\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\t/**\n\t * Same as {@link Curve#getTangent} but with equidistant samples.\n\t *\n\t * @param {number} u - The interpolation factor.\n\t * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {(Vector2|Vector3)} The tangent vector.\n\t * @see {@link Curve#getPointAt}\n\t */\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\t/**\n\t * Generates the Frenet Frames. Requires a curve definition in 3D space. Used\n\t * in geometries like {@link TubeGeometry} or {@link ExtrudeGeometry}.\n\t *\n\t * @param {number} segments - The number of segments.\n\t * @param {boolean} [closed=false] - Whether the curve is closed or not.\n\t * @return {{tangents: Array<Vector3>, normals: Array<Vector3>, binormals: Array<Vector3>}} The Frenet Frames.\n\t */\n\tcomputeFrenetFrames( segments, closed = false ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), -1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), -1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\t/**\n\t * Returns a new curve with copied values from this instance.\n\t *\n\t * @return {Curve} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given curve to this instance.\n\t *\n\t * @param {Curve} source - The curve to copy.\n\t * @return {Curve} A reference to this curve.\n\t */\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Serializes the curve into JSON.\n\t *\n\t * @return {Object} A JSON object representing the serialized curve.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.7,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\t/**\n\t * Deserializes the curve from the given JSON.\n\t *\n\t * @param {Object} json - The JSON holding the serialized curve.\n\t * @return {Curve} A reference to this curve.\n\t */\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing an ellipse.\n *\n * ```js\n * const curve = new THREE.EllipseCurve(\n * \t0, 0,\n * \t10, 10,\n * \t0, 2 * Math.PI,\n * \tfalse,\n * \t0\n * );\n *\n * const points = curve.getPoints( 50 );\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );\n *\n * // Create the final object to add to the scene\n * const ellipse = new THREE.Line( geometry, material );\n * ```\n *\n * @augments Curve\n */\nclass EllipseCurve extends Curve {\n\n\t/**\n\t * Constructs a new ellipse curve.\n\t *\n\t * @param {number} [aX=0] - The X center of the ellipse.\n\t * @param {number} [aY=0] - The Y center of the ellipse.\n\t * @param {number} [xRadius=1] - The radius of the ellipse in the x direction.\n\t * @param {number} [yRadius=1] - The radius of the ellipse in the y direction.\n\t * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis.\n\t * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not.\n\t * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.\n\t */\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\t/**\n\t\t * The X center of the ellipse.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.aX = aX;\n\n\t\t/**\n\t\t * The Y center of the ellipse.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.aY = aY;\n\n\t\t/**\n\t\t * The radius of the ellipse in the x direction.\n\t\t * Setting the this value equal to the {@link EllipseCurve#yRadius} will result in a circle.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.xRadius = xRadius;\n\n\t\t/**\n\t\t * The radius of the ellipse in the y direction.\n\t\t * Setting the this value equal to the {@link EllipseCurve#xRadius} will result in a circle.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.yRadius = yRadius;\n\n\t\t/**\n\t\t * The start angle of the curve in radians starting from the positive X axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.aStartAngle = aStartAngle;\n\n\t\t/**\n\t\t * The end angle of the curve in radians starting from the positive X axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Math.PI*2\n\t\t */\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\t/**\n\t\t * Whether the ellipse is drawn clockwise or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.aClockwise = aClockwise;\n\n\t\t/**\n\t\t * The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector2} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector2} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing an arc.\n *\n * @augments EllipseCurve\n */\nclass ArcCurve extends EllipseCurve {\n\n\t/**\n\t * Constructs a new arc curve.\n\t *\n\t * @param {number} [aX=0] - The X center of the ellipse.\n\t * @param {number} [aY=0] - The Y center of the ellipse.\n\t * @param {number} [aRadius=1] - The radius of the ellipse in the x direction.\n\t * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis.\n\t * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not.\n\t */\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\nfunction CubicPoly() {\n\n\t/**\n\t * Centripetal CatmullRom Curve - which is useful for avoiding\n\t* cusps and self-intersections in non-uniform catmull rom curves.\n\t* http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n\t*\n\t* curve.type accepts centripetal(default), chordal and catmullrom\n\t* curve.tension is used for catmullrom which defaults to 0.5\n\t*/\n\n\t/*\n\tBased on an optimized c++ solution in\n\t- http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n\t- http://ideone.com/NoEbVM\n\n\tThis CubicPoly class could be used for reusing some variables and calculations,\n\tbut for three.js curve use, it could be possible inlined and flatten into a single function call\n\twhich can be placed in CurveUtils.\n\t*/\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst tmp2 = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\n/**\n * A curve representing a Catmull-Rom spline.\n *\n * ```js\n * //Create a closed wavey loop\n * const curve = new THREE.CatmullRomCurve3( [\n * \tnew THREE.Vector3( -10, 0, 10 ),\n * \tnew THREE.Vector3( -5, 5, 5 ),\n * \tnew THREE.Vector3( 0, 0, 0 ),\n * \tnew THREE.Vector3( 5, -5, 5 ),\n * \tnew THREE.Vector3( 10, 0, 10 )\n * ] );\n *\n * const points = curve.getPoints( 50 );\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );\n *\n * // Create the final object to add to the scene\n * const curveObject = new THREE.Line( geometry, material );\n * ```\n *\n * @augments Curve\n */\nclass CatmullRomCurve3 extends Curve {\n\n\t/**\n\t * Constructs a new Catmull-Rom curve.\n\t *\n\t * @param {Array<Vector3>} [points] - An array of 3D points defining the curve.\n\t * @param {boolean} [closed=false] - Whether the curve is closed or not.\n\t * @param {('centripetal'|'chordal'|'catmullrom')} [curveType='centripetal'] - The curve type.\n\t * @param {number} [tension=0.5] - Tension of the curve.\n\t */\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\t/**\n\t\t * An array of 3D points defining the curve.\n\t\t *\n\t\t * @type {Array<Vector3>}\n\t\t */\n\t\tthis.points = points;\n\n\t\t/**\n\t\t * Whether the curve is closed or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.closed = closed;\n\n\t\t/**\n\t\t * The curve type.\n\t\t *\n\t\t * @type {('centripetal'|'chordal'|'catmullrom')}\n\t\t * @default 'centripetal'\n\t\t */\n\t\tthis.curveType = curveType;\n\n\t\t/**\n\t\t * Tension of the curve.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.5\n\t\t */\n\t\tthis.tension = tension;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector3} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp2.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp2;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Interpolations contains spline and B\u00E9zier functions internally used by concrete curve classes.\n *\n * Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n *\n * @module Interpolations\n */\n\n/**\n * Computes a point on a Catmull-Rom spline.\n *\n * @param {number} t - The interpolation factor.\n * @param {number} p0 - The first control point.\n * @param {number} p1 - The second control point.\n * @param {number} p2 - The third control point.\n * @param {number} p3 - The fourth control point.\n * @return {number} The calculated point on a Catmull-Rom spline.\n */\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( -3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\n/**\n * Computes a point on a Quadratic Bezier curve.\n *\n * @param {number} t - The interpolation factor.\n * @param {number} p0 - The first control point.\n * @param {number} p1 - The second control point.\n * @param {number} p2 - The third control point.\n * @return {number} The calculated point on a Quadratic Bezier curve.\n */\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\n/**\n * Computes a point on a Cubic Bezier curve.\n *\n * @param {number} t - The interpolation factor.\n * @param {number} p0 - The first control point.\n * @param {number} p1 - The second control point.\n * @param {number} p2 - The third control point.\n * @param {number} p3 - The fourth control point.\n * @return {number} The calculated point on a Cubic Bezier curve.\n */\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\n/**\n * A curve representing a 2D Cubic Bezier curve.\n *\n * ```js\n * const curve = new THREE.CubicBezierCurve(\n * \tnew THREE.Vector2( - 0, 0 ),\n * \tnew THREE.Vector2( - 5, 15 ),\n * \tnew THREE.Vector2( 20, 15 ),\n * \tnew THREE.Vector2( 10, 0 )\n * );\n *\n * const points = curve.getPoints( 50 );\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );\n *\n * // Create the final object to add to the scene\n * const curveObject = new THREE.Line( geometry, material );\n * ```\n *\n * @augments Curve\n */\nclass CubicBezierCurve extends Curve {\n\n\t/**\n\t * Constructs a new Cubic Bezier curve.\n\t *\n\t * @param {Vector2} [v0] - The start point.\n\t * @param {Vector2} [v1] - The first control point.\n\t * @param {Vector2} [v2] - The second control point.\n\t * @param {Vector2} [v3] - The end point.\n\t */\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v0 = v0;\n\n\t\t/**\n\t\t * The first control point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The second control point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v3 = v3;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector2} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector2} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 3D Cubic Bezier curve.\n *\n * @augments Curve\n */\nclass CubicBezierCurve3 extends Curve {\n\n\t/**\n\t * Constructs a new Cubic Bezier curve.\n\t *\n\t * @param {Vector3} [v0] - The start point.\n\t * @param {Vector3} [v1] - The first control point.\n\t * @param {Vector3} [v2] - The second control point.\n\t * @param {Vector3} [v3] - The end point.\n\t */\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v0 = v0;\n\n\t\t/**\n\t\t * The first control point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The second control point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v3 = v3;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector3} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 2D line segment.\n *\n * @augments Curve\n */\nclass LineCurve extends Curve {\n\n\t/**\n\t * Constructs a new line curve.\n\t *\n\t * @param {Vector2} [v1] - The start point.\n\t * @param {Vector2} [v2] - The end point.\n\t */\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t}\n\n\t/**\n\t * Returns a point on the line.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`.\n\t * @param {Vector2} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector2} The position on the line.\n\t */\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 3D line segment.\n *\n * @augments Curve\n */\nclass LineCurve3 extends Curve {\n\n\t/**\n\t * Constructs a new line curve.\n\t *\n\t * @param {Vector3} [v1] - The start point.\n\t * @param {Vector3} [v2] - The end point.\n\t */\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t}\n\n\t/**\n\t * Returns a point on the line.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`.\n\t * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector3} The position on the line.\n\t */\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 2D Quadratic Bezier curve.\n *\n * ```js\n * const curve = new THREE.QuadraticBezierCurve(\n * \tnew THREE.Vector2( - 10, 0 ),\n * \tnew THREE.Vector2( 20, 15 ),\n * \tnew THREE.Vector2( 10, 0 )\n * )\n *\n * const points = curve.getPoints( 50 );\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );\n *\n * // Create the final object to add to the scene\n * const curveObject = new THREE.Line( geometry, material );\n * ```\n *\n * @augments Curve\n */\nclass QuadraticBezierCurve extends Curve {\n\n\t/**\n\t * Constructs a new Quadratic Bezier curve.\n\t *\n\t * @param {Vector2} [v0] - The start point.\n\t * @param {Vector2} [v1] - The control point.\n\t * @param {Vector2} [v2] - The end point.\n\t */\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v0 = v0;\n\n\t\t/**\n\t\t * The control point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector2} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector2} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 3D Quadratic Bezier curve.\n *\n * @augments Curve\n */\nclass QuadraticBezierCurve3 extends Curve {\n\n\t/**\n\t * Constructs a new Quadratic Bezier curve.\n\t *\n\t * @param {Vector3} [v0] - The start point.\n\t * @param {Vector3} [v1] - The control point.\n\t * @param {Vector3} [v2] - The end point.\n\t */\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\t/**\n\t\t * The start point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v0 = v0;\n\n\t\t/**\n\t\t * The control point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v1 = v1;\n\n\t\t/**\n\t\t * The end point.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.v2 = v2;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector3} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A curve representing a 2D spline curve.\n *\n * ```js\n * // Create a sine-like wave\n * const curve = new THREE.SplineCurve( [\n * \tnew THREE.Vector2( -10, 0 ),\n * \tnew THREE.Vector2( -5, 5 ),\n * \tnew THREE.Vector2( 0, 0 ),\n * \tnew THREE.Vector2( 5, -5 ),\n * \tnew THREE.Vector2( 10, 0 )\n * ] );\n *\n * const points = curve.getPoints( 50 );\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n *\n * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );\n *\n * // Create the final object to add to the scene\n * const splineObject = new THREE.Line( geometry, material );\n * ```\n *\n * @augments Curve\n */\nclass SplineCurve extends Curve {\n\n\t/**\n\t * Constructs a new 2D spline curve.\n\t *\n\t * @param {Array<Vector2>} [points] - An array of 2D points defining the curve.\n\t */\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\t/**\n\t\t * An array of 2D points defining the curve.\n\t\t *\n\t\t * @type {Array<Vector2>}\n\t\t */\n\t\tthis.points = points;\n\n\t}\n\n\t/**\n\t * Returns a point on the curve.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {Vector2} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {Vector2} The position on the curve.\n\t */\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**\n * A base class extending {@link Curve}. `CurvePath` is simply an\n * array of connected curves, but retains the API of a curve.\n *\n * @augments Curve\n */\nclass CurvePath extends Curve {\n\n\t/**\n\t * Constructs a new curve path.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\t/**\n\t\t * An array of curves defining the\n\t\t * path.\n\t\t *\n\t\t * @type {Array<Curve>}\n\t\t */\n\t\tthis.curves = [];\n\n\t\t/**\n\t\t * Whether the path should automatically be closed\n\t\t * by a line curve.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.autoClose = false;\n\n\t}\n\n\t/**\n\t * Adds a curve to this curve path.\n\t *\n\t * @param {Curve} curve - The curve to add.\n\t */\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\t/**\n\t * Adds a line curve to close the path.\n\t *\n\t * @return {CurvePath} A reference to this curve path.\n\t */\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * This method returns a vector in 2D or 3D space (depending on the curve definitions)\n\t * for the given interpolation factor.\n\t *\n\t * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.\n\t * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.\n\t * @return {?(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.\n\t */\n\tgetPoint( t, optionalTarget ) {\n\n\t\t// To get accurate point with reference to\n\t\t// entire path distance at time t,\n\t\t// following has to be done:\n\n\t\t// 1. Length of each sub path have to be known\n\t\t// 2. Locate and identify type of curve\n\t\t// 3. Get t for the curve\n\t\t// 4. Return curve.getPointAt(t')\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 <d\n\n\t}\n\n\tgetLength() {\n\n\t\t// We cannot use the default THREE.Curve getPoint() with getLength() because in\n\t\t// THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath\n\t\t// getPoint() depends on getLength\n\n\t\tconst lens = this.getCurveLengths();\n\t\treturn lens[ lens.length - 1 ];\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\t// cacheLengths must be recalculated.\n\n\t\tthis.needsUpdate = true;\n\t\tthis.cacheLengths = null;\n\t\tthis.getCurveLengths();\n\n\t}\n\n\t/**\n\t * Returns list of cumulative curve lengths of the defined curves.\n\t *\n\t * @return {Array<number>} The curve lengths.\n\t */\n\tgetCurveLengths() {\n\n\t\t// Compute lengths and cache them\n\t\t// We cannot overwrite getLengths() because UtoT mapping uses it.\n\t\t// We use cache values if curves and cache array are same length\n\n\t\tif ( this.cacheLengths && this.cacheLengths.length === this.curves.length ) {\n\n\t\t\treturn this.cacheLengths;\n\n\t\t}\n\n\t\t// Get length of sub-curve\n\t\t// Push sums into cached array\n\n\t\tconst lengths = [];\n\t\tlet sums = 0;\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tsums += this.curves[ i ].getLength();\n\t\t\tlengths.push( sums );\n\n\t\t}\n\n\t\tthis.cacheLengths = lengths;\n\n\t\treturn lengths;\n\n\t}\n\n\tgetSpacedPoints( divisions = 40 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let i = 0; i <= divisions; i ++ ) {\n\n\t\t\tpoints.push( this.getPoint( i / divisions ) );\n\n\t\t}\n\n\t\tif ( this.autoClose ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tgetPoints( divisions = 12 ) {\n\n\t\tconst points = [];\n\t\tlet last;\n\n\t\tfor ( let i = 0, curves = this.curves; i < curves.length; i ++ ) {\n\n\t\t\tconst curve = curves[ i ];\n\t\t\tconst resolution = curve.isEllipseCurve ? divisions * 2\n\t\t\t\t: ( curve.isLineCurve || curve.isLineCurve3 ) ? 1\n\t\t\t\t\t: curve.isSplineCurve ? divisions * curve.points.length\n\t\t\t\t\t\t: divisions;\n\n\t\t\tconst pts = curve.getPoints( resolution );\n\n\t\t\tfor ( let j = 0; j < pts.length; j ++ ) {\n\n\t\t\t\tconst point = pts[ j ];\n\n\t\t\t\tif ( last && last.equals( point ) ) continue; // ensures no consecutive points are duplicates\n\n\t\t\t\tpoints.push( point );\n\t\t\t\tlast = point;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.autoClose && points.length > 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A 2D path representation. The class provides methods for creating paths\n * and contours of 2D shapes similar to the 2D Canvas API.\n *\n * ```js\n * const path = new THREE.Path();\n *\n * path.lineTo( 0, 0.8 );\n * path.quadraticCurveTo( 0, 1, 0.2, 1 );\n * path.lineTo( 1, 1 );\n *\n * const points = path.getPoints();\n *\n * const geometry = new THREE.BufferGeometry().setFromPoints( points );\n * const material = new THREE.LineBasicMaterial( { color: 0xffffff } );\n *\n * const line = new THREE.Line( geometry, material );\n * scene.add( line );\n * ```\n *\n * @augments CurvePath\n */\nclass Path extends CurvePath {\n\n\t/**\n\t * Constructs a new path.\n\t *\n\t * @param {Array<Vector2>} [points] - An array of 2D points defining the path.\n\t */\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\t/**\n\t\t * The current offset of the path. Any new curve added will start here.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Creates a path from the given list of points. The points are added\n\t * to the path as instances of {@link LineCurve}.\n\t *\n\t * @param {Array<Vector2>} points - An array of 2D points.\n\t * @return {Path} A reference to this path.\n\t */\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Moves {@link Path#currentPoint} to the given point.\n\t *\n\t * @param {number} x - The x coordinate.\n\t * @param {number} y - The y coordinate.\n\t * @return {Path} A reference to this path.\n\t */\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link LineCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} x - The x coordinate of the end point.\n\t * @param {number} y - The y coordinate of the end point.\n\t * @return {Path} A reference to this path.\n\t */\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} aCPx - The x coordinate of the control point.\n\t * @param {number} aCPy - The y coordinate of the control point.\n\t * @param {number} aX - The x coordinate of the end point.\n\t * @param {number} aY - The y coordinate of the end point.\n\t * @return {Path} A reference to this path.\n\t */\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link CubicBezierCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} aCP1x - The x coordinate of the first control point.\n\t * @param {number} aCP1y - The y coordinate of the first control point.\n\t * @param {number} aCP2x - The x coordinate of the second control point.\n\t * @param {number} aCP2y - The y coordinate of the second control point.\n\t * @param {number} aX - The x coordinate of the end point.\n\t * @param {number} aY - The y coordinate of the end point.\n\t * @return {Path} A reference to this path.\n\t */\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link SplineCurve} to the path by connecting\n\t * the current point with the given list of points.\n\t *\n\t * @param {Array<Vector2>} pts - An array of points in 2D space.\n\t * @return {Path} A reference to this path.\n\t */\n\tsplineThru( pts ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an arc as an instance of {@link EllipseCurve} to the path, positioned relative\n\t * to the current point.\n\t *\n\t * @param {number} [aX=0] - The x coordinate of the center of the arc offsetted from the previous curve.\n\t * @param {number} [aY=0] - The y coordinate of the center of the arc offsetted from the previous curve.\n\t * @param {number} [aRadius=1] - The radius of the arc.\n\t * @param {number} [aStartAngle=0] - The start angle in radians.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.\n\t * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.\n\t * @return {Path} A reference to this path.\n\t */\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an absolutely positioned arc as an instance of {@link EllipseCurve} to the path.\n\t *\n\t * @param {number} [aX=0] - The x coordinate of the center of the arc.\n\t * @param {number} [aY=0] - The y coordinate of the center of the arc.\n\t * @param {number} [aRadius=1] - The radius of the arc.\n\t * @param {number} [aStartAngle=0] - The start angle in radians.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.\n\t * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.\n\t * @return {Path} A reference to this path.\n\t */\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an ellipse as an instance of {@link EllipseCurve} to the path, positioned relative\n\t * to the current point\n\t *\n\t * @param {number} [aX=0] - The x coordinate of the center of the ellipse offsetted from the previous curve.\n\t * @param {number} [aY=0] - The y coordinate of the center of the ellipse offsetted from the previous curve.\n\t * @param {number} [xRadius=1] - The radius of the ellipse in the x axis.\n\t * @param {number} [yRadius=1] - The radius of the ellipse in the y axis.\n\t * @param {number} [aStartAngle=0] - The start angle in radians.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.\n\t * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.\n\t * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.\n\t * @return {Path} A reference to this path.\n\t */\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an absolutely positioned ellipse as an instance of {@link EllipseCurve} to the path.\n\t *\n\t * @param {number} [aX=0] - The x coordinate of the absolute center of the ellipse.\n\t * @param {number} [aY=0] - The y coordinate of the absolute center of the ellipse.\n\t * @param {number} [xRadius=1] - The radius of the ellipse in the x axis.\n\t * @param {number} [yRadius=1] - The radius of the ellipse in the y axis.\n\t * @param {number} [aStartAngle=0] - The start angle in radians.\n\t * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.\n\t * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.\n\t * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.\n\t * @return {Path} A reference to this path.\n\t */\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Defines an arbitrary 2d shape plane using paths with optional holes. It\n * can be used with {@link ExtrudeGeometry}, {@link ShapeGeometry}, to get\n * points, or to get triangulated faces.\n *\n * ```js\n * const heartShape = new THREE.Shape();\n *\n * heartShape.moveTo( 25, 25 );\n * heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 );\n * heartShape.bezierCurveTo( - 30, 0, - 30, 35, - 30, 35 );\n * heartShape.bezierCurveTo( - 30, 55, - 10, 77, 25, 95 );\n * heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 );\n * heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 );\n * heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 );\n *\n * const extrudeSettings = {\n * \tdepth: 8,\n * \tbevelEnabled: true,\n * \tbevelSegments: 2,\n * \tsteps: 2,\n * \tbevelSize: 1,\n * \tbevelThickness: 1\n * };\n *\n * const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings );\n * const mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() );\n * ```\n *\n * @augments Path\n */\nclass Shape extends Path {\n\n\t/**\n\t * Constructs a new shape.\n\t *\n\t * @param {Array<Vector2>} [points] - An array of 2D points defining the shape.\n\t */\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\t/**\n\t\t * The UUID of the shape.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\t/**\n\t\t * Defines the holes in the shape. Hole definitions must use the\n\t\t * opposite winding order (CW/CCW) than the outer shape.\n\t\t *\n\t\t * @type {Array<Path>}\n\t\t * @readonly\n\t\t */\n\t\tthis.holes = [];\n\n\t}\n\n\t/**\n\t * Returns an array representing each contour of the holes\n\t * as a list of 2D points.\n\t *\n\t * @param {number} divisions - The fineness of the result.\n\t * @return {Array<Array<Vector2>>} The holes as a series of 2D points.\n\t */\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\t/**\n\t * Returns an object that holds contour data for the shape and its holes as\n\t * arrays of 2D points.\n\t *\n\t * @param {number} divisions - The fineness of the result.\n\t * @return {{shape:Array<Vector2>,holes:Array<Array<Vector2>>}} An object with contour data.\n\t */\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* eslint-disable */\n// copy of mapbox/earcut version 3.0.2\n// https://github.com/mapbox/earcut/tree/v3.0.2\n\nfunction earcut(data, holeIndices, dim = 2) {\n\n const hasHoles = holeIndices && holeIndices.length;\n const outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n let outerNode = linkedList(data, 0, outerLen, dim, true);\n const triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n let minX, minY, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = data[0];\n minY = data[1];\n let maxX = minX;\n let maxY = minY;\n\n for (let i = dim; i < outerLen; i += dim) {\n const x = data[i];\n const y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n let last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);\n } else {\n for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n let p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n let stop = ear;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n const prev = ear.prev;\n const next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n triangles.push(prev.i, ear.i, next.i); // cut off the triangle\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n const a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox\n const x0 = Math.min(ax, bx, cx),\n y0 = Math.min(ay, by, cy),\n x1 = Math.max(ax, bx, cx),\n y1 = Math.max(ay, by, cy);\n\n let p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n const a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox\n const x0 = Math.min(ax, bx, cx),\n y0 = Math.min(ay, by, cy),\n x1 = Math.max(ax, bx, cx),\n y1 = Math.max(ay, by, cy);\n\n // z-order range for the current triangle bbox;\n const minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n let p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles) {\n let p = start;\n do {\n const a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i, p.i, b.i);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n let a = start;\n do {\n let b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n let c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n const queue = [];\n\n for (let i = 0, len = holeIndices.length; i < len; i++) {\n const start = holeIndices[i] * dim;\n const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n const list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareXYSlope);\n\n // process holes from left to right\n for (let i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareXYSlope(a, b) {\n let result = a.x - b.x;\n // when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find\n // the bridge to the outer shell is always the point that they meet at.\n if (result === 0) {\n result = a.y - b.y;\n if (result === 0) {\n const aSlope = (a.next.y - a.y) / (a.next.x - a.x);\n const bSlope = (b.next.y - b.y) / (b.next.x - b.x);\n result = aSlope - bSlope;\n }\n }\n return result;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole(hole, outerNode) {\n const bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n const bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n let p = outerNode;\n const hx = hole.x;\n const hy = hole.y;\n let qx = -Infinity;\n let m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n // unless they intersect at a vertex, then choose the vertex\n if (equals(hole, p)) return p;\n do {\n if (equals(hole, p.next)) return p.next;\n else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n const stop = m;\n const mx = m.x;\n const my = m.y;\n let tanMin = Infinity;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n const tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n let p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n let numMerges;\n let inSize = 1;\n\n do {\n let p = list;\n let e;\n list = null;\n let tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n let q = p;\n let pSize = 0;\n for (let i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n let qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n let p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a point lies within a convex triangle but false if its equal to the first point of the triangle\nfunction pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {\n return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n const o1 = sign(area(p1, q1, p2));\n const o2 = sign(area(p1, q1, q2));\n const o3 = sign(area(p2, q2, p1));\n const o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n let p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n let p = a;\n let inside = false;\n const px = (a.x + b.x) / 2;\n const py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n const a2 = createNode(a.i, a.x, a.y),\n b2 = createNode(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n const p = createNode(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction createNode(i, x, y) {\n return {\n i, // vertex index in coordinates array\n x, y, // vertex coordinates\n prev: null, // previous and next vertex nodes in a polygon ring\n next: null,\n z: 0, // z-order curve value\n prevZ: null, // previous and next nodes in z-order\n nextZ: null,\n steiner: false // indicates whether this is a steiner point\n };\n}\n\nfunction signedArea(data, start, end, dim) {\n let sum = 0;\n for (let i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n/**\n * An implementation of the earcut polygon triangulation algorithm.\n * The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut).\n *\n * @see https://github.com/mapbox/earcut\n */\nclass Earcut {\n\n\t/**\n\t * Triangulates the given shape definition by returning an array of triangles.\n\t *\n\t * @param {Array<number>} data - An array with 2D points.\n\t * @param {Array<number>} holeIndices - An array with indices defining holes.\n\t * @param {number} [dim=2] - The number of coordinates per vertex in the input array.\n\t * @return {Array<number>} An array representing the triangulated faces. Each face is defined by three consecutive numbers\n\t * representing vertex indices.\n\t */\n\tstatic triangulate( data, holeIndices, dim = 2 ) {\n\n\t\treturn earcut( data, holeIndices, dim );\n\n\t}\n\n}\n\n/**\n * A class containing utility functions for shapes.\n *\n * @hideconstructor\n */\nclass ShapeUtils {\n\n\t/**\n\t * Calculate area of a ( 2D ) contour polygon.\n\t *\n\t * @param {Array<Vector2>} contour - An array of 2D points.\n\t * @return {number} The area.\n\t */\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given contour uses a clockwise winding order.\n\t *\n\t * @param {Array<Vector2>} pts - An array of 2D points defining a polygon.\n\t * @return {boolean} Whether the given contour uses a clockwise winding order or not.\n\t */\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\t/**\n\t * Triangulates the given shape definition.\n\t *\n\t * @param {Array<Vector2>} contour - An array of 2D points defining the contour.\n\t * @param {Array<Array<Vector2>>} holes - An array that holds arrays of 2D points defining the holes.\n\t * @return {Array<Array<number>>} An array that holds for each face definition an array with three indices.\n\t */\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * ```js\n * const length = 12, width = 8;\n *\n * const shape = new THREE.Shape();\n * shape.moveTo( 0,0 );\n * shape.lineTo( 0, width );\n * shape.lineTo( length, width );\n * shape.lineTo( length, 0 );\n * shape.lineTo( 0, 0 );\n *\n * const geometry = new THREE.ExtrudeGeometry( shape );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n * const mesh = new THREE.Mesh( geometry, material ) ;\n * scene.add( mesh );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#ExtrudeGeometry\n */\nclass ExtrudeGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new extrude geometry.\n\t *\n\t * @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.\n\t * @param {ExtrudeGeometry~Options} [options] - The extrude settings.\n\t */\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( -0.5, 0.5 ), new Vector2( -0.5, -0.5 ), new Vector2( 0.5, -0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\tconst isClosed = extrudePath.isCatmullRomCurve3 ? extrudePath.closed : false;\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, isClosed );\n\n\t\t\t\t// log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/**Merges index-adjacent points that are within a threshold distance of each other. Array is modified in-place. Threshold distance is empirical, and scaled based on the magnitude of point coordinates.\n\t\t\t * @param {Array<Vector2>} points\n\t\t\t*/\n\t\t\tfunction mergeOverlappingPoints( points ) {\n\n\t\t\t\tconst THRESHOLD = 1e-10;\n\t\t\t\tconst THRESHOLD_SQ = THRESHOLD * THRESHOLD;\n\t\t\t\tlet prevPos = points[ 0 ];\n\t\t\t\tfor ( let i = 1; i <= points.length; i ++ ) {\n\n\t\t\t\t\tconst currentIndex = i % points.length;\n\t\t\t\t\tconst currentPos = points[ currentIndex ];\n\t\t\t\t\tconst dx = currentPos.x - prevPos.x;\n\t\t\t\t\tconst dy = currentPos.y - prevPos.y;\n\t\t\t\t\tconst distSq = dx * dx + dy * dy;\n\n\t\t\t\t\tconst scalingFactorSqrt = Math.max(\n\t\t\t\t\t\tMath.abs( currentPos.x ),\n\t\t\t\t\t\tMath.abs( currentPos.y ),\n\t\t\t\t\t\tMath.abs( prevPos.x ),\n\t\t\t\t\t\tMath.abs( prevPos.y )\n\t\t\t\t\t);\n\t\t\t\t\tconst thresholdSqScaled = THRESHOLD_SQ * scalingFactorSqrt * scalingFactorSqrt;\n\t\t\t\t\tif ( distSq <= thresholdSqScaled ) {\n\n\t\t\t\t\t\tpoints.splice( currentIndex, 1 );\n\t\t\t\t\t\ti --;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tprevPos = currentPos;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tmergeOverlappingPoints( vertices );\n\t\t\tholes.forEach( mergeOverlappingPoints );\n\n\t\t\tconst numHoles = holes.length;\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0; h < numHoles; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) error( 'ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = numHoles; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\t\t\tlet faces;\n\n\t\t\tif ( bevelSegments === 0 ) {\n\n\t\t\t\tfaces = ShapeUtils.triangulateShape( contour, holes );\n\n\t\t\t} else {\n\n\t\t\t\tconst contractedContourVertices = [];\n\t\t\t\tconst expandedHoleVertices = [];\n\n\t\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t\t// contract shape\n\n\t\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\t\t\t\t\t\tif ( t === 0 ) contractedContourVertices.push( vert );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// expand holes\n\n\t\t\t\t\tfor ( let h = 0, hl = numHoles; h < hl; h ++ ) {\n\n\t\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\t\t\t\t\t\tconst oneHoleVertices = [];\n\t\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\t\t\t\t\t\t\tif ( t === 0 ) oneHoleVertices.push( vert );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( t === 0 ) expandedHoleVertices.push( oneHoleVertices );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tfaces = ShapeUtils.triangulateShape( contractedContourVertices, expandedHoleVertices );\n\n\t\t\t}\n\n\t\t\tconst flen = faces.length;\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @param {Array<Shape>} shapes - An array of shapes.\n\t * @return {ExtrudeGeometry} A new instance.\n\t */\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\n/**\n * A geometry class for representing an icosahedron.\n *\n * ```js\n * const geometry = new THREE.IcosahedronGeometry();\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const icosahedron = new THREE.Mesh( geometry, material );\n * scene.add( icosahedron );\n * ```\n *\n * @augments PolyhedronGeometry\n * @demo scenes/geometry-browser.html#IcosahedronGeometry\n */\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\t/**\n\t * Constructs a new icosahedron geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the icosahedron.\n\t * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a icosahedron.\n\t */\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t-1, t, 0, \t1, t, 0, \t-1, - t, 0, \t1, - t, 0,\n\t\t\t0, -1, t, \t0, 1, t,\t0, -1, - t, \t0, 1, - t,\n\t\t\tt, 0, -1, \tt, 0, 1, \t- t, 0, -1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {IcosahedronGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\n/**\n * Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis.\n *\n * ```js\n * const points = [];\n * for ( let i = 0; i < 10; i ++ ) {\n * \tpoints.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) );\n * }\n * const geometry = new THREE.LatheGeometry( points );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const lathe = new THREE.Mesh( geometry, material );\n * scene.add( lathe );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#LatheGeometry\n */\nclass LatheGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new lathe geometry.\n\t *\n\t * @param {Array<Vector2|Vector3>} [points] - An array of points in 2D space. The x-coordinate of each point\n\t * must be greater than zero.\n\t * @param {number} [segments=12] - The number of circumference segments to generate.\n\t * @param {number} [phiStart=0] - The starting angle in radians.\n\t * @param {number} [phiLength=Math.PI*2] - The radian (0 to 2PI) range of the lathed section 2PI is a\n\t * closed lathe, less than 2PI is a portion.\n\t */\n\tconstructor( points = [ new Vector2( 0, -0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {LatheGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing an octahedron.\n *\n * ```js\n * const geometry = new THREE.OctahedronGeometry();\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const octahedron = new THREE.Mesh( geometry, material );\n * scene.add( octahedron );\n * ```\n *\n * @augments PolyhedronGeometry\n * @demo scenes/geometry-browser.html#OctahedronGeometry\n */\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\t/**\n\t * Constructs a new octahedron geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the octahedron.\n\t * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a octahedron.\n\t */\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t-1, 0, 0,\t0, 1, 0,\n\t\t\t0, -1, 0, \t0, 0, 1,\t0, 0, -1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {OctahedronGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing a plane.\n *\n * ```js\n * const geometry = new THREE.PlaneGeometry( 1, 1 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } );\n * const plane = new THREE.Mesh( geometry, material );\n * scene.add( plane );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#PlaneGeometry\n */\nclass PlaneGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new plane geometry.\n\t *\n\t * @param {number} [width=1] - The width along the X axis.\n\t * @param {number} [height=1] - The height along the Y axis\n\t * @param {number} [widthSegments=1] - The number of segments along the X axis.\n\t * @param {number} [heightSegments=1] - The number of segments along the Y axis.\n\t */\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {PlaneGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\n/**\n * A class for generating a two-dimensional ring geometry.\n *\n * ```js\n * const geometry = new THREE.RingGeometry( 1, 5, 32 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } );\n * const mesh = new THREE.Mesh( geometry, material );\n * scene.add( mesh );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#RingGeometry\n */\nclass RingGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new ring geometry.\n\t *\n\t * @param {number} [innerRadius=0.5] - The inner radius of the ring.\n\t * @param {number} [outerRadius=1] - The outer radius of the ring.\n\t * @param {number} [thetaSegments=32] - Number of segments. A higher number means the ring will be more round. Minimum is `3`.\n\t * @param {number} [phiSegments=1] - Number of segments per ring segment. Minimum is `1`.\n\t * @param {number} [thetaStart=0] - Starting angle in radians.\n\t * @param {number} [thetaLength=Math.PI*2] - Central angle in radians.\n\t */\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {RingGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\n/**\n * Creates an one-sided polygonal geometry from one or more path shapes.\n *\n * ```js\n * const arcShape = new THREE.Shape()\n *\t.moveTo( 5, 1 )\n *\t.absarc( 1, 1, 4, 0, Math.PI * 2, false );\n *\n * const geometry = new THREE.ShapeGeometry( arcShape );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide } );\n * const mesh = new THREE.Mesh( geometry, material ) ;\n * scene.add( mesh );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#ShapeGeometry\n */\nclass ShapeGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new shape geometry.\n\t *\n\t * @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.\n\t * @param {number} [curveSegments=12] - Number of segments per shape.\n\t */\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( -0.5, -0.5 ), new Vector2( 0.5, -0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @param {Array<Shape>} shapes - An array of shapes.\n\t * @return {ShapeGeometry} A new instance.\n\t */\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\n/**\n * A class for generating a sphere geometry.\n *\n * ```js\n * const geometry = new THREE.SphereGeometry( 15, 32, 16 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const sphere = new THREE.Mesh( geometry, material );\n * scene.add( sphere );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#SphereGeometry\n */\nclass SphereGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new sphere geometry.\n\t *\n\t * @param {number} [radius=1] - The sphere radius.\n\t * @param {number} [widthSegments=32] - The number of horizontal segments. Minimum value is `3`.\n\t * @param {number} [heightSegments=16] - The number of vertical segments. Minimum value is `2`.\n\t * @param {number} [phiStart=0] - The horizontal starting angle in radians.\n\t * @param {number} [phiLength=Math.PI*2] - The horizontal sweep angle size.\n\t * @param {number} [thetaStart=0] - The vertical starting angle in radians.\n\t * @param {number} [thetaLength=Math.PI] - The vertical sweep angle size.\n\t */\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = -0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {SphereGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing an tetrahedron.\n *\n * ```js\n * const geometry = new THREE.TetrahedronGeometry();\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const tetrahedron = new THREE.Mesh( geometry, material );\n * scene.add( tetrahedron );\n * ```\n *\n * @augments PolyhedronGeometry\n * @demo scenes/geometry-browser.html#TetrahedronGeometry\n */\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\t/**\n\t * Constructs a new tetrahedron geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the tetrahedron.\n\t * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a tetrahedron.\n\t */\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t-1, -1, 1, \t-1, 1, -1, \t1, -1, -1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {TetrahedronGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\n/**\n * A geometry class for representing an torus.\n *\n * ```js\n * const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const torus = new THREE.Mesh( geometry, material );\n * scene.add( torus );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#TorusGeometry\n */\nclass TorusGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new torus geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the torus, from the center of the torus to the center of the tube.\n\t * @param {number} [tube=0.4] - Radius of the tube. Must be smaller than `radius`.\n\t * @param {number} [radialSegments=12] - The number of radial segments.\n\t * @param {number} [tubularSegments=48] - The number of tubular segments.\n\t * @param {number} [arc=Math.PI*2] - Central angle in radians.\n\t * @param {number} [thetaStart=0] - Start of the tubular sweep in radians.\n\t * @param {number} [thetaLength=Math.PI*2] - Length of the tubular sweep in radians.\n\t */\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength,\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tconst v = thetaStart + ( j / radialSegments ) * thetaLength;\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {TorusGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\n/**\n * Creates a torus knot, the particular shape of which is defined by a pair\n * of coprime integers, p and q. If p and q are not coprime, the result will\n * be a torus link.\n *\n * ```js\n * const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 );\n * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );\n * const torusKnot = new THREE.Mesh( geometry, material );\n * scene.add( torusKnot );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#TorusKnotGeometry\n */\nclass TorusKnotGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new torus knot geometry.\n\t *\n\t * @param {number} [radius=1] - Radius of the torus knot.\n\t * @param {number} [tube=0.4] - Radius of the tube.\n\t * @param {number} [tubularSegments=64] - The number of tubular segments.\n\t * @param {number} [radialSegments=8] - The number of radial segments.\n\t * @param {number} [p=2] - This value determines, how many times the geometry winds around its axis of rotational symmetry.\n\t * @param {number} [q=3] - This value determines, how many times the geometry winds around a circle in the interior of the torus.\n\t */\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {TorusKnotGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\n/**\n * Creates a tube that extrudes along a 3D curve.\n *\n * ```js\n * class CustomSinCurve extends THREE.Curve {\n *\n * \tgetPoint( t, optionalTarget = new THREE.Vector3() ) {\n *\n * \t\tconst tx = t * 3 - 1.5;\n * \t\tconst ty = Math.sin( 2 * Math.PI * t );\n * \t\tconst tz = 0;\n *\n * \t\treturn optionalTarget.set( tx, ty, tz );\n * \t}\n *\n * }\n *\n * const path = new CustomSinCurve( 10 );\n * const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false );\n * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n * const mesh = new THREE.Mesh( geometry, material );\n * scene.add( mesh );\n * ```\n *\n * @augments BufferGeometry\n * @demo scenes/geometry-browser.html#TubeGeometry\n */\nclass TubeGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new tube geometry.\n\t *\n\t * @param {Curve} [path=QuadraticBezierCurve3] - A 3D curve defining the path of the tube.\n\t * @param {number} [tubularSegments=64] - The number of segments that make up the tube.\n\t * @param {number} [radius=1] -The radius of the tube.\n\t * @param {number} [radialSegments=8] - The number of segments that make up the cross-section.\n\t * @param {boolean} [closed=false] - Whether the tube is closed or not.\n\t */\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( -1, -1, 0 ), new Vector3( -1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\t/**\n\t * Factory method for creating an instance of this class from the given\n\t * JSON object.\n\t *\n\t * @param {Object} data - A JSON object representing the serialized geometry.\n\t * @return {TubeGeometry} A new instance.\n\t */\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\n/**\n * Can be used as a helper object to visualize a geometry as a wireframe.\n *\n * ```js\n * const geometry = new THREE.SphereGeometry();\n *\n * const wireframe = new THREE.WireframeGeometry( geometry );\n *\n * const line = new THREE.LineSegments( wireframe );\n * line.material.depthWrite = false;\n * line.material.opacity = 0.25;\n * line.material.transparent = true;\n *\n * scene.add( line );\n * ```\n *\n * Note: It is not yet possible to serialize/deserialize instances of this class.\n *\n * @augments BufferGeometry\n */\nclass WireframeGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new wireframe geometry.\n\t *\n\t * @param {?BufferGeometry} [geometry=null] - The geometry.\n\t */\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\t/**\n\t\t * Holds the constructor parameters that have been\n\t\t * used to generate the geometry. Any modification\n\t\t * after instantiation does not change the geometry.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\n/**\n * This material can receive shadows, but otherwise is completely transparent.\n *\n * ```js\n * const geometry = new THREE.PlaneGeometry( 2000, 2000 );\n * geometry.rotateX( - Math.PI / 2 );\n *\n * const material = new THREE.ShadowMaterial();\n * material.opacity = 0.2;\n *\n * const plane = new THREE.Mesh( geometry, material );\n * plane.position.y = -200;\n * plane.receiveShadow = true;\n * scene.add( plane );\n * ```\n *\n * @augments Material\n */\nclass ShadowMaterial extends Material {\n\n\t/**\n\t * Constructs a new shadow material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.color = new Color( 0x000000 );\n\n\t\t/**\n\t\t * Overwritten since shadow materials are transparent\n\t\t * by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.transparent = true;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Provides utility functions for managing uniforms.\n *\n * @module UniformsUtils\n */\n\n/**\n * Clones the given uniform definitions by performing a deep-copy. That means\n * if the value of a uniform refers to an object like a Vector3 or Texture,\n * the cloned uniform will refer to a new object reference.\n *\n * @param {Object} src - An object representing uniform definitions.\n * @return {Object} The cloned uniforms.\n */\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( isThreeObject( property ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\twarn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tif ( isThreeObject( property[ 0 ] ) ) {\n\n\t\t\t\t\tconst clonedProperty = [];\n\n\t\t\t\t\tfor ( let i = 0, l = property.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tclonedProperty[ i ] = property[ i ].clone();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdst[ u ][ p ] = clonedProperty;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\n/**\n * Merges the given uniform definitions into a single object. Since the\n * method internally uses cloneUniforms(), it performs a deep-copy when\n * producing the merged uniform definitions.\n *\n * @param {Array} uniforms - An array of objects containing uniform definitions.\n * @return {Object} The merged uniforms.\n */\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction isThreeObject( property ) {\n\n\treturn ( property && ( property.isColor ||\n\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\tproperty.isTexture || property.isQuaternion ) );\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\tif ( currentRenderTarget === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\t// https://github.com/mrdoob/three.js/issues/27868\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\treturn currentRenderTarget.texture.colorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\n/**\n * A material rendered with custom shaders. A shader is a small program written in GLSL.\n * that runs on the GPU. You may want to use a custom shader if you need to implement an\n * effect not included with any of the built-in materials.\n *\n * There are the following notes to bear in mind when using a `ShaderMaterial`:\n *\n * - `ShaderMaterial` can only be used with {@link WebGLRenderer}.\n * - Built in attributes and uniforms are passed to the shaders along with your code. If\n * you don't want that, use {@link RawShaderMaterial} instead.\n * - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end`\n * in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has\n * to be placed right above the loop. The loop formatting has to correspond to a defined standard.\n * - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop).\n * - The loop variable has to be *i*.\n * - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly\n * value of *i* for the given iteration and can be used in preprocessor\n * statements.\n *\n * ```js\n * const material = new THREE.ShaderMaterial( {\n * \tuniforms: {\n * \t\ttime: { value: 1.0 },\n * \t\tresolution: { value: new THREE.Vector2() }\n * \t},\n * \tvertexShader: document.getElementById( 'vertexShader' ).textContent,\n * \tfragmentShader: document.getElementById( 'fragmentShader' ).textContent\n * } );\n * ```\n *\n * @augments Material\n */\nclass ShaderMaterial extends Material {\n\n\t/**\n\t * Constructs a new shader material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\t/**\n\t\t * Defines custom constants using `#define` directives within the GLSL code\n\t\t * for both the vertex shader and the fragment shader; each key/value pair\n\t\t * yields another directive.\n\t\t * ```js\n\t\t * defines: {\n\t\t * \tFOO: 15,\n\t\t * \tBAR: true\n\t\t * }\n\t\t * ```\n\t\t * Yields the lines:\n\t\t * ```\n\t\t * #define FOO 15\n\t\t * #define BAR true\n\t\t * ```\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.defines = {};\n\n\t\t/**\n\t\t * An object of the form:\n\t\t * ```js\n\t\t * {\n\t\t * \t\"uniform1\": { value: 1.0 },\n\t\t * \t\"uniform2\": { value: 2 }\n\t\t * }\n\t\t * ```\n\t\t * specifying the uniforms to be passed to the shader code; keys are uniform\n\t\t * names, values are definitions of the form\n\t\t * ```\n\t\t * {\n\t\t * \tvalue: 1.0\n\t\t * }\n\t\t * ```\n\t\t * where `value` is the value of the uniform. Names must match the name of\n\t\t * the uniform, as defined in the GLSL code. Note that uniforms are refreshed\n\t\t * on every frame, so updating the value of the uniform will immediately\n\t\t * update the value available to the GLSL code.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.uniforms = {};\n\n\t\t/**\n\t\t * An array holding uniforms groups for configuring UBOs.\n\t\t *\n\t\t * @type {Array<UniformsGroup>}\n\t\t */\n\t\tthis.uniformsGroups = [];\n\n\t\t/**\n\t\t * Vertex shader GLSL code. This is the actual code for the shader.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.vertexShader = default_vertex;\n\n\t\t/**\n\t\t * Fragment shader GLSL code. This is the actual code for the shader.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.fragmentShader = default_fragment;\n\n\t\t/**\n\t\t * Controls line thickness or lines.\n\t\t *\n\t\t * WebGL and WebGPU ignore this setting and always render line primitives with a\n\t\t * width of one pixel.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.linewidth = 1;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * WebGL and WebGPU ignore this property and always render\n\t\t * 1 pixel wide lines.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines whether the material color is affected by global fog settings; `true`\n\t\t * to pass fog uniforms to the shader.\n\t\t *\n\t\t * Setting this property to `true` requires the definition of fog uniforms. It is\n\t\t * recommended to use `UniformsUtils.merge()` to combine the custom shader uniforms\n\t\t * with predefined fog uniforms.\n\t\t *\n\t\t * ```js\n\t\t * const material = new ShaderMaterial( {\n\t\t * uniforms: UniformsUtils.merge( [ UniformsLib[ 'fog' ], shaderUniforms ] );\n\t\t * vertexShader: vertexShader,\n\t\t * fragmentShader: fragmentShader,\n\t\t * fog: true\n\t\t * } );\n\t\t * ```\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.fog = false;\n\n\t\t/**\n\t\t * Defines whether this material uses lighting; `true` to pass uniform data\n\t\t * related to lighting to this shader.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.lights = false;\n\n\t\t/**\n\t\t * Defines whether this material supports clipping; `true` to let the renderer\n\t\t * pass the clippingPlanes uniform.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clipping = false;\n\n\t\t/**\n\t\t * Overwritten and set to `true` by default.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.forceSinglePass = true;\n\n\t\t/**\n\t\t * This object allows to enable certain WebGL 2 extensions.\n\t\t *\n\t\t * - clipCullDistance: set to `true` to use vertex shader clipping\n\t\t * - multiDraw: set to `true` to use vertex shader multi_draw / enable gl_DrawID\n\t\t *\n\t\t * @type {{clipCullDistance:false,multiDraw:false}}\n\t\t */\n\t\tthis.extensions = {\n\t\t\tclipCullDistance: false, // set to use vertex shader clipping\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\n\t\t};\n\n\t\t/**\n\t\t * When the rendered geometry doesn't include these attributes but the\n\t\t * material does, these default values will be passed to the shaders. This\n\t\t * avoids errors when buffer data is missing.\n\t\t *\n\t\t * - color: [ 1, 1, 1 ]\n\t\t * - uv: [ 0, 0 ]\n\t\t * - uv1: [ 0, 0 ]\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\t/**\n\t\t * If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation)\n\t\t * to bind a generic vertex index to an attribute variable.\n\t\t *\n\t\t * @type {string|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.index0AttributeName = undefined;\n\n\t\t/**\n\t\t * Can be used to force a uniform update while changing uniforms in\n\t\t * {@link Object3D#onBeforeRender}.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\t/**\n\t\t * Defines the GLSL version of custom shader code.\n\t\t *\n\t\t * @type {?(GLSL1|GLSL3)}\n\t\t * @default null\n\t\t */\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\tthis.defaultAttributeValues = Object.assign( {}, source.defaultAttributeValues );\n\n\t\tthis.index0AttributeName = source.index0AttributeName;\n\n\t\tthis.uniformsNeedUpdate = source.uniformsNeedUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * This class works just like {@link ShaderMaterial}, except that definitions\n * of built-in uniforms and attributes are not automatically prepended to the\n * GLSL shader code.\n *\n * `RawShaderMaterial` can only be used with {@link WebGLRenderer}.\n *\n * @augments ShaderMaterial\n */\nclass RawShaderMaterial extends ShaderMaterial {\n\n\t/**\n\t * Constructs a new raw shader material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\n/**\n * A standard physically based material, using Metallic-Roughness workflow.\n *\n * Physically based rendering (PBR) has recently become the standard in many\n * 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/),\n * [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and\n * [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017).\n *\n * This approach differs from older approaches in that instead of using\n * approximations for the way in which light interacts with a surface, a\n * physically correct model is used. The idea is that, instead of tweaking\n * materials to look good under specific lighting, a material can be created\n * that will react 'correctly' under all lighting scenarios.\n *\n * In practice this gives a more accurate and realistic looking result than\n * the {@link MeshLambertMaterial} or {@link MeshPhongMaterial}, at the cost of\n * being somewhat more computationally expensive. `MeshStandardMaterial` uses per-fragment\n * shading.\n *\n * Note that for best results you should always specify an environment map when using this material.\n *\n * For a non-technical introduction to the concept of PBR and how to set up a\n * PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co):\n *\n * - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)\n * - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)\n *\n * Technical details of the approach used in three.js (and most other PBR systems) can be found is this\n * [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf)\n * (pdf), by Brent Burley.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshStandardMaterial\n */\nclass MeshStandardMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh standard material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\t/**\n\t\t * How rough the material appears. `0.0` means a smooth mirror reflection, `1.0`\n\t\t * means fully diffuse. If `roughnessMap` is also provided,\n\t\t * both values are multiplied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.roughness = 1.0;\n\n\t\t/**\n\t\t * How much the material is like a metal. Non-metallic materials such as wood\n\t\t * or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between.\n\t\t * A value between `0.0` and `1.0` could be used for a rusty metal look.\n\t\t * If `metalnessMap` is also provided, both values are multiplied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.metalness = 0.0;\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The light map. Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.lightMap = null;\n\n\t\t/**\n\t\t * Intensity of the baked light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The red channel of this texture is used as the ambient occlusion map.\n\t\t * Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.aoMap = null;\n\n\t\t/**\n\t\t * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`\n\t\t * disables ambient occlusion. Where intensity is `1` and the AO map's\n\t\t * red channel is also `1`, ambient light is fully occluded on a surface.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Emissive (light) color of the material, essentially a solid color\n\t\t * unaffected by other lighting.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.emissive = new Color( 0x000000 );\n\n\t\t/**\n\t\t * Intensity of the emissive light. Modulates the emissive color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.emissiveIntensity = 1.0;\n\n\t\t/**\n\t\t * Set emissive (glow) map. The emissive map color is modulated by the\n\t\t * emissive color and the emissive intensity. If you have an emissive map,\n\t\t * be sure to set the emissive color to something other than black.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.emissiveMap = null;\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * The green channel of this texture is used to alter the roughness of the\n\t\t * material.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.roughnessMap = null;\n\n\t\t/**\n\t\t * The blue channel of this texture is used to alter the metalness of the\n\t\t * material.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.metalnessMap = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The environment map. To ensure a physically correct rendering, environment maps\n\t\t * are internally pre-processed with {@link PMREMGenerator}.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.envMap = null;\n\n\t\t/**\n\t\t * The rotation of the environment map in radians.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.envMapRotation = new Euler();\n\n\t\t/**\n\t\t * Scales the effect of the environment map by multiplying its color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.envMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of wireframe ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of wireframe joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is rendered with flat shading or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flatShading = false;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * An extension of the {@link MeshStandardMaterial}, providing more advanced\n * physically-based rendering properties:\n *\n * - Anisotropy: Ability to represent the anisotropic property of materials\n * as observable with brushed metals.\n * - Clearcoat: Some materials \u2014 like car paints, carbon fiber, and wet surfaces \u2014 require\n * a clear, reflective layer on top of another layer that may be irregular or rough.\n * Clearcoat approximates this effect, without the need for a separate transparent surface.\n * - Iridescence: Allows to render the effect where hue varies depending on the viewing\n * angle and illumination angle. This can be seen on soap bubbles, oil films, or on the\n * wings of many insects.\n * - Physically-based transparency: One limitation of {@link Material#opacity} is that highly\n * transparent materials are less reflective. Physically-based transmission provides a more\n * realistic option for thin, transparent surfaces like glass.\n * - Advanced reflectivity: More flexible reflectivity for non-metallic materials.\n * - Sheen: Can be used for representing cloth and fabric materials.\n *\n * As a result of these complex shading features, `MeshPhysicalMaterial` has a\n * higher performance cost, per pixel, than other three.js materials. Most\n * effects are disabled by default, and add cost as they are enabled. For\n * best results, always specify an environment map when using this material.\n *\n * @augments MeshStandardMaterial\n * @demo scenes/material-browser.html#MeshPhysicalMaterial\n */\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\t/**\n\t * Constructs a new mesh physical material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\t/**\n\t\t * The rotation of the anisotropy in tangent, bitangent space, measured in radians\n\t\t * counter-clockwise from the tangent. When `anisotropyMap` is present, this\n\t\t * property provides additional rotation to the vectors in the texture.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.anisotropyRotation = 0;\n\n\t\t/**\n\t\t * Red and green channels represent the anisotropy direction in `[-1, 1]` tangent,\n\t\t * bitangent space, to be rotated by `anisotropyRotation`. The blue channel\n\t\t * contains strength as `[0, 1]` to be multiplied by `anisotropy`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.anisotropyMap = null;\n\n\t\t/**\n\t\t * The red channel of this texture is multiplied against `clearcoat`,\n\t\t * for per-pixel control over a coating's intensity.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.clearcoatMap = null;\n\n\t\t/**\n\t\t * Roughness of the clear coat layer, from `0.0` to `1.0`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.clearcoatRoughness = 0.0;\n\n\t\t/**\n\t\t * The green channel of this texture is multiplied against\n\t\t * `clearcoatRoughness`, for per-pixel control over a coating's roughness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.clearcoatRoughnessMap = null;\n\n\t\t/**\n\t\t * How much `clearcoatNormalMap` affects the clear coat layer, from\n\t\t * `(0,0)` to `(1,1)`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * Can be used to enable independent normals for the clear coat layer.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.clearcoatNormalMap = null;\n\n\t\t/**\n\t\t * Index-of-refraction for non-metallic materials, from `1.0` to `2.333`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1.5\n\t\t */\n\t\tthis.ior = 1.5;\n\n\t\t/**\n\t\t * Degree of reflectivity, from `0.0` to `1.0`. Default is `0.5`, which\n\t\t * corresponds to an index-of-refraction of `1.5`.\n\t\t *\n\t\t * This models the reflectivity of non-metallic materials. It has no effect\n\t\t * when `metalness` is `1.0`\n\t\t *\n\t\t * @name MeshPhysicalMaterial#reflectivity\n\t\t * @type {number}\n\t\t * @default 0.5\n\t\t */\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\t/**\n\t\t * The red channel of this texture is multiplied against `iridescence`, for per-pixel\n\t\t * control over iridescence.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.iridescenceMap = null;\n\n\t\t/**\n\t\t * Strength of the iridescence RGB color shift effect, represented by an index-of-refraction.\n\t\t * Between `1.0` to `2.333`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1.3\n\t\t */\n\t\tthis.iridescenceIOR = 1.3;\n\n\t\t/**\n\t\t *Array of exactly 2 elements, specifying minimum and maximum thickness of the iridescence layer.\n\t\t Thickness of iridescence layer has an equivalent effect of the one `thickness` has on `ior`.\n\t\t *\n\t\t * @type {Array<number,number>}\n\t\t * @default [100,400]\n\t\t */\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\n\t\t/**\n\t\t * A texture that defines the thickness of the iridescence layer, stored in the green channel.\n\t\t * Minimum and maximum values of thickness are defined by `iridescenceThicknessRange` array:\n\t\t * - `0.0` in the green channel will result in thickness equal to first element of the array.\n\t\t * - `1.0` in the green channel will result in thickness equal to second element of the array.\n\t\t * - Values in-between will linearly interpolate between the elements of the array.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\t/**\n\t\t * The sheen tint.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.sheenColor = new Color( 0x000000 );\n\n\t\t/**\n\t\t * The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control\n\t\t * over sheen tint.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.sheenColorMap = null;\n\n\t\t/**\n\t\t * Roughness of the sheen layer, from `0.0` to `1.0`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.sheenRoughness = 1.0;\n\n\t\t/**\n\t\t * The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control\n\t\t * over sheen roughness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.sheenRoughnessMap = null;\n\n\t\t/**\n\t\t * The red channel of this texture is multiplied against `transmission`, for per-pixel control over\n\t\t * optical transparency.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.transmissionMap = null;\n\n\t\t/**\n\t\t * The thickness of the volume beneath the surface. The value is given in the\n\t\t * coordinate space of the mesh. If the value is `0` the material is\n\t\t * thin-walled. Otherwise the material is a volume boundary.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.thickness = 0;\n\n\t\t/**\n\t\t * A texture that defines the thickness, stored in the green channel. This will\n\t\t * be multiplied by `thickness`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.thicknessMap = null;\n\n\t\t/**\n\t\t * Density of the medium given as the average distance that light travels in\n\t\t * the medium before interacting with a particle. The value is given in world\n\t\t * space units, and must be greater than zero.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Infinity\n\t\t */\n\t\tthis.attenuationDistance = Infinity;\n\n\t\t/**\n\t\t * The color that white light turns into due to absorption when reaching the\n\t\t * attenuation distance.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\t/**\n\t\t * A float that scales the amount of specular reflection for non-metals only.\n\t\t * When set to zero, the model is effectively Lambertian. From `0.0` to `1.0`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.specularIntensity = 1.0;\n\n\t\t/**\n\t\t * The alpha channel of this texture is multiplied against `specularIntensity`,\n\t\t * for per-pixel control over specular intensity.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.specularIntensityMap = null;\n\n\t\t/**\n\t\t * Tints the specular reflection at normal incidence for non-metals only.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\n\t\t/**\n\t\t * The RGB channels of this texture are multiplied against `specularColor`,\n\t\t * for per-pixel control over specular color.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._dispersion = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\t/**\n\t * The anisotropy strength, from `0.0` to `1.0`.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\t/**\n\t * Represents the intensity of the clear coat layer, from `0.0` to `1.0`. Use\n\t * clear coat related properties to enable multilayer materials that have a\n\t * thin translucent layer over the base layer.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\t/**\n\t * The intensity of the iridescence layer, simulating RGB color shift based on the angle between\n\t * the surface and the viewer, from `0.0` to `1.0`.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\t/**\n\t * Defines the strength of the angular separation of colors (chromatic aberration) transmitting\n\t * through a relatively clear volume. Any value zero or larger is valid, the typical range of\n\t * realistic values is `[0, 1]`. This property can be only be used with transmissive objects.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget dispersion() {\n\n\t\treturn this._dispersion;\n\n\t}\n\n\tset dispersion( value ) {\n\n\t\tif ( this._dispersion > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._dispersion = value;\n\n\t}\n\n\t/**\n\t * The intensity of the sheen layer, from `0.0` to `1.0`.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\t/**\n\t * Degree of transmission (or optical transparency), from `0.0` to `1.0`.\n\t *\n\t * Thin, transparent or semitransparent, plastic or glass materials remain\n\t * largely reflective even if they are fully transmissive. The transmission\n\t * property can be used to model these materials.\n\t *\n\t * When transmission is non-zero, `opacity` should be set to `1`.\n\t *\n\t * @type {number}\n\t * @default 0\n\t */\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.dispersion = source.dispersion;\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material for shiny surfaces with specular highlights.\n *\n * The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model)\n * model for calculating reflectance. Unlike the Lambertian model used in the\n * {@link MeshLambertMaterial} this can simulate shiny surfaces with specular\n * highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.\n *\n * Performance will generally be greater when using this material over the\n * {@link MeshStandardMaterial} or {@link MeshPhysicalMaterial}, at the cost of\n * some graphical accuracy.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshPhongMaterial\n */\nclass MeshPhongMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh phong material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\t/**\n\t\t * Specular color of the material. The default color is set to `0x111111` (very dark grey)\n\t\t *\n\t\t * This defines how shiny the material is and the color of its shine.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.specular = new Color( 0x111111 );\n\n\t\t/**\n\t\t * How shiny the specular highlight is; a higher value gives a sharper highlight.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 30\n\t\t */\n\t\tthis.shininess = 30;\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The light map. Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.lightMap = null;\n\n\t\t/**\n\t\t * Intensity of the baked light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The red channel of this texture is used as the ambient occlusion map.\n\t\t * Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.aoMap = null;\n\n\t\t/**\n\t\t * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`\n\t\t * disables ambient occlusion. Where intensity is `1` and the AO map's\n\t\t * red channel is also `1`, ambient light is fully occluded on a surface.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Emissive (light) color of the material, essentially a solid color\n\t\t * unaffected by other lighting.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.emissive = new Color( 0x000000 );\n\n\t\t/**\n\t\t * Intensity of the emissive light. Modulates the emissive color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.emissiveIntensity = 1.0;\n\n\t\t/**\n\t\t * Set emissive (glow) map. The emissive map color is modulated by the\n\t\t * emissive color and the emissive intensity. If you have an emissive map,\n\t\t * be sure to set the emissive color to something other than black.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.emissiveMap = null;\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * The specular map value affects both how much the specular surface\n\t\t * highlight contributes and how much of the environment map affects the\n\t\t * surface.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.specularMap = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The environment map.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.envMap = null;\n\n\t\t/**\n\t\t * The rotation of the environment map in radians.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.envMapRotation = new Euler();\n\n\t\t/**\n\t\t * How to combine the result of the surface's color with the environment map, if any.\n\t\t *\n\t\t * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to\n\t\t * blend between the two colors.\n\t\t *\n\t\t * @type {(MultiplyOperation|MixOperation|AddOperation)}\n\t\t * @default MultiplyOperation\n\t\t */\n\t\tthis.combine = MultiplyOperation;\n\n\t\t/**\n\t\t * How much the environment map affects the surface.\n\t\t * The valid range is between `0` (no reflections) and `1` (full reflections).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.reflectivity = 1;\n\n\t\t/**\n\t\t * Scales the effect of the environment map by multiplying its color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.envMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The index of refraction (IOR) of air (approximately 1) divided by the\n\t\t * index of refraction of the material. It is used with environment mapping\n\t\t * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}.\n\t\t * The refraction ratio should not exceed `1`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.98\n\t\t */\n\t\tthis.refractionRatio = 0.98;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of wireframe ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of wireframe joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is rendered with flat shading or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flatShading = false;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material implementing toon shading.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshToonMaterial\n */\nclass MeshToonMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh toon material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff );\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * Gradient map for toon shading. It's required to set\n\t\t * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}\n\t\t * when using this type of texture.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.gradientMap = null;\n\n\t\t/**\n\t\t * The light map. Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.lightMap = null;\n\n\t\t/**\n\t\t * Intensity of the baked light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The red channel of this texture is used as the ambient occlusion map.\n\t\t * Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.aoMap = null;\n\n\t\t/**\n\t\t * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`\n\t\t * disables ambient occlusion. Where intensity is `1` and the AO map's\n\t\t * red channel is also `1`, ambient light is fully occluded on a surface.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Emissive (light) color of the material, essentially a solid color\n\t\t * unaffected by other lighting.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.emissive = new Color( 0x000000 );\n\n\t\t/**\n\t\t * Intensity of the emissive light. Modulates the emissive color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.emissiveIntensity = 1.0;\n\n\t\t/**\n\t\t * Set emissive (glow) map. The emissive map color is modulated by the\n\t\t * emissive color and the emissive intensity. If you have an emissive map,\n\t\t * be sure to set the emissive color to something other than black.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.emissiveMap = null;\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of wireframe ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of wireframe joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material that maps the normal vectors to RGB colors.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshNormalMaterial\n */\nclass MeshNormalMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh normal material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * WebGL and WebGPU ignore this property and always render\n\t\t * 1 pixel wide lines.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Whether the material is rendered with flat shading or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material for non-shiny surfaces, without specular highlights.\n *\n * The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance)\n * model for calculating reflectance. This can simulate some surfaces (such\n * as untreated wood or stone) well, but cannot simulate shiny surfaces with\n * specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment\n * shading.\n *\n * Due to the simplicity of the reflectance and illumination models,\n * performance will be greater when using this material over the\n * {@link MeshPhongMaterial}, {@link MeshStandardMaterial} or\n * {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshLambertMaterial\n */\nclass MeshLambertMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh lambert material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The light map. Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.lightMap = null;\n\n\t\t/**\n\t\t * Intensity of the baked light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The red channel of this texture is used as the ambient occlusion map.\n\t\t * Requires a second set of UVs.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.aoMap = null;\n\n\t\t/**\n\t\t * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`\n\t\t * disables ambient occlusion. Where intensity is `1` and the AO map's\n\t\t * red channel is also `1`, ambient light is fully occluded on a surface.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\t/**\n\t\t * Emissive (light) color of the material, essentially a solid color\n\t\t * unaffected by other lighting.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.emissive = new Color( 0x000000 );\n\n\t\t/**\n\t\t * Intensity of the emissive light. Modulates the emissive color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.emissiveIntensity = 1.0;\n\n\t\t/**\n\t\t * Set emissive (glow) map. The emissive map color is modulated by the\n\t\t * emissive color and the emissive intensity. If you have an emissive map,\n\t\t * be sure to set the emissive color to something other than black.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.emissiveMap = null;\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * Specular map used by the material.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.specularMap = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The environment map.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.envMap = null;\n\n\t\t/**\n\t\t * The rotation of the environment map in radians.\n\t\t *\n\t\t * @type {Euler}\n\t\t * @default (0,0,0)\n\t\t */\n\t\tthis.envMapRotation = new Euler();\n\n\t\t/**\n\t\t * How to combine the result of the surface's color with the environment map, if any.\n\t\t *\n\t\t * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to\n\t\t * blend between the two colors.\n\t\t *\n\t\t * @type {(MultiplyOperation|MixOperation|AddOperation)}\n\t\t * @default MultiplyOperation\n\t\t */\n\t\tthis.combine = MultiplyOperation;\n\n\t\t/**\n\t\t * How much the environment map affects the surface.\n\t\t * The valid range is between `0` (no reflections) and `1` (full reflections).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.reflectivity = 1;\n\n\t\t/**\n\t\t * Scales the effect of the environment map by multiplying its color.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.envMapIntensity = 1.0;\n\n\t\t/**\n\t\t * The index of refraction (IOR) of air (approximately 1) divided by the\n\t\t * index of refraction of the material. It is used with environment mapping\n\t\t * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}.\n\t\t * The refraction ratio should not exceed `1`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.98\n\t\t */\n\t\tthis.refractionRatio = 0.98;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Defines appearance of wireframe ends.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinecap = 'round';\n\n\t\t/**\n\t\t * Defines appearance of wireframe joints.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {('round'|'bevel'|'miter')}\n\t\t * @default 'round'\n\t\t */\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\t/**\n\t\t * Whether the material is rendered with flat shading or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flatShading = false;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material for drawing geometry by depth. Depth is based off of the camera\n * near and far plane. White is nearest, black is farthest.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshDepthMaterial\n */\nclass MeshDepthMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh depth material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\t/**\n\t\t * Type for depth packing.\n\t\t *\n\t\t * @type {(BasicDepthPacking|RGBADepthPacking|RGBDepthPacking|RGDepthPacking)}\n\t\t * @default BasicDepthPacking\n\t\t */\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * WebGL and WebGPU ignore this property and always render\n\t\t * 1 pixel wide lines.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material used internally for implementing shadow mapping with\n * point lights.\n *\n * Can also be used to customize the shadow casting of an object by assigning\n * an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}.\n * The following examples demonstrates this approach in order to ensure\n * transparent parts of objects do not cast shadows.\n *\n * @augments Material\n */\nclass MeshDistanceMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh distance material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * This material is defined by a MatCap (or Lit Sphere) texture, which encodes the\n * material color and shading.\n *\n * `MeshMatcapMaterial` does not respond to lights since the matcap image file encodes\n * baked lighting. It will cast a shadow onto an object that receives shadows\n * (and shadow clipping works), but it will not self-shadow or receive\n * shadows.\n *\n * @augments Material\n * @demo scenes/material-browser.html#MeshMatcapMaterial\n */\nclass MeshMatcapMaterial extends Material {\n\n\t/**\n\t * Constructs a new mesh matcap material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\t/**\n\t\t * Color of the material.\n\t\t *\n\t\t * @type {Color}\n\t\t * @default (1,1,1)\n\t\t */\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\t/**\n\t\t * The matcap map.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.matcap = null;\n\n\t\t/**\n\t\t * The color map. May optionally include an alpha channel, typically combined\n\t\t * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map\n\t\t * color is modulated by the diffuse `color`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The texture to create a bump map. The black and white values map to the\n\t\t * perceived depth in relation to the lights. Bump doesn't actually affect\n\t\t * the geometry of the object, only the lighting. If a normal map is defined\n\t\t * this will be ignored.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.bumpMap = null;\n\n\t\t/**\n\t\t * How much the bump map affects the material. Typical range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.bumpScale = 1;\n\n\t\t/**\n\t\t * The texture to create a normal map. The RGB values affect the surface\n\t\t * normal for each pixel fragment and change the way the color is lit. Normal\n\t\t * maps do not change the actual shape of the surface, only the lighting. In\n\t\t * case the material has a normal map authored using the left handed\n\t\t * convention, the `y` component of `normalScale` should be negated to compensate\n\t\t * for the different handedness.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.normalMap = null;\n\n\t\t/**\n\t\t * The type of normal map.\n\t\t *\n\t\t * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)}\n\t\t * @default TangentSpaceNormalMap\n\t\t */\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\n\t\t/**\n\t\t * How much the normal map affects the material. Typical value range is `[0,1]`.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (1,1)\n\t\t */\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\t/**\n\t\t * The displacement map affects the position of the mesh's vertices. Unlike\n\t\t * other maps which only affect the light and shade of the material the\n\t\t * displaced vertices can cast shadows, block other objects, and otherwise\n\t\t * act as real geometry. The displacement texture is an image where the value\n\t\t * of each pixel (white being the highest) is mapped against, and\n\t\t * repositions, the vertices of the mesh.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.displacementMap = null;\n\n\t\t/**\n\t\t * How much the displacement map affects the mesh (where black is no\n\t\t * displacement, and white is maximum displacement). Without a displacement\n\t\t * map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementScale = 1;\n\n\t\t/**\n\t\t * The offset of the displacement map's values on the mesh's vertices.\n\t\t * The bias is added to the scaled sample of the displacement map.\n\t\t * Without a displacement map set, this value is not applied.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.displacementBias = 0;\n\n\t\t/**\n\t\t * The alpha map is a grayscale texture that controls the opacity across the\n\t\t * surface (black: fully transparent; white: fully opaque).\n\t\t *\n\t\t * Only the color of the texture is used, ignoring the alpha channel if one\n\t\t * exists. For RGB and RGBA textures, the renderer will use the green channel\n\t\t * when sampling this texture due to the extra bit of precision provided for\n\t\t * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and\n\t\t * luminance/alpha textures will also still work as expected.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.alphaMap = null;\n\n\t\t/**\n\t\t * Renders the geometry as a wireframe.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.wireframe = false;\n\n\t\t/**\n\t\t * Controls the thickness of the wireframe.\n\t\t *\n\t\t * Can only be used with {@link SVGRenderer}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.wireframeLinewidth = 1;\n\n\t\t/**\n\t\t * Whether the material is rendered with flat shading or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.flatShading = false;\n\n\t\t/**\n\t\t * Whether the material is affected by fog or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * A material for rendering line primitives.\n *\n * Materials define the appearance of renderable 3D objects.\n *\n * ```js\n * const material = new THREE.LineDashedMaterial( {\n * \tcolor: 0xffffff,\n * \tscale: 1,\n * \tdashSize: 3,\n * \tgapSize: 1,\n * } );\n * ```\n *\n * @augments LineBasicMaterial\n */\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\t/**\n\t * Constructs a new line dashed material.\n\t *\n\t * @param {Object} [parameters] - An object with one or more properties\n\t * defining the material's appearance. Any property of the material\n\t * (including any property from inherited materials) can be passed\n\t * in here. Color values can be passed any type of value accepted\n\t * by {@link Color#set}.\n\t */\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLineDashedMaterial = true;\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\t/**\n\t\t * The scale of the dashed part of a line.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.scale = 1;\n\n\t\t/**\n\t\t * The size of the dash. This is both the gap with the stroke.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 3\n\t\t */\n\t\tthis.dashSize = 3;\n\n\t\t/**\n\t\t * The size of the gap.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Converts an array to a specific type.\n *\n * @param {TypedArray|Array} array - The array to convert.\n * @param {TypedArray.constructor} type - The constructor of a typed array that defines the new type.\n * @return {TypedArray} The converted array.\n */\nfunction convertArray( array, type ) {\n\n\tif ( ! array || array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\n/**\n * Returns an array by which times and values can be sorted.\n *\n * @param {Array<number>} times - The keyframe time values.\n * @return {Array<number>} The array.\n */\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n/**\n * Sorts the given array by the previously computed order via `getKeyframeOrder()`.\n *\n * @param {Array<number>} values - The values to sort.\n * @param {number} stride - The stride.\n * @param {Array<number>} order - The sort order.\n * @return {Array<number>} The sorted values.\n */\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n/**\n * Used for parsing AOS keyframe formats.\n *\n * @param {Array<number>} jsonKeys - A list of JSON keyframes.\n * @param {Array<number>} times - This array will be filled with keyframe times by this function.\n * @param {Array<number>} values - This array will be filled with keyframe values by this function.\n * @param {string} valuePropertyName - The name of the property to use.\n */\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( ...value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\n/**\n * Creates a new clip, containing only the segment of the original clip between the given frames.\n *\n * @param {AnimationClip} sourceClip - The values to sort.\n * @param {string} name - The name of the clip.\n * @param {number} startFrame - The start frame.\n * @param {number} endFrame - The end frame.\n * @param {number} [fps=30] - The FPS.\n * @return {AnimationClip} The new sub clip.\n */\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( -1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\n/**\n * Converts the keyframes of the given animation clip to an additive format.\n *\n * @param {AnimationClip} targetClip - The clip to make additive.\n * @param {number} [referenceFrame=0] - The reference frame.\n * @param {AnimationClip} [referenceClip=targetClip] - The reference clip.\n * @param {number} [fps=30] - The FPS.\n * @return {AnimationClip} The updated clip which is now additive.\n */\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\n/**\n * A class with various methods to assist with animations.\n *\n * @hideconstructor\n */\nclass AnimationUtils {\n\n\t/**\n\t * Converts an array to a specific type\n\t *\n\t * @static\n\t * @param {TypedArray|Array} array - The array to convert.\n\t * @param {TypedArray.constructor} type - The constructor of a type array.\n\t * @return {TypedArray} The converted array\n\t */\n\tstatic convertArray( array, type ) {\n\n\t\treturn convertArray( array, type );\n\n\t}\n\n\t/**\n\t * Returns `true` if the given object is a typed array.\n\t *\n\t * @static\n\t * @param {any} object - The object to check.\n\t * @return {boolean} Whether the given object is a typed array.\n\t */\n\tstatic isTypedArray( object ) {\n\n\t\treturn isTypedArray( object );\n\n\t}\n\n\t/**\n\t * Returns an array by which times and values can be sorted.\n\t *\n\t * @static\n\t * @param {Array<number>} times - The keyframe time values.\n\t * @return {Array<number>} The array.\n\t */\n\tstatic getKeyframeOrder( times ) {\n\n\t\treturn getKeyframeOrder( times );\n\n\t}\n\n\t/**\n\t * Sorts the given array by the previously computed order via `getKeyframeOrder()`.\n\t *\n\t * @static\n\t * @param {Array<number>} values - The values to sort.\n\t * @param {number} stride - The stride.\n\t * @param {Array<number>} order - The sort order.\n\t * @return {Array<number>} The sorted values.\n\t */\n\tstatic sortedArray( values, stride, order ) {\n\n\t\treturn sortedArray( values, stride, order );\n\n\t}\n\n\t/**\n\t * Used for parsing AOS keyframe formats.\n\t *\n\t * @static\n\t * @param {Array<number>} jsonKeys - A list of JSON keyframes.\n\t * @param {Array<number>} times - This array will be filled with keyframe times by this method.\n\t * @param {Array<number>} values - This array will be filled with keyframe values by this method.\n\t * @param {string} valuePropertyName - The name of the property to use.\n\t */\n\tstatic flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\t\tflattenJSON( jsonKeys, times, values, valuePropertyName );\n\n\t}\n\n\t/**\n\t * Creates a new clip, containing only the segment of the original clip between the given frames.\n\t *\n\t * @static\n\t * @param {AnimationClip} sourceClip - The values to sort.\n\t * @param {string} name - The name of the clip.\n\t * @param {number} startFrame - The start frame.\n\t * @param {number} endFrame - The end frame.\n\t * @param {number} [fps=30] - The FPS.\n\t * @return {AnimationClip} The new sub clip.\n\t */\n\tstatic subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\t\treturn subclip( sourceClip, name, startFrame, endFrame, fps );\n\n\t}\n\n\t/**\n\t * Converts the keyframes of the given animation clip to an additive format.\n\t *\n\t * @static\n\t * @param {AnimationClip} targetClip - The clip to make additive.\n\t * @param {number} [referenceFrame=0] - The reference frame.\n\t * @param {AnimationClip} [referenceClip=targetClip] - The reference clip.\n\t * @param {number} [fps=30] - The FPS.\n\t * @return {AnimationClip} The updated clip which is now additive.\n\t */\n\tstatic makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\t\treturn makeClipAdditive( targetClip, referenceFrame, referenceClip, fps );\n\n\t}\n\n}\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References: {@link http://www.oodesign.com/template-method-pattern.html}\n *\n * @abstract\n */\nclass Interpolant {\n\n\t/**\n\t * Constructs a new interpolant.\n\t *\n\t * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n\t * @param {TypedArray} sampleValues - The sample values.\n\t * @param {number} sampleSize - The sample size\n\t * @param {TypedArray} [resultBuffer] - The result buffer.\n\t */\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\t/**\n\t\t * The parameter positions.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.parameterPositions = parameterPositions;\n\n\t\t/**\n\t\t * A cache index.\n\t\t *\n\t\t * @private\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis._cachedIndex = 0;\n\n\t\t/**\n\t\t * The result buffer.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor( sampleSize );\n\n\t\t/**\n\t\t * The sample values.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.sampleValues = sampleValues;\n\n\t\t/**\n\t\t * The value size.\n\t\t *\n\t\t * @type {TypedArray}\n\t\t */\n\t\tthis.valueSize = sampleSize;\n\n\t\t/**\n\t\t * The interpolation settings.\n\t\t *\n\t\t * @type {?Object}\n\t\t * @default null\n\t\t */\n\t\tthis.settings = null;\n\n\t\t/**\n\t\t * The default settings object.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\t/**\n\t * Evaluate the interpolant at position `t`.\n\t *\n\t * @param {number} t - The interpolation factor.\n\t * @return {TypedArray} The result buffer.\n\t */\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\t/**\n\t * Returns the interpolation settings.\n\t *\n\t * @return {Object} The interpolation settings.\n\t */\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\t/**\n\t * Copies a sample value to the result buffer.\n\t *\n\t * @param {number} index - An index into the sample value buffer.\n\t * @return {TypedArray} The result buffer.\n\t */\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/**\n\t * Copies a sample value to the result buffer.\n\t *\n\t * @abstract\n\t * @param {number} i1 - An index into the sample value buffer.\n\t * @param {number} t0 - The previous interpolation factor.\n\t * @param {number} t - The current interpolation factor.\n\t * @param {number} t1 - The next interpolation factor.\n\t * @return {TypedArray} The result buffer.\n\t */\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\t/**\n\t * Optional method that is executed when the interval has changed.\n\t *\n\t * @param {number} i1 - An index into the sample value buffer.\n\t * @param {number} t0 - The previous interpolation factor.\n\t * @param {number} t - The current interpolation factor.\n\t */\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n *\n * @augments Interpolant\n */\nclass CubicInterpolant extends Interpolant {\n\n\t/**\n\t * Constructs a new cubic interpolant.\n\t *\n\t * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n\t * @param {TypedArray} sampleValues - The sample values.\n\t * @param {number} sampleSize - The sample size\n\t * @param {TypedArray} [resultBuffer] - The result buffer.\n\t */\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = -0;\n\t\tthis._offsetPrev = -0;\n\t\tthis._weightNext = -0;\n\t\tthis._offsetNext = -0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( -1.5 - 2 * wP ) * pp + ( -0.5 + wP ) * p + 1;\n\t\tconst s1 = ( -1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A basic linear interpolant.\n *\n * @augments Interpolant\n */\nclass LinearInterpolant extends Interpolant {\n\n\t/**\n\t * Constructs a new linear interpolant.\n\t *\n\t * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n\t * @param {TypedArray} sampleValues - The sample values.\n\t * @param {number} sampleSize - The sample size\n\t * @param {TypedArray} [resultBuffer] - The result buffer.\n\t */\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n *\n * @augments Interpolant\n */\nclass DiscreteInterpolant extends Interpolant {\n\n\t/**\n\t * Constructs a new discrete interpolant.\n\t *\n\t * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n\t * @param {TypedArray} sampleValues - The sample values.\n\t * @param {number} sampleSize - The sample size\n\t * @param {TypedArray} [resultBuffer] - The result buffer.\n\t */\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\n/**\n * A Bezier interpolant using cubic Bezier curves with 2D control points.\n *\n * This interpolant supports the COLLADA/Maya style of Bezier animation where\n * each keyframe has explicit in/out tangent control points specified as\n * 2D coordinates (time, value).\n *\n * The tangent data must be provided via the `settings` object:\n * - `settings.inTangents`: Float32Array with [time, value] pairs per keyframe per component\n * - `settings.outTangents`: Float32Array with [time, value] pairs per keyframe per component\n *\n * For a track with N keyframes and stride S:\n * - Each tangent array has N * S * 2 values\n * - Layout: [k0_c0_time, k0_c0_value, k0_c1_time, k0_c1_value, ..., k0_cS_time, k0_cS_value,\n * k1_c0_time, k1_c0_value, ...]\n *\n * @augments Interpolant\n */\nclass BezierInterpolant extends Interpolant {\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer;\n\t\tconst values = this.sampleValues;\n\t\tconst stride = this.valueSize;\n\n\t\tconst offset1 = i1 * stride;\n\t\tconst offset0 = offset1 - stride;\n\n\t\tconst settings = this.settings || this.DefaultSettings_;\n\t\tconst inTangents = settings.inTangents;\n\t\tconst outTangents = settings.outTangents;\n\n\t\t// If no tangent data, fall back to linear interpolation\n\t\tif ( ! inTangents || ! outTangents ) {\n\n\t\t\tconst weight1 = ( t - t0 ) / ( t1 - t0 );\n\t\t\tconst weight0 = 1 - weight1;\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tresult[ i ] = values[ offset0 + i ] * weight0 + values[ offset1 + i ] * weight1;\n\n\t\t\t}\n\n\t\t\treturn result;\n\n\t\t}\n\n\t\tconst tangentStride = stride * 2;\n\t\tconst i0 = i1 - 1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst v0 = values[ offset0 + i ];\n\t\t\tconst v1 = values[ offset1 + i ];\n\n\t\t\t// outTangent of previous keyframe (C0)\n\t\t\tconst outTangentOffset = i0 * tangentStride + i * 2;\n\t\t\tconst c0x = outTangents[ outTangentOffset ];\n\t\t\tconst c0y = outTangents[ outTangentOffset + 1 ];\n\n\t\t\t// inTangent of current keyframe (C1)\n\t\t\tconst inTangentOffset = i1 * tangentStride + i * 2;\n\t\t\tconst c1x = inTangents[ inTangentOffset ];\n\t\t\tconst c1y = inTangents[ inTangentOffset + 1 ];\n\n\t\t\t// Solve for Bezier parameter s where Bx(s) = t using Newton-Raphson\n\t\t\tlet s = ( t - t0 ) / ( t1 - t0 );\n\t\t\tlet s2, s3, oneMinusS, oneMinusS2, oneMinusS3;\n\n\t\t\tfor ( let iter = 0; iter < 8; iter ++ ) {\n\n\t\t\t\ts2 = s * s;\n\t\t\t\ts3 = s2 * s;\n\t\t\t\toneMinusS = 1 - s;\n\t\t\t\toneMinusS2 = oneMinusS * oneMinusS;\n\t\t\t\toneMinusS3 = oneMinusS2 * oneMinusS;\n\n\t\t\t\t// Bezier X(s) = (1-s)\u00B3\u00B7t0 + 3(1-s)\u00B2s\u00B7c0x + 3(1-s)s\u00B2\u00B7c1x + s\u00B3\u00B7t1\n\t\t\t\tconst bx = oneMinusS3 * t0 + 3 * oneMinusS2 * s * c0x + 3 * oneMinusS * s2 * c1x + s3 * t1;\n\n\t\t\t\tconst error = bx - t;\n\t\t\t\tif ( Math.abs( error ) < 1e-10 ) break;\n\n\t\t\t\t// Derivative dX/ds\n\t\t\t\tconst dbx = 3 * oneMinusS2 * ( c0x - t0 ) + 6 * oneMinusS * s * ( c1x - c0x ) + 3 * s2 * ( t1 - c1x );\n\t\t\t\tif ( Math.abs( dbx ) < 1e-10 ) break;\n\n\t\t\t\ts = s - error / dbx;\n\t\t\t\ts = Math.max( 0, Math.min( 1, s ) );\n\n\t\t\t}\n\n\t\t\t// Evaluate Bezier Y(s)\n\t\t\tresult[ i ] = oneMinusS3 * v0 + 3 * oneMinusS2 * s * c0y + 3 * oneMinusS * s2 * c1y + s3 * v1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * Represents a timed sequence of keyframes, which are composed of lists of\n * times and related values, and which are used to animate a specific property\n * of an object.\n */\nclass KeyframeTrack {\n\n\t/**\n\t * Constructs a new keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number|string|boolean>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\t/**\n\t\t * The track's name can refer to morph targets or bones or\n\t\t * possibly other values within an animated object. See {@link PropertyBinding#parseTrackName}\n\t\t * for the forms of strings that can be parsed for property binding.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = name;\n\n\t\t/**\n\t\t * The keyframe times.\n\t\t *\n\t\t * @type {Float32Array}\n\t\t */\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\n\t\t/**\n\t\t * The keyframe values.\n\t\t *\n\t\t * @type {Float32Array}\n\t\t */\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t/**\n\t * Converts the keyframe track to JSON.\n\t *\n\t * @static\n\t * @param {KeyframeTrack} track - The keyframe track to serialize.\n\t * @return {Object} The serialized keyframe track as JSON.\n\t */\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\t/**\n\t * Factory method for creating a new discrete interpolant.\n\t *\n\t * @static\n\t * @param {TypedArray} [result] - The result buffer.\n\t * @return {DiscreteInterpolant} The new interpolant.\n\t */\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\t/**\n\t * Factory method for creating a new linear interpolant.\n\t *\n\t * @static\n\t * @param {TypedArray} [result] - The result buffer.\n\t * @return {LinearInterpolant} The new interpolant.\n\t */\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\t/**\n\t * Factory method for creating a new smooth interpolant.\n\t *\n\t * @static\n\t * @param {TypedArray} [result] - The result buffer.\n\t * @return {CubicInterpolant} The new interpolant.\n\t */\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\t/**\n\t * Factory method for creating a new Bezier interpolant.\n\t *\n\t * The Bezier interpolant requires tangent data to be set via the `settings` property\n\t * on the track before creating the interpolant. The settings should contain:\n\t * - `inTangents`: Float32Array with [time, value] pairs per keyframe per component\n\t * - `outTangents`: Float32Array with [time, value] pairs per keyframe per component\n\t *\n\t * @static\n\t * @param {TypedArray} [result] - The result buffer.\n\t * @return {BezierInterpolant} The new interpolant.\n\t */\n\tInterpolantFactoryMethodBezier( result ) {\n\n\t\tconst interpolant = new BezierInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t\t// Pass tangent data from track settings to interpolant\n\t\tif ( this.settings ) {\n\n\t\t\tinterpolant.settings = this.settings;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t/**\n\t * Defines the interpolation factor method for this keyframe track.\n\t *\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} interpolation - The interpolation type.\n\t * @return {KeyframeTrack} A reference to this keyframe track.\n\t */\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateBezier:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodBezier;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\twarn( 'KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current interpolation type.\n\t *\n\t * @return {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} The interpolation type.\n\t */\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t\tcase this.InterpolantFactoryMethodBezier:\n\n\t\t\t\treturn InterpolateBezier;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns the value size.\n\t *\n\t * @return {number} The value size.\n\t */\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t/**\n\t * Moves all keyframes either forward or backward in time.\n\t *\n\t * @param {number} timeOffset - The offset to move the time values.\n\t * @return {KeyframeTrack} A reference to this keyframe track.\n\t */\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Scale all keyframe times by a factor (useful for frame - seconds conversions).\n\t *\n\t * @param {number} timeScale - The time scale.\n\t * @return {KeyframeTrack} A reference to this keyframe track.\n\t */\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes keyframes before and after animation without changing any values within the defined time range.\n\t *\n\t * Note: The method does not shift around keys to the start of the track time, because for interpolated\n\t * keys this will change their values\n\t *\n\t * @param {number} startTime - The start time.\n\t * @param {number} endTime - The end time.\n\t * @return {KeyframeTrack} A reference to this keyframe track.\n\t */\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== -1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Performs minimal validation on the keyframe track. Returns `true` if the values\n\t * are valid.\n\t *\n\t * @return {boolean} Whether the keyframes are valid or not.\n\t */\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\terror( 'KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\terror( 'KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\terror( 'KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\terror( 'KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\terror( 'KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t/**\n\t * Optimizes this keyframe track by removing equivalent sequential keys (which are\n\t * common in morph target sequences).\n\t *\n\t * @return {KeyframeTrack} A reference to this keyframe track.\n\t */\n\toptimize() {\n\n\t\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new keyframe track with copied values from this instance.\n\t *\n\t * @return {KeyframeTrack} A clone of this instance.\n\t */\n\tclone() {\n\n\t\tconst times = this.times.slice();\n\t\tconst values = this.values.slice();\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default ''\n */\nKeyframeTrack.prototype.ValueTypeName = '';\n\n/**\n * The time buffer type of this keyframe track.\n *\n * @type {TypedArray|Array}\n * @default Float32Array.constructor\n */\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\n\n/**\n * The value buffer type of this keyframe track.\n *\n * @type {TypedArray|Array}\n * @default Float32Array.constructor\n */\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\n\n/**\n * The default interpolation type of this keyframe track.\n *\n * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)}\n * @default InterpolateLinear\n */\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A track for boolean keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new boolean keyframe track.\n\t *\n\t * This keyframe track type has no `interpolation` parameter because the\n\t * interpolation is always discrete.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<boolean>} values - A list of keyframe values.\n\t */\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'bool'\n */\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\n\n/**\n * The value buffer type of this keyframe track.\n *\n * @type {TypedArray|Array}\n * @default Array.constructor\n */\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\n\n/**\n * The default interpolation type of this keyframe track.\n *\n * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)}\n * @default InterpolateDiscrete\n */\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A track for color keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass ColorKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new color keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tsuper( name, times, values, interpolation );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'color'\n */\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A track for numeric keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass NumberKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new number keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tsuper( name, times, values, interpolation );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'number'\n */\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n *\n * @augments Interpolant\n */\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\t/**\n\t * Constructs a new SLERP interpolant.\n\t *\n\t * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n\t * @param {TypedArray} sampleValues - The sample values.\n\t * @param {number} sampleSize - The sample size\n\t * @param {TypedArray} [resultBuffer] - The result buffer.\n\t */\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A track for Quaternion keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new Quaternion keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tsuper( name, times, values, interpolation );\n\n\t}\n\n\t/**\n\t * Overwritten so the method returns Quaternion based interpolant.\n\t *\n\t * @static\n\t * @param {TypedArray} [result] - The result buffer.\n\t * @return {QuaternionLinearInterpolant} The new interpolant.\n\t */\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'quaternion'\n */\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\n// DefaultInterpolation is inherited;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A track for string keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass StringKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new string keyframe track.\n\t *\n\t * This keyframe track type has no `interpolation` parameter because the\n\t * interpolation is always discrete.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<string>} values - A list of keyframe values.\n\t */\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'string'\n */\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\n\n/**\n * The value buffer type of this keyframe track.\n *\n * @type {TypedArray|Array}\n * @default Array.constructor\n */\nStringKeyframeTrack.prototype.ValueBufferType = Array;\n\n/**\n * The default interpolation type of this keyframe track.\n *\n * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)}\n * @default InterpolateDiscrete\n */\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A track for vector keyframe values.\n *\n * @augments KeyframeTrack\n */\nclass VectorKeyframeTrack extends KeyframeTrack {\n\n\t/**\n\t * Constructs a new vector keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tsuper( name, times, values, interpolation );\n\n\t}\n\n}\n\n/**\n * The value type name.\n *\n * @type {string}\n * @default 'vector'\n */\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\n/**\n * A reusable set of keyframe tracks which represent an animation.\n */\nclass AnimationClip {\n\n\t/**\n\t * Constructs a new animation clip.\n\t *\n\t * Note: Instead of instantiating an AnimationClip directly with the constructor, you can\n\t * use the static interface of this class for creating clips. In most cases though, animation clips\n\t * will automatically be created by loaders when importing animated 3D assets.\n\t *\n\t * @param {string} [name=''] - The clip's name.\n\t * @param {number} [duration=-1] - The clip's duration in seconds. If a negative value is passed,\n\t * the duration will be calculated from the passed keyframes.\n\t * @param {Array<KeyframeTrack>} tracks - An array of keyframe tracks.\n\t * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation\n\t * is blended/combined when two or more animations are simultaneously played.\n\t */\n\tconstructor( name = '', duration = -1, tracks = [], blendMode = NormalAnimationBlendMode ) {\n\n\t\t/**\n\t\t * The clip's name.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = name;\n\n\t\t/**\n\t\t * An array of keyframe tracks.\n\t\t *\n\t\t * @type {Array<KeyframeTrack>}\n\t\t */\n\t\tthis.tracks = tracks;\n\n\t\t/**\n\t\t * The clip's duration in seconds.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.duration = duration;\n\n\t\t/**\n\t\t * Defines how the animation is blended/combined when two or more animations\n\t\t * are simultaneously played.\n\t\t *\n\t\t * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)}\n\t\t */\n\t\tthis.blendMode = blendMode;\n\n\t\t/**\n\t\t * The UUID of the animation clip.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t/**\n\t\t * An object that can be used to store custom data about the animation clip.\n\t\t * It should not hold references to functions as these will not be cloned.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.userData = {};\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Factory method for creating an animation clip from the given JSON.\n\t *\n\t * @static\n\t * @param {Object} json - The serialized animation clip.\n\t * @return {AnimationClip} The new animation clip.\n\t */\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\tclip.userData = JSON.parse( json.userData || '{}' );\n\n\t\treturn clip;\n\n\t}\n\n\t/**\n\t * Serializes the given animation clip into JSON.\n\t *\n\t * @static\n\t * @param {AnimationClip} clip - The animation clip to serialize.\n\t * @return {Object} The JSON object.\n\t */\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode,\n\t\t\t'userData': JSON.stringify( clip.userData ),\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\t/**\n\t * Returns a new animation clip from the passed morph targets array of a\n\t * geometry, taking a name and the number of frames per second.\n\t *\n\t * Note: The fps parameter is required, but the animation speed can be\n\t * overridden via {@link AnimationAction#setDuration}.\n\t *\n\t * @static\n\t * @param {string} name - The name of the animation clip.\n\t * @param {Array<Object>} morphTargetSequence - A sequence of morph targets.\n\t * @param {number} fps - The Frames-Per-Second value.\n\t * @param {boolean} noLoop - Whether the clip should be no loop or not.\n\t * @return {AnimationClip} The new animation clip.\n\t */\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, -1, tracks );\n\n\t}\n\n\t/**\n\t * Searches for an animation clip by name, taking as its first parameter\n\t * either an array of clips, or a mesh or geometry that contains an\n\t * array named \"animations\" property.\n\t *\n\t * @static\n\t * @param {(Array<AnimationClip>|Object3D)} objectOrClipArray - The array or object to search through.\n\t * @param {string} name - The name to search for.\n\t * @return {?AnimationClip} The found animation clip. Returns `null` if no clip has been found.\n\t */\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t/**\n\t * Returns an array of new AnimationClips created from the morph target\n\t * sequences of a geometry, trying to sort morph target names into\n\t * animation-group-based patterns like \"Walk_001, Walk_002, Run_001, Run_002...\".\n\t *\n\t * See {@link MD2Loader#parse} as an example for how the method should be used.\n\t *\n\t * @static\n\t * @param {Array<Object>} morphTargets - A sequence of morph targets.\n\t * @param {number} fps - The Frames-Per-Second value.\n\t * @param {boolean} noLoop - Whether the clip should be no loop or not.\n\t * @return {Array<AnimationClip>} An array of new animation clips.\n\t */\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t/**\n\t * Parses the `animation.hierarchy` format and returns a new animation clip.\n\t *\n\t * @static\n\t * @deprecated since r175.\n\t * @param {Object} animation - A serialized animation clip as JSON.\n\t * @param {Array<Bone>} bones - An array of bones.\n\t * @return {?AnimationClip} The new animation clip.\n\t */\n\tstatic parseAnimation( animation, bones ) {\n\n\t\twarn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );\n\n\t\tif ( ! animation ) {\n\n\t\t\terror( 'AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || -1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = -1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\t/**\n\t * Sets the duration of this clip to the duration of its longest keyframe track.\n\t *\n\t * @return {AnimationClip} A reference to this animation clip.\n\t */\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Trims all tracks to the clip's duration.\n\t *\n\t * @return {AnimationClip} A reference to this animation clip.\n\t */\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Performs minimal validation on each track in the clip. Returns `true` if all\n\t * tracks are valid.\n\t *\n\t * @return {boolean} Whether the clip's keyframes are valid or not.\n\t */\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t/**\n\t * Optimizes each track by removing equivalent sequential keys (which are\n\t * common in morph target sequences).\n\t *\n\t * @return {AnimationClip} A reference to this animation clip.\n\t */\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new animation clip with copied values from this instance.\n\t *\n\t * @return {AnimationClip} A clone of this instance.\n\t */\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\tconst clip = new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t\tclip.userData = JSON.parse( JSON.stringify( this.userData ) );\n\n\t\treturn clip;\n\n\t}\n\n\t/**\n\t * Serializes this animation clip into JSON.\n\t *\n\t * @return {Object} The JSON object.\n\t */\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\n/**\n * @class\n * @classdesc A simple caching system, used internally by {@link FileLoader}.\n * To enable caching across all loaders that use {@link FileLoader}, add `THREE.Cache.enabled = true.` once in your app.\n * @hideconstructor\n */\nconst Cache = {\n\n\t/**\n\t * Whether caching is enabled or not.\n\t *\n\t * @static\n\t * @type {boolean}\n\t * @default false\n\t */\n\tenabled: false,\n\n\t/**\n\t * A dictionary that holds cached files.\n\t *\n\t * @static\n\t * @type {Object<string,Object>}\n\t */\n\tfiles: {},\n\n\t/**\n\t * Adds a cache entry with a key to reference the file. If this key already\n\t * holds a file, it is overwritten.\n\t *\n\t * @static\n\t * @param {string} key - The key to reference the cached file.\n\t * @param {Object} file - The file to be cached.\n\t */\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\tif ( isBlobURL( key ) ) return;\n\n\t\t// log( 'Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\t/**\n\t * Gets the cached value for the given key.\n\t *\n\t * @static\n\t * @param {string} key - The key to reference the cached file.\n\t * @return {Object|undefined} The cached file. If the key does not exist `undefined` is returned.\n\t */\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\tif ( isBlobURL( key ) ) return;\n\n\t\t// log( 'Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\t/**\n\t * Removes the cached file associated with the given key.\n\t *\n\t * @static\n\t * @param {string} key - The key to reference the cached file.\n\t */\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\t/**\n\t * Remove all values from the cache.\n\t *\n\t * @static\n\t */\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\n/**\n * Returns true if the given cache key contains the blob: scheme.\n *\n * @private\n * @param {string} key - The cache key.\n * @return {boolean} Whether the given cache key contains the blob: scheme or not.\n */\nfunction isBlobURL( key ) {\n\n\ttry {\n\n\t\tconst urlString = key.slice( key.indexOf( ':' ) + 1 ); // remove type identifier\n\n\t\tconst url = new URL( urlString );\n\t\treturn url.protocol === 'blob:';\n\n\t} catch ( e ) {\n\n\t\t// If the string is not a valid URL, it throws an error\n\t\treturn false;\n\n\t}\n\n}\n\n/**\n * Handles and keeps track of loaded and pending data. A default global\n * instance of this class is created and used by loaders if not supplied\n * manually.\n *\n * In general that should be sufficient, however there are times when it can\n * be useful to have separate loaders - for example if you want to show\n * separate loading bars for objects and textures.\n *\n * ```js\n * const manager = new THREE.LoadingManager();\n * manager.onLoad = () => console.log( 'Loading complete!' );\n *\n * const loader1 = new OBJLoader( manager );\n * const loader2 = new ColladaLoader( manager );\n * ```\n */\nclass LoadingManager {\n\n\t/**\n\t * Constructs a new loading manager.\n\t *\n\t * @param {Function} [onLoad] - Executes when all items have been loaded.\n\t * @param {Function} [onProgress] - Executes when single items have been loaded.\n\t * @param {Function} [onError] - Executes when an error occurs.\n\t */\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\t/**\n\t\t * Executes when an item starts loading.\n\t\t *\n\t\t * @type {Function|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.onStart = undefined;\n\n\t\t/**\n\t\t * Executes when all items have been loaded.\n\t\t *\n\t\t * @type {Function|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.onLoad = onLoad;\n\n\t\t/**\n\t\t * Executes when single items have been loaded.\n\t\t *\n\t\t * @type {Function|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.onProgress = onProgress;\n\n\t\t/**\n\t\t * Executes when an error occurs.\n\t\t *\n\t\t * @type {Function|undefined}\n\t\t * @default undefined\n\t\t */\n\t\tthis.onError = onError;\n\n\t\t/**\n\t\t * Used for aborting ongoing requests in loaders using this manager.\n\t\t *\n\t\t * @private\n\t\t * @type {AbortController | null}\n\t\t */\n\t\tthis._abortController = null;\n\n\t\t/**\n\t\t * This should be called by any loader using the manager when the loader\n\t\t * starts loading an item.\n\t\t *\n\t\t * @param {string} url - The URL to load.\n\t\t */\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\t/**\n\t\t * This should be called by any loader using the manager when the loader\n\t\t * ended loading an item.\n\t\t *\n\t\t * @param {string} url - The URL of the loaded item.\n\t\t */\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * This should be called by any loader using the manager when the loader\n\t\t * encounters an error when loading an item.\n\t\t *\n\t\t * @param {string} url - The URL of the item that produces an error.\n\t\t */\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Given a URL, uses the URL modifier callback (if any) and returns a\n\t\t * resolved URL. If no URL modifier is set, returns the original URL.\n\t\t *\n\t\t * @param {string} url - The URL to load.\n\t\t * @return {string} The resolved URL.\n\t\t */\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\t/**\n\t\t * If provided, the callback will be passed each resource URL before a\n\t\t * request is sent. The callback may return the original URL, or a new URL to\n\t\t * override loading behavior. This behavior can be used to load assets from\n\t\t * .ZIP files, drag-and-drop APIs, and Data URIs.\n\t\t *\n\t\t * ```js\n\t\t * const blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3};\n\t\t *\n\t\t * const manager = new THREE.LoadingManager();\n\t\t *\n\t\t * // Initialize loading manager with URL callback.\n\t\t * const objectURLs = [];\n\t\t * manager.setURLModifier( ( url ) => {\n\t\t *\n\t\t * \turl = URL.createObjectURL( blobs[ url ] );\n\t\t * \tobjectURLs.push( url );\n\t\t * \treturn url;\n\t\t *\n\t\t * } );\n\t\t *\n\t\t * // Load as usual, then revoke the blob URLs.\n\t\t * const loader = new GLTFLoader( manager );\n\t\t * loader.load( 'fish.gltf', (gltf) => {\n\t\t *\n\t\t * \tscene.add( gltf.scene );\n\t\t * \tobjectURLs.forEach( ( url ) => URL.revokeObjectURL( url ) );\n\t\t *\n\t\t * } );\n\t\t * ```\n\t\t *\n\t\t * @param {function(string):string} transform - URL modifier callback. Called with an URL and must return a resolved URL.\n\t\t * @return {LoadingManager} A reference to this loading manager.\n\t\t */\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\t/**\n\t\t * Registers a loader with the given regular expression. Can be used to\n\t\t * define what loader should be used in order to load specific files. A\n\t\t * typical use case is to overwrite the default loader for textures.\n\t\t *\n\t\t * ```js\n\t\t * // add handler for TGA textures\n\t\t * manager.addHandler( /\\.tga$/i, new TGALoader() );\n\t\t * ```\n\t\t *\n\t\t * @param {string} regex - A regular expression.\n\t\t * @param {Loader} loader - A loader that should handle matched cases.\n\t\t * @return {LoadingManager} A reference to this loading manager.\n\t\t */\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\t/**\n\t\t * Removes the loader for the given regular expression.\n\t\t *\n\t\t * @param {string} regex - A regular expression.\n\t\t * @return {LoadingManager} A reference to this loading manager.\n\t\t */\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== -1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\t/**\n\t\t * Can be used to retrieve the registered loader for the given file path.\n\t\t *\n\t\t * @param {string} file - The file path.\n\t\t * @return {?Loader} The registered loader. Returns `null` if no loader was found.\n\t\t */\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t\t/**\n\t\t * Can be used to abort ongoing loading requests in loaders using this manager.\n\t\t * The abort only works if the loaders implement {@link Loader#abort} and `AbortSignal.any()`\n\t\t * is supported in the browser.\n\t\t *\n\t\t * @return {LoadingManager} A reference to this loading manager.\n\t\t */\n\t\tthis.abort = function () {\n\n\n\t\t\tthis.abortController.abort();\n\t\t\tthis._abortController = null;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t}\n\n\t// TODO: Revert this back to a single member variable once this issue has been fixed\n\t// https://github.com/cloudflare/workerd/issues/3657\n\n\t/**\n\t * Used for aborting ongoing requests in loaders using this manager.\n\t *\n\t * @type {AbortController}\n\t */\n\tget abortController() {\n\n\t\tif ( ! this._abortController ) {\n\n\t\t\tthis._abortController = new AbortController();\n\n\t\t}\n\n\t\treturn this._abortController;\n\n\t}\n\n}\n\n/**\n * The global default loading manager.\n *\n * @constant\n * @type {LoadingManager}\n */\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\n/**\n * Abstract base class for loaders.\n *\n * @abstract\n */\nclass Loader {\n\n\t/**\n\t * Constructs a new loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\t/**\n\t\t * The loading manager.\n\t\t *\n\t\t * @type {LoadingManager}\n\t\t * @default DefaultLoadingManager\n\t\t */\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\t/**\n\t\t * The crossOrigin string to implement CORS for loading the url from a\n\t\t * different domain that allows CORS.\n\t\t *\n\t\t * @type {string}\n\t\t * @default 'anonymous'\n\t\t */\n\t\tthis.crossOrigin = 'anonymous';\n\n\t\t/**\n\t\t * Whether the XMLHttpRequest uses credentials.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.withCredentials = false;\n\n\t\t/**\n\t\t * The base path from which the asset will be loaded.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.path = '';\n\n\t\t/**\n\t\t * The base path from which additional resources like textures will be loaded.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.resourcePath = '';\n\n\t\t/**\n\t\t * The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)\n\t\t * used in HTTP request.\n\t\t *\n\t\t * @type {Object<string, any>}\n\t\t */\n\t\tthis.requestHeader = {};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * This method needs to be implemented by all concrete loaders. It holds the\n\t * logic for loading assets from the backend.\n\t *\n\t * @abstract\n\t * @param {string} url - The path/URL of the file to be loaded.\n\t * @param {Function} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n\t * @param {onErrorCallback} [onError] - Executed when errors occur.\n\t */\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\t/**\n\t * A async version of {@link Loader#load}.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded.\n\t * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n\t * @return {Promise} A Promise that resolves when the asset has been loaded.\n\t */\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * This method needs to be implemented by all concrete loaders. It holds the\n\t * logic for parsing the asset into three.js entities.\n\t *\n\t * @abstract\n\t * @param {any} data - The data to parse.\n\t */\n\tparse( /* data */ ) {}\n\n\t/**\n\t * Sets the `crossOrigin` String to implement CORS for loading the URL\n\t * from a different domain that allows CORS.\n\t *\n\t * @param {string} crossOrigin - The `crossOrigin` value.\n\t * @return {Loader} A reference to this instance.\n\t */\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Whether the XMLHttpRequest uses credentials such as cookies, authorization\n\t * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).\n\t *\n\t * Note: This setting has no effect if you are loading files locally or from the same domain.\n\t *\n\t * @param {boolean} value - The `withCredentials` value.\n\t * @return {Loader} A reference to this instance.\n\t */\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the base path for the asset.\n\t *\n\t * @param {string} path - The base path.\n\t * @return {Loader} A reference to this instance.\n\t */\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the base path for dependent resources like textures.\n\t *\n\t * @param {string} resourcePath - The resource path.\n\t * @return {Loader} A reference to this instance.\n\t */\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given request header.\n\t *\n\t * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)\n\t * for configuring the HTTP request.\n\t * @return {Loader} A reference to this instance.\n\t */\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * This method can be implemented in loaders for aborting ongoing requests.\n\t *\n\t * @abstract\n\t * @return {Loader} A reference to this instance.\n\t */\n\tabort() {\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Callback for onProgress in loaders.\n *\n * @callback onProgressCallback\n * @param {ProgressEvent} event - An instance of `ProgressEvent` that represents the current loading status.\n */\n\n/**\n * Callback for onError in loaders.\n *\n * @callback onErrorCallback\n * @param {Error} error - The error which occurred during the loading process.\n */\n\n/**\n * The default material name that is used by loaders\n * when creating materials for loaded 3D objects.\n *\n * Note: Not all loaders might honor this setting.\n *\n * @static\n * @type {string}\n * @default '__DEFAULT'\n */\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\n/**\n * A low level class for loading resources with the Fetch API, used internally by\n * most loaders. It can also be used directly to load any file type that does\n * not have a loader.\n *\n * This loader supports caching. If you want to use it, add `THREE.Cache.enabled = true;`\n * once to your application.\n *\n * ```js\n * const loader = new THREE.FileLoader();\n * const data = await loader.loadAsync( 'example.txt' );\n * ```\n *\n * @augments Loader\n */\nclass FileLoader extends Loader {\n\n\t/**\n\t * Constructs a new file loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\t/**\n\t\t * The expected mime type. Valid values can be found\n\t\t * [here](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.mimeType = '';\n\n\t\t/**\n\t\t * The expected response type.\n\t\t *\n\t\t * @type {('arraybuffer'|'blob'|'document'|'json'|'')}\n\t\t * @default ''\n\t\t */\n\t\tthis.responseType = '';\n\n\t\t/**\n\t\t * Used for aborting requests.\n\t\t *\n\t\t * @private\n\t\t * @type {AbortController}\n\t\t */\n\t\tthis._abortController = new AbortController();\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded response to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(any)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n\t * @param {onErrorCallback} [onError] - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( `file:${url}` );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\tsignal: ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\twarn( 'FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'X-File-Size' ) || response.headers.get( 'Content-Length' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}, ( e ) => {\n\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === '' ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( `file:${url}`, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\t/**\n\t * Sets the expected response type.\n\t *\n\t * @param {('arraybuffer'|'blob'|'document'|'json'|'')} value - The response type.\n\t * @return {FileLoader} A reference to this file loader.\n\t */\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the expected mime type of the loaded file.\n\t *\n\t * @param {string} value - The mime type.\n\t * @return {FileLoader} A reference to this file loader.\n\t */\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Aborts ongoing fetch requests.\n\t *\n\t * @return {FileLoader} A reference to this instance.\n\t */\n\tabort() {\n\n\t\tthis._abortController.abort();\n\t\tthis._abortController = new AbortController();\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Class for loading animation clips in the JSON format. The files are internally\n * loaded via {@link FileLoader}.\n *\n * ```js\n * const loader = new THREE.AnimationLoader();\n * const animations = await loader.loadAsync( 'animations/animation.js' );\n * ```\n *\n * @augments Loader\n */\nclass AnimationLoader extends Loader {\n\n\t/**\n\t * Constructs a new animation loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded animations as an array\n\t * holding instances of {@link AnimationClip} to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(Array<AnimationClip>)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\terror( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\t/**\n\t * Parses the given JSON object and returns an array of animation clips.\n\t *\n\t * @param {Object} json - The serialized animation clips.\n\t * @return {Array<AnimationClip>} The parsed animation clips.\n\t */\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract base class for loading compressed texture formats S3TC, ASTC or ETC.\n * Textures are internally loaded via {@link FileLoader}.\n *\n * Derived classes have to implement the `parse()` method which holds the parsing\n * for the respective format.\n *\n * @abstract\n * @augments Loader\n */\nclass CompressedTextureLoader extends Loader {\n\n\t/**\n\t * Constructs a new compressed texture loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and passes the loaded compressed texture\n\t * to the `onLoad()` callback. The method also returns a new texture object which can\n\t * directly be used for material creation. If you do it this way, the texture\n\t * may pop up in your scene once the respective loading process is finished.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t * @return {CompressedTexture} The compressed texture.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nconst _loading = new WeakMap();\n\n/**\n * A loader for loading images. The class loads images with the HTML `Image` API.\n *\n * ```js\n * const loader = new THREE.ImageLoader();\n * const image = await loader.loadAsync( 'image.png' );\n * ```\n * Please note that `ImageLoader` has dropped support for progress\n * events in `r84`. For an `ImageLoader` that supports progress events, see\n * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639).\n *\n * @augments Loader\n */\nclass ImageLoader extends Loader {\n\n\t/**\n\t * Constructs a new image loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and passes the loaded image\n\t * to the `onLoad()` callback. The method also returns a new `Image` object which can\n\t * directly be used for texture creation. If you do it this way, the texture\n\t * may pop up in your scene once the respective loading process is finished.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(Image)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Unsupported in this loader.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t * @return {Image} The image.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( `image:${url}` );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tif ( cached.complete === true ) {\n\n\t\t\t\tscope.manager.itemStart( url );\n\n\t\t\t\tsetTimeout( function () {\n\n\t\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tlet arr = _loading.get( cached );\n\n\t\t\t\tif ( arr === undefined ) {\n\n\t\t\t\t\tarr = [];\n\t\t\t\t\t_loading.set( cached, arr );\n\n\t\t\t\t}\n\n\t\t\t\tarr.push( { onLoad, onError } );\n\n\t\t\t}\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\t//\n\n\t\t\tconst callbacks = _loading.get( this ) || [];\n\n\t\t\tfor ( let i = 0; i < callbacks.length; i ++ ) {\n\n\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\tif ( callback.onLoad ) callback.onLoad( this );\n\n\t\t\t}\n\n\t\t\t_loading.delete( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tCache.remove( `image:${url}` );\n\n\t\t\t//\n\n\t\t\tconst callbacks = _loading.get( this ) || [];\n\n\t\t\tfor ( let i = 0; i < callbacks.length; i ++ ) {\n\n\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\tif ( callback.onError ) callback.onError( event );\n\n\t\t\t}\n\n\t\t\t_loading.delete( this );\n\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tCache.add( `image:${url}`, image );\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\n/**\n * Class for loading cube textures. Images are internally loaded via {@link ImageLoader}.\n *\n * The loader returns an instance of {@link CubeTexture} and expects the cube map to\n * be defined as six separate images representing the sides of a cube. Other cube map definitions\n * like vertical and horizontal cross, column and row layouts are not supported.\n *\n * Note that, by convention, cube maps are specified in a coordinate system\n * in which positive-x is to the right when looking up the positive-z axis --\n * in other words, using a left-handed coordinate system. Since three.js uses\n * a right-handed coordinate system, environment maps used in three.js will\n * have pos-x and neg-x swapped.\n *\n * The loaded cube texture is in sRGB color space. Meaning {@link Texture#colorSpace}\n * is set to `SRGBColorSpace` by default.\n *\n * ```js\n * const loader = new THREE.CubeTextureLoader().setPath( 'textures/cubeMaps/' );\n * const cubeTexture = await loader.loadAsync( [\n * \t'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png'\n * ] );\n * scene.background = cubeTexture;\n * ```\n *\n * @augments Loader\n */\nclass CubeTextureLoader extends Loader {\n\n\t/**\n\t * Constructs a new cube texture loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the fully loaded cube texture\n\t * to the `onLoad()` callback. The method also returns a new cube texture object which can\n\t * directly be used for material creation. If you do it this way, the cube texture\n\t * may pop up in your scene once the respective loading process is finished.\n\t *\n\t * @param {Array<string>} urls - Array of 6 URLs to images, one for each side of the\n\t * cube texture. The urls should be specified in the following order: pos-x,\n\t * neg-x, pos-y, neg-y, pos-z, neg-z. An array of data URIs are allowed as well.\n\t * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Unsupported in this loader.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t * @return {CubeTexture} The cube texture.\n\t */\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract base class for loading binary texture formats RGBE, EXR or TGA.\n * Textures are internally loaded via {@link FileLoader}.\n *\n * Derived classes have to implement the `parse()` method which holds the parsing\n * for the respective format.\n *\n * @abstract\n * @augments Loader\n */\nclass DataTextureLoader extends Loader {\n\n\t/**\n\t * Constructs a new data texture loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and passes the loaded data texture\n\t * to the `onLoad()` callback. The method also returns a new texture object which can\n\t * directly be used for material creation. If you do it this way, the texture\n\t * may pop up in your scene once the respective loading process is finished.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t * @return {DataTexture} The data texture.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\terror( e );\n\n\t\t\t\t}\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Class for loading textures. Images are internally\n * loaded via {@link ImageLoader}.\n *\n * ```js\n * const loader = new THREE.TextureLoader();\n * const texture = await loader.loadAsync( 'textures/land_ocean_ice_cloud_2048.jpg' );\n *\n * const material = new THREE.MeshBasicMaterial( { map:texture } );\n * ```\n * Please note that `TextureLoader` has dropped support for progress\n * events in `r84`. For a `TextureLoader` that supports progress events, see\n * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).\n *\n * @augments Loader\n */\nclass TextureLoader extends Loader {\n\n\t/**\n\t * Constructs a new texture loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the fully loaded texture\n\t * to the `onLoad()` callback. The method also returns a new texture object which can\n\t * directly be used for material creation. If you do it this way, the texture\n\t * may pop up in your scene once the respective loading process is finished.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(Texture)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Unsupported in this loader.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t * @return {Texture} The texture.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract base class for lights - all other light types inherit the\n * properties and methods described here.\n *\n * @abstract\n * @augments Object3D\n */\nclass Light extends Object3D {\n\n\t/**\n\t * Constructs a new light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t */\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\t/**\n\t\t * The light's color.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.color = new Color( color );\n\n\t\t/**\n\t\t * The light's intensity.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.intensity = intensity;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * A light source positioned directly above the scene, with color fading from\n * the sky color to the ground color.\n *\n * This light cannot be used to cast shadows.\n *\n * ```js\n * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );\n * scene.add( light );\n * ```\n *\n * @augments Light\n */\nclass HemisphereLight extends Light {\n\n\t/**\n\t * Constructs a new hemisphere light.\n\t *\n\t * @param {(number|Color|string)} [skyColor=0xffffff] - The light's sky color.\n\t * @param {(number|Color|string)} [groundColor=0xffffff] - The light's ground color.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t */\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\t/**\n\t\t * The light's ground color.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.groundColor = this.groundColor.getHex();\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\n/**\n * Abstract base class for light shadow classes. These classes\n * represent the shadow configuration for different light types.\n *\n * @abstract\n */\nclass LightShadow {\n\n\t/**\n\t * Constructs a new light shadow.\n\t *\n\t * @param {Camera} camera - The light's view of the world.\n\t */\n\tconstructor( camera ) {\n\n\t\t/**\n\t\t * The light's view of the world.\n\t\t *\n\t\t * @type {Camera}\n\t\t */\n\t\tthis.camera = camera;\n\n\t\t/**\n\t\t * The intensity of the shadow. The default is `1`.\n\t\t * Valid values are in the range `[0, 1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.intensity = 1;\n\n\t\t/**\n\t\t * Shadow map bias, how much to add or subtract from the normalized depth\n\t\t * when deciding whether a surface is in shadow.\n\t\t *\n\t\t * The default is `0`. Very tiny adjustments here (in the order of `0.0001`)\n\t\t * may help reduce artifacts in shadows.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.bias = 0;\n\n\t\t/**\n\t\t * A node version of `bias`. Only supported with `WebGPURenderer`.\n\t\t *\n\t\t * If a bias node is defined, `bias` has no effect.\n\t\t *\n\t\t * @type {?Node<float>}\n\t\t * @default null\n\t\t */\n\t\tthis.biasNode = null;\n\n\t\t/**\n\t\t * Defines how much the position used to query the shadow map is offset along\n\t\t * the object normal. The default is `0`. Increasing this value can be used to\n\t\t * reduce shadow acne especially in large scenes where light shines onto\n\t\t * geometry at a shallow angle. The cost is that shadows may appear distorted.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.normalBias = 0;\n\n\t\t/**\n\t\t * Setting this to values greater than 1 will blur the edges of the shadow.\n\t\t * High values will cause unwanted banding effects in the shadows - a greater\n\t\t * map size will allow for a higher value to be used here before these effects\n\t\t * become visible.\n\t\t *\n\t\t * The property has no effect when the shadow map type is `BasicShadowMap`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.radius = 1;\n\n\t\t/**\n\t\t * The amount of samples to use when blurring a VSM shadow map.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 8\n\t\t */\n\t\tthis.blurSamples = 8;\n\n\t\t/**\n\t\t * Defines the width and height of the shadow map. Higher values give better quality\n\t\t * shadows at the cost of computation time. Values must be powers of two.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (512,512)\n\t\t */\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\t/**\n\t\t * The type of shadow texture. The default is `UnsignedByteType`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default UnsignedByteType\n\t\t */\n\t\tthis.mapType = UnsignedByteType;\n\n\t\t/**\n\t\t * The depth map generated using the internal camera; a location beyond a\n\t\t * pixel's depth is in shadow. Computed internally during rendering.\n\t\t *\n\t\t * @type {?RenderTarget}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * The distribution map generated using the internal camera; an occlusion is\n\t\t * calculated based on the distribution of depths. Computed internally during\n\t\t * rendering.\n\t\t *\n\t\t * @type {?RenderTarget}\n\t\t * @default null\n\t\t */\n\t\tthis.mapPass = null;\n\n\t\t/**\n\t\t * Model to shadow camera space, to compute location and depth in shadow map.\n\t\t * This is computed internally during rendering.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.matrix = new Matrix4();\n\n\t\t/**\n\t\t * Enables automatic updates of the light's shadow. If you do not require dynamic\n\t\t * lighting / shadows, you may set this to `false`.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoUpdate = true;\n\n\t\t/**\n\t\t * When set to `true`, shadow maps will be updated in the next `render` call.\n\t\t * If you have set {@link LightShadow#autoUpdate} to `false`, you will need to\n\t\t * set this property to `true` and then make a render call to update the light's shadow.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\t/**\n\t * Used internally by the renderer to get the number of viewports that need\n\t * to be rendered for this shadow.\n\t *\n\t * @return {number} The viewport count.\n\t */\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\t/**\n\t * Gets the shadow cameras frustum. Used internally by the renderer to cull objects.\n\t *\n\t * @return {Frustum} The shadow camera frustum.\n\t */\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\t/**\n\t * Update the matrices for the camera and shadow, used internally by the renderer.\n\t *\n\t * @param {Light} light - The light for which the shadow is being rendered.\n\t */\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );\n\n\t\tif ( shadowCamera.coordinateSystem === WebGPUCoordinateSystem || shadowCamera.reversedDepth ) {\n\n\t\t\tshadowMatrix.set(\n\t\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t\t0.0, 0.0, 1.0, 0.0, // Identity Z (preserving the correct [0, 1] range from the projection matrix)\n\t\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tshadowMatrix.set(\n\t\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t\t);\n\n\t\t}\n\n\t\tshadowMatrix.multiply( _projScreenMatrix );\n\n\t}\n\n\t/**\n\t * Returns a viewport definition for the given viewport index.\n\t *\n\t * @param {number} viewportIndex - The viewport index.\n\t * @return {Vector4} The viewport.\n\t */\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\t/**\n\t * Returns the frame extends.\n\t *\n\t * @return {Vector2} The frame extends.\n\t */\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Copies the values of the given light shadow instance to this instance.\n\t *\n\t * @param {LightShadow} source - The light shadow to copy.\n\t * @return {LightShadow} A reference to this light shadow instance.\n\t */\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.intensity = source.intensity;\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\t\tthis.needsUpdate = source.needsUpdate;\n\t\tthis.normalBias = source.normalBias;\n\t\tthis.blurSamples = source.blurSamples;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\tthis.biasNode = source.biasNode;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new light shadow instance with copied values from this instance.\n\t *\n\t * @return {LightShadow} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Serializes the light shadow into JSON.\n\t *\n\t * @return {Object} A JSON object representing the serialized light shadow.\n\t * @see {@link ObjectLoader#parse}\n\t */\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.intensity !== 1 ) object.intensity = this.intensity;\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nconst _position$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\n\n/**\n * Abstract base class for cameras. This class should always be inherited\n * when you build a new camera.\n *\n * @abstract\n * @augments Object3D\n */\nclass Camera extends Object3D {\n\n\t/**\n\t * Constructs a new camera.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\t/**\n\t\t * The inverse of the camera's world matrix.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\t/**\n\t\t * The camera's projection matrix.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.projectionMatrix = new Matrix4();\n\n\t\t/**\n\t\t * The inverse of the camera's projection matrix.\n\t\t *\n\t\t * @type {Matrix4}\n\t\t */\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\t/**\n\t\t * The coordinate system in which the camera is used.\n\t\t *\n\t\t * @type {(WebGLCoordinateSystem|WebGPUCoordinateSystem)}\n\t\t */\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t\tthis._reversedDepth = false;\n\n\t}\n\n\t/**\n\t * The flag that indicates whether the camera uses a reversed depth buffer.\n\t *\n\t * @type {boolean}\n\t * @default false\n\t */\n\tget reversedDepth() {\n\n\t\treturn this._reversedDepth;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a vector representing the (\"look\") direction of the 3D object in world space.\n\t *\n\t * This method is overwritten since cameras have a different forward vector compared to other\n\t * 3D objects. A camera looks down its local, negative z-axis by default.\n\t *\n\t * @param {Vector3} target - The target vector the result is stored to.\n\t * @return {Vector3} The 3D object's direction in world space.\n\t */\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\t// exclude scale from view matrix to be glTF conform\n\n\t\tthis.matrixWorld.decompose( _position$2, _quaternion$2, _scale$2 );\n\n\t\tif ( _scale$2.x === 1 && _scale$2.y === 1 && _scale$2.z === 1 ) {\n\n\t\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else {\n\n\t\t\tthis.matrixWorldInverse.compose( _position$2, _quaternion$2, _scale$2.set( 1, 1, 1 ) ).invert();\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\t// exclude scale from view matrix to be glTF conform\n\n\t\tthis.matrixWorld.decompose( _position$2, _quaternion$2, _scale$2 );\n\n\t\tif ( _scale$2.x === 1 && _scale$2.y === 1 && _scale$2.z === 1 ) {\n\n\t\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else {\n\n\t\t\tthis.matrixWorldInverse.compose( _position$2, _quaternion$2, _scale$2.set( 1, 1, 1 ) ).invert();\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _v3$1 = /*@__PURE__*/ new Vector3();\nconst _minTarget = /*@__PURE__*/ new Vector2();\nconst _maxTarget = /*@__PURE__*/ new Vector2();\n\n/**\n * Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)).\n *\n * This projection mode is designed to mimic the way the human eye sees. It\n * is the most common projection mode used for rendering a 3D scene.\n *\n * ```js\n * const camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );\n * scene.add( camera );\n * ```\n *\n * @augments Camera\n */\nclass PerspectiveCamera extends Camera {\n\n\t/**\n\t * Constructs a new perspective camera.\n\t *\n\t * @param {number} [fov=50] - The vertical field of view.\n\t * @param {number} [aspect=1] - The aspect ratio.\n\t * @param {number} [near=0.1] - The camera's near plane.\n\t * @param {number} [far=2000] - The camera's far plane.\n\t */\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\t/**\n\t\t * The vertical field of view, from bottom to top of view,\n\t\t * in degrees.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 50\n\t\t */\n\t\tthis.fov = fov;\n\n\t\t/**\n\t\t * The zoom factor of the camera.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.zoom = 1;\n\n\t\t/**\n\t\t * The camera's near plane. The valid range is greater than `0`\n\t\t * and less than the current value of {@link PerspectiveCamera#far}.\n\t\t *\n\t\t * Note that, unlike for the {@link OrthographicCamera}, `0` is <em>not</em> a\n\t\t * valid value for a perspective camera's near plane.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.1\n\t\t */\n\t\tthis.near = near;\n\n\t\t/**\n\t\t * The camera's far plane. Must be greater than the\n\t\t * current value of {@link PerspectiveCamera#near}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 2000\n\t\t */\n\t\tthis.far = far;\n\n\t\t/**\n\t\t * Object distance used for stereoscopy and depth-of-field effects. This\n\t\t * parameter does not influence the projection matrix unless a\n\t\t * {@link StereoCamera} is being used.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 10\n\t\t */\n\t\tthis.focus = 10;\n\n\t\t/**\n\t\t * The aspect ratio, usually the canvas width / canvas height.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aspect = aspect;\n\n\t\t/**\n\t\t * Represents the frustum window specification. This property should not be edited\n\t\t * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}.\n\t\t *\n\t\t * @type {?Object}\n\t\t * @default null\n\t\t */\n\t\tthis.view = null;\n\n\t\t/**\n\t\t * Film size used for the larger axis. Default is `35` (millimeters). This\n\t\t * parameter does not influence the projection matrix unless {@link PerspectiveCamera#filmOffset}\n\t\t * is set to a nonzero value.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 35\n\t\t */\n\t\tthis.filmGauge = 35;\n\n\t\t/**\n\t\t * Horizontal off-center offset in the same unit as {@link PerspectiveCamera#filmGauge}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.filmOffset = 0;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current {@link PerspectiveCamera#filmGauge}.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * @param {number} focalLength - Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Returns the focal length from the current {@link PerspectiveCamera#fov} and\n\t * {@link PerspectiveCamera#filmGauge}.\n\t *\n\t * @return {number} The computed focal length.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\t/**\n\t * Returns the current vertical field of view angle in degrees considering {@link PerspectiveCamera#zoom}.\n\t *\n\t * @return {number} The effective FOV.\n\t */\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\t/**\n\t * Returns the width of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or\n\t * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}.\n\t *\n\t * @return {number} The film width.\n\t */\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Returns the height of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or\n\t * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}.\n\t *\n\t * @return {number} The film width.\n\t */\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Sets `minTarget` and `maxTarget` to the coordinates of the lower-left and upper-right corners of the view rectangle.\n\t *\n\t * @param {number} distance - The viewing distance.\n\t * @param {Vector2} minTarget - The lower-left corner of the view rectangle is written into this vector.\n\t * @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector.\n\t */\n\tgetViewBounds( distance, minTarget, maxTarget ) {\n\n\t\t_v3$1.set( -1, -1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t}\n\n\t/**\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n\t *\n\t * @param {number} distance - The viewing distance.\n\t * @param {Vector2} target - The target vector that is used to store result where x is width and y is height.\n\t * @returns {Vector2} The view size.\n\t */\n\tgetViewSize( distance, target ) {\n\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\n\n\t\treturn target.subVectors( _maxTarget, _minTarget );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *```\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *```\n\t * then for each monitor you would call it like this:\n\t *```js\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * // --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * // --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * // --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * // --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * // --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * // --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t * ```\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t *\n\t * @param {number} fullWidth - The full width of multiview setup.\n\t * @param {number} fullHeight - The full height of multiview setup.\n\t * @param {number} x - The horizontal offset of the subcamera.\n\t * @param {number} y - The vertical offset of the subcamera.\n\t * @param {number} width - The width of subcamera.\n\t * @param {number} height - The height of subcamera.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Removes the view offset from the projection matrix.\n\t */\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Updates the camera's projection matrix. Must be called after any change of\n\t * camera properties.\n\t */\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = -0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem, this.reversedDepth );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Represents the shadow configuration of directional lights.\n *\n * @augments LightShadow\n */\nclass SpotLightShadow extends LightShadow {\n\n\t/**\n\t * Constructs a new spot light shadow.\n\t */\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSpotLightShadow = true;\n\n\t\t/**\n\t\t * Used to focus the shadow camera. The camera's field of view is set as a\n\t\t * percentage of the spotlight's field-of-view. Range is `[0, 1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.focus = 1;\n\n\t\t/**\n\t\t * Texture aspect ratio.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aspect = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = ( this.mapSize.width / this.mapSize.height ) * this.aspect;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * This light gets emitted from a single point in one direction, along a cone\n * that increases in size the further from the light it gets.\n *\n * This light can cast shadows - see the {@link SpotLightShadow} for details.\n *\n * ```js\n * // white spotlight shining from the side, modulated by a texture\n * const spotLight = new THREE.SpotLight( 0xffffff );\n * spotLight.position.set( 100, 1000, 100 );\n * spotLight.map = new THREE.TextureLoader().load( url );\n *\n * spotLight.castShadow = true;\n * spotLight.shadow.mapSize.width = 1024;\n * spotLight.shadow.mapSize.height = 1024;\n * spotLight.shadow.camera.near = 500;\n * spotLight.shadow.camera.far = 4000;\n * spotLight.shadow.camera.fov = 30;s\n * ```\n *\n * @augments Light\n */\nclass SpotLight extends Light {\n\n\t/**\n\t * Constructs a new spot light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd).\n\t * @param {number} [distance=0] - Maximum range of the light. `0` means no limit.\n\t * @param {number} [angle=Math.PI/3] - Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`.\n\t * @param {number} [penumbra=0] - Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`.\n\t * @param {number} [decay=2] - The amount the light dims along the distance of the light.\n\t */\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\t/**\n\t\t * The spot light points from its position to the\n\t\t * target's position.\n\t\t *\n\t\t * For the target's position to be changed to anything other\n\t\t * than the default, it must be added to the scene.\n\t\t *\n\t\t * It is also possible to set the target to be another 3D object\n\t\t * in the scene. The light will now track the target object.\n\t\t *\n\t\t * @type {Object3D}\n\t\t */\n\t\tthis.target = new Object3D();\n\n\t\t/**\n\t\t * Maximum range of the light. `0` means no limit.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.distance = distance;\n\n\t\t/**\n\t\t * Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Math.PI/3\n\t\t */\n\t\tthis.angle = angle;\n\n\t\t/**\n\t\t * Percent of the spotlight cone that is attenuated due to penumbra.\n\t\t * Value range is `[0,1]`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.penumbra = penumbra;\n\n\t\t/**\n\t\t * The amount the light dims along the distance of the light. In context of\n\t\t * physically-correct rendering the default value should not be changed.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 2\n\t\t */\n\t\tthis.decay = decay;\n\n\t\t/**\n\t\t * A texture used to modulate the color of the light. The spot light\n\t\t * color is mixed with the RGB value of this texture, with a ratio\n\t\t * corresponding to its alpha value. The cookie-like masking effect is\n\t\t * reproduced using pixel values (0, 0, 0, 1-cookie_value).\n\t\t *\n\t\t * *Warning*: This property is disabled if {@link Object3D#castShadow} is set to `false`.\n\t\t *\n\t\t * @type {?Texture}\n\t\t * @default null\n\t\t */\n\t\tthis.map = null;\n\n\t\t/**\n\t\t * This property holds the light's shadow configuration.\n\t\t *\n\t\t * @type {SpotLightShadow}\n\t\t */\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\t/**\n\t * The light's power. Power is the luminous power of the light measured in lumens (lm).\n\t * Changing the power will also change the light's intensity.\n\t *\n\t * @type {number}\n\t */\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = \u03C0 * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tsuper.dispose();\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\t\tthis.map = source.map;\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.distance = this.distance;\n\t\tdata.object.angle = this.angle;\n\t\tdata.object.decay = this.decay;\n\t\tdata.object.penumbra = this.penumbra;\n\n\t\tdata.object.target = this.target.uuid;\n\n\t\tif ( this.map && this.map.isTexture ) data.object.map = this.map.toJSON( meta ).uuid;\n\n\t\tdata.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Represents the shadow configuration of point lights.\n *\n * @augments LightShadow\n */\nclass PointLightShadow extends LightShadow {\n\n\t/**\n\t * Constructs a new point light shadow.\n\t */\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPointLightShadow = true;\n\n\t}\n\n}\n\n/**\n * A light that gets emitted from a single point in all directions. A common\n * use case for this is to replicate the light emitted from a bare\n * lightbulb.\n *\n * This light can cast shadows - see the {@link PointLightShadow} for details.\n *\n * ```js\n * const light = new THREE.PointLight( 0xff0000, 1, 100 );\n * light.position.set( 50, 50, 50 );\n * scene.add( light );\n * ```\n *\n * @augments Light\n */\nclass PointLight extends Light {\n\n\t/**\n\t * Constructs a new point light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd).\n\t * @param {number} [distance=0] - Maximum range of the light. `0` means no limit.\n\t * @param {number} [decay=2] - The amount the light dims along the distance of the light.\n\t */\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\t/**\n\t\t * When distance is zero, light will attenuate according to inverse-square\n\t\t * law to infinite distance. When distance is non-zero, light will attenuate\n\t\t * according to inverse-square law until near the distance cutoff, where it\n\t\t * will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not\n\t\t * physically correct.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.distance = distance;\n\n\t\t/**\n\t\t * The amount the light dims along the distance of the light. In context of\n\t\t * physically-correct rendering the default value should not be changed.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 2\n\t\t */\n\t\tthis.decay = decay;\n\n\t\t/**\n\t\t * This property holds the light's shadow configuration.\n\t\t *\n\t\t * @type {PointLightShadow}\n\t\t */\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\t/**\n\t * The light's power. Power is the luminous power of the light measured in lumens (lm).\n\t * Changing the power will also change the light's intensity.\n\t *\n\t * @type {number}\n\t */\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 \u03C0 luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tsuper.dispose();\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.distance = this.distance;\n\t\tdata.object.decay = this.decay;\n\n\t\tdata.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection).\n *\n * In this projection mode, an object's size in the rendered image stays\n * constant regardless of its distance from the camera. This can be useful\n * for rendering 2D scenes and UI elements, amongst other things.\n *\n * ```js\n * const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );\n * scene.add( camera );\n * ```\n *\n * @augments Camera\n */\nclass OrthographicCamera extends Camera {\n\n\t/**\n\t * Constructs a new orthographic camera.\n\t *\n\t * @param {number} [left=-1] - The left plane of the camera's frustum.\n\t * @param {number} [right=1] - The right plane of the camera's frustum.\n\t * @param {number} [top=1] - The top plane of the camera's frustum.\n\t * @param {number} [bottom=-1] - The bottom plane of the camera's frustum.\n\t * @param {number} [near=0.1] - The camera's near plane.\n\t * @param {number} [far=2000] - The camera's far plane.\n\t */\n\tconstructor( left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\t/**\n\t\t * The zoom factor of the camera.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.zoom = 1;\n\n\t\t/**\n\t\t * Represents the frustum window specification. This property should not be edited\n\t\t * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}.\n\t\t *\n\t\t * @type {?Object}\n\t\t * @default null\n\t\t */\n\t\tthis.view = null;\n\n\t\t/**\n\t\t * The left plane of the camera's frustum.\n\t\t *\n\t\t * @type {number}\n\t\t * @default -1\n\t\t */\n\t\tthis.left = left;\n\n\t\t/**\n\t\t * The right plane of the camera's frustum.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.right = right;\n\n\t\t/**\n\t\t * The top plane of the camera's frustum.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.top = top;\n\n\t\t/**\n\t\t * The bottom plane of the camera's frustum.\n\t\t *\n\t\t * @type {number}\n\t\t * @default -1\n\t\t */\n\t\tthis.bottom = bottom;\n\n\t\t/**\n\t\t * The camera's near plane. The valid range is greater than `0`\n\t\t * and less than the current value of {@link OrthographicCamera#far}.\n\t\t *\n\t\t * Note that, unlike for the {@link PerspectiveCamera}, `0` is a\n\t\t * valid value for an orthographic camera's near plane.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.1\n\t\t */\n\t\tthis.near = near;\n\n\t\t/**\n\t\t * The camera's far plane. Must be greater than the\n\t\t * current value of {@link OrthographicCamera#near}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 2000\n\t\t */\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * @param {number} fullWidth - The full width of multiview setup.\n\t * @param {number} fullHeight - The full height of multiview setup.\n\t * @param {number} x - The horizontal offset of the subcamera.\n\t * @param {number} y - The vertical offset of the subcamera.\n\t * @param {number} width - The width of subcamera.\n\t * @param {number} height - The height of subcamera.\n\t * @see {@link PerspectiveCamera#setViewOffset}\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Removes the view offset from the projection matrix.\n\t */\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Updates the camera's projection matrix. Must be called after any change of\n\t * camera properties.\n\t */\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem, this.reversedDepth );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Represents the shadow configuration of directional lights.\n *\n * @augments LightShadow\n */\nclass DirectionalLightShadow extends LightShadow {\n\n\t/**\n\t * Constructs a new directional light shadow.\n\t */\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( -5, 5, 5, -5, 0.5, 500 ) );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\n/**\n * A light that gets emitted in a specific direction. This light will behave\n * as though it is infinitely far away and the rays produced from it are all\n * parallel. The common use case for this is to simulate daylight; the sun is\n * far enough away that its position can be considered to be infinite, and\n * all light rays coming from it are parallel.\n *\n * A common point of confusion for directional lights is that setting the\n * rotation has no effect. This is because three.js's DirectionalLight is the\n * equivalent to what is often called a 'Target Direct Light' in other\n * applications.\n *\n * This means that its direction is calculated as pointing from the light's\n * {@link Object3D#position} to the {@link DirectionalLight#target} position\n * (as opposed to a 'Free Direct Light' that just has a rotation\n * component).\n *\n * This light can cast shadows - see the {@link DirectionalLightShadow} for details.\n *\n * ```js\n * // White directional light at half intensity shining from the top.\n * const directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );\n * scene.add( directionalLight );\n * ```\n *\n * @augments Light\n */\nclass DirectionalLight extends Light {\n\n\t/**\n\t * Constructs a new directional light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t */\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\t/**\n\t\t * The directional light points from its position to the\n\t\t * target's position.\n\t\t *\n\t\t * For the target's position to be changed to anything other\n\t\t * than the default, it must be added to the scene.\n\t\t *\n\t\t * It is also possible to set the target to be another 3D object\n\t\t * in the scene. The light will now track the target object.\n\t\t *\n\t\t * @type {Object3D}\n\t\t */\n\t\tthis.target = new Object3D();\n\n\t\t/**\n\t\t * This property holds the light's shadow configuration.\n\t\t *\n\t\t * @type {DirectionalLightShadow}\n\t\t */\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tsuper.dispose();\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.shadow = this.shadow.toJSON();\n\t\tdata.object.target = this.target.uuid;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * This light globally illuminates all objects in the scene equally.\n *\n * It cannot be used to cast shadows as it does not have a direction.\n *\n * ```js\n * const light = new THREE.AmbientLight( 0x404040 ); // soft white light\n * scene.add( light );\n * ```\n *\n * @augments Light\n */\nclass AmbientLight extends Light {\n\n\t/**\n\t * Constructs a new ambient light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t */\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\n/**\n * This class emits light uniformly across the face a rectangular plane.\n * This light type can be used to simulate light sources such as bright\n * windows or strip lighting.\n *\n * Important Notes:\n *\n * - There is no shadow support.\n * - Only PBR materials are supported.\n * - You have to include `RectAreaLightUniformsLib` (`WebGLRenderer`) or `RectAreaLightTexturesLib` (`WebGPURenderer`)\n * into your app and init the uniforms/textures.\n *\n * ```js\n * RectAreaLightUniformsLib.init(); // only relevant for WebGLRenderer\n * THREE.RectAreaLightNode.setLTC( RectAreaLightTexturesLib.init() ); // only relevant for WebGPURenderer\n *\n * const intensity = 1; const width = 10; const height = 10;\n * const rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height );\n * rectLight.position.set( 5, 5, 0 );\n * rectLight.lookAt( 0, 0, 0 );\n * scene.add( rectLight )\n * ```\n *\n * @augments Light\n */\nclass RectAreaLight extends Light {\n\n\t/**\n\t * Constructs a new area light.\n\t *\n\t * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t * @param {number} [width=10] - The width of the light.\n\t * @param {number} [height=10] - The height of the light.\n\t */\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\t/**\n\t\t * The width of the light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 10\n\t\t */\n\t\tthis.width = width;\n\n\t\t/**\n\t\t * The height of the light.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 10\n\t\t */\n\t\tthis.height = height;\n\n\t}\n\n\t/**\n\t * The light's power. Power is the luminous power of the light measured in lumens (lm).\n\t * Changing the power will also change the light's intensity.\n\t *\n\t * @type {number}\n\t */\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Represents a third-order spherical harmonics (SH). Light probes use this class\n * to encode lighting information.\n *\n * - Primary reference: {@link https://graphics.stanford.edu/papers/envmap/envmap.pdf}\n * - Secondary reference: {@link https://www.ppsloan.org/publications/StupidSH36.pdf}\n */\nclass SphericalHarmonics3 {\n\n\t/**\n\t * Constructs a new spherical harmonics.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\t/**\n\t\t * An array holding the (9) SH coefficients.\n\t\t *\n\t\t * @type {Array<Vector3>}\n\t\t */\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the given SH coefficients to this instance by copying\n\t * the values.\n\t *\n\t * @param {Array<Vector3>} coefficients - The SH coefficients.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets all SH coefficients to `0`.\n\t *\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the radiance in the direction of the given normal.\n\t *\n\t * @param {Vector3} normal - The normal vector (assumed to be unit length)\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The radiance.\n\t */\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Returns the irradiance (radiance convolved with cosine lobe) in the\n\t * direction of the given normal.\n\t *\n\t * @param {Vector3} normal - The normal vector (assumed to be unit length)\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The irradiance.\n\t */\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // \u03C0 * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * \u03C0 / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( \u03C0 / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( \u03C0 / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( \u03C0 / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\t/**\n\t * Adds the given SH to this instance.\n\t *\n\t * @param {SphericalHarmonics3} sh - The SH to add.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * A convenience method for performing {@link SphericalHarmonics3#add} and\n\t * {@link SphericalHarmonics3#scale} at once.\n\t *\n\t * @param {SphericalHarmonics3} sh - The SH to add.\n\t * @param {number} s - The scale factor.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Scales this SH by the given scale factor.\n\t *\n\t * @param {number} s - The scale factor.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linear interpolates between the given SH and this instance by the given\n\t * alpha factor.\n\t *\n\t * @param {SphericalHarmonics3} sh - The SH to interpolate with.\n\t * @param {number} alpha - The alpha factor.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this spherical harmonics is equal with the given one.\n\t *\n\t * @param {SphericalHarmonics3} sh - The spherical harmonics to test for equality.\n\t * @return {boolean} Whether this spherical harmonics is equal with the given one.\n\t */\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\t/**\n\t * Copies the values of the given spherical harmonics to this instance.\n\t *\n\t * @param {SphericalHarmonics3} sh - The spherical harmonics to copy.\n\t * @return {SphericalHarmonics3} A reference to this spherical harmonics.\n\t */\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\t/**\n\t * Returns a new spherical harmonics with copied values from this instance.\n\t *\n\t * @return {SphericalHarmonics3} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Sets the SH coefficients of this instance from the given array.\n\t *\n\t * @param {Array<number>} array - An array holding the SH coefficients.\n\t * @param {number} [offset=0] - The array offset where to start copying.\n\t * @return {SphericalHarmonics3} A clone of this instance.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns an array with the SH coefficients, or copies them into the provided\n\t * array. The coefficients are represented as numbers.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array.\n\t * @param {number} [offset=0] - The array offset where to start copying.\n\t * @return {Array<number>} An array with flat SH coefficients.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Computes the SH basis for the given normal vector.\n\t *\n\t * @param {Vector3} normal - The normal.\n\t * @param {Array<number>} shBasis - The target array holding the SH basis.\n\t */\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\n/**\n * Light probes are an alternative way of adding light to a 3D scene. Unlike\n * classical light sources (e.g. directional, point or spot lights), light\n * probes do not emit light. Instead they store information about light\n * passing through 3D space. During rendering, the light that hits a 3D\n * object is approximated by using the data from the light probe.\n *\n * Light probes are usually created from (radiance) environment maps. The\n * class {@link LightProbeGenerator} can be used to create light probes from\n * cube textures or render targets. However, light estimation data could also\n * be provided in other forms e.g. by WebXR. This enables the rendering of\n * augmented reality content that reacts to real world lighting.\n *\n * The current probe implementation in three.js supports so-called diffuse\n * light probes. This type of light probe is functionally equivalent to an\n * irradiance environment map.\n *\n * @augments Light\n */\nclass LightProbe extends Light {\n\n\t/**\n\t * Constructs a new light probe.\n\t *\n\t * @param {SphericalHarmonics3} sh - The spherical harmonics which represents encoded lighting information.\n\t * @param {number} [intensity=1] - The light's strength/intensity.\n\t */\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isLightProbe = true;\n\n\t\t/**\n\t\t * A light probe uses spherical harmonics to encode lighting information.\n\t\t *\n\t\t * @type {SphericalHarmonics3}\n\t\t */\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Class for loading materials. The files are internally\n * loaded via {@link FileLoader}.\n *\n * ```js\n * const loader = new THREE.MaterialLoader();\n * const material = await loader.loadAsync( 'material.json' );\n * ```\n * This loader does not support node materials. Use {@link NodeMaterialLoader} instead.\n *\n * @augments Loader\n */\nclass MaterialLoader extends Loader {\n\n\t/**\n\t * Constructs a new material loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\t/**\n\t\t * A dictionary holding textures used by the material.\n\t\t *\n\t\t * @type {Object<string,Texture>}\n\t\t */\n\t\tthis.textures = {};\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded material to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(Material)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\terror( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\t/**\n\t * Parses the given JSON object and returns a material.\n\t *\n\t * @param {Object} json - The serialized material.\n\t * @return {Material} The parsed material.\n\t */\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\twarn( 'MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = this.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.dispersion !== undefined ) material.dispersion = json.dispersion;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\t\tif ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors > 0;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\t/**\n\t * Textures are not embedded in the material JSON so they have\n\t * to be injected before the loading process starts.\n\t *\n\t * @param {Object} value - A dictionary holding textures for material properties.\n\t * @return {MaterialLoader} A reference to this material loader.\n\t */\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Creates a material for the given type.\n\t *\n\t * @param {string} type - The material type.\n\t * @return {Material} The new material.\n\t */\n\tcreateMaterialFromType( type ) {\n\n\t\treturn MaterialLoader.createMaterialFromType( type );\n\n\t}\n\n\t/**\n\t * Creates a material for the given type.\n\t *\n\t * @static\n\t * @param {string} type - The material type.\n\t * @return {Material} The new material.\n\t */\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\n/**\n * A class with loader utility functions.\n */\nclass LoaderUtils {\n\n\t/**\n\t * Extracts the base URL from the given URL.\n\t *\n\t * @param {string} url -The URL to extract the base URL from.\n\t * @return {string} The extracted base URL.\n\t */\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === -1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\t/**\n\t * Resolves relative URLs against the given path. Absolute paths, data urls,\n\t * and blob URLs will be returned as is. Invalid URLs will return an empty\n\t * string.\n\t *\n\t * @param {string} url -The URL to resolve.\n\t * @param {string} path - The base path for relative URLs to be resolved against.\n\t * @return {string} The resolved URL.\n\t */\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\n/**\n * An instanced version of a geometry.\n */\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\t/**\n\t * Constructs a new instanced buffer geometry.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\n\t\t/**\n\t\t * The instance count.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Infinity\n\t\t */\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Class for loading geometries. The files are internally\n * loaded via {@link FileLoader}.\n *\n * ```js\n * const loader = new THREE.BufferGeometryLoader();\n * const geometry = await loader.loadAsync( 'models/json/pressure.json' );\n *\n * const material = new THREE.MeshBasicMaterial( { color: 0xF5F5F5 } );\n * const object = new THREE.Mesh( geometry, material );\n * scene.add( object );\n * ```\n *\n * @augments Loader\n */\nclass BufferGeometryLoader extends Loader {\n\n\t/**\n\t * Constructs a new geometry loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded geometry to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\terror( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\t/**\n\t * Parses the given JSON object and returns a geometry.\n\t *\n\t * @param {Object} json - The serialized geometry.\n\t * @return {BufferGeometry} The parsed geometry.\n\t */\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tgeometry.boundingSphere = new Sphere().fromJSON( boundingSphere );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nconst _customGeometries = {};\n\n/**\n * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).\n * The files are internally loaded via {@link FileLoader}.\n *\n * ```js\n * const loader = new THREE.ObjectLoader();\n * const obj = await loader.loadAsync( 'models/json/example.json' );\n * scene.add( obj );\n *\n * // Alternatively, to parse a previously loaded JSON structure\n * const object = await loader.parseAsync( a_json_object );\n * scene.add( object );\n * ```\n *\n * @augments Loader\n */\nclass ObjectLoader extends Loader {\n\n\t/**\n\t * Constructs a new object loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded 3D object to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(Object3D)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( e );\n\n\t\t\t\terror( 'ObjectLoader: Can\\'t parse ' + url + '.', e.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\terror( 'ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\t/**\n\t * Async version of {@link ObjectLoader#load}.\n\t *\n\t * @async\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @return {Promise<Object3D>} A Promise that resolves with the loaded 3D object.\n\t */\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tlet json;\n\n\t\ttry {\n\n\t\t\tjson = JSON.parse( text );\n\n\t\t} catch ( e ) {\n\n\t\t\tthrow new Error( 'ObjectLoader: Can\\'t parse ' + url + '. ' + e.message );\n\n\t\t}\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\t/**\n\t * Parses the given JSON. This is used internally by {@link ObjectLoader#load}\n\t * but can also be used directly to parse a previously loaded JSON structure.\n\t *\n\t * @param {Object} json - The serialized 3D object.\n\t * @param {onLoad} onLoad - Executed when all resources (e.g. textures) have been fully loaded.\n\t * @return {Object3D} The parsed 3D object.\n\t */\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\t\tthis.bindLightTargets( object );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\t/**\n\t * Async version of {@link ObjectLoader#parse}.\n\t *\n\t * @param {Object} json - The serialized 3D object.\n\t * @return {Promise<Object3D>} A Promise that resolves with the parsed 3D object.\n\t */\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\t\tthis.bindLightTargets( object );\n\n\t\treturn object;\n\n\t}\n\n\t/**\n\t * Registers the given geometry at the internal\n\t * geometry library.\n\t *\n\t * @static\n\t * @param {string} type - The geometry type.\n\t * @param {BufferGeometry.constructor} geometryClass - The geometry class.\n\t */\n\tstatic registerGeometry( type, geometryClass ) {\n\n\t\t_customGeometries[ type ] = geometryClass;\n\n\t}\n\n\t// internals\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else if ( data.type in _customGeometries ) {\n\n\t\t\t\t\t\t\tgeometry = _customGeometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\twarn( `ObjectLoader: Unknown geometry type \"${ data.type }\". Use .registerGeometry() before starting the deserialization process.` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\twarn( 'ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\twarn( 'ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\twarn( 'ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\t\t\t\tif ( data.normalized !== undefined ) texture.normalized = data.normalized;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\twarn( 'ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\twarn( 'ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\twarn( 'ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\twarn( 'ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\n\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\t\t\t\tobject.target = data.target || '';\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\t\t\t\tobject.target = data.target || '';\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tconst sh = new SphericalHarmonics3().fromArray( data.sh );\n\t\t\t\tobject = new LightProbe( sh, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._geometryInfo = data.geometryInfo.map( info => {\n\n\t\t\t\t\tlet box = null;\n\t\t\t\t\tlet sphere = null;\n\t\t\t\t\tif ( info.boundingBox !== undefined ) {\n\n\t\t\t\t\t\tbox = new Box3().fromJSON( info.boundingBox );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( info.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\tsphere = new Sphere().fromJSON( info.boundingSphere );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...info,\n\t\t\t\t\t\tboundingBox: box,\n\t\t\t\t\t\tboundingSphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\t\t\t\tobject._instanceInfo = data.instanceInfo;\n\n\t\t\t\tobject._availableInstanceIds = data._availableInstanceIds;\n\t\t\t\tobject._availableGeometryIds = data._availableGeometryIds;\n\n\t\t\t\tobject._nextIndexStart = data.nextIndexStart;\n\t\t\t\tobject._nextVertexStart = data.nextVertexStart;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._maxInstanceCount = data.maxInstanceCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\n\t\t\t\tobject._indirectTexture = getTexture( data.indirectTexture.uuid );\n\n\t\t\t\tif ( data.colorsTexture !== undefined ) {\n\n\t\t\t\t\tobject._colorsTexture = getTexture( data.colorsTexture.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.boundingSphere !== undefined ) {\n\n\t\t\t\t\tobject.boundingSphere = new Sphere().fromJSON( data.boundingSphere );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.boundingBox !== undefined ) {\n\n\t\t\t\t\tobject.boundingBox = new Box3().fromJSON( data.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.pivot !== undefined ) object.pivot = new Vector3().fromArray( data.pivot );\n\n\t\tif ( data.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, data.morphTargetDictionary );\n\t\tif ( data.morphTargetInfluences !== undefined ) object.morphTargetInfluences = data.morphTargetInfluences.slice();\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.static !== undefined ) object.static = data.static;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\twarn( 'ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n\tbindLightTargets( object ) {\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isDirectionalLight || child.isSpotLight ) {\n\n\t\t\t\tconst uuid = child.target;\n\n\t\t\t\tconst target = object.getObjectByProperty( 'uuid', uuid );\n\n\t\t\t\tif ( target !== undefined ) {\n\n\t\t\t\t\tchild.target = target;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.target = new Object3D();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nconst _errorMap = new WeakMap();\n\n/**\n * A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap).\n * An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare\n * textures for rendering.\n *\n * Note that {@link Texture#flipY} and {@link Texture#premultiplyAlpha} are ignored with image bitmaps.\n * These options need to be configured via {@link ImageBitmapLoader#setOptions} prior to loading,\n * unlike regular images which can be configured on the Texture to set these options on GPU upload instead.\n *\n * To match the default behaviour of {@link Texture}, the following options are needed:\n *\n * ```js\n * { imageOrientation: 'flipY', premultiplyAlpha: 'none' }\n * ```\n *\n * Also note that unlike {@link FileLoader}, this loader will only avoid multiple concurrent requests to the same URL if {@link Cache} is enabled.\n *\n * ```js\n * const loader = new THREE.ImageBitmapLoader();\n * loader.setOptions( { imageOrientation: 'flipY' } ); // set options if needed\n * const imageBitmap = await loader.loadAsync( 'image.png' );\n *\n * const texture = new THREE.Texture( imageBitmap );\n * texture.needsUpdate = true;\n * ```\n *\n * @augments Loader\n */\nclass ImageBitmapLoader extends Loader {\n\n\t/**\n\t * Constructs a new image bitmap loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\twarn( 'ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\twarn( 'ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\t/**\n\t\t * Represents the loader options.\n\t\t *\n\t\t * @type {Object}\n\t\t * @default {premultiplyAlpha:'none'}\n\t\t */\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t\t/**\n\t\t * Used for aborting requests.\n\t\t *\n\t\t * @private\n\t\t * @type {AbortController}\n\t\t */\n\t\tthis._abortController = new AbortController();\n\n\t}\n\n\t/**\n\t * Sets the given loader options. The structure of the object must match the `options` parameter of\n\t * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).\n\t *\n\t * Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with\n\t * different options will return the cached result of the first request.\n\t *\n\t * @param {Object} options - The loader options to set.\n\t * @return {ImageBitmapLoader} A reference to this image bitmap loader.\n\t */\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and pass the loaded image bitmap to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Unsupported in this loader.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( `image-bitmap:${url}` );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\t// check if there is an error for the cached promise\n\n\t\t\t\t\tif ( _errorMap.has( cached ) === true ) {\n\n\t\t\t\t\t\tif ( onError ) onError( _errorMap.get( cached ) );\n\n\t\t\t\t\t\tscope.manager.itemError( url );\n\t\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\t\tfetchOptions.signal = ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal;\n\n\t\tconst promise = fetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( `image-bitmap:${url}`, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\t_errorMap.set( promise, e );\n\n\t\t\tCache.remove( `image-bitmap:${url}` );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( `image-bitmap:${url}`, promise );\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n\t/**\n\t * Aborts ongoing fetch requests.\n\t *\n\t * @return {ImageBitmapLoader} A reference to this instance.\n\t */\n\tabort() {\n\n\t\tthis._abortController.abort();\n\t\tthis._abortController = new AbortController();\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _context;\n\n/**\n * Manages the global audio context in the engine.\n *\n * @hideconstructor\n */\nclass AudioContext {\n\n\t/**\n\t * Returns the global native audio context.\n\t *\n\t * @return {Window.AudioContext} The native audio context.\n\t */\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\t/**\n\t * Allows to set the global native audio context from outside.\n\t *\n\t * @param {Window.AudioContext} value - The native context to set.\n\t */\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\n/**\n * Class for loading audio buffers. Audios are internally\n * loaded via {@link FileLoader}.\n *\n * ```js\n * const audioListener = new THREE.AudioListener();\n * const ambientSound = new THREE.Audio( audioListener );\n *\n * const loader = new THREE.AudioLoader();\n * const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' );\n *\n * ambientSound.setBuffer( audioBuffer );\n * ambientSound.play();\n * ```\n *\n * @augments Loader\n */\nclass AudioLoader extends Loader {\n\n\t/**\n\t * Constructs a new audio loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and passes the loaded audio buffer\n\t * to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(AudioBuffer)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\n\t\t\t\tconst decodeUrl = url + '#decode';\n\t\t\t\tscope.manager.itemStart( decodeUrl ); // prevent loading manager from completing too early, see #33378\n\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\t\t\t\t\tscope.manager.itemEnd( decodeUrl );\n\n\t\t\t\t} ).catch( function ( e ) {\n\n\t\t\t\t\thandleError( e );\n\t\t\t\t\tscope.manager.itemEnd( decodeUrl );\n\n\t\t\t\t} );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\terror( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\n/**\n * A special type of camera that uses two perspective cameras with\n * stereoscopic projection. Can be used for rendering stereo effects\n * like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or\n * [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier).\n */\nclass StereoCamera {\n\n\t/**\n\t * Constructs a new stereo camera.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * The type property is used for detecting the object type\n\t\t * in context of serialization/deserialization.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.type = 'StereoCamera';\n\n\t\t/**\n\t\t * The aspect.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.aspect = 1;\n\n\t\t/**\n\t\t * The eye separation which represents the distance\n\t\t * between the left and right camera.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0.064\n\t\t */\n\t\tthis.eyeSep = 0.064;\n\n\t\t/**\n\t\t * The camera representing the left eye. This is added to layer `1` so objects to be\n\t\t * rendered by the left camera must also be added to this layer.\n\t\t *\n\t\t * @type {PerspectiveCamera}\n\t\t */\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\t/**\n\t\t * The camera representing the right eye. This is added to layer `2` so objects to be\n\t\t * rendered by the right camera must also be added to this layer.\n\t\t *\n\t\t * @type {PerspectiveCamera}\n\t\t */\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\t/**\n\t * Updates the stereo camera based on the given perspective camera.\n\t *\n\t * @param {PerspectiveCamera} camera - The perspective camera.\n\t */\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nconst fov = -90; // negative fov is not an error\nconst aspect = 1;\n\n/**\n * A special type of camera that is positioned in 3D space to render its surroundings into a\n * cube render target. The render target can then be used as an environment map for rendering\n * realtime reflections in your scene.\n *\n * ```js\n * // Create cube render target\n * const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );\n *\n * // Create cube camera\n * const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );\n * scene.add( cubeCamera );\n *\n * // Create car\n * const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } );\n * const car = new THREE.Mesh( carGeometry, chromeMaterial );\n * scene.add( car );\n *\n * // Update the render target cube\n * car.visible = false;\n * cubeCamera.position.copy( car.position );\n * cubeCamera.update( renderer, scene );\n *\n * // Render the scene\n * car.visible = true;\n * renderer.render( scene, camera );\n * ```\n *\n * @augments Object3D\n */\nclass CubeCamera extends Object3D {\n\n\t/**\n\t * Constructs a new cube camera.\n\t *\n\t * @param {number} near - The camera's near plane.\n\t * @param {number} far - The camera's far plane.\n\t * @param {WebGLCubeRenderTarget} renderTarget - The cube render target.\n\t */\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\t/**\n\t\t * A reference to the cube render target.\n\t\t *\n\t\t * @type {WebGLCubeRenderTarget}\n\t\t */\n\t\tthis.renderTarget = renderTarget;\n\n\t\t/**\n\t\t * The current active coordinate system.\n\t\t *\n\t\t * @type {?(WebGLCoordinateSystem|WebGPUCoordinateSystem)}\n\t\t * @default null\n\t\t */\n\t\tthis.coordinateSystem = null;\n\n\t\t/**\n\t\t * The current active mipmap level\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.activeMipmapLevel = 0;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\t/**\n\t * Must be called when the coordinate system of the cube camera is changed.\n\t */\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( -1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, -1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, -1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, -1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, -1, 0 );\n\t\t\tcameraPX.lookAt( -1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, -1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, -1 );\n\t\t\tcameraNY.lookAt( 0, -1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, -1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, -1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, -1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Calling this method will render the given scene with the given renderer\n\t * into the cube render target of the camera.\n\t *\n\t * @param {(Renderer|WebGLRenderer)} renderer - The renderer.\n\t * @param {Scene} scene - The scene to render.\n\t */\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst { renderTarget, activeMipmapLevel } = this;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\t// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812\n\n\t\tlet reversedDepthBuffer = false;\n\n\t\tif ( renderer.isWebGLRenderer === true ) {\n\n\t\t\treversedDepthBuffer = renderer.state.buffers.depth.getReversed();\n\n\t\t} else {\n\n\t\t\treversedDepthBuffer = renderer.reversedDepthBuffer;\n\n\t\t}\n\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\tif ( reversedDepthBuffer && renderer.autoClear === false ) renderer.clearDepth();\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\n/**\n * This type of camera can be used in order to efficiently render a scene with a\n * predefined set of cameras. This is an important performance aspect for\n * rendering VR scenes.\n *\n * An instance of `ArrayCamera` always has an array of sub cameras. It's mandatory\n * to define for each sub camera the `viewport` property which determines the\n * part of the viewport that is rendered with this camera.\n *\n * @augments PerspectiveCamera\n */\nclass ArrayCamera extends PerspectiveCamera {\n\n\t/**\n\t * Constructs a new array camera.\n\t *\n\t * @param {Array<PerspectiveCamera>} [array=[]] - An array of perspective sub cameras.\n\t */\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isArrayCamera = true;\n\n\t\t/**\n\t\t * Whether this camera is used with multiview rendering or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default false\n\t\t */\n\t\tthis.isMultiViewCamera = false;\n\n\t\t/**\n\t\t * An array of perspective sub cameras.\n\t\t *\n\t\t * @type {Array<PerspectiveCamera>}\n\t\t */\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\n/**\n * This class is an alternative to {@link Clock} with a different API design and behavior.\n * The goal is to avoid the conceptual flaws that became apparent in `Clock` over time.\n *\n * - `Timer` has an `update()` method that updates its internal state. That makes it possible to\n * call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values.\n * - The class can make use of the Page Visibility API to avoid large time delta values when the app\n * is inactive (e.g. tab switched or browser hidden).\n *\n * ```js\n * const timer = new Timer();\n * timer.connect( document ); // use Page Visibility API\n * ```\n */\nclass Timer {\n\n\t/**\n\t * Constructs a new timer.\n\t */\n\tconstructor() {\n\n\t\tthis._previousTime = 0;\n\t\tthis._currentTime = 0;\n\t\tthis._startTime = performance.now();\n\n\t\tthis._delta = 0;\n\t\tthis._elapsed = 0;\n\n\t\tthis._timescale = 1;\n\n\t\tthis._document = null;\n\t\tthis._pageVisibilityHandler = null;\n\n\t}\n\n\t/**\n\t * Connect the timer to the given document.Calling this method is not mandatory to\n\t * use the timer but enables the usage of the Page Visibility API to avoid large time\n\t * delta values.\n\t *\n\t * @param {Document} document - The document.\n\t */\n\tconnect( document ) {\n\n\t\tthis._document = document;\n\n\t\t// use Page Visibility API to avoid large time delta values\n\n\t\tif ( document.hidden !== undefined ) {\n\n\t\t\tthis._pageVisibilityHandler = handleVisibilityChange.bind( this );\n\n\t\t\tdocument.addEventListener( 'visibilitychange', this._pageVisibilityHandler, false );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.\n\t */\n\tdisconnect() {\n\n\t\tif ( this._pageVisibilityHandler !== null ) {\n\n\t\t\tthis._document.removeEventListener( 'visibilitychange', this._pageVisibilityHandler );\n\t\t\tthis._pageVisibilityHandler = null;\n\n\t\t}\n\n\t\tthis._document = null;\n\n\t}\n\n\t/**\n\t * Returns the time delta in seconds.\n\t *\n\t * @return {number} The time delta in second.\n\t */\n\tgetDelta() {\n\n\t\treturn this._delta / 1000;\n\n\t}\n\n\t/**\n\t * Returns the elapsed time in seconds.\n\t *\n\t * @return {number} The elapsed time in second.\n\t */\n\tgetElapsed() {\n\n\t\treturn this._elapsed / 1000;\n\n\t}\n\n\t/**\n\t * Returns the timescale.\n\t *\n\t * @return {number} The timescale.\n\t */\n\tgetTimescale() {\n\n\t\treturn this._timescale;\n\n\t}\n\n\t/**\n\t * Sets the given timescale which scale the time delta computation\n\t * in `update()`.\n\t *\n\t * @param {number} timescale - The timescale to set.\n\t * @return {Timer} A reference to this timer.\n\t */\n\tsetTimescale( timescale ) {\n\n\t\tthis._timescale = timescale;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Resets the time computation for the current simulation step.\n\t *\n\t * @return {Timer} A reference to this timer.\n\t */\n\treset() {\n\n\t\tthis._currentTime = performance.now() - this._startTime;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Can be used to free all internal resources. Usually called when\n\t * the timer instance isn't required anymore.\n\t */\n\tdispose() {\n\n\t\tthis.disconnect();\n\n\t}\n\n\t/**\n\t * Updates the internal state of the timer. This method should be called\n\t * once per simulation step and before you perform queries against the timer\n\t * (e.g. via `getDelta()`).\n\t *\n\t * @param {number} timestamp - The current time in milliseconds. Can be obtained\n\t * from the `requestAnimationFrame` callback argument. If not provided, the current\n\t * time will be determined with `performance.now`.\n\t * @return {Timer} A reference to this timer.\n\t */\n\tupdate( timestamp ) {\n\n\t\tif ( this._pageVisibilityHandler !== null && this._document.hidden === true ) {\n\n\t\t\tthis._delta = 0;\n\n\t\t} else {\n\n\t\t\tthis._previousTime = this._currentTime;\n\t\t\tthis._currentTime = ( timestamp !== undefined ? timestamp : performance.now() ) - this._startTime;\n\n\t\t\tthis._delta = ( this._currentTime - this._previousTime ) * this._timescale;\n\t\t\tthis._elapsed += this._delta; // _elapsed is the accumulation of all previous deltas\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction handleVisibilityChange() {\n\n\tif ( this._document.hidden === false ) this.reset();\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\n\nconst _forward = /*@__PURE__*/ new Vector3();\nconst _up = /*@__PURE__*/ new Vector3();\n\n/**\n * The class represents a virtual listener of the all positional and non-positional audio effects\n * in the scene. A three.js application usually creates a single listener. It is a mandatory\n * constructor parameter for audios entities like {@link Audio} and {@link PositionalAudio}.\n *\n * In most cases, the listener object is a child of the camera. So the 3D transformation of the\n * camera represents the 3D transformation of the listener.\n *\n * @augments Object3D\n */\nclass AudioListener extends Object3D {\n\n\t/**\n\t * Constructs a new audio listener.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\t/**\n\t\t * The native audio context.\n\t\t *\n\t\t * @type {AudioContext}\n\t\t * @readonly\n\t\t */\n\t\tthis.context = AudioContext.getContext();\n\n\t\t/**\n\t\t * The gain node used for volume control.\n\t\t *\n\t\t * @type {GainNode}\n\t\t * @readonly\n\t\t */\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\t/**\n\t\t * An optional filter.\n\t\t *\n\t\t * Defined via {@link AudioListener#setFilter}.\n\t\t *\n\t\t * @type {?AudioNode}\n\t\t * @default null\n\t\t * @readonly\n\t\t */\n\t\tthis.filter = null;\n\n\t\t/**\n\t\t * Time delta values required for `linearRampToValueAtTime()` usage.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t * @readonly\n\t\t */\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._timer = new Timer();\n\n\t}\n\n\t/**\n\t * Returns the listener's input node.\n\t *\n\t * This method is used by other audio nodes to connect to this listener.\n\t *\n\t * @return {GainNode} The input node.\n\t */\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\t/**\n\t * Removes the current filter from this listener.\n\t *\n\t * @return {AudioListener} A reference to this listener.\n\t */\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current set filter.\n\t *\n\t * @return {?AudioNode} The filter.\n\t */\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\t/**\n\t * Sets the given filter to this listener.\n\t *\n\t * @param {AudioNode} value - The filter to set.\n\t * @return {AudioListener} A reference to this listener.\n\t */\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the applications master volume.\n\t *\n\t * @return {number} The master volume.\n\t */\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\t/**\n\t * Sets the applications master volume. This volume setting affects\n\t * all audio nodes in the scene.\n\t *\n\t * @param {number} value - The master volume to set.\n\t * @return {AudioListener} A reference to this listener.\n\t */\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis._timer.update();\n\n\t\tconst listener = this.context.listener;\n\n\t\tthis.timeDelta = this._timer.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t// the initial forward and up directions must be orthogonal\n\t\t_forward.set( 0, 0, -1 ).applyQuaternion( _quaternion$1 );\n\t\t_up.set( 0, 1, 0 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _forward.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _forward.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _forward.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( _up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( _up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( _up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _forward.x, _forward.y, _forward.z, _up.x, _up.y, _up.z );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Represents a non-positional ( global ) audio object.\n *\n * This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/).\n *\n * ```js\n * // create an AudioListener and add it to the camera\n * const listener = new THREE.AudioListener();\n * camera.add( listener );\n *\n * // create a global audio source\n * const sound = new THREE.Audio( listener );\n *\n * // load a sound and set it as the Audio object's buffer\n * const audioLoader = new THREE.AudioLoader();\n * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {\n * \tsound.setBuffer( buffer );\n * \tsound.setLoop( true );\n * \tsound.setVolume( 0.5 );\n * \tsound.play();\n * });\n * ```\n *\n * @augments Object3D\n */\nclass Audio extends Object3D {\n\n\t/**\n\t * Constructs a new audio.\n\t *\n\t * @param {AudioListener} listener - The global audio listener.\n\t */\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\t/**\n\t\t * The global audio listener.\n\t\t *\n\t\t * @type {AudioListener}\n\t\t * @readonly\n\t\t */\n\t\tthis.listener = listener;\n\n\t\t/**\n\t\t * The audio context.\n\t\t *\n\t\t * @type {AudioContext}\n\t\t * @readonly\n\t\t */\n\t\tthis.context = listener.context;\n\n\t\t/**\n\t\t * The gain node used for volume control.\n\t\t *\n\t\t * @type {GainNode}\n\t\t * @readonly\n\t\t */\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\t/**\n\t\t * Whether to start playback automatically or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.autoplay = false;\n\n\t\t/**\n\t\t * A reference to an audio buffer.\n\t\t *\n\t\t * Defined via {@link Audio#setBuffer}.\n\t\t *\n\t\t * @type {?AudioBuffer}\n\t\t * @default null\n\t\t * @readonly\n\t\t */\n\t\tthis.buffer = null;\n\n\t\t/**\n\t\t * Modify pitch, measured in cents. +/- 100 is a semitone.\n\t\t * +/- 1200 is an octave.\n\t\t *\n\t\t * Defined via {@link Audio#setDetune}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t * @readonly\n\t\t */\n\t\tthis.detune = 0;\n\n\t\t/**\n\t\t * Whether the audio should loop or not.\n\t\t *\n\t\t * Defined via {@link Audio#setLoop}.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t * @readonly\n\t\t */\n\t\tthis.loop = false;\n\n\t\t/**\n\t\t * Defines where in the audio buffer the replay should\n\t\t * start, in seconds.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.loopStart = 0;\n\n\t\t/**\n\t\t * Defines where in the audio buffer the replay should\n\t\t * stop, in seconds.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.loopEnd = 0;\n\n\t\t/**\n\t\t * An offset to the time within the audio buffer the playback\n\t\t * should begin, in seconds.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.offset = 0;\n\n\t\t/**\n\t\t * Overrides the default duration of the audio.\n\t\t *\n\t\t * @type {undefined|number}\n\t\t * @default undefined\n\t\t */\n\t\tthis.duration = undefined;\n\n\t\t/**\n\t\t * The playback speed.\n\t\t *\n\t\t * Defined via {@link Audio#setPlaybackRate}.\n\t\t *\n\t\t * @type {number}\n\t\t * @readonly\n\t\t * @default 1\n\t\t */\n\t\tthis.playbackRate = 1;\n\n\t\t/**\n\t\t * Indicates whether the audio is playing or not.\n\t\t *\n\t\t * This flag will be automatically set when using {@link Audio#play},\n\t\t * {@link Audio#pause}, {@link Audio#stop}.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default false\n\t\t */\n\t\tthis.isPlaying = false;\n\n\t\t/**\n\t\t * Indicates whether the audio playback can be controlled\n\t\t * with method like {@link Audio#play} or {@link Audio#pause}.\n\t\t *\n\t\t * This flag will be automatically set when audio sources are\n\t\t * defined.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.hasPlaybackControl = true;\n\n\t\t/**\n\t\t * Holds a reference to the current audio source.\n\t\t *\n\t\t * The property is automatically by one of the `set*()` methods.\n\t\t *\n\t\t * @type {?AudioNode}\n\t\t * @readonly\n\t\t * @default null\n\t\t */\n\t\tthis.source = null;\n\n\t\t/**\n\t\t * Defines the source type.\n\t\t *\n\t\t * The property is automatically set by one of the `set*()` methods.\n\t\t *\n\t\t * @type {('empty'|'audioNode'|'mediaNode'|'mediaStreamNode'|'buffer')}\n\t\t * @readonly\n\t\t * @default 'empty'\n\t\t */\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\t/**\n\t\t * Can be used to apply a variety of low-order filters to create\n\t\t * more complex sound effects e.g. via `BiquadFilterNode`.\n\t\t *\n\t\t * The property is automatically set by {@link Audio#setFilters}.\n\t\t *\n\t\t * @type {Array<AudioNode>}\n\t\t * @readonly\n\t\t */\n\t\tthis.filters = [];\n\n\t}\n\n\t/**\n\t * Returns the output audio node.\n\t *\n\t * @return {GainNode} The output node.\n\t */\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\t/**\n\t * Sets the given audio node as the source of this instance.\n\t *\n\t * {@link Audio#sourceType} is set to `audioNode` and {@link Audio#hasPlaybackControl} to `false`.\n\t *\n\t * @param {AudioNode} audioNode - The audio node like an instance of `OscillatorNode`.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given media element as the source of this instance.\n\t *\n\t * {@link Audio#sourceType} is set to `mediaNode` and {@link Audio#hasPlaybackControl} to `false`.\n\t *\n\t * @param {HTMLMediaElement} mediaElement - The media element.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given media stream as the source of this instance.\n\t *\n\t * {@link Audio#sourceType} is set to `mediaStreamNode` and {@link Audio#hasPlaybackControl} to `false`.\n\t *\n\t * @param {MediaStream} mediaStream - The media stream.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given audio buffer as the source of this instance.\n\t *\n\t * {@link Audio#sourceType} is set to `buffer` and {@link Audio#hasPlaybackControl} to `true`.\n\t *\n\t * @param {AudioBuffer} audioBuffer - The audio buffer.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Starts the playback of the audio.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @param {number} [delay=0] - The delay, in seconds, at which the audio should start playing.\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\twarn( 'Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\t/**\n\t * Pauses the playback of the audio.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Stops the playback of the audio.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @param {number} [delay=0] - The delay, in seconds, at which the audio should stop playing.\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tstop( delay = 0 ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop( this.context.currentTime + delay );\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Connects to the audio source. This is used internally on\n\t * initialisation and when setting / removing filters.\n\t *\n\t * @return {Audio} A reference to this instance.\n\t */\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Disconnects to the audio source. This is used internally on\n\t * initialisation and when setting / removing filters.\n\t *\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tdisconnect() {\n\n\t\tif ( this._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current set filters.\n\t *\n\t * @return {Array<AudioNode>} The list of filters.\n\t */\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\t/**\n\t * Sets an array of filters and connects them with the audio source.\n\t *\n\t * @param {Array<AudioNode>} [value] - A list of filters.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Defines the detuning of oscillation in cents.\n\t *\n\t * @param {number} value - The detuning of oscillation in cents.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.isPlaying === true && this.source.detune !== undefined ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the detuning of oscillation in cents.\n\t *\n\t * @return {number} The detuning of oscillation in cents.\n\t */\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\t/**\n\t * Returns the first filter in the list of filters.\n\t *\n\t * @return {AudioNode|undefined} The first filter in the list of filters.\n\t */\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\t/**\n\t * Applies a single filter node to the audio.\n\t *\n\t * @param {AudioNode} [filter] - The filter to set.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\t/**\n\t * Sets the playback rate.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @param {number} [value] - The playback rate to set.\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current playback rate.\n\n\t * @return {number} The playback rate.\n\t */\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\t/**\n\t * Automatically called when playback finished.\n\t */\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\t\tthis._progress = 0;\n\n\t}\n\n\t/**\n\t * Returns the loop flag.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @return {boolean} Whether the audio should loop or not.\n\t */\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\t/**\n\t * Sets the loop flag.\n\t *\n\t * Can only be used with compatible audio sources that allow playback control.\n\t *\n\t * @param {boolean} value - Whether the audio should loop or not.\n\t * @return {Audio|undefined} A reference to this instance.\n\t */\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\twarn( 'Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the loop start value which defines where in the audio buffer the replay should\n\t * start, in seconds.\n\t *\n\t * @param {number} value - The loop start value.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the loop end value which defines where in the audio buffer the replay should\n\t * stop, in seconds.\n\t *\n\t * @param {number} value - The loop end value.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the volume.\n\t *\n\t * @return {number} The volume.\n\t */\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\t/**\n\t * Sets the volume.\n\t *\n\t * @param {number} value - The volume to set.\n\t * @return {Audio} A reference to this instance.\n\t */\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.sourceType !== 'buffer' ) {\n\n\t\t\twarn( 'Audio: Audio source type cannot be copied.' );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.autoplay = source.autoplay;\n\n\t\tthis.buffer = source.buffer;\n\t\tthis.detune = source.detune;\n\t\tthis.loop = source.loop;\n\t\tthis.loopStart = source.loopStart;\n\t\tthis.loopEnd = source.loopEnd;\n\t\tthis.offset = source.offset;\n\t\tthis.duration = source.duration;\n\t\tthis.playbackRate = source.playbackRate;\n\t\tthis.hasPlaybackControl = source.hasPlaybackControl;\n\t\tthis.sourceType = source.sourceType;\n\n\t\tthis.filters = source.filters.slice();\n\n\t\treturn this;\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor( this.listener ).copy( this, recursive );\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\n/**\n * Represents a positional audio object.\n *\n * ```js\n * // create an AudioListener and add it to the camera\n * const listener = new THREE.AudioListener();\n * camera.add( listener );\n *\n * // create the PositionalAudio object (passing in the listener)\n * const sound = new THREE.PositionalAudio( listener );\n *\n * // load a sound and set it as the PositionalAudio object's buffer\n * const audioLoader = new THREE.AudioLoader();\n * audioLoader.load( 'sounds/song.ogg', function( buffer ) {\n * \tsound.setBuffer( buffer );\n * \tsound.setRefDistance( 20 );\n * \tsound.play();\n * });\n *\n * // create an object for the sound to play from\n * const sphere = new THREE.SphereGeometry( 20, 32, 16 );\n * const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } );\n * const mesh = new THREE.Mesh( sphere, material );\n * scene.add( mesh );\n *\n * // finally add the sound to the mesh\n * mesh.add( sound );\n *\n * @augments Audio\n */\nclass PositionalAudio extends Audio {\n\n\t/**\n\t * Constructs a positional audio.\n\t *\n\t * @param {AudioListener} listener - The global audio listener.\n\t */\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\t/**\n\t\t * The panner node represents the location, direction, and behavior of an audio\n\t\t * source in 3D space.\n\t\t *\n\t\t * @type {PannerNode}\n\t\t * @readonly\n\t\t */\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t\treturn this;\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\t/**\n\t * Returns the current reference distance.\n\t *\n\t * @return {number} The reference distance.\n\t */\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\t/**\n\t * Defines the reference distance for reducing volume as the audio source moves\n\t * further from the listener \u2013 i.e. the distance at which the volume reduction\n\t * starts taking effect.\n\t *\n\t * @param {number} value - The reference distance to set.\n\t * @return {PositionalAudio} A reference to this instance.\n\t */\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current rolloff factor.\n\t *\n\t * @return {number} The rolloff factor.\n\t */\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\t/**\n\t * Defines how quickly the volume is reduced as the source moves away from the listener.\n\t *\n\t * @param {number} value - The rolloff factor.\n\t * @return {PositionalAudio} A reference to this instance.\n\t */\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current distance model.\n\t *\n\t * @return {('linear'|'inverse'|'exponential')} The distance model.\n\t */\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\t/**\n\t * Defines which algorithm to use to reduce the volume of the audio source\n\t * as it moves away from the listener.\n\t *\n\t * Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype)\n\t * for more details.\n\t *\n\t * @param {('linear'|'inverse'|'exponential')} value - The distance model to set.\n\t * @return {PositionalAudio} A reference to this instance.\n\t */\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the current max distance.\n\t *\n\t * @return {number} The max distance.\n\t */\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\t/**\n\t * Defines the maximum distance between the audio source and the listener,\n\t * after which the volume is not reduced any further.\n\t *\n\t * This value is used only by the `linear` distance model.\n\t *\n\t * @param {number} value - The max distance.\n\t * @return {PositionalAudio} A reference to this instance.\n\t */\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the directional cone in which the audio can be listened.\n\t *\n\t * @param {number} coneInnerAngle - An angle, in degrees, of a cone inside of which there will be no volume reduction.\n\t * @param {number} coneOuterAngle - An angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the `coneOuterGain` parameter.\n\t * @param {number} coneOuterGain - The amount of volume reduction outside the cone defined by the `coneOuterAngle`. When set to `0`, no sound can be heard.\n\t * @return {PositionalAudio} A reference to this instance.\n\t */\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * This class can be used to analyse audio data.\n *\n * ```js\n * // create an AudioListener and add it to the camera\n * const listener = new THREE.AudioListener();\n * camera.add( listener );\n *\n * // create an Audio source\n * const sound = new THREE.Audio( listener );\n *\n * // load a sound and set it as the Audio object's buffer\n * const audioLoader = new THREE.AudioLoader();\n * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {\n * \tsound.setBuffer( buffer );\n * \tsound.setLoop(true);\n * \tsound.setVolume(0.5);\n * \tsound.play();\n * });\n *\n * // create an AudioAnalyser, passing in the sound and desired fftSize\n * const analyser = new THREE.AudioAnalyser( sound, 32 );\n *\n * // get the average frequency of the sound\n * const data = analyser.getAverageFrequency();\n * ```\n */\nclass AudioAnalyser {\n\n\t/**\n\t * Constructs a new audio analyzer.\n\t *\n\t * @param {Audio} audio - The audio to analyze.\n\t * @param {number} [fftSize=2048] - The window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data.\n\t */\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\t/**\n\t\t * The global audio listener.\n\t\t *\n\t\t * @type {AnalyserNode}\n\t\t */\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\t/**\n\t\t * Holds the analyzed data.\n\t\t *\n\t\t * @type {Uint8Array}\n\t\t */\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\t/**\n\t * Returns an array with frequency data of the audio.\n\t *\n\t * Each item in the array represents the decibel value for a specific frequency.\n\t * The frequencies are spread linearly from 0 to 1/2 of the sample rate.\n\t * For example, for 48000 sample rate, the last item of the array will represent\n\t * the decibel value for 24000 Hz.\n\t *\n\t * @return {Uint8Array} The frequency data.\n\t */\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\t/**\n\t * Returns the average of the frequencies returned by {@link AudioAnalyser#getFrequencyData}.\n\t *\n\t * @return {number} The average frequency.\n\t */\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\n/**\n * Buffered scene graph property that allows weighted accumulation; used internally.\n */\nclass PropertyMixer {\n\n\t/**\n\t * Constructs a new property mixer.\n\t *\n\t * @param {PropertyBinding} binding - The property binding.\n\t * @param {string} typeName - The keyframe track type name.\n\t * @param {number} valueSize - The keyframe track value size.\n\t */\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\t/**\n\t\t * The property binding.\n\t\t *\n\t\t * @type {PropertyBinding}\n\t\t */\n\t\tthis.binding = binding;\n\n\t\t/**\n\t\t * The keyframe track value size.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\t/**\n\t\t * Accumulated weight of the property binding.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.cumulativeWeight = 0;\n\n\t\t/**\n\t\t * Accumulated additive weight of the property binding.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\t/**\n\t\t * Number of active keyframe tracks currently using this property binding.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.useCount = 0;\n\n\t\t/**\n\t\t * Number of keyframe tracks referencing this property binding.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t/**\n\t * Accumulates data in the `incoming` region into `accu<i>`.\n\t *\n\t * @param {number} accuIndex - The accumulation index.\n\t * @param {number} weight - The weight.\n\t */\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t/**\n\t * Accumulates data in the `incoming` region into `add`.\n\t *\n\t * @param {number} weight - The weight.\n\t */\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t/**\n\t * Applies the state of `accu<i>` to the binding when accus differ.\n\t *\n\t * @param {number} accuIndex - The accumulation index.\n\t */\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\t/**\n\t * Remembers the state of the bound property and copy it to both accus.\n\t */\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t/**\n\t * Applies the state previously taken via {@link PropertyMixer#saveOriginalState} to the binding.\n\t */\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t// internals\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\n\n\n/**\n * This holds a reference to a real property in the scene graph; used internally.\n */\nclass PropertyBinding {\n\n\t/**\n\t * Constructs a new property binding.\n\t *\n\t * @param {Object} rootNode - The root node.\n\t * @param {string} path - The path.\n\t * @param {?Object} [parsedPath] - The parsed path.\n\t */\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\t/**\n\t\t * The object path to the animated property.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.path = path;\n\n\t\t/**\n\t\t * An object holding information about the path.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\t/**\n\t\t * The object owns the animated property.\n\t\t *\n\t\t * @type {?Object}\n\t\t */\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\t/**\n\t\t * The root node.\n\t\t *\n\t\t * @type {Object3D|Skeleton}\n\t\t */\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\t/**\n\t * Factory method for creating a property binding from the given parameters.\n\t *\n\t * @static\n\t * @param {Object} root - The root node.\n\t * @param {string} path - The path.\n\t * @param {?Object} [parsedPath] - The parsed path.\n\t * @return {PropertyBinding|Composite} The created property binding or composite.\n\t */\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name - Node name to be sanitized.\n\t * @return {string} The sanitized node name.\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\t/**\n\t * Parses the given track name (an object path to an animated property) and\n\t * returns an object with information about the path. Matches strings in the following forms:\n\t *\n\t * - nodeName.property\n\t * - nodeName.property[accessor]\n\t * - nodeName.material.property[accessor]\n\t * - uuid.property[accessor]\n\t * - uuid.objectName[objectIndex].propertyName[propertyIndex]\n\t * - parentName/nodeName.property\n\t * - parentName/parentName/nodeName.property[index]\n\t * - .bone[Armature.DEF_cog].position\n\t * - scene:helium_balloon_model:helium_balloon_model.position\n\t *\n\t * @static\n\t * @param {string} trackName - The track name to parse.\n\t * @return {Object} The parsed track name as an object.\n\t */\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== -1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== -1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\t/**\n\t * Searches for a node in the hierarchy of the given root object by the given\n\t * node name.\n\t *\n\t * @static\n\t * @param {Object} root - The root object.\n\t * @param {string|number} nodeName - The name of the node.\n\t * @return {?Object} The found node. Returns `null` if no object was found.\n\t */\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t/**\n\t * Creates a getter / setter pair for the property tracked by this binding.\n\t */\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\twarn( 'PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\terror( 'PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\terror( 'PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\terror( 'PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.isMaterial === true ) {\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.isObject3D === true ) {\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\terror( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\terror( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\t/**\n\t * Unbinds the property.\n\t */\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n * - Instead pass this object as 'root'.\n * - You can also add and remove objects later when the mixer is running.\n *\n * Note:\n *\n * - Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the all objects in the group.\n * - A single property can either be controlled through a target group or directly, but not both.\n */\nclass AnimationObjectGroup {\n\n\t/**\n\t * Constructs a new animation group.\n\t *\n\t * @param {...Object3D} arguments - An arbitrary number of 3D objects that share the same animation state.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\t/**\n\t\t * The UUID of the 3D object.\n\t\t *\n\t\t * @type {string}\n\t\t * @readonly\n\t\t */\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t/**\n\t * Adds an arbitrary number of objects to this animation group.\n\t *\n\t * @param {...Object3D} arguments - The 3D objects to add.\n\t */\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\terror( 'AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t/**\n\t * Removes an arbitrary number of objects to this animation group\n\t *\n\t * @param {...Object3D} arguments - The 3D objects to remove.\n\t */\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t/**\n\t * Deallocates all memory resources for the passed 3D objects of this animation group.\n\t *\n\t * @param {...Object3D} arguments - The 3D objects to uncache.\n\t */\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * An instance of `AnimationAction` schedules the playback of an animation which is\n * stored in {@link AnimationClip}.\n */\nclass AnimationAction {\n\n\t/**\n\t * Constructs a new animation action.\n\t *\n\t * @param {AnimationMixer} mixer - The mixer that is controlled by this action.\n\t * @param {AnimationClip} clip - The animation clip that holds the actual keyframes.\n\t * @param {?Object3D} [localRoot=null] - The root object on which this action is performed.\n\t * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode.\n\t */\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\n\t\t/**\n\t\t * Defines how the animation is blended/combined when two or more animations\n\t\t * are simultaneously played.\n\t\t *\n\t\t * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)}\n\t\t */\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\n\t\t\t// preserve interpolant settings (like tangent data from BezierInterpolant)\n\n\t\t\tif ( interpolant.settings ) {\n\n\t\t\t\tObject.assign( interpolantSettings, interpolant.settings );\n\n\t\t\t}\n\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\t/**\n\t\t * The loop mode, set via {@link AnimationAction#setLoop}.\n\t\t *\n\t\t * @type {(LoopRepeat|LoopOnce|LoopPingPong)}\n\t\t * @default LoopRepeat\n\t\t */\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = -1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t/**\n\t\t * The local time of this action (in seconds, starting with `0`).\n\t\t *\n\t\t * The value gets clamped or wrapped to `[0,clip.duration]` (according to the\n\t\t * loop state).\n\t\t *\n\t\t * @type {number}\n\t\t * @default Infinity\n\t\t */\n\t\tthis.time = 0;\n\n\t\t/**\n\t\t * Scaling factor for the {@link AnimationAction#time}. A value of `0` causes the\n\t\t * animation to pause. Negative values cause the animation to play backwards.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\t/**\n\t\t * The degree of influence of this action (in the interval `[0, 1]`). Values\n\t\t * between `0` (no impact) and `1` (full impact) can be used to blend between\n\t\t * several actions.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\t/**\n\t\t * The number of repetitions of the performed clip over the course of this action.\n\t\t * Can be set via {@link AnimationAction#setLoop}.\n\t\t *\n\t\t * Setting this number has no effect if {@link AnimationAction#loop} is set to\n\t\t * `THREE:LoopOnce`.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Infinity\n\t\t */\n\t\tthis.repetitions = Infinity;\n\n\t\t/**\n\t\t * If set to `true`, the playback of the action is paused.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.paused = false;\n\n\t\t/**\n\t\t * If set to `false`, the action is disabled so it has no impact.\n\t\t *\n\t\t * When the action is re-enabled, the animation continues from its current\n\t\t * time (setting `enabled` to `false` doesn't reset the action).\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to true the animation will automatically be paused on its last frame.\n\t\t *\n\t\t * If set to false, {@link AnimationAction#enabled} will automatically be switched\n\t\t * to `false` when the last loop of the action has finished, so that this action has\n\t\t * no further impact.\n\t\t *\n\t\t * Note: This member has no impact if the action is interrupted (it\n\t\t * has only an effect if its last loop has really finished).\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clampWhenFinished = false;\n\n\t\t/**\n\t\t * Enables smooth interpolation without separate clips for start, loop and end.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.zeroSlopeAtStart = true;\n\n\t\t/**\n\t\t * Enables smooth interpolation without separate clips for start, loop and end.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.zeroSlopeAtEnd = true;\n\n\t}\n\n\t/**\n\t * Starts the playback of the animation.\n\t *\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Stops the playback of the animation.\n\t *\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\t/**\n\t * Resets the playback of the animation.\n\t *\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = -1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\t/**\n\t * Returns `true` if the animation is running.\n\t *\n\t * @return {boolean} Whether the animation is running or not.\n\t */\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t/**\n\t * Returns `true` when {@link AnimationAction#play} has been called.\n\t *\n\t * @return {boolean} Whether the animation is scheduled or not.\n\t */\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\t/**\n\t * Defines the time when the animation should start.\n\t *\n\t * @param {number} time - The start time in seconds.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Configures the loop settings for this action.\n\t *\n\t * @param {(LoopRepeat|LoopOnce|LoopPingPong)} mode - The loop mode.\n\t * @param {number} repetitions - The number of repetitions.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the effective weight of this action.\n\t *\n\t * An action has no effect and thus an effective weight of zero when the\n\t * action is disabled.\n\t *\n\t * @param {number} weight - The weight to set.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t/**\n\t * Returns the effective weight of this action.\n\t *\n\t * @return {number} The effective weight.\n\t */\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\t/**\n\t * Fades the animation in by increasing its weight gradually from `0` to `1`,\n\t * within the passed time interval.\n\t *\n\t * @param {number} duration - The duration of the fade.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\t/**\n\t * Fades the animation out by decreasing its weight gradually from `1` to `0`,\n\t * within the passed time interval.\n\t *\n\t * @param {number} duration - The duration of the fade.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\t/**\n\t * Causes this action to fade in and the given action to fade out,\n\t * within the passed time interval.\n\t *\n\t * @param {AnimationAction} fadeOutAction - The animation action to fade out.\n\t * @param {number} duration - The duration of the fade.\n\t * @param {boolean} [warp=false] - Whether warping should be used or not.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tcrossFadeFrom( fadeOutAction, duration, warp = false ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp === true ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Causes this action to fade out and the given action to fade in,\n\t * within the passed time interval.\n\t *\n\t * @param {AnimationAction} fadeInAction - The animation action to fade in.\n\t * @param {number} duration - The duration of the fade.\n\t * @param {boolean} [warp=false] - Whether warping should be used or not.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tcrossFadeTo( fadeInAction, duration, warp = false ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\t/**\n\t * Stops any fading which is applied to this action.\n\t *\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the effective time scale of this action.\n\t *\n\t * An action has no effect and thus an effective time scale of zero when the\n\t * action is paused.\n\t *\n\t * @param {number} timeScale - The time scale to set.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t/**\n\t * Returns the effective time scale of this action.\n\t *\n\t * @return {number} The effective time scale.\n\t */\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\t/**\n\t * Sets the duration for a single loop of this action.\n\t *\n\t * @param {number} duration - The duration to set.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t/**\n\t * Synchronizes this action with the passed other action.\n\t *\n\t * @param {AnimationAction} action - The action to sync with.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t/**\n\t * Decelerates this animation's speed to `0` within the passed time interval.\n\t *\n\t * @param {number} duration - The duration.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\t/**\n\t * Changes the playback speed, within the passed time interval, by modifying\n\t * {@link AnimationAction#timeScale} gradually from `startTimeScale` to\n\t * `endTimeScale`.\n\t *\n\t * @param {number} startTimeScale - The start time scale.\n\t * @param {number} endTimeScale - The end time scale.\n\t * @param {number} duration - The duration.\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Stops any scheduled warping which is applied to this action.\n\t *\n\t * @return {AnimationAction} A reference to this animation action.\n\t */\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the animation mixer of this animation action.\n\t *\n\t * @return {AnimationMixer} The animation mixer.\n\t */\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\t/**\n\t * Returns the animation clip of this animation action.\n\t *\n\t * @return {AnimationClip} The animation clip.\n\t */\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\t/**\n\t * Returns the root object of this animation action.\n\t *\n\t * @return {Object3D} The root object.\n\t */\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Internal\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === -1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === -1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? -1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === -1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : -1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis._loopCount = loopCount;\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n/**\n * `AnimationMixer` is a player for animations on a particular object in\n * the scene. When multiple objects in the scene are animated independently,\n * one `AnimationMixer` may be used for each object.\n */\nclass AnimationMixer extends EventDispatcher {\n\n\t/**\n\t * Constructs a new animation mixer.\n\t *\n\t * @param {Object3D} root - The object whose animations shall be played by this mixer.\n\t */\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\n\t\t/**\n\t\t * The global mixer time (in seconds; starting with `0` on the mixer's creation).\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.time = 0;\n\n\t\t/**\n\t\t * A scaling factor for the global time.\n\t\t *\n\t\t * Note: Setting this member to `0` and later back to `1` is a\n\t\t * possibility to pause/unpause all actions that are controlled by this\n\t\t * mixer.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.timeScale = 1.0;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t/**\n\t * Returns an instance of {@link AnimationAction} for the passed clip.\n\t *\n\t * If an action fitting the clip and root parameters doesn't yet exist, it\n\t * will be created by this method. Calling this method several times with the\n\t * same clip and root parameters always returns the same action.\n\t *\n\t * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.\n\t * @param {Object3D} [optionalRoot] - An alternative root object.\n\t * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode.\n\t * @return {?AnimationAction} The animation action.\n\t */\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t/**\n\t * Returns an existing animation action for the passed clip.\n\t *\n\t * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.\n\t * @param {Object3D} [optionalRoot] - An alternative root object.\n\t * @return {?AnimationAction} The animation action. Returns `null` if no action was found.\n\t */\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t/**\n\t * Deactivates all previously scheduled actions on this mixer.\n\t *\n\t * @return {AnimationMixer} A reference to this animation mixer.\n\t */\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Advances the global mixer time and updates the animation.\n\t *\n\t * This is usually done in the render loop by passing the delta\n\t * time from {@link Clock} or {@link Timer}.\n\t *\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @return {AnimationMixer} A reference to this animation mixer.\n\t */\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the global mixer to a specific time and updates the animation accordingly.\n\t *\n\t * This is useful when you need to jump to an exact time in an animation. The\n\t * input parameter will be scaled by {@link AnimationMixer#timeScale}\n\t *\n\t * @param {number} time - The time to set in seconds.\n\t * @return {AnimationMixer} A reference to this animation mixer.\n\t */\n\tsetTime( time ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( time ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t/**\n\t * Returns this mixer's root object.\n\t *\n\t * @return {Object3D} The mixer's root object.\n\t */\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t/**\n\t * Deallocates all memory resources for a clip. Before using this method make\n\t * sure to call {@link AnimationAction#stop} for all related actions.\n\t *\n\t * @param {AnimationClip} clip - The clip to uncache.\n\t */\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Deallocates all memory resources for a root object. Before using this\n\t * method make sure to call {@link AnimationAction#stop} for all related\n\t * actions or alternatively {@link AnimationMixer#stopAllAction} when the\n\t * mixer operates on a single root.\n\t *\n\t * @param {Object3D} root - The root object to uncache.\n\t */\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Deallocates all memory resources for an action. The action is identified by the\n\t * given clip and an optional root object. Before using this method make\n\t * sure to call {@link AnimationAction#stop} to deactivate the action.\n\t *\n\t * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.\n\t * @param {Object3D} [optionalRoot] - An alternative root object.\n\t */\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Represents a 3D render target.\n *\n * @augments RenderTarget\n */\nclass RenderTarget3D extends RenderTarget {\n\n\t/**\n\t * Constructs a new 3D render target.\n\t *\n\t * @param {number} [width=1] - The width of the render target.\n\t * @param {number} [height=1] - The height of the render target.\n\t * @param {number} [depth=1] - The height of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isRenderTarget3D = true;\n\n\t\tthis.depth = depth;\n\n\t\t/**\n\t\t * Overwritten with a different texture type.\n\t\t *\n\t\t * @type {Data3DTexture}\n\t\t */\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\t\tthis._setTextureOptions( options );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\n/**\n * Represents a uniform which is a global shader variable. They are passed to shader programs.\n *\n * When declaring a uniform of a {@link ShaderMaterial}, it is declared by value or by object.\n * ```js\n * uniforms: {\n * \ttime: { value: 1.0 },\n * \tresolution: new Uniform( new Vector2() )\n * };\n * ```\n * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported\n * in {@link WebGLRenderer}.\n */\nclass Uniform {\n\n\t/**\n\t * Constructs a new uniform.\n\t *\n\t * @param {any} value - The uniform value.\n\t */\n\tconstructor( value ) {\n\n\t\t/**\n\t\t * The uniform value.\n\t\t *\n\t\t * @type {any}\n\t\t */\n\t\tthis.value = value;\n\n\t}\n\n\t/**\n\t * Returns a new uniform with copied values from this instance.\n\t * If the value has a `clone()` method, the value is cloned as well.\n\t *\n\t * @return {Uniform} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet _id = 0;\n\n/**\n * A class for managing multiple uniforms in a single group. The renderer will process\n * such a definition as a single UBO.\n *\n * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported\n * in {@link WebGLRenderer}.\n *\n * @augments EventDispatcher\n */\nclass UniformsGroup extends EventDispatcher {\n\n\t/**\n\t * Constructs a new uniforms group.\n\t */\n\tconstructor() {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isUniformsGroup = true;\n\n\t\t/**\n\t\t * The ID of the 3D object.\n\t\t *\n\t\t * @name UniformsGroup#id\n\t\t * @type {number}\n\t\t * @readonly\n\t\t */\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\t/**\n\t\t * The name of the uniforms group.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The buffer usage.\n\t\t *\n\t\t * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)}\n\t\t * @default StaticDrawUsage\n\t\t */\n\t\tthis.usage = StaticDrawUsage;\n\n\t\t/**\n\t\t * An array holding the uniforms.\n\t\t *\n\t\t * @type {Array<Uniform>}\n\t\t */\n\t\tthis.uniforms = [];\n\n\t}\n\n\t/**\n\t * Adds the given uniform to this uniforms group.\n\t *\n\t * @param {Uniform} uniform - The uniform to add.\n\t * @return {UniformsGroup} A reference to this uniforms group.\n\t */\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Removes the given uniform from this uniforms group.\n\t *\n\t * @param {Uniform} uniform - The uniform to remove.\n\t * @return {UniformsGroup} A reference to this uniforms group.\n\t */\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== -1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the name of this uniforms group.\n\t *\n\t * @param {string} name - The name to set.\n\t * @return {UniformsGroup} A reference to this uniforms group.\n\t */\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the usage of this uniforms group.\n\t *\n\t * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set.\n\t * @return {UniformsGroup} A reference to this uniforms group.\n\t */\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t *\n\t * @fires Texture#dispose\n\t */\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\t/**\n\t * Copies the values of the given uniforms group to this instance.\n\t *\n\t * @param {UniformsGroup} source - The uniforms group to copy.\n\t * @return {UniformsGroup} A reference to this uniforms group.\n\t */\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new uniforms group with copied values from this instance.\n\t *\n\t * @return {UniformsGroup} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * An instanced version of an interleaved buffer.\n *\n * @augments InterleavedBuffer\n */\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\t/**\n\t * Constructs a new instanced interleaved buffer.\n\t *\n\t * @param {TypedArray} array - A typed array with a shared buffer storing attribute data.\n\t * @param {number} stride - The number of typed-array elements per vertex.\n\t * @param {number} [meshPerAttribute=1] - Defines how often a value of this interleaved buffer should be repeated.\n\t */\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\t/**\n\t\t * Defines how often a value of this buffer attribute should be repeated,\n\t\t * see {@link InstancedBufferAttribute#meshPerAttribute}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\n/**\n * An alternative version of a buffer attribute with more control over the VBO.\n *\n * The renderer does not construct a VBO for this kind of attribute. Instead, it uses\n * whatever VBO is passed in constructor and can later be altered via the `buffer` property.\n *\n * The most common use case for this class is when some kind of GPGPU calculation interferes\n * or even produces the VBOs in question.\n *\n * Notice that this class can only be used with {@link WebGLRenderer}.\n */\nclass GLBufferAttribute {\n\n\t/**\n\t * Constructs a new GL buffer attribute.\n\t *\n\t * @param {WebGLBuffer} buffer - The native WebGL buffer.\n\t * @param {number} type - The native data type (e.g. `gl.FLOAT`).\n\t * @param {number} itemSize - The item size.\n\t * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter.\n\t * @param {number} count - The expected number of vertices in VBO.\n\t * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n\t */\n\tconstructor( buffer, type, itemSize, elementSize, count, normalized = false ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isGLBufferAttribute = true;\n\n\t\t/**\n\t\t * The name of the buffer attribute.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = '';\n\n\t\t/**\n\t\t * The native WebGL buffer.\n\t\t *\n\t\t * @type {WebGLBuffer}\n\t\t */\n\t\tthis.buffer = buffer;\n\n\t\t/**\n\t\t * The native data type.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.type = type;\n\n\t\t/**\n\t\t * The item size, see {@link BufferAttribute#itemSize}.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.itemSize = itemSize;\n\n\t\t/**\n\t\t * The corresponding size (in bytes) for the given `type` parameter.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.elementSize = elementSize;\n\n\t\t/**\n\t\t * The expected number of vertices in VBO.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.count = count;\n\n\t\t/**\n\t\t * Applies to integer data only. Indicates how the underlying data in the buffer maps to\n\t\t * the values in the GLSL code. For instance, if `buffer` contains data of `gl.UNSIGNED_SHORT`,\n\t\t * and `normalized` is `true`, the values `0 - +65535` in the buffer data will be mapped to\n\t\t * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted\n\t\t * to floats unmodified, i.e. `65535` becomes `65535.0f`.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tthis.normalized = normalized;\n\n\t\t/**\n\t\t * A version number, incremented every time the `needsUpdate` is set to `true`.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.version = 0;\n\n\t}\n\n\t/**\n\t * Flag to indicate that this attribute has changed and should be re-sent to\n\t * the GPU. Set this to `true` when you modify the value of the array.\n\t *\n\t * @type {number}\n\t * @default false\n\t * @param {boolean} value\n\t */\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\t/**\n\t * Sets the given native WebGL buffer.\n\t *\n\t * @param {WebGLBuffer} buffer - The buffer to set.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given native data type and element size.\n\t *\n\t * @param {number} type - The native data type (e.g. `gl.FLOAT`).\n\t * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the item size.\n\t *\n\t * @param {number} itemSize - The item size.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the count (the expected number of vertices in VBO).\n\t *\n\t * @param {number} count - The count.\n\t * @return {BufferAttribute} A reference to this instance.\n\t */\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\n\n/**\n * This class is designed to assist with raycasting. Raycasting is used for\n * mouse picking (working out what objects in the 3d space the mouse is over)\n * amongst other things.\n */\nclass Raycaster {\n\n\t/**\n\t * Constructs a new raycaster.\n\t *\n\t * @param {Vector3} origin - The origin vector where the ray casts from.\n\t * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray.\n\t * @param {number} [near=0] - All results returned are further away than near. Near can't be negative.\n\t * @param {number} [far=Infinity] - All results returned are closer than far. Far can't be lower than near.\n\t */\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\t/**\n\t\t * The ray used for raycasting.\n\t\t *\n\t\t * @type {Ray}\n\t\t */\n\t\tthis.ray = new Ray( origin, direction );\n\n\t\t/**\n\t\t * All results returned are further away than near. Near can't be negative.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.near = near;\n\n\t\t/**\n\t\t * All results returned are closer than far. Far can't be lower than near.\n\t\t *\n\t\t * @type {number}\n\t\t * @default Infinity\n\t\t */\n\t\tthis.far = far;\n\n\t\t/**\n\t\t * The camera to use when raycasting against view-dependent objects such as\n\t\t * billboarded objects like sprites. This field can be set manually or\n\t\t * is set when calling `setFromCamera()`.\n\t\t *\n\t\t * @type {?Camera}\n\t\t * @default null\n\t\t */\n\t\tthis.camera = null;\n\n\t\t/**\n\t\t * Allows to selectively ignore 3D objects when performing intersection tests.\n\t\t * The following code example ensures that only 3D objects on layer `1` will be\n\t\t * honored by raycaster.\n\t\t * ```js\n\t\t * raycaster.layers.set( 1 );\n\t\t * object.layers.enable( 1 );\n\t\t * ```\n\t\t *\n\t\t * @type {Layers}\n\t\t */\n\t\tthis.layers = new Layers();\n\n\n\t\t/**\n\t\t * A parameter object that configures the raycasting. It has the structure:\n\t\t *\n\t\t * ```\n\t\t * {\n\t\t * \tMesh: {},\n\t\t * \tLine: { threshold: 1 },\n\t\t * \tLOD: {},\n\t\t * \tPoints: { threshold: 1 },\n\t\t * \tSprite: {}\n\t\t * }\n\t\t * ```\n\t\t * Where `threshold` is the precision of the raycaster when intersecting objects, in world units.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\t/**\n\t * Updates the ray with a new origin and direction by copying the values from the arguments.\n\t *\n\t * @param {Vector3} origin - The origin vector where the ray casts from.\n\t * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray.\n\t */\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\t/**\n\t * Uses the given coordinates and camera to compute a new origin and direction for the internal ray.\n\t *\n\t * @param {Vector2} coords - 2D coordinates of the mouse, in normalized device coordinates (NDC).\n\t * X and Y components should be between `-1` and `1`.\n\t * @param {Camera} camera - The camera from which the ray should originate.\n\t */\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, -1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\terror( 'Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Uses the given WebXR controller to compute a new origin and direction for the internal ray.\n\t *\n\t * @param {WebXRController} controller - The controller to copy the position and direction from.\n\t * @return {Raycaster} A reference to this raycaster.\n\t */\n\tsetFromXRController( controller ) {\n\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\n\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\n\t\tthis.ray.direction.set( 0, 0, -1 ).applyMatrix4( _matrix );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The intersection point of a raycaster intersection test.\n\t * @typedef {Object} Raycaster~Intersection\n\t * @property {number} distance - The distance from the ray's origin to the intersection point.\n\t * @property {number} distanceToRay - Some 3D objects e.g. {@link Points} provide the distance of the\n\t * intersection to the nearest point on the ray. For other objects it will be `undefined`.\n\t * @property {Vector3} point - The intersection point, in world coordinates.\n\t * @property {Object} face - The face that has been intersected.\n\t * @property {number} faceIndex - The face index.\n\t * @property {Object3D} object - The 3D object that has been intersected.\n\t * @property {Vector2} uv - U,V coordinates at point of intersection.\n\t * @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection.\n\t * @property {Vector3} normal - Interpolated normal vector at point of intersection.\n\t * @property {number} instanceId - The index number of the instance where the ray\n\t * intersects the {@link InstancedMesh}.\n\t */\n\n\t/**\n\t * Checks all intersection between the ray and the object with or without the\n\t * descendants. Intersections are returned sorted by distance, closest first.\n\t *\n\t * `Raycaster` delegates to the `raycast()` method of the passed 3D object, when\n\t * evaluating whether the ray intersects the object or not. This allows meshes to respond\n\t * differently to ray casting than lines or points.\n\t *\n\t * Note that for meshes, faces must be pointed towards the origin of the ray in order\n\t * to be detected; intersections of the ray passing through the back of a face will not\n\t * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side}\n\t * to `THREE.DoubleSide`.\n\t *\n\t * @param {Object3D} object - The 3D object to check for intersection with the ray.\n\t * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.\n\t * Otherwise it only checks intersection with the object.\n\t * @param {Array<Raycaster~Intersection>} [intersects=[]] The target array that holds the result of the method.\n\t * @return {Array<Raycaster~Intersection>} An array holding the intersection points.\n\t */\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersect( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\t/**\n\t * Checks all intersection between the ray and the objects with or without\n\t * the descendants. Intersections are returned sorted by distance, closest first.\n\t *\n\t * @param {Array<Object3D>} objects - The 3D objects to check for intersection with the ray.\n\t * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.\n\t * Otherwise it only checks intersection with the object.\n\t * @param {Array<Raycaster~Intersection>} [intersects=[]] The target array that holds the result of the method.\n\t * @return {Array<Raycaster~Intersection>} An array holding the intersection points.\n\t */\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersect( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersect( object, raycaster, intersects, recursive ) {\n\n\tlet propagate = true;\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tconst result = object.raycast( raycaster, intersects );\n\n\t\tif ( result === false ) propagate = false;\n\n\t}\n\n\tif ( propagate === true && recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersect( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Class for keeping track of time.\n *\n * @deprecated since r183.\n */\nclass Clock {\n\n\t/**\n\t * Constructs a new clock.\n\t *\n\t * @deprecated since 183.\n\t * @param {boolean} [autoStart=true] - Whether to automatically start the clock when\n\t * `getDelta()` is called for the first time.\n\t */\n\tconstructor( autoStart = true ) {\n\n\t\t/**\n\t\t * If set to `true`, the clock starts automatically when `getDelta()` is called\n\t\t * for the first time.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoStart = autoStart;\n\n\t\t/**\n\t\t * Holds the time at which the clock's `start()` method was last called.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.startTime = 0;\n\n\t\t/**\n\t\t * Holds the time at which the clock's `start()`, `getElapsedTime()` or\n\t\t * `getDelta()` methods were last called.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.oldTime = 0;\n\n\t\t/**\n\t\t * Keeps track of the total time that the clock has been running.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.elapsedTime = 0;\n\n\t\t/**\n\t\t * Whether the clock is running or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.running = false;\n\n\t\twarn( 'Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183\n\n\t}\n\n\t/**\n\t * Starts the clock. When `autoStart` is set to `true`, the method is automatically\n\t * called by the class.\n\t */\n\tstart() {\n\n\t\tthis.startTime = performance.now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\t/**\n\t * Stops the clock.\n\t */\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\t/**\n\t * Returns the elapsed time in seconds.\n\t *\n\t * @return {number} The elapsed time.\n\t */\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\t/**\n\t * Returns the delta time in seconds.\n\t *\n\t * @return {number} The delta time.\n\t */\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = performance.now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\n/**\n * This class can be used to represent points in 3D space as\n * [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system).\n */\nclass Spherical {\n\n\t/**\n\t * Constructs a new spherical.\n\t *\n\t * @param {number} [radius=1] - The radius, or the Euclidean distance (straight-line distance) from the point to the origin.\n\t * @param {number} [phi=0] - The polar angle in radians from the y (up) axis.\n\t * @param {number} [theta=0] - The equator/azimuthal angle in radians around the y (up) axis.\n\t */\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\t/**\n\t\t * The radius, or the Euclidean distance (straight-line distance) from the point to the origin.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.radius = radius;\n\n\t\t/**\n\t\t * The polar angle in radians from the y (up) axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.phi = phi;\n\n\t\t/**\n\t\t * The equator/azimuthal angle in radians around the y (up) axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.theta = theta;\n\n\t}\n\n\t/**\n\t * Sets the spherical components by copying the given values.\n\t *\n\t * @param {number} radius - The radius.\n\t * @param {number} phi - The polar angle.\n\t * @param {number} theta - The azimuthal angle.\n\t * @return {Spherical} A reference to this spherical.\n\t */\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given spherical to this instance.\n\t *\n\t * @param {Spherical} other - The spherical to copy.\n\t * @return {Spherical} A reference to this spherical.\n\t */\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Restricts the polar angle [page:.phi phi] to be between `0.000001` and pi -\n\t * `0.000001`.\n\t *\n\t * @return {Spherical} A reference to this spherical.\n\t */\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = clamp( this.phi, EPS, Math.PI - EPS );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the spherical components from the given vector which is assumed to hold\n\t * Cartesian coordinates.\n\t *\n\t * @param {Vector3} v - The vector to set.\n\t * @return {Spherical} A reference to this spherical.\n\t */\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\t/**\n\t * Sets the spherical components from the given Cartesian coordinates.\n\t *\n\t * @param {number} x - The x value.\n\t * @param {number} y - The y value.\n\t * @param {number} z - The z value.\n\t * @return {Spherical} A reference to this spherical.\n\t */\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, -1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new spherical with copied values from this instance.\n\t *\n\t * @return {Spherical} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * This class can be used to represent points in 3D space as\n * [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system).\n */\nclass Cylindrical {\n\n\t/**\n\t * Constructs a new cylindrical.\n\t *\n\t * @param {number} [radius=1] - The distance from the origin to a point in the x-z plane.\n\t * @param {number} [theta=0] - A counterclockwise angle in the x-z plane measured in radians from the positive z-axis.\n\t * @param {number} [y=0] - The height above the x-z plane.\n\t */\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\t/**\n\t\t * The distance from the origin to a point in the x-z plane.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.radius = radius;\n\n\t\t/**\n\t\t * A counterclockwise angle in the x-z plane measured in radians from the positive z-axis.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.theta = theta;\n\n\t\t/**\n\t\t * The height above the x-z plane.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 0\n\t\t */\n\t\tthis.y = y;\n\n\t}\n\n\t/**\n\t * Sets the cylindrical components by copying the given values.\n\t *\n\t * @param {number} radius - The radius.\n\t * @param {number} theta - The theta angle.\n\t * @param {number} y - The height value.\n\t * @return {Cylindrical} A reference to this cylindrical.\n\t */\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given cylindrical to this instance.\n\t *\n\t * @param {Cylindrical} other - The cylindrical to copy.\n\t * @return {Cylindrical} A reference to this cylindrical.\n\t */\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the cylindrical components from the given vector which is assumed to hold\n\t * Cartesian coordinates.\n\t *\n\t * @param {Vector3} v - The vector to set.\n\t * @return {Cylindrical} A reference to this cylindrical.\n\t */\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\t/**\n\t * Sets the cylindrical components from the given Cartesian coordinates.\n\t *\n\t * @param {number} x - The x value.\n\t * @param {number} y - The x value.\n\t * @param {number} z - The x value.\n\t * @return {Cylindrical} A reference to this cylindrical.\n\t */\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new cylindrical with copied values from this instance.\n\t *\n\t * @return {Cylindrical} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Represents a 2x2 matrix.\n *\n * A Note on Row-Major and Column-Major Ordering:\n *\n * The constructor and {@link Matrix2#set} method take arguments in\n * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)\n * order, while internally they are stored in the {@link Matrix2#elements} array in column-major order.\n * This means that calling:\n * ```js\n * const m = new THREE.Matrix2();\n * m.set( 11, 12,\n * 21, 22 );\n * ```\n * will result in the elements array containing:\n * ```js\n * m.elements = [ 11, 21,\n * 12, 22 ];\n * ```\n * and internally all calculations are performed using column-major ordering.\n * However, as the actual ordering makes no difference mathematically and\n * most people are used to thinking about matrices in row-major order, the\n * three.js documentation shows matrices in row-major order. Just bear in\n * mind that if you are reading the source code, you'll have to take the\n * transpose of any matrices outlined here to make sense of the calculations.\n */\nclass Matrix2 {\n\n\tstatic {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tMatrix2.prototype.isMatrix2 = true;\n\n\t}\n\n\t/**\n\t * Constructs a new 2x2 matrix. The arguments are supposed to be\n\t * in row-major order. If no arguments are provided, the constructor\n\t * initializes the matrix as an identity matrix.\n\t *\n\t * @param {number} [n11] - 1-1 matrix element.\n\t * @param {number} [n12] - 1-2 matrix element.\n\t * @param {number} [n21] - 2-1 matrix element.\n\t * @param {number} [n22] - 2-2 matrix element.\n\t */\n\tconstructor( n11, n12, n21, n22 ) {\n\n\t\t/**\n\t\t * A column-major list of matrix values.\n\t\t *\n\t\t * @type {Array<number>}\n\t\t */\n\t\tthis.elements = [\n\t\t\t1, 0,\n\t\t\t0, 1,\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n21, n22 );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets this matrix to the 2x2 identity matrix.\n\t *\n\t * @return {Matrix2} A reference to this matrix.\n\t */\n\tidentity() {\n\n\t\tthis.set(\n\t\t\t1, 0,\n\t\t\t0, 1,\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix from the given array.\n\t *\n\t * @param {Array<number>} array - The matrix elements in column-major order.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Matrix2} A reference to this matrix.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the elements of the matrix.The arguments are supposed to be\n\t * in row-major order.\n\t *\n\t * @param {number} n11 - 1-1 matrix element.\n\t * @param {number} n12 - 1-2 matrix element.\n\t * @param {number} n21 - 2-1 matrix element.\n\t * @param {number} n22 - 2-2 matrix element.\n\t * @return {Matrix2} A reference to this matrix.\n\t */\n\tset( n11, n12, n21, n22 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 2 ] = n12;\n\t\tte[ 1 ] = n21; te[ 3 ] = n22;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\n/**\n * Represents an axis-aligned bounding box (AABB) in 2D space.\n */\nclass Box2 {\n\n\t/**\n\t * Constructs a new bounding box.\n\t *\n\t * @param {Vector2} [min=(Infinity,Infinity)] - A vector representing the lower boundary of the box.\n\t * @param {Vector2} [max=(-Infinity,-Infinity)] - A vector representing the upper boundary of the box.\n\t */\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isBox2 = true;\n\n\t\t/**\n\t\t * The lower boundary of the box.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.min = min;\n\n\t\t/**\n\t\t * The upper boundary of the box.\n\t\t *\n\t\t * @type {Vector2}\n\t\t */\n\t\tthis.max = max;\n\n\t}\n\n\t/**\n\t * Sets the lower and upper boundaries of this box.\n\t * Please note that this method only copies the values from the given objects.\n\t *\n\t * @param {Vector2} min - The lower boundary of the box.\n\t * @param {Vector2} max - The upper boundary of the box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the upper and lower bounds of this box so it encloses the position data\n\t * in the given array.\n\t *\n\t * @param {Array<Vector2>} points - An array holding 2D position data as instances of {@link Vector2}.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Centers this box on the given center vector and sets this box's width, height and\n\t * depth to the given size values.\n\t *\n\t * @param {Vector2} center - The center of the box.\n\t * @param {Vector2} size - The x and y dimensions of the box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns a new box with copied values from this instance.\n\t *\n\t * @return {Box2} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\t/**\n\t * Copies the values of the given box to this instance.\n\t *\n\t * @param {Box2} box - The box to copy.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Makes this box empty which means in encloses a zero space in 2D.\n\t *\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns true if this box includes zero points within its bounds.\n\t * Note that a box with equal lower and upper bounds still includes one\n\t * point, the one both bounds share.\n\t *\n\t * @return {boolean} Whether this box is empty or not.\n\t */\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\t/**\n\t * Returns the center point of this box.\n\t *\n\t * @param {Vector2} target - The target vector that is used to store the method's result.\n\t * @return {Vector2} The center point.\n\t */\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\t/**\n\t * Returns the dimensions of this box.\n\t *\n\t * @param {Vector2} target - The target vector that is used to store the method's result.\n\t * @return {Vector2} The size.\n\t */\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\t/**\n\t * Expands the boundaries of this box to include the given point.\n\t *\n\t * @param {Vector2} point - The point that should be included by the bounding box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands this box equilaterally by the given vector. The width of this\n\t * box will be expanded by the x component of the vector in both\n\t * directions. The height of this box will be expanded by the y component of\n\t * the vector in both directions.\n\t *\n\t * @param {Vector2} vector - The vector that should expand the bounding box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Expands each dimension of the box by the given scalar. If negative, the\n\t * dimensions of the box will be contracted.\n\t *\n\t * @param {number} scalar - The scalar value that should expand the bounding box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if the given point lies within or on the boundaries of this box.\n\t *\n\t * @param {Vector2} point - The point to test.\n\t * @return {boolean} Whether the bounding box contains the given point or not.\n\t */\n\tcontainsPoint( point ) {\n\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y;\n\n\t}\n\n\t/**\n\t * Returns `true` if this bounding box includes the entirety of the given bounding box.\n\t * If this box and the given one are identical, this function also returns `true`.\n\t *\n\t * @param {Box2} box - The bounding box to test.\n\t * @return {boolean} Whether the bounding box contains the given bounding box or not.\n\t */\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\t/**\n\t * Returns a point as a proportion of this box's width and height.\n\t *\n\t * @param {Vector2} point - A point in 2D space.\n\t * @param {Vector2} target - The target vector that is used to store the method's result.\n\t * @return {Vector2} A point as a proportion of this box's width and height.\n\t */\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\t/**\n\t * Returns `true` if the given bounding box intersects with this bounding box.\n\t *\n\t * @param {Box2} box - The bounding box to test.\n\t * @return {boolean} Whether the given bounding box intersects with this bounding box.\n\t */\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y;\n\n\t}\n\n\t/**\n\t * Clamps the given point within the bounds of this box.\n\t *\n\t * @param {Vector2} point - The point to clamp.\n\t * @param {Vector2} target - The target vector that is used to store the method's result.\n\t * @return {Vector2} The clamped point.\n\t */\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\t/**\n\t * Returns the euclidean distance from any edge of this box to the specified point. If\n\t * the given point lies inside of this box, the distance will be `0`.\n\t *\n\t * @param {Vector2} point - The point to compute the distance to.\n\t * @return {number} The euclidean distance.\n\t */\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\t/**\n\t * Computes the intersection of this bounding box and the given one, setting the upper\n\t * bound of this box to the lesser of the two boxes' upper bounds and the\n\t * lower bound of this box to the greater of the two boxes' lower bounds. If\n\t * there's no overlap, makes this box empty.\n\t *\n\t * @param {Box2} box - The bounding box to intersect with.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Computes the union of this box and another and the given one, setting the upper\n\t * bound of this box to the greater of the two boxes' upper bounds and the\n\t * lower bound of this box to the lesser of the two boxes' lower bounds.\n\t *\n\t * @param {Box2} box - The bounding box that will be unioned with this instance.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given offset to both the upper and lower bounds of this bounding box,\n\t * effectively moving it in 2D space.\n\t *\n\t * @param {Vector2} offset - The offset that should be used to translate the bounding box.\n\t * @return {Box2} A reference to this bounding box.\n\t */\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this bounding box is equal with the given one.\n\t *\n\t * @param {Box2} box - The box to test for equality.\n\t * @return {boolean} Whether this bounding box is equal with the given one.\n\t */\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nconst _d1 = /*@__PURE__*/ new Vector3();\nconst _d2 = /*@__PURE__*/ new Vector3();\nconst _r = /*@__PURE__*/ new Vector3();\nconst _c1 = /*@__PURE__*/ new Vector3();\nconst _c2 = /*@__PURE__*/ new Vector3();\n\n/**\n * An analytical line segment in 3D space represented by a start and end point.\n */\nclass Line3 {\n\n\t/**\n\t * Constructs a new line segment.\n\t *\n\t * @param {Vector3} [start=(0,0,0)] - Start of the line segment.\n\t * @param {Vector3} [end=(0,0,0)] - End of the line segment.\n\t */\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\t/**\n\t\t * Start of the line segment.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.start = start;\n\n\t\t/**\n\t\t * End of the line segment.\n\t\t *\n\t\t * @type {Vector3}\n\t\t */\n\t\tthis.end = end;\n\n\t}\n\n\t/**\n\t * Sets the start and end values by copying the given vectors.\n\t *\n\t * @param {Vector3} start - The start point.\n\t * @param {Vector3} end - The end point.\n\t * @return {Line3} A reference to this line segment.\n\t */\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Copies the values of the given line segment to this instance.\n\t *\n\t * @param {Line3} line - The line segment to copy.\n\t * @return {Line3} A reference to this line segment.\n\t */\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the center of the line segment.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The center point.\n\t */\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\t/**\n\t * Returns the delta vector of the line segment's start and end point.\n\t *\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The delta vector.\n\t */\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\t/**\n\t * Returns the squared Euclidean distance between the line' start and end point.\n\t *\n\t * @return {number} The squared Euclidean distance.\n\t */\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\t/**\n\t * Returns the Euclidean distance between the line' start and end point.\n\t *\n\t * @return {number} The Euclidean distance.\n\t */\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\t/**\n\t * Returns a vector at a certain position along the line segment.\n\t *\n\t * @param {number} t - A value between `[0,1]` to represent a position along the line segment.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The delta vector.\n\t */\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\t/**\n\t * Returns a point parameter based on the closest point as projected on the line segment.\n\t *\n\t * @param {Vector3} point - The point for which to return a point parameter.\n\t * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not.\n\t * @return {number} The point parameter.\n\t */\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\n\t\tif ( startEnd2 === 0 ) return 0;\n\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\t/**\n\t * Returns the closest point on the line for a given point.\n\t *\n\t * @param {Vector3} point - The point to compute the closest point on the line for.\n\t * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not.\n\t * @param {Vector3} target - The target vector that is used to store the method's result.\n\t * @return {Vector3} The closest point on the line.\n\t */\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\t/**\n\t * Returns the closest squared distance between this line segment and the given one.\n\t *\n\t * @param {Line3} line - The line segment to compute the closest squared distance to.\n\t * @param {Vector3} [c1] - The closest point on this line segment.\n\t * @param {Vector3} [c2] - The closest point on the given line segment.\n\t * @return {number} The squared distance between this line segment and the given one.\n\t */\n\tdistanceSqToLine3( line, c1 = _c1, c2 = _c2 ) {\n\n\t\t// from Real-Time Collision Detection by Christer Ericson, chapter 5.1.9\n\n\t\t// Computes closest points C1 and C2 of S1(s)=P1+s*(Q1-P1) and\n\t\t// S2(t)=P2+t*(Q2-P2), returning s and t. Function result is squared\n\t\t// distance between between S1(s) and S2(t)\n\n\t\tconst EPSILON = 1e-8 * 1e-8; // must be squared since we compare squared length\n\t\tlet s, t;\n\n\t\tconst p1 = this.start;\n\t\tconst p2 = line.start;\n\t\tconst q1 = this.end;\n\t\tconst q2 = line.end;\n\n\t\t_d1.subVectors( q1, p1 ); // Direction vector of segment S1\n\t\t_d2.subVectors( q2, p2 ); // Direction vector of segment S2\n\t\t_r.subVectors( p1, p2 );\n\n\t\tconst a = _d1.dot( _d1 ); // Squared length of segment S1, always nonnegative\n\t\tconst e = _d2.dot( _d2 ); // Squared length of segment S2, always nonnegative\n\t\tconst f = _d2.dot( _r );\n\n\t\t// Check if either or both segments degenerate into points\n\n\t\tif ( a <= EPSILON && e <= EPSILON ) {\n\n\t\t\t// Both segments degenerate into points\n\n\t\t\tc1.copy( p1 );\n\t\t\tc2.copy( p2 );\n\n\t\t\tc1.sub( c2 );\n\n\t\t\treturn c1.dot( c1 );\n\n\t\t}\n\n\t\tif ( a <= EPSILON ) {\n\n\t\t\t// First segment degenerates into a point\n\n\t\t\ts = 0;\n\t\t\tt = f / e; // s = 0 => t = (b*s + f) / e = f / e\n\t\t\tt = clamp( t, 0, 1 );\n\n\n\t\t} else {\n\n\t\t\tconst c = _d1.dot( _r );\n\n\t\t\tif ( e <= EPSILON ) {\n\n\t\t\t\t// Second segment degenerates into a point\n\n\t\t\t\tt = 0;\n\t\t\t\ts = clamp( - c / a, 0, 1 ); // t = 0 => s = (b*t - c) / a = -c / a\n\n\t\t\t} else {\n\n\t\t\t\t// The general nondegenerate case starts here\n\n\t\t\t\tconst b = _d1.dot( _d2 );\n\t\t\t\tconst denom = a * e - b * b; // Always nonnegative\n\n\t\t\t\t// If segments not parallel, compute closest point on L1 to L2 and\n\t\t\t\t// clamp to segment S1. Else pick arbitrary s (here 0)\n\n\t\t\t\tif ( denom !== 0 ) {\n\n\t\t\t\t\ts = clamp( ( b * f - c * e ) / denom, 0, 1 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ts = 0;\n\n\t\t\t\t}\n\n\t\t\t\t// Compute point on L2 closest to S1(s) using\n\t\t\t\t// t = Dot((P1 + D1*s) - P2,D2) / Dot(D2,D2) = (b*s + f) / e\n\n\t\t\t\tt = ( b * s + f ) / e;\n\n\t\t\t\t// If t in [0,1] done. Else clamp t, recompute s for the new value\n\t\t\t\t// of t using s = Dot((P2 + D2*t) - P1,D1) / Dot(D1,D1)= (t*b - c) / a\n\t\t\t\t// and clamp s to [0, 1]\n\n\t\t\t\tif ( t < 0 ) {\n\n\t\t\t\t\tt = 0.;\n\t\t\t\t\ts = clamp( - c / a, 0, 1 );\n\n\t\t\t\t} else if ( t > 1 ) {\n\n\t\t\t\t\tt = 1;\n\t\t\t\t\ts = clamp( ( b - c ) / a, 0, 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tc1.copy( p1 ).addScaledVector( _d1, s );\n\t\tc2.copy( p2 ).addScaledVector( _d2, t );\n\n\t\treturn c1.distanceToSquared( c2 );\n\n\t}\n\n\t/**\n\t * Applies a 4x4 transformation matrix to this line segment.\n\t *\n\t * @param {Matrix4} matrix - The transformation matrix.\n\t * @return {Line3} A reference to this line segment.\n\t */\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this line segment is equal with the given one.\n\t *\n\t * @param {Line3} line - The line segment to test for equality.\n\t * @return {boolean} Whether this line segment is equal with the given one.\n\t */\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\t/**\n\t * Returns a new line segment with copied values from this instance.\n\t *\n\t * @return {Line3} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\n/**\n * This displays a cone shaped helper object for a {@link SpotLight}.\n *\n * When the spot light or its target are transformed or light properties are\n * changed, it's necessary to call the `update()` method of the respective helper.\n *\n * ```js\n * const spotLight = new THREE.SpotLight( 0xffffff );\n * spotLight.position.set( 10, 10, 10 );\n * scene.add( spotLight );\n *\n * const spotLightHelper = new THREE.SpotLightHelper( spotLight );\n * scene.add( spotLightHelper );\n * ```\n *\n * @augments Object3D\n */\nclass SpotLightHelper extends Object3D {\n\n\t/**\n\t * Constructs a new spot light helper.\n\t *\n\t * @param {HemisphereLight} light - The light to be visualized.\n\t * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take\n\t * the color of the light.\n\t */\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * The light being visualized.\n\t\t *\n\t\t * @type {SpotLight}\n\t\t */\n\t\tthis.light = light;\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\t/**\n\t\t * The color parameter passed in the constructor.\n\t\t * If not set, the helper will take the color of the light.\n\t\t *\n\t\t * @type {number|Color|string}\n\t\t */\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t-1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, -1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\t/**\n\t * Updates the helper to match the position and direction of the\n\t * light being visualized.\n\t */\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t// update the local matrix based on the parent and light target transforms\n\t\tif ( this.parent ) {\n\n\t\t\tthis.parent.updateWorldMatrix( true );\n\n\t\t\tthis.matrix\n\t\t\t\t.copy( this.parent.matrixWorld )\n\t\t\t\t.invert()\n\t\t\t\t.multiply( this.light.matrixWorld );\n\n\t\t} else {\n\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\n\n\t\t}\n\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n/**\n * A helper object to assist with visualizing a {@link Skeleton}.\n *\n * ```js\n * const helper = new THREE.SkeletonHelper( skinnedMesh );\n * scene.add( helper );\n * ```\n *\n * @augments LineSegments\n */\nclass SkeletonHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new skeleton helper.\n\t *\n\t * @param {Object3D} object - Usually an instance of {@link SkinnedMesh}. However, any 3D object\n\t * can be used if it represents a hierarchy of bones (see {@link Bone}).\n\t */\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( 0, 0, 0 );\n\t\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\t/**\n\t\t * The object being visualized.\n\t\t *\n\t\t * @type {Object3D}\n\t\t */\n\t\tthis.root = object;\n\n\t\t/**\n\t\t * The list of bones that the helper visualizes.\n\t\t *\n\t\t * @type {Array<Bone>}\n\t\t */\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\t// colors\n\n\t\tconst color1 = new Color( 0x0000ff );\n\t\tconst color2 = new Color( 0x00ff00 );\n\n\t\tthis.setColors( color1, color2 );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\t/**\n\t * Defines the colors of the helper.\n\t *\n\t * @param {Color} color1 - The first line color for each bone.\n\t * @param {Color} color2 - The second line color for each bone.\n\t * @return {SkeletonHelper} A reference to this helper.\n\t */\n\tsetColors( color1, color2 ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\tfor ( let i = 0; i < colorAttribute.count; i += 2 ) {\n\n\t\t\tcolorAttribute.setXYZ( i, color1.r, color1.g, color1.b );\n\t\t\tcolorAttribute.setXYZ( i + 1, color2.r, color2.g, color2.b );\n\n\t\t}\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push( ...getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\n/**\n * This displays a helper object consisting of a spherical mesh for\n * visualizing an instance of {@link PointLight}.\n *\n * ```js\n * const pointLight = new THREE.PointLight( 0xff0000, 1, 100 );\n * pointLight.position.set( 10, 10, 10 );\n * scene.add( pointLight );\n *\n * const sphereSize = 1;\n * const pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize );\n * scene.add( pointLightHelper );\n * ```\n *\n * @augments Mesh\n */\nclass PointLightHelper extends Mesh {\n\n\t/**\n\t * Constructs a new point light helper.\n\t *\n\t * @param {PointLight} light - The light to be visualized.\n\t * @param {number} [sphereSize=1] - The size of the sphere helper.\n\t * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take\n\t * the color of the light.\n\t */\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\t/**\n\t\t * The light being visualized.\n\t\t *\n\t\t * @type {PointLight}\n\t\t */\n\t\tthis.light = light;\n\n\t\t/**\n\t\t * The color parameter passed in the constructor.\n\t\t * If not set, the helper will take the color of the light.\n\t\t *\n\t\t * @type {number|Color|string}\n\t\t */\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\t/**\n\t * Updates the helper to match the position of the\n\t * light being visualized.\n\t */\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\n/**\n * Creates a visual aid consisting of a spherical mesh for a\n * given {@link HemisphereLight}.\n *\n * When the hemisphere light is transformed or its light properties are changed,\n * it's necessary to call the `update()` method of the respective helper.\n *\n * ```js\n * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );\n * const helper = new THREE.HemisphereLightHelper( light, 5 );\n * scene.add( helper );\n * ```\n *\n * @augments Object3D\n */\nclass HemisphereLightHelper extends Object3D {\n\n\t/**\n\t * Constructs a new hemisphere light helper.\n\t *\n\t * @param {HemisphereLight} light - The light to be visualized.\n\t * @param {number} [size=1] - The size of the mesh used to visualize the light.\n\t * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take\n\t * the color of the light.\n\t */\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * The light being visualized.\n\t\t *\n\t\t * @type {HemisphereLight}\n\t\t */\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\t/**\n\t\t * The color parameter passed in the constructor.\n\t\t * If not set, the helper will take the color of the light.\n\t\t *\n\t\t * @type {number|Color|string}\n\t\t */\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\t/**\n\t * Updates the helper to match the position and direction of the\n\t * light being visualized.\n\t */\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\n/**\n * The helper is an object to define grids. Grids are two-dimensional\n * arrays of lines.\n *\n * ```js\n * const size = 10;\n * const divisions = 10;\n *\n * const gridHelper = new THREE.GridHelper( size, divisions );\n * scene.add( gridHelper );\n * ```\n *\n * @augments LineSegments\n */\nclass GridHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new grid helper.\n\t *\n\t * @param {number} [size=10] - The size of the grid.\n\t * @param {number} [divisions=10] - The number of divisions across the grid.\n\t * @param {number|Color|string} [color1=0x444444] - The color of the center line.\n\t * @param {number|Color|string} [color2=0x888888] - The color of the lines of the grid.\n\t */\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n/**\n * This helper is an object to define polar grids. Grids are\n * two-dimensional arrays of lines.\n *\n * ```js\n * const radius = 10;\n * const sectors = 16;\n * const rings = 8;\n * const divisions = 64;\n *\n * const helper = new THREE.PolarGridHelper( radius, sectors, rings, divisions );\n * scene.add( helper );\n * ```\n *\n * @augments LineSegments\n */\nclass PolarGridHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new polar grid helper.\n\t *\n\t * @param {number} [radius=10] - The radius of the polar grid. This can be any positive number.\n\t * @param {number} [sectors=16] - The number of sectors the grid will be divided into. This can be any positive integer.\n\t * @param {number} [rings=16] - The number of rings. This can be any positive integer.\n\t * @param {number} [divisions=64] - The number of line segments used for each circle. This can be any positive integer.\n\t * @param {number|Color|string} [color1=0x444444] - The first color used for grid elements.\n\t * @param {number|Color|string} [color2=0x888888] - The second color used for grid elements.\n\t */\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\n/**\n * Helper object to assist with visualizing a {@link DirectionalLight}'s\n * effect on the scene. This consists of a plane and a line representing the\n * light's position and direction.\n *\n * When the directional light or its target are transformed or light properties\n * are changed, it's necessary to call the `update()` method of the respective helper.\n *\n * ```js\n * const light = new THREE.DirectionalLight( 0xFFFFFF );\n * scene.add( light );\n *\n * const helper = new THREE.DirectionalLightHelper( light, 5 );\n * scene.add( helper );\n * ```\n *\n * @augments Object3D\n */\nclass DirectionalLightHelper extends Object3D {\n\n\t/**\n\t * Constructs a new directional light helper.\n\t *\n\t * @param {DirectionalLight} light - The light to be visualized.\n\t * @param {number} [size=1] - The dimensions of the plane.\n\t * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take\n\t * the color of the light.\n\t */\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * The light being visualized.\n\t\t *\n\t\t * @type {DirectionalLight}\n\t\t */\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\t/**\n\t\t * The color parameter passed in the constructor.\n\t\t * If not set, the helper will take the color of the light.\n\t\t *\n\t\t * @type {number|Color|string}\n\t\t */\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\t/**\n\t\t * Contains the line showing the location of the directional light.\n\t\t *\n\t\t * @type {Line}\n\t\t */\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\t/**\n\t\t * Represents the target line of the directional light.\n\t\t *\n\t\t * @type {Line}\n\t\t */\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\t/**\n\t * Updates the helper to match the position and direction of the\n\t * light being visualized.\n\t */\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n * This helps with visualizing what a camera contains in its frustum. It\n * visualizes the frustum of a camera using a line segments.\n *\n * Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html).\n *\n * `CameraHelper` must be a child of the scene.\n *\n * When the camera is transformed or its projection matrix is changed, it's necessary\n * to call the `update()` method of the respective helper.\n *\n * ```js\n * const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );\n * const helper = new THREE.CameraHelper( camera );\n * scene.add( helper );\n * ```\n *\n * @augments LineSegments\n */\nclass CameraHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new arrow helper.\n\t *\n\t * @param {Camera} camera - The camera to visualize.\n\t */\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\t/**\n\t\t * The camera being visualized.\n\t\t *\n\t\t * @type {Camera}\n\t\t */\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\t/**\n\t\t * This contains the points used to visualize the camera.\n\t\t *\n\t\t * @type {Object<string,Array<number>>}\n\t\t */\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\t/**\n\t * Defines the colors of the helper.\n\t *\n\t * @param {Color} frustum - The frustum line color.\n\t * @param {Color} cone - The cone line color.\n\t * @param {Color} up - The up line color.\n\t * @param {Color} target - The target line color.\n\t * @param {Color} cross - The cross line color.\n\t * @return {CameraHelper} A reference to this helper.\n\t */\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Updates the helper based on the projection matrix of the camera.\n\t */\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\tlet nearZ, farZ;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// Adjust z values based on coordinate system\n\n\t\tif ( this.camera.reversedDepth === true ) {\n\n\t\t\tnearZ = 1;\n\t\t\tfarZ = 0;\n\n\t\t} else {\n\n\t\t\tif ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tnearZ = -1;\n\t\t\t\tfarZ = 1;\n\n\t\t\t} else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tnearZ = 0;\n\t\t\t\tfarZ = 1;\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\t// center / target\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, farZ );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, farZ );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, farZ );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, farZ );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, nearZ );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, nearZ );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, nearZ );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, farZ );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, farZ );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, farZ );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, farZ );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, nearZ );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, nearZ );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\n/**\n * Helper object to graphically show the world-axis-aligned bounding box\n * around an object. The actual bounding box is handled with {@link Box3},\n * this is just a visual helper for debugging. It can be automatically\n * resized with {@link BoxHelper#update} when the object it's created from\n * is transformed. Note that the object must have a geometry for this to work,\n * so it won't work with sprites.\n *\n * ```js\n * const sphere = new THREE.SphereGeometry();\n * const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );\n * const box = new THREE.BoxHelper( object, 0xffff00 );\n * scene.add( box );\n * ```\n *\n * @augments LineSegments\n */\nclass BoxHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new box helper.\n\t *\n\t * @param {Object3D} [object] - The 3D object to show the world-axis-aligned bounding box.\n\t * @param {number|Color|string} [color=0xffff00] - The box's color.\n\t */\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\t/**\n\t\t * The 3D object being visualized.\n\t\t *\n\t\t * @type {Object3D}\n\t\t */\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\t/**\n\t * Updates the helper's geometry to match the dimensions of the object,\n\t * including any children.\n\t */\n\tupdate() {\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\t/**\n\t * Updates the wireframe box for the passed object.\n\t *\n\t * @param {Object3D} object - The 3D object to create the helper for.\n\t * @return {BoxHelper} A reference to this instance.\n\t */\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n/**\n * A helper object to visualize an instance of {@link Box3}.\n *\n * ```js\n * const box = new THREE.Box3();\n * box.setFromCenterAndSize( new THREE.Vector3( 1, 1, 1 ), new THREE.Vector3( 2, 1, 3 ) );\n *\n * const helper = new THREE.Box3Helper( box, 0xffff00 );\n * scene.add( helper )\n * ```\n *\n * @augments LineSegments\n */\nclass Box3Helper extends LineSegments {\n\n\t/**\n\t * Constructs a new box3 helper.\n\t *\n\t * @param {Box3} box - The box to visualize.\n\t * @param {number|Color|string} [color=0xffff00] - The box's color.\n\t */\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst positions = [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\t/**\n\t\t * The box being visualized.\n\t\t *\n\t\t * @type {Box3}\n\t\t */\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n/**\n * A helper object to visualize an instance of {@link Plane}.\n *\n * ```js\n * const plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 );\n * const helper = new THREE.PlaneHelper( plane, 1, 0xffff00 );\n * scene.add( helper );\n * ```\n *\n * @augments Line\n */\nclass PlaneHelper extends Line {\n\n\t/**\n\t * Constructs a new plane helper.\n\t *\n\t * @param {Plane} plane - The plane to be visualized.\n\t * @param {number} [size=1] - The side length of plane helper.\n\t * @param {number|Color|string} [hex=0xffff00] - The helper's color.\n\t */\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\t/**\n\t\t * The plane being visualized.\n\t\t *\n\t\t * @type {Plane}\n\t\t */\n\t\tthis.plane = plane;\n\n\t\t/**\n\t\t * The side length of plane helper.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\t/**\n\t * Updates the helper to match the position and direction of the\n\t * light being visualized.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\n/**\n * An 3D arrow object for visualizing directions.\n *\n * ```js\n * const dir = new THREE.Vector3( 1, 2, 0 );\n *\n * //normalize the direction vector (convert to vector of length 1)\n * dir.normalize();\n *\n * const origin = new THREE.Vector3( 0, 0, 0 );\n * const length = 1;\n * const hex = 0xffff00;\n *\n * const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );\n * scene.add( arrowHelper );\n * ```\n *\n * @augments Object3D\n */\nclass ArrowHelper extends Object3D {\n\n\t/**\n\t * Constructs a new arrow helper.\n\t *\n\t * @param {Vector3} [dir=(0, 0, 1)] - The (normalized) direction vector.\n\t * @param {Vector3} [origin=(0, 0, 0)] - Point at which the arrow starts.\n\t * @param {number} [length=1] - Length of the arrow in world units.\n\t * @param {(number|Color|string)} [color=0xffff00] - Color of the arrow.\n\t * @param {number} [headLength=length*0.2] - The length of the head of the arrow.\n\t * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow.\n\t */\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new ConeGeometry( 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, -0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\t/**\n\t\t * The line part of the arrow helper.\n\t\t *\n\t\t * @type {Line}\n\t\t */\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\t/**\n\t\t * The cone part of the arrow helper.\n\t\t *\n\t\t * @type {Mesh}\n\t\t */\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\t/**\n\t * Sets the direction of the helper.\n\t *\n\t * @param {Vector3} dir - The normalized direction vector.\n\t */\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < -0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Sets the length of the helper.\n\t *\n\t * @param {number} length - Length of the arrow in world units.\n\t * @param {number} [headLength=length*0.2] - The length of the head of the arrow.\n\t * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow.\n\t */\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\t/**\n\t * Sets the color of the helper.\n\t *\n\t * @param {number|Color|string} color - The color to set.\n\t */\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\n/**\n * An axis object to visualize the 3 axes in a simple way.\n * The X axis is red. The Y axis is green. The Z axis is blue.\n *\n * ```js\n * const axesHelper = new THREE.AxesHelper( 5 );\n * scene.add( axesHelper );\n * ```\n *\n * @augments LineSegments\n */\nclass AxesHelper extends LineSegments {\n\n\t/**\n\t * Constructs a new axes helper.\n\t *\n\t * @param {number} [size=1] - Size of the lines representing the axes.\n\t */\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\t/**\n\t * Defines the colors of the axes helper.\n\t *\n\t * @param {number|Color|string} xAxisColor - The color for the x axis.\n\t * @param {number|Color|string} yAxisColor - The color for the y axis.\n\t * @param {number|Color|string} zAxisColor - The color for the z axis.\n\t * @return {AxesHelper} A reference to this axes helper.\n\t */\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever this instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n/**\n * This class is used to convert a series of paths to an array of\n * shapes. It is specifically used in context of fonts and SVG.\n */\nclass ShapePath {\n\n\t/**\n\t * Constructs a new shape path.\n\t */\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\t/**\n\t\t * The color of the shape.\n\t\t *\n\t\t * @type {Color}\n\t\t */\n\t\tthis.color = new Color();\n\n\t\t/**\n\t\t * The paths that have been generated for this shape.\n\t\t *\n\t\t * @type {Array<Path>}\n\t\t * @default null\n\t\t */\n\t\tthis.subPaths = [];\n\n\t\t/**\n\t\t * The current path that is being generated.\n\t\t *\n\t\t * @type {?Path}\n\t\t * @default null\n\t\t */\n\t\tthis.currentPath = null;\n\n\t}\n\n\t/**\n\t * Creates a new path and moves it current point to the given one.\n\t *\n\t * @param {number} x - The x coordinate.\n\t * @param {number} y - The y coordinate.\n\t * @return {ShapePath} A reference to this shape path.\n\t */\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link LineCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} x - The x coordinate of the end point.\n\t * @param {number} y - The y coordinate of the end point.\n\t * @return {ShapePath} A reference to this shape path.\n\t */\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} aCPx - The x coordinate of the control point.\n\t * @param {number} aCPy - The y coordinate of the control point.\n\t * @param {number} aX - The x coordinate of the end point.\n\t * @param {number} aY - The y coordinate of the end point.\n\t * @return {ShapePath} A reference to this shape path.\n\t */\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link CubicBezierCurve} to the path by connecting\n\t * the current point with the given one.\n\t *\n\t * @param {number} aCP1x - The x coordinate of the first control point.\n\t * @param {number} aCP1y - The y coordinate of the first control point.\n\t * @param {number} aCP2x - The x coordinate of the second control point.\n\t * @param {number} aCP2y - The y coordinate of the second control point.\n\t * @param {number} aX - The x coordinate of the end point.\n\t * @param {number} aY - The y coordinate of the end point.\n\t * @return {ShapePath} A reference to this shape path.\n\t */\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds an instance of {@link SplineCurve} to the path by connecting\n\t * the current point with the given list of points.\n\t *\n\t * @param {Array<Vector2>} pts - An array of points in 2D space.\n\t * @return {ShapePath} A reference to this shape path.\n\t */\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Converts the paths into an array of shapes.\n\t *\n\t * @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).\n\t * If this flag is set to `true`, then those are flipped.\n\t * @return {Array<Shape>} An array of shapes.\n\t */\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\n/**\n * Abstract base class for controls.\n *\n * @abstract\n * @augments EventDispatcher\n */\nclass Controls extends EventDispatcher {\n\n\t/**\n\t * Constructs a new controls instance.\n\t *\n\t * @param {Object3D} object - The object that is managed by the controls.\n\t * @param {?HTMLElement} domElement - The HTML element used for event listeners.\n\t */\n\tconstructor( object, domElement = null ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * The object that is managed by the controls.\n\t\t *\n\t\t * @type {Object3D}\n\t\t */\n\t\tthis.object = object;\n\n\t\t/**\n\t\t * The HTML element used for event listeners.\n\t\t *\n\t\t * @type {?HTMLElement}\n\t\t * @default null\n\t\t */\n\t\tthis.domElement = domElement;\n\n\t\t/**\n\t\t * Whether the controls responds to user input or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * The internal state of the controls.\n\t\t *\n\t\t * @type {number}\n\t\t * @default -1\n\t\t */\n\t\tthis.state = -1;\n\n\t\t/**\n\t\t * This object defines the keyboard input of the controls.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.keys = {};\n\n\t\t/**\n\t\t * This object defines what type of actions are assigned to the available mouse buttons.\n\t\t * It depends on the control implementation what kind of mouse buttons and actions are supported.\n\t\t *\n\t\t * @type {{LEFT: ?number, MIDDLE: ?number, RIGHT: ?number}}\n\t\t */\n\t\tthis.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };\n\n\t\t/**\n\t\t * This object defines what type of actions are assigned to what kind of touch interaction.\n\t\t * It depends on the control implementation what kind of touch interaction and actions are supported.\n\t\t *\n\t\t * @type {{ONE: ?number, TWO: ?number}}\n\t\t */\n\t\tthis.touches = { ONE: null, TWO: null };\n\n\t}\n\n\t/**\n\t * Connects the controls to the DOM. This method has so called \"side effects\" since\n\t * it adds the module's event listeners to the DOM.\n\t *\n\t * @param {HTMLElement} element - The DOM element to connect to.\n\t */\n\tconnect( element ) {\n\n\t\tif ( element === undefined ) {\n\n\t\t\twarn( 'Controls: connect() now requires an element.' ); // @deprecated, the warning can be removed with r185\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.domElement !== null ) this.disconnect();\n\n\t\tthis.domElement = element;\n\n\t}\n\n\t/**\n\t * Disconnects the controls from the DOM.\n\t */\n\tdisconnect() {}\n\n\t/**\n\t * Call this method if you no longer want use to the controls. It frees all internal\n\t * resources and removes all event listeners.\n\t */\n\tdispose() {}\n\n\t/**\n\t * Controls should implement this method if they have to update their internal state\n\t * per simulation step.\n\t *\n\t * @param {number} [delta] - The time delta in seconds.\n\t */\n\tupdate( /* delta */ ) {}\n\n}\n\n/**\n * Scales the texture as large as possible within its surface without cropping\n * or stretching the texture. The method preserves the original aspect ratio of\n * the texture. Akin to CSS `object-fit: contain`\n *\n * @param {Texture} texture - The texture.\n * @param {number} aspect - The texture's aspect ratio.\n * @return {Texture} The updated texture.\n */\nfunction contain( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t} else {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t}\n\n\treturn texture;\n\n}\n\n/**\n * Scales the texture to the smallest possible size to fill the surface, leaving\n * no empty space. The method preserves the original aspect ratio of the texture.\n * Akin to CSS `object-fit: cover`.\n *\n * @param {Texture} texture - The texture.\n * @param {number} aspect - The texture's aspect ratio.\n * @return {Texture} The updated texture.\n */\nfunction cover( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t} else {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t}\n\n\treturn texture;\n\n}\n\n/**\n * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`.\n *\n * @param {Texture} texture - The texture.\n * @return {Texture} The updated texture.\n */\nfunction fill( texture ) {\n\n\ttexture.repeat.x = 1;\n\ttexture.repeat.y = 1;\n\n\ttexture.offset.x = 0;\n\ttexture.offset.y = 0;\n\n\treturn texture;\n\n}\n\n/**\n * Determines how many bytes must be used to represent the texture.\n *\n * @param {number} width - The width of the texture.\n * @param {number} height - The height of the texture.\n * @param {number} format - The texture's format.\n * @param {number} type - The texture's type.\n * @return {number} The byte length.\n */\nfunction getByteLength( width, height, format, type ) {\n\n\tconst typeByteLength = getTextureTypeByteLength( type );\n\n\tswitch ( format ) {\n\n\t\t// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\n\t\tcase AlphaFormat:\n\t\t\treturn width * height;\n\t\tcase RedFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RedIntegerFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGIntegerFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBFormat:\n\t\t\treturn ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAIntegerFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\n\t\tcase RGB_S3TC_DXT1_Format:\n\t\tcase RGBA_S3TC_DXT1_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_S3TC_DXT3_Format:\n\t\tcase RGBA_S3TC_DXT5_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\n\t\tcase RGB_PVRTC_2BPPV1_Format:\n\t\tcase RGBA_PVRTC_2BPPV1_Format:\n\t\t\treturn ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;\n\t\tcase RGB_PVRTC_4BPPV1_Format:\n\t\tcase RGBA_PVRTC_4BPPV1_Format:\n\t\t\treturn ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\n\t\tcase RGB_ETC1_Format:\n\t\tcase RGB_ETC2_Format:\n\t\tcase R11_EAC_Format:\n\t\tcase SIGNED_R11_EAC_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_ETC2_EAC_Format:\n\t\tcase RG11_EAC_Format:\n\t\tcase SIGNED_RG11_EAC_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\n\t\tcase RGBA_ASTC_4x4_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x4_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x5_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x5_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x6_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x5_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_8x6_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x8_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x5_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_10x6_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_10x8_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x10_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x10_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x12_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\n\t\tcase RGBA_BPTC_Format:\n\t\tcase RGB_BPTC_SIGNED_Format:\n\t\tcase RGB_BPTC_UNSIGNED_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\n\t\tcase RED_RGTC1_Format:\n\t\tcase SIGNED_RED_RGTC1_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;\n\t\tcase RED_GREEN_RGTC2_Format:\n\t\tcase SIGNED_RED_GREEN_RGTC2_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine texture byte length for ${format} format.`,\n\t);\n\n}\n\nfunction getTextureTypeByteLength( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase UnsignedByteType:\n\t\tcase ByteType:\n\t\t\treturn { byteLength: 1, components: 1 };\n\t\tcase UnsignedShortType:\n\t\tcase ShortType:\n\t\tcase HalfFloatType:\n\t\t\treturn { byteLength: 2, components: 1 };\n\t\tcase UnsignedShort4444Type:\n\t\tcase UnsignedShort5551Type:\n\t\t\treturn { byteLength: 2, components: 4 };\n\t\tcase UnsignedIntType:\n\t\tcase IntType:\n\t\tcase FloatType:\n\t\t\treturn { byteLength: 4, components: 1 };\n\t\tcase UnsignedInt5999Type:\n\t\tcase UnsignedInt101111Type:\n\t\t\treturn { byteLength: 4, components: 3 };\n\n\t}\n\n\tthrow new Error( `Unknown texture type ${type}.` );\n\n}\n\n/**\n * A class containing utility functions for textures.\n *\n * @hideconstructor\n */\nclass TextureUtils {\n\n\t/**\n\t * Scales the texture as large as possible within its surface without cropping\n\t * or stretching the texture. The method preserves the original aspect ratio of\n\t * the texture. Akin to CSS `object-fit: contain`\n\t *\n\t * @param {Texture} texture - The texture.\n\t * @param {number} aspect - The texture's aspect ratio.\n\t * @return {Texture} The updated texture.\n\t */\n\tstatic contain( texture, aspect ) {\n\n\t\treturn contain( texture, aspect );\n\n\t}\n\n\t/**\n\t * Scales the texture to the smallest possible size to fill the surface, leaving\n\t * no empty space. The method preserves the original aspect ratio of the texture.\n\t * Akin to CSS `object-fit: cover`.\n\t *\n\t * @param {Texture} texture - The texture.\n\t * @param {number} aspect - The texture's aspect ratio.\n\t * @return {Texture} The updated texture.\n\t */\n\tstatic cover( texture, aspect ) {\n\n\t\treturn cover( texture, aspect );\n\n\t}\n\n\t/**\n\t * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`.\n\t *\n\t * @param {Texture} texture - The texture.\n\t * @return {Texture} The updated texture.\n\t */\n\tstatic fill( texture ) {\n\n\t\treturn fill( texture );\n\n\t}\n\n\t/**\n\t * Determines how many bytes must be used to represent the texture.\n\t *\n\t * @param {number} width - The width of the texture.\n\t * @param {number} height - The height of the texture.\n\t * @param {number} format - The texture's format.\n\t * @param {number} type - The texture's type.\n\t * @return {number} The byte length.\n\t */\n\tstatic getByteLength( width, height, format, type ) {\n\n\t\treturn getByteLength( width, height, format, type );\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\twarn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, setConsoleFunction, warn, warnOnce, yieldToMain };\n", "/**\n * @license\n * Copyright 2010-2026 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nimport { Matrix3, Vector2, Color, Vector3, mergeUniforms, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Matrix4, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, warn, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, CubeReflectionMapping, CubeRefractionMapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, error, NoBlending, WebGLRenderTarget, BufferAttribute, LinearSRGBColorSpace, LinearFilter, CubeTexture, LinearMipmapLinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, DataArrayTexture, Vector4, DepthTexture, Float32BufferAttribute, RawShaderMaterial, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, Data3DTexture, GreaterEqualCompare, LessEqualCompare, Texture, GLSL3, VSMShadowMap, PCFShadowMap, AddOperation, MixOperation, MultiplyOperation, LinearTransfer, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, RGFormat, RG11_EAC_Format, RED_GREEN_RGTC2_Format, MeshDepthMaterial, MeshDistanceMaterial, PCFSoftShadowMap, DepthFormat, NearestFilter, CubeDepthTexture, UnsignedIntType, Frustum, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, ReversedDepthFuncs, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, DataTexture, createCanvasElement, SRGBColorSpace, REVISION, log, WebGLCoordinateSystem, probeAsync } from './three.core.js';\nexport { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js';\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\t\t\tif ( context === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tif ( context !== null ) context.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl ) {\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\t\tconst size = array.byteLength;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {\n\n\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version,\n\t\t\tsize: size\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\t// Before applying update ranges, we merge any adjacent / overlapping\n\t\t\t// ranges to reduce load on `gl.bufferSubData`. Empirically, this has led\n\t\t\t// to performance improvements for applications which make heavy use of\n\t\t\t// update ranges. Likely due to GPU command overhead.\n\t\t\t//\n\t\t\t// Note that to reduce garbage collection between frames, we merge the\n\t\t\t// update ranges in-place. This is safe because this method will clear the\n\t\t\t// update ranges once updated.\n\n\t\t\tupdateRanges.sort( ( a, b ) => a.start - b.start );\n\n\t\t\t// To merge the update ranges in-place, we work from left to right in the\n\t\t\t// existing updateRanges array, merging ranges. This may result in a final\n\t\t\t// array which is smaller than the original. This index tracks the last\n\t\t\t// index representing a merged range, any data after this index can be\n\t\t\t// trimmed once the merge algorithm is completed.\n\t\t\tlet mergeIndex = 0;\n\n\t\t\tfor ( let i = 1; i < updateRanges.length; i ++ ) {\n\n\t\t\t\tconst previousRange = updateRanges[ mergeIndex ];\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\t// We add one here to merge adjacent ranges. This is safe because ranges\n\t\t\t\t// operate over positive integers.\n\t\t\t\tif ( range.start <= previousRange.start + previousRange.count + 1 ) {\n\n\t\t\t\t\tpreviousRange.count = Math.max(\n\t\t\t\t\t\tpreviousRange.count,\n\t\t\t\t\t\trange.start + range.count - previousRange.start\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\t++ mergeIndex;\n\t\t\t\t\tupdateRanges[ mergeIndex ] = range;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Trim the array to only contain the merged ranges.\n\t\t\tupdateRanges.length = mergeIndex + 1;\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\n\n\t\t\t}\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\t#if ! defined( GL_ANGLE_multi_draw )\\n\\t#define gl_DrawID _gl_DrawID\\n\\tuniform int _gl_DrawID;\\n\\t#endif\\n\\tuniform highp sampler2D batchingTexture;\\n\\tuniform highp usampler2D batchingIdTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n\\tfloat getIndirectIndex( const in int i ) {\\n\\t\\tint size = textureSize( batchingIdTexture, 0 ).x;\\n\\t\\tint x = i % size;\\n\\t\\tint y = i / size;\\n\\t\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\n\\t}\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tuniform sampler2D batchingColorTexture;\\n\\tvec4 getBatchingColor( const in float i ) {\\n\\t\\tint size = textureSize( batchingColorTexture, 0 ).x;\\n\\t\\tint j = int( i );\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\\n\\t}\\n#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvarying vec4 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvColor = vec4( 1.0 );\\n#endif\\n#ifdef USE_COLOR_ALPHA\\n\\tvColor *= color;\\n#elif defined( USE_COLOR )\\n\\tvColor.rgb *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.rgb *= instanceColor.rgb;\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\\n\\t\\temissiveColor = sRGBTransferEOTF( emissiveColor );\\n\\t#endif\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"vec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferEOTF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\\n\\t\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform mat3 envMapRotation;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\\n#include <lightprobes_pars_fragment>\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nmaterial.metalness = metalnessFactor;\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\\n\\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = vec3( 0.04 );\\n\\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_DISPERSION\\n\\tmaterial.dispersion = dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"uniform sampler2D dfgLUT;\\nstruct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 diffuseContribution;\\n\\tvec3 specularColor;\\n\\tvec3 specularColorBlended;\\n\\tfloat roughness;\\n\\tfloat metalness;\\n\\tfloat specularF90;\\n\\tfloat dispersion;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t\\tvec3 iridescenceFresnelDielectric;\\n\\t\\tvec3 iridescenceFresnelMetallic;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\treturn 0.5 / max( gv + gl, EPSILON );\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColorBlended;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat rInv = 1.0 / ( roughness + 0.1 );\\n\\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\\n\\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\\n\\tfloat DG = exp( a * dotNV + b );\\n\\treturn saturate( DG );\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\\n\\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\\n\\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\\n\\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\\n\\tfloat Ess_V = dfgV.x + dfgV.y;\\n\\tfloat Ess_L = dfgL.x + dfgL.y;\\n\\tfloat Ems_V = 1.0 - Ess_V;\\n\\tfloat Ems_L = 1.0 - Ess_L;\\n\\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\\n\\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\\n\\tfloat compensationFactor = Ems_V * Ems_L;\\n\\tvec3 multiScatter = Fms * compensationFactor;\\n\\treturn singleScatter + multiScatter;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t\\t#ifdef USE_CLEARCOAT\\n\\t\\t\\tvec3 Ncc = geometryClearcoatNormal;\\n\\t\\t\\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\\n\\t\\t\\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\\n\\t\\t\\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\\n\\t\\t\\tmat3 mInvClearcoat = mat3(\\n\\t\\t\\t\\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\\n\\t\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\t\\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\\n\\t\\t\\t);\\n\\t\\t\\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\\n\\t\\t\\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\\n\\t\\t#endif\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n \\n \\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n \\n \\t\\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n \\t\\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\\n \\n \\t\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\\n \\n \\t\\tirradiance *= sheenEnergyComp;\\n \\n \\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\\n\\t\\tdiffuse *= sheenEnergyComp;\\n\\t#endif\\n\\treflectedLight.indirectDiffuse += diffuse;\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\\n \\t#endif\\n\\tvec3 singleScatteringDielectric = vec3( 0.0 );\\n\\tvec3 multiScatteringDielectric = vec3( 0.0 );\\n\\tvec3 singleScatteringMetallic = vec3( 0.0 );\\n\\tvec3 multiScatteringMetallic = vec3( 0.0 );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\\n\\t#endif\\n\\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\\n\\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\\n\\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\\n\\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\tvec3 indirectSpecular = radiance * singleScattering;\\n\\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\\n\\t\\tindirectSpecular *= sheenEnergyComp;\\n\\t\\tindirectDiffuse *= sheenEnergyComp;\\n\\t#endif\\n\\treflectedLight.indirectSpecular += indirectSpecular;\\n\\treflectedLight.indirectDiffuse += indirectDiffuse;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\\n\\t\\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#ifdef USE_LIGHT_PROBES_GRID\\n\\t\\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\\n\\t\\tvec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );\\n\\t\\tirradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\\n\\t\\t\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\n\\t\\t#endif\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\t#if defined( LAMBERT ) || defined( PHONG )\\n\\t\\tirradiance += iblIrradiance;\\n\\t#endif\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar lightprobes_pars_fragment = \"#ifdef USE_LIGHT_PROBES_GRID\\nuniform highp sampler3D probesSH;\\nuniform vec3 probesMin;\\nuniform vec3 probesMax;\\nuniform vec3 probesResolution;\\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\\n\\tvec3 res = probesResolution;\\n\\tvec3 gridRange = probesMax - probesMin;\\n\\tvec3 resMinusOne = res - 1.0;\\n\\tvec3 probeSpacing = gridRange / resMinusOne;\\n\\tvec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\\n\\tvec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\\n\\tuvw = uvw * resMinusOne / res + 0.5 / res;\\n\\tfloat nz = res.z;\\n\\tfloat paddedSlices = nz + 2.0;\\n\\tfloat atlasDepth = 7.0 * paddedSlices;\\n\\tfloat uvZBase = uvw.z * nz + 1.0;\\n\\tvec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\\n\\tvec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\\n\\tvec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\\n\\tvec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\\n\\tvec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\\n\\tvec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\\n\\tvec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\\n\\tvec3 c0 = s0.xyz;\\n\\tvec3 c1 = vec3( s0.w, s1.xy );\\n\\tvec3 c2 = vec3( s1.zw, s2.x );\\n\\tvec3 c3 = s2.yzw;\\n\\tvec3 c4 = s3.xyz;\\n\\tvec3 c5 = vec3( s3.w, s4.xy );\\n\\tvec3 c6 = vec3( s4.zw, s5.x );\\n\\tvec3 c7 = s5.yzw;\\n\\tvec3 c8 = s6.xyz;\\n\\tfloat x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\\n\\tvec3 result = c0 * 0.886227;\\n\\tresult += c1 * 2.0 * 0.511664 * y;\\n\\tresult += c2 * 2.0 * 0.511664 * z;\\n\\tresult += c3 * 2.0 * 0.511664 * x;\\n\\tresult += c4 * 2.0 * 0.429043 * x * y;\\n\\tresult += c5 * 2.0 * 0.429043 * y * z;\\n\\tresult += c6 * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += c7 * 2.0 * 0.429043 * x * z;\\n\\tresult += c8 * 0.429043 * ( x * x - y * y );\\n\\treturn max( result, vec3( 0.0 ) );\\n}\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t#endif\\n\\tuniform sampler2DArray morphTargetsTexture;\\n\\tuniform ivec2 morphTargetsTextureSize;\\n\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t}\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 nonPerturbedNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#if defined( USE_PACKED_NORMALMAP )\\n\\t\\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\\n\\t#endif\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\\nconst float Inv255 = 1. / 255.;\\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec4( 0., 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec4( 1., 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat af = modf( v * PackFactors.a, vuf );\\n\\tfloat bf = modf( vuf * ShiftRight8, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\\n}\\nvec3 packDepthToRGB( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec3( 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec3( 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat bf = modf( v * PackFactors.b, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\\n}\\nvec2 packDepthToRG( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec2( 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec2( 1., 1. );\\n\\tfloat vuf;\\n\\tfloat gf = modf( v * 256., vuf );\\n\\treturn vec2( vuf * Inv255, gf );\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors4 );\\n}\\nfloat unpackRGBToDepth( const in vec3 v ) {\\n\\treturn dot( v, UnpackFactors3 );\\n}\\nfloat unpackRGToDepth( const in vec2 v ) {\\n\\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\\n}\\nvec4 pack2HalfToRGBA( const in vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( const in vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\n\\t\\treturn depth * ( far - near ) - far;\\n\\t#else\\n\\t\\treturn depth * ( near - far ) - near;\\n\\t#endif\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\t\\n\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\treturn ( near * far ) / ( ( near - far ) * depth - near );\\n\\t#else\\n\\t\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n\\t#endif\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\t#else\\n\\t\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\t#endif\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\t#else\\n\\t\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\t#endif\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\t#elif defined( SHADOWMAP_TYPE_BASIC )\\n\\t\\t\\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\t#endif\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\tfloat interleavedGradientNoise( vec2 position ) {\\n\\t\\t\\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\\n\\t\\t}\\n\\t\\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\\n\\t\\t\\tconst float goldenAngle = 2.399963229728653;\\n\\t\\t\\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\\n\\t\\t\\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\\n\\t\\t\\treturn vec2( cos( theta ), sin( theta ) ) * r;\\n\\t\\t}\\n\\t#endif\\n\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\t\\tfloat shadow = 1.0;\\n\\t\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\t\\tshadowCoord.z += shadowBias;\\n\\t\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\t\\tif ( frustumTest ) {\\n\\t\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\t\\tfloat radius = shadowRadius * texelSize.x;\\n\\t\\t\\t\\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\\n\\t\\t\\t\\t\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\\n\\t\\t\\t\\t\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\\n\\t\\t\\t\\t\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\\n\\t\\t\\t\\t\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\\n\\t\\t\\t\\t) * 0.2;\\n\\t\\t\\t}\\n\\t\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t\\t}\\n\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\t\\tfloat shadow = 1.0;\\n\\t\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\tshadowCoord.z -= shadowBias;\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadowCoord.z += shadowBias;\\n\\t\\t\\t#endif\\n\\t\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\t\\tif ( frustumTest ) {\\n\\t\\t\\t\\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\\n\\t\\t\\t\\tfloat mean = distribution.x;\\n\\t\\t\\t\\tfloat variance = distribution.y * distribution.y;\\n\\t\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\t\\tfloat hard_shadow = step( mean, shadowCoord.z );\\n\\t\\t\\t\\t#else\\n\\t\\t\\t\\t\\tfloat hard_shadow = step( shadowCoord.z, mean );\\n\\t\\t\\t\\t#endif\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tif ( hard_shadow == 1.0 ) {\\n\\t\\t\\t\\t\\tshadow = 1.0;\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tvariance = max( variance, 0.0000001 );\\n\\t\\t\\t\\t\\tfloat d = shadowCoord.z - mean;\\n\\t\\t\\t\\t\\tfloat p_max = variance / ( variance + d * d );\\n\\t\\t\\t\\t\\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\\n\\t\\t\\t\\t\\tshadow = max( hard_shadow, p_max );\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t\\t}\\n\\t#else\\n\\t\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\t\\tfloat shadow = 1.0;\\n\\t\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\tshadowCoord.z -= shadowBias;\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadowCoord.z += shadowBias;\\n\\t\\t\\t#endif\\n\\t\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\t\\tif ( frustumTest ) {\\n\\t\\t\\t\\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\\n\\t\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\t\\tshadow = step( depth, shadowCoord.z );\\n\\t\\t\\t\\t#else\\n\\t\\t\\t\\t\\tshadow = step( shadowCoord.z, depth );\\n\\t\\t\\t\\t#endif\\n\\t\\t\\t}\\n\\t\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t\\t}\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\tvec3 absVec = abs( lightToPosition );\\n\\t\\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\\n\\t\\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\\n\\t\\t\\t\\tdp -= shadowBias;\\n\\t\\t\\t#else\\n\\t\\t\\t\\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\\n\\t\\t\\t\\tdp += shadowBias;\\n\\t\\t\\t#endif\\n\\t\\t\\tfloat texelSize = shadowRadius / shadowMapSize.x;\\n\\t\\t\\tvec3 absDir = abs( bd3D );\\n\\t\\t\\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\\n\\t\\t\\ttangent = normalize( cross( bd3D, tangent ) );\\n\\t\\t\\tvec3 bitangent = cross( bd3D, tangent );\\n\\t\\t\\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\\n\\t\\t\\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\\n\\t\\t\\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\\n\\t\\t\\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\\n\\t\\t\\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\\n\\t\\t\\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\\n\\t\\t\\t\\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\\n\\t\\t\\t\\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\\n\\t\\t\\t\\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\\n\\t\\t\\t\\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\\n\\t\\t\\t) * 0.2;\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n\\t#elif defined( SHADOWMAP_TYPE_BASIC )\\n\\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tvec3 absVec = abs( lightToPosition );\\n\\t\\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\\n\\t\\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\\n\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tfloat depth = textureCube( shadowMap, bd3D ).r;\\n\\t\\t\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\t\\t\\tdepth = 1.0 - depth;\\n\\t\\t\\t#endif\\n\\t\\t\\tshadow = step( dp, depth );\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n\\t#endif\\n\\t#endif\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\t#ifdef HAS_NORMAL\\n\\t\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t#else\\n\\t\\tvec3 shadowWorldNormal = vec3( 0.0 );\\n\\t#endif\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 CineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tconst float StartCompression = 0.8 - 0.04;\\n\\tconst float Desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min( color.r, min( color.g, color.b ) );\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max( color.r, max( color.g, color.b ) );\\n\\tif ( peak < StartCompression ) return color;\\n\\tfloat d = 1. - StartCompression;\\n\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\n\\treturn mix( color, vec3( newPeak ), g );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec4 transmittedLight;\\n\\t\\tvec3 transmittance;\\n\\t\\t#ifdef USE_DISPERSION\\n\\t\\t\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\n\\t\\t\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\n\\t\\t\\tfor ( int i = 0; i < 3; i ++ ) {\\n\\t\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\n\\t\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\t\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\n\\t\\t\\t\\ttransmittedLight[ i ] = transmissionSample[ i ];\\n\\t\\t\\t\\ttransmittedLight.a += transmissionSample.a;\\n\\t\\t\\t\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\n\\t\\t\\t}\\n\\t\\t\\ttransmittedLight.a /= 3.0;\\n\\t\\t#else\\n\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\t\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\t#endif\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nconst vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include <begin_vertex>\\n\\t#include <project_vertex>\\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include <cube_uv_reflection_fragment>\\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include <begin_vertex>\\n\\t#include <project_vertex>\\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n}\";\n\nconst vertex$e = \"#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include <common>\\n#include <packing>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include <clipping_planes_fragment>\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\n\\t\\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\\n\\t#else\\n\\t\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\\n\\t#endif\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#elif DEPTH_PACKING == 3202\\n\\t\\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\\n\\t#elif DEPTH_PACKING == 3203\\n\\t\\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\\n\\t#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include <common>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main () {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include <clipping_planes_fragment>\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include <begin_vertex>\\n\\t#include <project_vertex>\\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include <common>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n}\";\n\nconst vertex$a = \"#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinbase_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t\\t#include <defaultnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <specularmap_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include <aomap_fragment>\\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include <envmap_fragment>\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <envmap_physical_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_lambert_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <specularmap_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_lambert_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include <envmap_fragment>\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <color_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <normal_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include <uv_pars_fragment>\\n#include <normal_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <envmap_physical_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_phong_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <specularmap_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_phong_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include <envmap_fragment>\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_DISPERSION\\n\\tuniform float dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <iridescence_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_physical_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_physical_pars_fragment>\\n#include <transmission_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <clearcoat_pars_fragment>\\n#include <iridescence_pars_fragment>\\n#include <roughnessmap_pars_fragment>\\n#include <metalnessmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <roughnessmap_fragment>\\n\\t#include <metalnessmap_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <clearcoat_normal_fragment_begin>\\n\\t#include <clearcoat_normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_physical_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include <transmission_fragment>\\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n \\n\\t\\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\\n \\n \\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\n\\t#endif\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <batching_pars_vertex>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <gradientmap_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_toon_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_toon_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include <common>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include <color_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphcolor_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <project_vertex>\\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include <common>\\n#include <color_pars_fragment>\\n#include <map_particle_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_particle_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n}\";\n\nconst vertex$2 = \"#include <common>\\n#include <batching_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <shadowmap_pars_vertex>\\nvoid main() {\\n\\t#include <batching_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphinstance_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include <common>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <logdepthbuf_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <shadowmask_pars_fragment>\\nvoid main() {\\n\\t#include <logdepthbuf_fragment>\\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\tvec4 mvPosition = modelViewMatrix[ 3 ];\\n\\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include <common>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <alphahash_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <clipping_planes_fragment>\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <alphahash_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <opaque_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <colorspace_fragment>\\n\\t#include <fog_fragment>\\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlightprobes_pars_fragment: lightprobes_pars_fragment,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphinstance_vertex: morphinstance_vertex,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistance_vert: vertex$d,\n\tdistance_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n// Uniforms library for shared webgl shaders\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\t\tdfgLUT: { value: null } // DFG LUT for physically-based rendering\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null },\n\n\t\tprobesSH: { value: null },\n\t\tprobesMin: { value: /*@__PURE__*/ new Vector3() },\n\t\tprobesMax: { value: /*@__PURE__*/ new Vector3() },\n\t\tprobesResolution: { value: /*@__PURE__*/ new Vector3() }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tenvMapIntensity: { value: 1 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 },\n\t\t\t\tenvMapIntensity: { value: 1 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 },\n\t\t\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: -1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistance: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distance_vert,\n\t\tfragmentShader: ShaderChunk.distance_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tdispersion: { value: 0 },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _m$1 = /*@__PURE__*/ new Matrix3();\n\n_m$1.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );\n\nfunction WebGLBackground( renderer, environments, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction getBackground( scene ) {\n\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = environments.get( background, usePMREM );\n\n\t\t}\n\n\t\treturn background;\n\n\t}\n\n\tfunction render( scene ) {\n\n\t\tlet forceClear = false;\n\t\tconst background = getBackground( scene );\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\t// buffers might not be writable which is required to ensure a correct clear\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t}\n\n\tfunction addToRenderList( renderList, scene ) {\n\n\t\tconst background = getBackground( scene );\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false,\n\t\t\t\t\t\tallowOverride: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\n\n\t\t\t// note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()\n\t\t\tboxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( scene.backgroundRotation ) ).transpose();\n\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\n\n\t\t\t\tboxMesh.material.uniforms.backgroundRotation.value.premultiply( _m$1 );\n\n\t\t\t}\n\n\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false,\n\t\t\t\t\t\tallowOverride: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\tfunction dispose() {\n\n\t\tif ( boxMesh !== undefined ) {\n\n\t\t\tboxMesh.geometry.dispose();\n\t\t\tboxMesh.material.dispose();\n\n\t\t\tboxMesh = undefined;\n\n\t\t}\n\n\t\tif ( planeMesh !== undefined ) {\n\n\t\t\tplaneMesh.geometry.dispose();\n\t\t\tplaneMesh.material.dispose();\n\n\t\t\tplaneMesh = undefined;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render,\n\t\taddToRenderList: addToRenderList,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, attributes ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tconst state = getBindingState( object, geometry, program, material );\n\n\t\tif ( currentState !== state ) {\n\n\t\t\tcurrentState = state;\n\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t}\n\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\treturn gl.createVertexArray();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\treturn gl.bindVertexArray( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\treturn gl.deleteVertexArray( vao );\n\n\t}\n\n\tfunction getBindingState( object, geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet objectMap = bindingStates[ geometry.id ];\n\n\t\tif ( objectMap === undefined ) {\n\n\t\t\tobjectMap = {};\n\t\t\tbindingStates[ geometry.id ] = objectMap;\n\n\t\t}\n\n\t\t// Each InstancedMesh requires unique binding states because it contains instanced attributes.\n\t\tconst objectId = ( object.isInstancedMesh === true ) ? object.id : 0;\n\n\t\tlet programMap = objectMap[ objectId ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tobjectMap[ objectId ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tgl.vertexAttribDivisor( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes\n\n\t\t\t\t\tconst integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst objectMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const objectId in objectMap ) {\n\n\t\t\t\tconst programMap = objectMap[ objectId ];\n\n\t\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst objectMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const objectId in objectMap ) {\n\n\t\t\tconst programMap = objectMap[ objectId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst objectMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const objectId in objectMap ) {\n\n\t\t\t\tconst programMap = objectMap[ objectId ];\n\n\t\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ program.id ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfObject( object ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst objectMap = bindingStates[ geometryId ];\n\n\t\t\tconst objectId = ( object.isInstancedMesh === true ) ? object.id : 0;\n\n\t\t\tconst programMap = objectMap[ objectId ];\n\n\t\t\tif ( programMap === undefined ) continue;\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete objectMap[ objectId ];\n\n\t\t\tif ( Object.keys( objectMap ).length === 0 ) {\n\n\t\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfObject: releaseStatesOfObject,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawArraysInstanced( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters, utils ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction textureFormatReadable( textureFormat ) {\n\n\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction textureTypeReadable( textureType ) {\n\n\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\n\n\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\twarn( 'WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\tconst reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );\n\n\tif ( parameters.reversedDepthBuffer === true && reversedDepthBuffer === false ) {\n\n\t\twarn( 'WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.' );\n\n\t}\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\n\tconst samples = gl.getParameter( gl.SAMPLES );\n\n\treturn {\n\n\t\tisWebGL2: true, // keeping this for backwards compatibility\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\ttextureFormatReadable: textureFormatReadable,\n\t\ttextureTypeReadable: textureTypeReadable,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\t\treversedDepthBuffer: reversedDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tmaxSamples: maxSamples,\n\n\t\tsamples: samples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips.\n// Used for scene blur in fromScene() method.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\n// Used for scene blur in fromScene() method.\nconst MAX_SAMPLES = 20;\n\n// GGX VNDF importance sampling configuration\nconst GGX_SAMPLES = 256;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\nlet _oldXrEnabled = false;\n\nconst _origin = /*@__PURE__*/ new Vector3();\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * The prefiltering uses GGX VNDF (Visible Normal Distribution Function)\n * importance sampling based on \"Sampling the GGX Distribution of Visible Normals\"\n * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF\n * used in material rendering for physically-based image-based lighting.\n */\nclass PMREMGenerator {\n\n\t/**\n\t * Constructs a new PMREM generator.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t */\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\t\tthis._lodMeshes = [];\n\n\t\tthis._backgroundBox = null;\n\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._blurMaterial = null;\n\t\tthis._ggxMaterial = null;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety.\n\t *\n\t * @param {Scene} scene - The scene to be captured.\n\t * @param {number} [sigma=0] - The blur radius in radians.\n\t * @param {number} [near=0.1] - The near plane distance.\n\t * @param {number} [far=100] - The far plane distance.\n\t * @param {Object} [options={}] - The configuration options.\n\t * @param {number} [options.size=256] - The texture size of the PMREM.\n\t * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene.\n\t * @return {WebGLRenderTarget} The resulting PMREM.\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100, options = {} ) {\n\n\t\tconst {\n\t\t\tsize = 256,\n\t\t\tposition = _origin,\n\t\t} = options;\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tthis._setSize( size );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget, position );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t *\n\t * @param {Texture} equirectangular - The equirectangular texture to be converted.\n\t * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.\n\t * @return {WebGLRenderTarget} The resulting PMREM.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t *\n\t * @param {Texture} cubemap - The cubemap texture to be converted.\n\t * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.\n\t * @return {WebGLRenderTarget} The resulting PMREM.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t\tif ( this._backgroundBox !== null ) {\n\n\t\t\tthis._backgroundBox.geometry.dispose();\n\t\t\tthis._backgroundBox.material.dispose();\n\n\t\t}\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\t\tif ( this._ggxMaterial !== null ) this._ggxMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodMeshes.length; i ++ ) {\n\n\t\t\tthis._lodMeshes[ i ].geometry.dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\n\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\t\t\tthis._ggxMaterial = _getGGXShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst mesh = new Mesh( new BufferGeometry(), material );\n\t\tthis._renderer.compile( mesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget, position ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, -1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, -1, -1, -1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\t// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812\n\t\tconst reversedDepthBuffer = renderer.state.buffers.depth.getReversed();\n\n\t\tif ( reversedDepthBuffer ) {\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\t\trenderer.clearDepth();\n\t\t\trenderer.setRenderTarget( null );\n\n\t\t}\n\n\t\tif ( this._backgroundBox === null ) {\n\n\t\t\tthis._backgroundBox = new Mesh(\n\t\t\t\tnew BoxGeometry(),\n\t\t\t\tnew MeshBasicMaterial( {\n\t\t\t\t\tname: 'PMREM.Background',\n\t\t\t\t\tside: BackSide,\n\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\tdepthTest: false,\n\t\t\t\t} )\n\t\t\t);\n\n\t\t}\n\n\t\tconst backgroundBox = this._backgroundBox;\n\t\tconst backgroundMaterial = backgroundBox.material;\n\n\t\tlet useSolidColor = false;\n\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.position.set( position.x, position.y, position.z );\n\t\t\t\tcubeCamera.lookAt( position.x + forwardSign[ i ], position.y, position.z );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.position.set( position.x, position.y, position.z );\n\t\t\t\tcubeCamera.lookAt( position.x, position.y + forwardSign[ i ], position.z );\n\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.position.set( position.x, position.y, position.z );\n\t\t\t\tcubeCamera.lookAt( position.x, position.y, position.z + forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? -1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\n\t\tconst mesh = this._lodMeshes[ 0 ];\n\t\tmesh.material = material;\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tconst n = this._lodMeshes.length;\n\n\t\t// Use GGX VNDF importance sampling\n\t\tfor ( let i = 1; i < n; i ++ ) {\n\n\t\t\tthis._applyGGXFilter( cubeUVRenderTarget, i - 1, i );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.\n\t * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the\n\t * GGX BRDF for physically-based rendering. Reads from the previous LOD level and\n\t * applies incremental roughness filtering to avoid over-blurring.\n\t *\n\t * @private\n\t * @param {WebGLRenderTarget} cubeUVRenderTarget\n\t * @param {number} lodIn - Source LOD level to read from\n\t * @param {number} lodOut - Target LOD level to write to\n\t */\n\t_applyGGXFilter( cubeUVRenderTarget, lodIn, lodOut ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tconst ggxMaterial = this._ggxMaterial;\n\t\tconst ggxMesh = this._lodMeshes[ lodOut ];\n\t\tggxMesh.material = ggxMaterial;\n\n\t\tconst ggxUniforms = ggxMaterial.uniforms;\n\n\t\t// Calculate incremental roughness between LOD levels\n\t\tconst targetRoughness = lodOut / ( this._lodMeshes.length - 1 );\n\t\tconst sourceRoughness = lodIn / ( this._lodMeshes.length - 1 );\n\t\tconst incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );\n\n\t\t// Apply blur strength mapping for better quality across the roughness range\n\t\tconst blurStrength = 0.0 + targetRoughness * 1.25;\n\t\tconst adjustedRoughness = incrementalRoughness * blurStrength;\n\n\t\t// Calculate viewport position based on output LOD level\n\t\tconst { _lodMax } = this;\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t// Read from previous LOD with incremental roughness\n\t\tggxUniforms[ 'envMap' ].value = cubeUVRenderTarget.texture;\n\t\tggxUniforms[ 'roughness' ].value = adjustedRoughness;\n\t\tggxUniforms[ 'mipInt' ].value = _lodMax - lodIn; // Sample from input LOD\n\n\t\t_setViewport( pingPongRenderTarget, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( pingPongRenderTarget );\n\t\trenderer.render( ggxMesh, _flatCamera );\n\n\t\t// Copy from pingPong back to cubeUV (simple direct copy)\n\t\tggxUniforms[ 'envMap' ].value = pingPongRenderTarget.texture;\n\t\tggxUniforms[ 'roughness' ].value = 0.0; // Direct copy\n\t\tggxUniforms[ 'mipInt' ].value = _lodMax - lodOut; // Read from the level we just wrote\n\n\t\t_setViewport( cubeUVRenderTarget, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( ggxMesh, _flatCamera );\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t *\n\t * Used for initial scene blur in fromScene() method when sigma > 0.\n\t *\n\t * @private\n\t * @param {WebGLRenderTarget} cubeUVRenderTarget\n\t * @param {number} lodIn\n\t * @param {number} lodOut\n\t * @param {number} sigma\n\t * @param {Vector3} [poleAxis]\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\terror(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = this._lodMeshes[ lodOut ];\n\t\tblurMesh.material = blurMaterial;\n\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\twarn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\tconst lodMeshes = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : -1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodMeshes.push( new Mesh( planes, null ) );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodMeshes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getGGXShader( lodMax, width, height ) {\n\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'PMREMGGXConvolution',\n\n\t\tdefines: {\n\t\t\t'GGX_SAMPLES': GGX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'roughness': { value: 0.0 },\n\t\t\t'mipInt': { value: 0 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// \"Sampling the GGX Distribution of Visible Normals\"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: -1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\n/**\n * A cube render target used in context of {@link WebGLRenderer}.\n *\n * @augments WebGLRenderTarget\n */\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\t/**\n\t * Constructs a new cube render target.\n\t *\n\t * @param {number} [size=1] - The size of the render target.\n\t * @param {RenderTarget~Options} [options] - The configuration object.\n\t */\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\t/**\n\t\t * Overwritten with a different texture type.\n\t\t *\n\t\t * @type {DataArrayTexture}\n\t\t */\n\t\tthis.texture = new CubeTexture( images );\n\t\tthis._setTextureOptions( options );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n\t/**\n\t * Converts the given equirectangular texture to a cube map.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {Texture} texture - The equirectangular texture.\n\t * @return {WebGLCubeRenderTarget} A reference to this cube render target.\n\t */\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Clears this cube render target.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.\n\t * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.\n\t * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.\n\t */\n\tclear( renderer, color = true, depth = true, stencil = true ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nfunction WebGLEnvironments( renderer ) {\n\n\tlet cubeMaps = new WeakMap();\n\tlet pmremMaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture, usePMREM = false ) {\n\n\t\tif ( texture === null || texture === undefined ) return null;\n\n\t\tif ( usePMREM ) {\n\n\t\t\treturn getPMREM( texture );\n\n\t\t}\n\n\t\treturn getCube( texture );\n\n\t}\n\n\tfunction getCube( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubeMaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubeMaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubeMaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onCubemapDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction getPMREM( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tlet renderTarget = pmremMaps.get( texture );\n\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\tpmremMaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( renderTarget !== undefined ) {\n\n\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\t\t\tpmremMaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onPMREMDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\t}\n\n\tfunction onCubemapDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onCubemapDispose );\n\n\t\tconst cubemap = cubeMaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubeMaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction onPMREMDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onPMREMDispose );\n\n\t\tconst pmrem = pmremMaps.get( texture );\n\n\t\tif ( pmrem !== undefined ) {\n\n\t\t\tpmremMaps.delete( texture );\n\t\t\tpmrem.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeMaps = new WeakMap();\n\t\tpmremMaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tconst extension = gl.getExtension( name );\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function () {\n\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\twarnOnce( 'WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryPosition === undefined ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check whether a 32 bit or 16 bit buffer is required to store the indices\n\t\t// account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\t\tconst attribute = new ( geometryPosition.count >= 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\terror( 'WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\t// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet entry = morphTextures.get( geometry );\n\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\tlet vertexDataCount = 0;\n\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\tlet height = 1;\n\n\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t}\n\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\ttexture.type = FloatType;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\t// fill buffer\n\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tentry = {\n\t\t\t\tcount: morphTargetsCount,\n\t\t\t\ttexture: texture,\n\t\t\t\tsize: new Vector2( width, height )\n\t\t\t};\n\n\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\tfunction disposeTexture() {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\t//\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\n\n\t\t} else {\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t}\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, bindingStates, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tbindingStates.releaseStatesOfObject( instancedMesh );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nconst toneMappingMap = {\n\t[ LinearToneMapping ]: 'LINEAR_TONE_MAPPING',\n\t[ ReinhardToneMapping ]: 'REINHARD_TONE_MAPPING',\n\t[ CineonToneMapping ]: 'CINEON_TONE_MAPPING',\n\t[ ACESFilmicToneMapping ]: 'ACES_FILMIC_TONE_MAPPING',\n\t[ AgXToneMapping ]: 'AGX_TONE_MAPPING',\n\t[ NeutralToneMapping ]: 'NEUTRAL_TONE_MAPPING',\n\t[ CustomToneMapping ]: 'CUSTOM_TONE_MAPPING'\n};\n\nfunction WebGLOutput( type, width, height, depth, stencil ) {\n\n\t// render targets for scene and post-processing\n\tconst targetA = new WebGLRenderTarget( width, height, {\n\t\ttype: type,\n\t\tdepthBuffer: depth,\n\t\tstencilBuffer: stencil,\n\t\tdepthTexture: depth ? new DepthTexture( width, height ) : undefined\n\t} );\n\n\tconst targetB = new WebGLRenderTarget( width, height, {\n\t\ttype: HalfFloatType,\n\t\tdepthBuffer: false,\n\t\tstencilBuffer: false\n\t} );\n\n\t// create fullscreen triangle geometry\n\tconst geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ -1, 3, 0, -1, -1, 0, 3, -1, 0 ], 3 ) );\n\tgeometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t// create output material with tone mapping support\n\tconst material = new RawShaderMaterial( {\n\t\tuniforms: {\n\t\t\ttDiffuse: { value: null }\n\t\t},\n\t\tvertexShader: /* glsl */`\n\t\t\tprecision highp float;\n\n\t\t\tuniform mat4 modelViewMatrix;\n\t\t\tuniform mat4 projectionMatrix;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t}`,\n\t\tfragmentShader: /* glsl */`\n\t\t\tprecision highp float;\n\n\t\t\tuniform sampler2D tDiffuse;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\t#include <tonemapping_pars_fragment>\n\t\t\t#include <colorspace_pars_fragment>\n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}`,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\t} );\n\n\tconst mesh = new Mesh( geometry, material );\n\tconst camera = new OrthographicCamera( -1, 1, 1, -1, 0, 1 );\n\n\tlet _outputColorSpace = null;\n\tlet _outputToneMapping = null;\n\tlet _isCompositing = false;\n\tlet _savedToneMapping;\n\tlet _savedRenderTarget = null;\n\tlet _effects = [];\n\tlet _hasRenderPass = false;\n\n\tthis.setSize = function ( width, height ) {\n\n\t\ttargetA.setSize( width, height );\n\t\ttargetB.setSize( width, height );\n\n\t\tfor ( let i = 0; i < _effects.length; i ++ ) {\n\n\t\t\tconst effect = _effects[ i ];\n\t\t\tif ( effect.setSize ) effect.setSize( width, height );\n\n\t\t}\n\n\t};\n\n\tthis.setEffects = function ( effects ) {\n\n\t\t_effects = effects;\n\t\t_hasRenderPass = _effects.length > 0 && _effects[ 0 ].isRenderPass === true;\n\n\t\tconst width = targetA.width;\n\t\tconst height = targetA.height;\n\n\t\tfor ( let i = 0; i < _effects.length; i ++ ) {\n\n\t\t\tconst effect = _effects[ i ];\n\t\t\tif ( effect.setSize ) effect.setSize( width, height );\n\n\t\t}\n\n\t};\n\n\tthis.begin = function ( renderer, renderTarget ) {\n\n\t\t// Don't begin during compositing phase (post-processing effects call render())\n\t\tif ( _isCompositing ) return false;\n\n\t\tif ( renderer.toneMapping === NoToneMapping && _effects.length === 0 ) return false;\n\n\t\t_savedRenderTarget = renderTarget;\n\n\t\t// resize internal buffers to match render target (e.g. XR resolution)\n\t\tif ( renderTarget !== null ) {\n\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\n\t\t\tif ( targetA.width !== width || targetA.height !== height ) {\n\n\t\t\t\tthis.setSize( width, height );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if first effect is a RenderPass, it will set its own render target\n\t\tif ( _hasRenderPass === false ) {\n\n\t\t\trenderer.setRenderTarget( targetA );\n\n\t\t}\n\n\t\t// disable tone mapping during render - it will be applied in end()\n\t\t_savedToneMapping = renderer.toneMapping;\n\t\trenderer.toneMapping = NoToneMapping;\n\n\t\treturn true;\n\n\t};\n\n\tthis.hasRenderPass = function () {\n\n\t\treturn _hasRenderPass;\n\n\t};\n\n\tthis.end = function ( renderer, deltaTime ) {\n\n\t\t// restore tone mapping\n\t\trenderer.toneMapping = _savedToneMapping;\n\n\t\t_isCompositing = true;\n\n\t\t// run post-processing effects\n\t\tlet readBuffer = targetA;\n\t\tlet writeBuffer = targetB;\n\n\t\tfor ( let i = 0; i < _effects.length; i ++ ) {\n\n\t\t\tconst effect = _effects[ i ];\n\n\t\t\tif ( effect.enabled === false ) continue;\n\n\t\t\teffect.render( renderer, writeBuffer, readBuffer, deltaTime );\n\n\t\t\tif ( effect.needsSwap !== false ) {\n\n\t\t\t\tconst temp = readBuffer;\n\t\t\t\treadBuffer = writeBuffer;\n\t\t\t\twriteBuffer = temp;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// update output material defines if settings changed\n\t\tif ( _outputColorSpace !== renderer.outputColorSpace || _outputToneMapping !== renderer.toneMapping ) {\n\n\t\t\t_outputColorSpace = renderer.outputColorSpace;\n\t\t\t_outputToneMapping = renderer.toneMapping;\n\n\t\t\tmaterial.defines = {};\n\n\t\t\tif ( ColorManagement.getTransfer( _outputColorSpace ) === SRGBTransfer ) material.defines.SRGB_TRANSFER = '';\n\n\t\t\tconst toneMapping = toneMappingMap[ _outputToneMapping ];\n\t\t\tif ( toneMapping ) material.defines[ toneMapping ] = '';\n\n\t\t\tmaterial.needsUpdate = true;\n\n\t\t}\n\n\t\t// final output to canvas (or XR render target)\n\t\tmaterial.uniforms.tDiffuse.value = readBuffer.texture;\n\t\trenderer.setRenderTarget( _savedRenderTarget );\n\t\trenderer.render( mesh, camera );\n\n\t\t_savedRenderTarget = null;\n\t\t_isCompositing = false;\n\n\t};\n\n\tthis.isCompositing = function () {\n\n\t\treturn _isCompositing;\n\n\t};\n\n\tthis.dispose = function () {\n\n\t\tif ( targetA.depthTexture ) targetA.depthTexture.dispose();\n\t\ttargetA.dispose();\n\t\ttargetB.dispose();\n\t\tgeometry.dispose();\n\t\tmaterial.dispose();\n\n\t};\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\n\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\tlet emptyTexture2D;\n\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\n\n\t\temptyShadowTexture.compareFunction = textures.isReversedDepthBuffer() ? GreaterEqualCompare : LessEqualCompare;\n\t\temptyTexture2D = emptyShadowTexture;\n\n\t} else {\n\n\t\temptyTexture2D = emptyTexture;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture2D, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tlet emptyTexture2D;\n\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\n\n\t\temptyTexture2D = emptyShadowTexture;\n\n\t} else {\n\n\t\temptyTexture2D = emptyTexture;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture2D, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t\t// Sort uniforms to prioritize shadow samplers first (for optimal texture unit allocation)\n\n\t\tconst shadowSamplers = [];\n\t\tconst otherUniforms = [];\n\n\t\tfor ( const u of this.seq ) {\n\n\t\t\tif ( u.type === gl.SAMPLER_2D_SHADOW || u.type === gl.SAMPLER_CUBE_SHADOW || u.type === gl.SAMPLER_2D_ARRAY_SHADOW ) {\n\n\t\t\t\tshadowSamplers.push( u );\n\n\t\t\t} else {\n\n\t\t\t\totherUniforms.push( u );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( shadowSamplers.length > 0 ) {\n\n\t\t\tthis.seq = shadowSamplers.concat( otherUniforms );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nconst _m0 = /*@__PURE__*/ new Matrix3();\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tColorManagement._getMatrix( _m0, ColorManagement.workingColorSpace, colorSpace );\n\n\tconst encodingMatrix = `mat3( ${ _m0.elements.map( ( v ) => v.toFixed( 4 ) ) } )`;\n\n\tswitch ( ColorManagement.getTransfer( colorSpace ) ) {\n\n\t\tcase LinearTransfer:\n\t\t\treturn [ encodingMatrix, 'LinearTransferOETF' ];\n\n\t\tcase SRGBTransfer:\n\t\t\treturn [ encodingMatrix, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\twarn( 'WebGLProgram: Unsupported color space: ', colorSpace );\n\t\t\treturn [ encodingMatrix, 'LinearTransferOETF' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\n\tconst shaderInfoLog = gl.getShaderInfoLog( shader ) || '';\n\tconst errors = shaderInfoLog.trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\n\treturn [\n\n\t\t`vec4 ${functionName}( vec4 value ) {`,\n\n\t\t`\treturn ${components[ 1 ]}( vec4( value.rgb * ${components[ 0 ]}, value.a ) );`,\n\n\t\t'}',\n\n\t].join( '\\n' );\n\n}\n\nconst toneMappingFunctions = {\n\t[ LinearToneMapping ]: 'Linear',\n\t[ ReinhardToneMapping ]: 'Reinhard',\n\t[ CineonToneMapping ]: 'Cineon',\n\t[ ACESFilmicToneMapping ]: 'ACESFilmic',\n\t[ AgXToneMapping ]: 'AgX',\n\t[ NeutralToneMapping ]: 'Neutral',\n\t[ CustomToneMapping ]: 'Custom'\n};\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tconst toneMappingName = toneMappingFunctions[ toneMapping ];\n\n\tif ( toneMappingName === undefined ) {\n\n\t\twarn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\treturn 'vec3 ' + functionName + '( vec3 color ) { return LinearToneMapping( color ); }';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\n\nfunction getLuminanceFunction() {\n\n\tColorManagement.getLuminanceCoefficients( _v0 );\n\n\tconst r = _v0.x.toFixed( 4 );\n\tconst g = _v0.y.toFixed( 4 );\n\tconst b = _v0.z.toFixed( 4 );\n\n\treturn [\n\n\t\t'float luminance( const in vec3 rgb ) {',\n\n\t\t`\tconst vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,\n\n\t\t'\treturn dot( weights, rgb );',\n\n\t\t'}'\n\n\t].join( '\\n' );\n\n}\n\nfunction generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// log( 'WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map();\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\twarn( 'WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = `precision ${parameters.precision} float;\n\tprecision ${parameters.precision} int;\n\tprecision ${parameters.precision} sampler2D;\n\tprecision ${parameters.precision} samplerCube;\n\tprecision ${parameters.precision} sampler3D;\n\tprecision ${parameters.precision} sampler2DArray;\n\tprecision ${parameters.precision} sampler2DShadow;\n\tprecision ${parameters.precision} samplerCubeShadow;\n\tprecision ${parameters.precision} sampler2DArrayShadow;\n\tprecision ${parameters.precision} isampler2D;\n\tprecision ${parameters.precision} isampler3D;\n\tprecision ${parameters.precision} isamplerCube;\n\tprecision ${parameters.precision} isampler2DArray;\n\tprecision ${parameters.precision} usampler2D;\n\tprecision ${parameters.precision} usampler3D;\n\tprecision ${parameters.precision} usamplerCube;\n\tprecision ${parameters.precision} usampler2DArray;\n\t`;\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nconst shadowMapTypeDefines = {\n\t[ PCFShadowMap ]: 'SHADOWMAP_TYPE_PCF',\n\t[ VSMShadowMap ]: 'SHADOWMAP_TYPE_VSM'\n};\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\treturn shadowMapTypeDefines[ parameters.shadowMapType ] || 'SHADOWMAP_TYPE_BASIC';\n\n}\n\nconst envMapTypeDefines = {\n\t[ CubeReflectionMapping ]: 'ENVMAP_TYPE_CUBE',\n\t[ CubeRefractionMapping ]: 'ENVMAP_TYPE_CUBE',\n\t[ CubeUVReflectionMapping ]: 'ENVMAP_TYPE_CUBE_UV'\n};\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tif ( parameters.envMap === false ) return 'ENVMAP_TYPE_CUBE';\n\n\treturn envMapTypeDefines[ parameters.envMapMode ] || 'ENVMAP_TYPE_CUBE';\n\n}\n\nconst envMapModeDefines = {\n\t[ CubeRefractionMapping ]: 'ENVMAP_MODE_REFRACTION'\n};\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tif ( parameters.envMap === false ) return 'ENVMAP_MODE_REFLECTION';\n\n\treturn envMapModeDefines[ parameters.envMapMode ] || 'ENVMAP_MODE_REFLECTION';\n\n}\n\nconst envMapBlendingDefines = {\n\t[ MultiplyOperation ]: 'ENVMAP_BLENDING_MULTIPLY',\n\t[ MixOperation ]: 'ENVMAP_BLENDING_MIX',\n\t[ AddOperation ]: 'ENVMAP_BLENDING_ADD'\n};\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tif ( parameters.envMap === false ) return 'ENVMAP_BLENDING_NONE';\n\n\treturn envMapBlendingDefines[ parameters.combine ] || 'ENVMAP_BLENDING_NONE';\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customVertexExtensions = generateVertexExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexNormals ? '#define HAS_NORMAL' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',\n\t\t\tparameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_MORPH',\n\n\t\t\t'\tuniform sampler2D morphTexture;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.packedNormalMap ? '#define USE_PACKED_NORMALMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.dispersion ? '#define USE_DISPERSION' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas || parameters.batchingColor ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.numLightProbeGrids > 0 ? '#define USE_LIGHT_PROBES_GRID' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\t\t\tparameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',\n\t\t\tparameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\t\t\tgetLuminanceFunction(),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\tcustomVertexExtensions,\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// log( '*VERTEX*', vertexGlsl );\n\t// log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programInfoLog = gl.getProgramInfoLog( program ) || '';\n\t\t\tconst vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';\n\t\t\tconst fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';\n\n\t\t\tconst programLog = programInfoLog.trim();\n\t\t\tconst vertexLog = vertexShaderInfoLog.trim();\n\t\t\tconst fragmentLog = fragmentShaderInfoLog.trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\terror(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\twarn( 'WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction isPackedRGFormat( format ) {\n\n\treturn format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;\n\n}\n\nfunction WebGLPrograms( renderer, environments, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst _activeChannels = new Set();\n\tconst programs = [];\n\tconst programsMap = new Map();\n\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distance',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\t_activeChannels.add( value );\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object, lightProbeGrids ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;\n\n\t\tconst usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );\n\t\tconst envMap = environments.get( material.envMap || environment, usePMREM );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\twarn( 'WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst reversedDepthBuffer = renderer.state.buffers.depth.getReversed();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_DISPERSION = material.dispersion > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tbatching: IS_BATCHEDMESH,\n\t\t\tbatchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,\n\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace ),\n\t\t\talphaToCoverage: !! material.alphaToCoverage,\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\t\t\tpackedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat( material.normalMap.format\t),\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tdispersion: HAS_DISPERSION,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexNormals: !! geometry.attributes.normal,\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( !! fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.wireframe === false && (\n\t\t\t\tmaterial.flatShading === true ||\n\t\t\t\t( geometry.attributes.normal === undefined && HAS_NORMALMAP === false &&\n\t\t\t\t\t( material.isMeshLambertMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isMeshPhysicalMaterial )\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\t\t\treversedDepthBuffer: reversedDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumLightProbes: lights.numLightProbes,\n\n\t\t\tnumLightProbeGrids: lightProbeGrids.length,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\n\t\t\tdecodeVideoTextureEmissive: HAS_EMISSIVEMAP && ( material.emissiveMap.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.emissiveMap.colorSpace ) === SRGBTransfer ),\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\n\t\t\textensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),\n\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\t// the usage of getChannel() determines the active texture channels for this shader\n\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\n\n\t\t_activeChannels.clear();\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.numLightProbes );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancingMorph )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.dispersion )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.batchingColor )\n\t\t\t_programLayers.enable( 20 );\n\t\tif ( parameters.gradientMap )\n\t\t\t_programLayers.enable( 21 );\n\t\tif ( parameters.packedNormalMap )\n\t\t\t_programLayers.enable( 22 );\n\t\tif ( parameters.vertexNormals )\n\t\t\t_programLayers.enable( 23 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.reversedDepthBuffer )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.decodeVideoTextureEmissive )\n\t\t\t_programLayers.enable( 20 );\n\t\tif ( parameters.alphaToCoverage )\n\t\t\t_programLayers.enable( 21 );\n\t\tif ( parameters.numLightProbeGrids > 0 )\n\t\t\t_programLayers.enable( 22 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program = programsMap.get( cacheKey );\n\n\t\tif ( program !== undefined ) {\n\n\t\t\t++ program.usedTimes;\n\n\t\t} else {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t\tprogramsMap.set( cacheKey, program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Remove from map\n\t\t\tprogramsMap.delete( program.cacheKey );\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction has( object ) {\n\n\t\treturn properties.has( object );\n\n\t}\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\thas: has,\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.materialVariant !== b.materialVariant ) {\n\n\t\treturn a.materialVariant - b.materialVariant;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction materialVariant( object ) {\n\n\t\tlet variant = 0;\n\t\tif ( object.isInstancedMesh ) variant += 2;\n\t\tif ( object.isSkinnedMesh ) variant += 1;\n\t\treturn variant;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tmaterialVariant: materialVariant( object ),\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.materialVariant = materialVariant( object );\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: -1,\n\t\t\tpointLength: -1,\n\t\t\tspotLength: -1,\n\t\t\trectAreaLength: -1,\n\t\t\themiLength: -1,\n\n\t\t\tnumDirectionalShadows: -1,\n\t\t\tnumPointShadows: -1,\n\t\t\tnumSpotShadows: -1,\n\t\t\tnumSpotMaps: -1,\n\n\t\t\tnumLightProbes: -1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0,\n\t\tnumLightProbes: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tlet shadowMap = null;\n\n\t\t\tif ( light.shadow && light.shadow.map ) {\n\n\t\t\t\tif ( light.shadow.map.texture.format === RGFormat ) {\n\n\t\t\t\t\t// VSM uses color texture with blurred mean/std_dev\n\t\t\t\t\tshadowMap = light.shadow.map.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Other types use depth texture\n\t\t\t\t\tshadowMap = light.shadow.map.depthTexture || light.shadow.map.texture;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity;\n\t\t\t\tg += color.g * intensity;\n\t\t\t\tb += color.b * intensity;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t\tnumLightProbes ++;\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ||\n\t\t\thash.numLightProbes !== numLightProbes ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\t\t\tstate.numLightProbes = numLightProbes;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\thash.numLightProbes = numLightProbes;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions ) {\n\n\tconst lights = new WebGLLights( extensions );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\tconst lightProbeGridArray = [];\n\n\tfunction init( camera ) {\n\n\t\tstate.camera = camera;\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\t\tlightProbeGridArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction pushLightProbeGrid( volume ) {\n\n\t\tlightProbeGridArray.push( volume );\n\n\t}\n\n\tfunction setupLights() {\n\n\t\tlights.setup( lightsArray );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\t\tlightProbeGridArray: lightProbeGridArray,\n\n\t\tcamera: null,\n\n\t\tlights: lights,\n\n\t\ttransmissionRenderTarget: {},\n\t\ttextureUnits: 0\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow,\n\t\tpushLightProbeGrid: pushLightProbeGrid\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\\n\\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\\n}\";\n\nconst _cubeDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 0, 0 ), /*@__PURE__*/ new Vector3( -1, 0, 0 ), /*@__PURE__*/ new Vector3( 0, 1, 0 ),\n\t/*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, 0, 1 ), /*@__PURE__*/ new Vector3( 0, 0, -1 )\n];\n\nconst _cubeUps = [\n\t/*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, 0, 1 ),\n\t/*@__PURE__*/ new Vector3( 0, 0, -1 ), /*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, -1, 0 )\n];\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nfunction WebGLShadowMap( renderer, objects, capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial(),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ -1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tif ( this.type === PCFSoftShadowMap ) {\n\n\t\t\twarn( 'WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.' );\n\t\t\tthis.type = PCFShadowMap;\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst activeCubeFace = renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst _state = renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\n\t\tif ( _state.buffers.depth.getReversed() === true ) {\n\n\t\t\t_state.buffers.color.setClear( 0, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\n\t\t}\n\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst typeChanged = _previousType !== this.type;\n\n\t\t// When shadow map type changes, materials need recompilation because sampler types change\n\t\t// (sampler2DShadow for PCF vs sampler2D for Basic)\n\t\tif ( typeChanged ) {\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tif ( object.material ) {\n\n\t\t\t\t\tif ( Array.isArray( object.material ) ) {\n\n\t\t\t\t\t\tobject.material.forEach( mat => mat.needsUpdate = true );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.material.needsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t}\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\twarn( 'WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst reversedDepthBuffer = renderer.state.buffers.depth.getReversed();\n\t\t\tshadow.camera._reversedDepth = reversedDepthBuffer;\n\n\t\t\tif ( shadow.map === null || typeChanged === true ) {\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tif ( shadow.map.depthTexture !== null ) {\n\n\t\t\t\t\t\tshadow.map.depthTexture.dispose();\n\t\t\t\t\t\tshadow.map.depthTexture = null;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.type === VSMShadowMap ) {\n\n\t\t\t\t\tif ( light.isPointLight ) {\n\n\t\t\t\t\t\twarn( 'WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.' );\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, {\n\t\t\t\t\t\tformat: RGFormat,\n\t\t\t\t\t\ttype: HalfFloatType,\n\t\t\t\t\t\tminFilter: LinearFilter,\n\t\t\t\t\t\tmagFilter: LinearFilter,\n\t\t\t\t\t\tgenerateMipmaps: false\n\t\t\t\t\t} );\n\t\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\t\t// Native depth texture for VSM - depth is captured here, then blurred into the color texture\n\t\t\t\t\tshadow.map.depthTexture = new DepthTexture( _shadowMapSize.x, _shadowMapSize.y, FloatType );\n\t\t\t\t\tshadow.map.depthTexture.name = light.name + '.shadowMapDepth';\n\t\t\t\t\tshadow.map.depthTexture.format = DepthFormat;\n\t\t\t\t\tshadow.map.depthTexture.compareFunction = null; // For regular sampling (not shadow comparison)\n\t\t\t\t\tshadow.map.depthTexture.minFilter = NearestFilter;\n\t\t\t\t\tshadow.map.depthTexture.magFilter = NearestFilter;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( light.isPointLight ) {\n\n\t\t\t\t\t\tshadow.map = new WebGLCubeRenderTarget( _shadowMapSize.x );\n\t\t\t\t\t\tshadow.map.depthTexture = new CubeDepthTexture( _shadowMapSize.x, UnsignedIntType );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\t\t\t\t\t\tshadow.map.depthTexture = new DepthTexture( _shadowMapSize.x, _shadowMapSize.y, UnsignedIntType );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tshadow.map.depthTexture.name = light.name + '.shadowMap';\n\t\t\t\t\tshadow.map.depthTexture.format = DepthFormat;\n\n\t\t\t\t\tif ( this.type === PCFShadowMap ) {\n\n\t\t\t\t\t\tshadow.map.depthTexture.compareFunction = reversedDepthBuffer ? GreaterEqualCompare : LessEqualCompare;\n\t\t\t\t\t\tshadow.map.depthTexture.minFilter = LinearFilter;\n\t\t\t\t\t\tshadow.map.depthTexture.magFilter = LinearFilter;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshadow.map.depthTexture.compareFunction = null;\n\t\t\t\t\t\tshadow.map.depthTexture.minFilter = NearestFilter;\n\t\t\t\t\t\tshadow.map.depthTexture.magFilter = NearestFilter;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t// For cube render targets (PointLights), render all 6 faces. Otherwise, render once.\n\t\t\tconst faceCount = shadow.map.isWebGLCubeRenderTarget ? 6 : 1;\n\n\t\t\tfor ( let face = 0; face < faceCount; face ++ ) {\n\n\t\t\t\t// For cube render targets, render to each face separately\n\t\t\t\tif ( shadow.map.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\trenderer.setRenderTarget( shadow.map, face );\n\t\t\t\t\trenderer.clear();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// For 2D render targets, use viewports\n\t\t\t\t\tif ( face === 0 ) {\n\n\t\t\t\t\t\trenderer.setRenderTarget( shadow.map );\n\t\t\t\t\t\trenderer.clear();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst viewport = shadow.getViewport( face );\n\n\t\t\t\t\t_viewport.set(\n\t\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t\t);\n\n\t\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\t}\n\n\t\t\t\tif ( light.isPointLight ) {\n\n\t\t\t\t\tconst camera = shadow.camera;\n\t\t\t\t\tconst shadowMatrix = shadow.matrix;\n\n\t\t\t\t\tconst far = light.distance || camera.far;\n\n\t\t\t\t\tif ( far !== camera.far ) {\n\n\t\t\t\t\t\tcamera.far = far;\n\t\t\t\t\t\tcamera.updateProjectionMatrix();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t\t\t\t_lookTarget.copy( camera.position );\n\t\t\t\t\t_lookTarget.add( _cubeDirections[ face ] );\n\t\t\t\t\tcamera.up.copy( _cubeUps[ face ] );\n\t\t\t\t\tcamera.lookAt( _lookTarget );\n\t\t\t\t\tcamera.updateMatrixWorld();\n\n\t\t\t\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t\t\tshadow._frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t}\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\trenderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, {\n\t\t\t\tformat: RGFormat,\n\t\t\t\ttype: HalfFloatType\n\t\t\t} );\n\n\t\t}\n\n\t\t// vertical pass - read from native depth texture\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\trenderer.setRenderTarget( shadow.mapPass );\n\t\trenderer.clear();\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\trenderer.setRenderTarget( shadow.map );\n\t\trenderer.clear();\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ||\n\t\t\t\t( material.alphaToCoverage === true ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions ) {\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( -1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentReversed = false;\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetReversed: function ( reversed ) {\n\n\t\t\t\tif ( currentReversed !== reversed ) {\n\n\t\t\t\t\tconst ext = extensions.get( 'EXT_clip_control' );\n\n\t\t\t\t\tif ( reversed ) {\n\n\t\t\t\t\t\text.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\text.clipControlEXT( ext.LOWER_LEFT_EXT, ext.NEGATIVE_ONE_TO_ONE_EXT );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentReversed = reversed;\n\n\t\t\t\t\tconst oldDepth = currentDepthClear;\n\t\t\t\t\tcurrentDepthClear = null;\n\t\t\t\t\tthis.setClear( oldDepth );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tgetReversed: function () {\n\n\t\t\t\treturn currentReversed;\n\n\t\t\t},\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentReversed ) depthFunc = ReversedDepthFuncs[ depthFunc ];\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t\tif ( currentReversed ) {\n\n\t\t\t\t\t\tdepth = 1 - depth;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.clearDepth( depth );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\t\t\t\tcurrentReversed = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\tlet parameters = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== -1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== -1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t}\n\n\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t}\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tequationToGL[ MinEquation ] = gl.MIN;\n\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terror( 'WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\terror( 'WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\terror( 'WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terror( 'WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t\tif ( depthBuffer.getReversed() ) {\n\n\t\t\t\t\tfactor = - factor;\n\n\t\t\t\t}\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D( ...arguments );\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLState:', e );\n\n\t\t}\n\n\t}\n\n\tfunction getParameter( name ) {\n\n\t\tif ( parameters[ name ] !== undefined ) {\n\n\t\t\treturn parameters[ name ];\n\n\t\t} else {\n\n\t\t\treturn gl.getParameter( name );\n\n\t\t}\n\n\t}\n\n\tfunction pixelStorei( name, value ) {\n\n\t\tif ( parameters[ name ] !== value ) {\n\n\t\t\tgl.pixelStorei( name, value );\n\t\t\tparameters[ name ] = value;\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\t\tgl.blendColor( 0, 0, 0, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\n\t\tdepthBuffer.setReversed( false );\n\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tgl.pixelStorei( gl.PACK_ALIGNMENT, 4 );\n\t\tgl.pixelStorei( gl.UNPACK_ALIGNMENT, 4 );\n\t\tgl.pixelStorei( gl.UNPACK_FLIP_Y_WEBGL, false );\n\t\tgl.pixelStorei( gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false );\n\t\tgl.pixelStorei( gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL );\n\t\tgl.pixelStorei( gl.PACK_ROW_LENGTH, 0 );\n\t\tgl.pixelStorei( gl.PACK_SKIP_PIXELS, 0 );\n\t\tgl.pixelStorei( gl.PACK_SKIP_ROWS, 0 );\n\t\tgl.pixelStorei( gl.UNPACK_ROW_LENGTH, 0 );\n\t\tgl.pixelStorei( gl.UNPACK_IMAGE_HEIGHT, 0 );\n\t\tgl.pixelStorei( gl.UNPACK_SKIP_PIXELS, 0 );\n\t\tgl.pixelStorei( gl.UNPACK_SKIP_ROWS, 0 );\n\t\tgl.pixelStorei( gl.UNPACK_SKIP_IMAGES, 0 );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\t\tparameters = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\t\tpixelStorei: pixelStorei,\n\t\tgetParameter: getParameter,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _imageDimensions = new Vector2();\n\tconst _videoTextures = new WeakMap();\n\tconst _htmlTextures = new Set();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\tconst dimensions = getDimensions( image );\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||\n\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\n\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\n\t\t\t\tconst height = Math.floor( scale * dimensions.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\twarn( 'WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\twarn( 'WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture ) {\n\n\t\treturn texture.generateMipmaps;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getTargetType( texture ) {\n\n\t\tif ( texture.isWebGLCubeRenderTarget ) return _gl.TEXTURE_CUBE_MAP;\n\t\tif ( texture.isWebGL3DRenderTarget ) return _gl.TEXTURE_3D;\n\t\tif ( texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture ) return _gl.TEXTURE_2D_ARRAY;\n\t\treturn _gl.TEXTURE_2D;\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\twarn( 'WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet ext_texture_norm16;\n\n\t\tif ( normalized ) {\n\n\t\t\text_texture_norm16 = extensions.get( 'EXT_texture_norm16' );\n\n\t\t\tif ( ! ext_texture_norm16 ) {\n\n\t\t\t\twarn( 'WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.R16_EXT;\n\t\t\tif ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.R16_SNORM_EXT;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RG16_EXT;\n\t\t\tif ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGB8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGB16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGB32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RGB8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RGB16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RGB32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGBA16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGBA32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RGBA8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RGBA16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RGBA32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGB16_EXT;\n\t\t\tif ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\n\t\t\tif ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGBA16_EXT;\n\t\t\tif ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getInternalDepthFormat( useStencil, depthType ) {\n\n\t\tlet glInternalFormat;\n\t\tif ( useStencil ) {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH32F_STENCIL8;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\t\t\t\twarn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn glInternalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t\tif ( texture.isHTMLTexture ) {\n\n\t\t\t_htmlTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t\tproperties.remove( renderTarget.depthTexture );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\tinfo.memory.textures --;\n\n\t\t\t}\n\n\t\t\tproperties.remove( textures[ i ] );\n\n\t\t}\n\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction getTextureUnits() {\n\n\t\treturn textureUnits;\n\n\t}\n\n\tfunction setTextureUnits( value ) {\n\n\t\ttextureUnits = value;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\n\n\t\t\twarn( 'WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\twarn( 'WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\twarn( 'WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t} else if ( texture.isExternalTexture ) {\n\n\t\t\ttextureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t} else if ( texture.isExternalTexture ) {\n\n\t\t\ttextureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isCubeDepthTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture ) {\n\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\n\n\t\t\twarn( 'WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction getRow( index, rowLength, componentStride ) {\n\n\t\treturn Math.floor( Math.floor( index / componentStride ) / rowLength );\n\n\t}\n\n\tfunction updateTexture( texture, image, glFormat, glType ) {\n\n\t\tconst componentStride = 4; // only RGBA supported\n\n\t\tconst updateRanges = texture.updateRanges;\n\n\t\tif ( updateRanges.length === 0 ) {\n\n\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t} else {\n\n\t\t\t// Before applying update ranges, we merge any adjacent / overlapping\n\t\t\t// ranges to reduce load on `gl.texSubImage2D`. Empirically, this has led\n\t\t\t// to performance improvements for applications which make heavy use of\n\t\t\t// update ranges. Likely due to GPU command overhead.\n\t\t\t//\n\t\t\t// Note that to reduce garbage collection between frames, we merge the\n\t\t\t// update ranges in-place. This is safe because this method will clear the\n\t\t\t// update ranges once updated.\n\n\t\t\tupdateRanges.sort( ( a, b ) => a.start - b.start );\n\n\t\t\t// To merge the update ranges in-place, we work from left to right in the\n\t\t\t// existing updateRanges array, merging ranges. This may result in a final\n\t\t\t// array which is smaller than the original. This index tracks the last\n\t\t\t// index representing a merged range, any data after this index can be\n\t\t\t// trimmed once the merge algorithm is completed.\n\t\t\tlet mergeIndex = 0;\n\n\t\t\tfor ( let i = 1; i < updateRanges.length; i ++ ) {\n\n\t\t\t\tconst previousRange = updateRanges[ mergeIndex ];\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\t// Only merge if in the same row and overlapping/adjacent\n\t\t\t\tconst previousEnd = previousRange.start + previousRange.count;\n\t\t\t\tconst currentRow = getRow( range.start, image.width, componentStride );\n\t\t\t\tconst previousRow = getRow( previousRange.start, image.width, componentStride );\n\n\t\t\t\t// We add one here to merge adjacent ranges. This is safe because ranges\n\t\t\t\t// operate over positive integers.\n\t\t\t\tif (\n\t\t\t\t\trange.start <= previousEnd + 1 &&\n\t\t\t\t\tcurrentRow === previousRow &&\n\t\t\t\t\tgetRow( range.start + range.count - 1, image.width, componentStride ) === currentRow // ensure range doesn't spill\n\t\t\t\t) {\n\n\t\t\t\t\tpreviousRange.count = Math.max(\n\t\t\t\t\t\tpreviousRange.count,\n\t\t\t\t\t\trange.start + range.count - previousRange.start\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\t++ mergeIndex;\n\t\t\t\t\tupdateRanges[ mergeIndex ] = range;\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\t// Trim the array to only contain the merged ranges.\n\t\t\tupdateRanges.length = mergeIndex + 1;\n\n\t\t\tconst currentUnpackRowLen = state.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackSkipPixels = state.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = state.getParameter( _gl.UNPACK_SKIP_ROWS );\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tconst pixelStart = Math.floor( range.start / componentStride );\n\t\t\t\tconst pixelCount = Math.ceil( range.count / componentStride );\n\n\t\t\t\tconst x = pixelStart % image.width;\n\t\t\t\tconst y = Math.floor( pixelStart / image.width );\n\n\t\t\t\t// Assumes update ranges refer to contiguous memory\n\t\t\t\tconst width = pixelCount;\n\t\t\t\tconst height = 1;\n\n\t\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );\n\t\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );\n\n\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );\n\n\t\t\t}\n\n\t\t\ttexture.clearUpdateRanges();\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\n\t\t}\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst isImageBitmap = ( typeof ImageBitmap !== 'undefined' && texture.image instanceof ImageBitmap );\n\n\t\t\tif ( isImageBitmap === false ) {\n\n\t\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t\tstate.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t\tstate.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t\tstate.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\t}\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tconst levels = getMipLevels( texture, image );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\tglInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tupdateTexture( texture, image, glFormat, glType );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tconst layerData = mipmap.data.subarray(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData );\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\twarn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\twarn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\tconst layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\tconst layerData = image.data.subarray(\n\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isHTMLTexture ) {\n\n\t\t\t\tif ( 'texElementImage2D' in _gl ) {\n\n\t\t\t\t\tconst canvas = _gl.canvas;\n\n\t\t\t\t\t// Ensure the canvas supports HTML-in-Canvas and the element is a child.\n\t\t\t\t\tif ( ! canvas.hasAttribute( 'layoutsubtree' ) ) {\n\n\t\t\t\t\t\tcanvas.setAttribute( 'layoutsubtree', 'true' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image.parentNode !== canvas ) {\n\n\t\t\t\t\t\tcanvas.appendChild( image );\n\n\t\t\t\t\t\t// Register and set up a shared paint callback for all HTMLTextures.\n\t\t\t\t\t\t_htmlTextures.add( texture );\n\n\t\t\t\t\t\tcanvas.onpaint = ( event ) => {\n\n\t\t\t\t\t\t\tconst changed = event.changedElements;\n\n\t\t\t\t\t\t\tfor ( const t of _htmlTextures ) {\n\n\t\t\t\t\t\t\t\tif ( changed.includes( t.image ) ) {\n\n\t\t\t\t\t\t\t\t\tt.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tcanvas.requestPaint();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst level = 0;\n\t\t\t\t\tconst internalFormat = _gl.RGBA;\n\t\t\t\t\tconst srcFormat = _gl.RGBA;\n\t\t\t\t\tconst srcType = _gl.UNSIGNED_BYTE;\n\n\t\t\t\t\t_gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image );\n\t\t\t\t\t_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );\n\t\t\t\t\t_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\n\t\t\t\t\t_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tconst dimensions = getDimensions( image );\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\tstate.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\tstate.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\tstate.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tlet levels = getMipLevels( texture, image );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\twarn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tconst dimensions = getDimensions( cubeImage[ 0 ] );\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\ttextureProperties.__renderTarget = renderTarget;\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, useMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t// retrieve the depth attachment types\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tconst depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;\n\t\t\tconst glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );\n\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t// set up the attachment\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisample ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisample ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget, cubeFace ) {\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\tconst textureProperties = properties.get( renderTarget.depthTexture );\n\t\ttextureProperties.__renderTarget = renderTarget;\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! textureProperties.__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( isCube ) {\n\n\t\t\t// For cube depth textures, initialize and bind without uploading image data\n\t\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\t\ttextureProperties.__webglInit = true;\n\t\t\t\trenderTarget.depthTexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t}\n\n\t\t\t// Only create and allocate storage once\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget.depthTexture );\n\n\t\t\t\t// Allocate storage for all 6 faces with correct depth texture format\n\t\t\t\tconst glFormat = utils.convert( renderTarget.depthTexture.format );\n\t\t\t\tconst glType = utils.convert( renderTarget.depthTexture.type );\n\n\t\t\t\t// Use proper internal format for depth textures\n\t\t\t\tlet glInternalFormat;\n\t\t\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\t}\n\n\t\tconst webglDepthTexture = textureProperties.__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tconst glTextureType = isCube ? _gl.TEXTURE_CUBE_MAP_POSITIVE_X + cubeFace : _gl.TEXTURE_2D;\n\t\tconst glAttachmentType = renderTarget.depthTexture.format === DepthStencilFormat ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\t// if the bound depth texture has changed\n\t\tif ( renderTargetProperties.__boundDepthTexture !== renderTarget.depthTexture ) {\n\n\t\t\t// fire the dispose event to get rid of stored state associated with the previously bound depth buffer\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tif ( renderTargetProperties.__depthDisposeCallback ) {\n\n\t\t\t\trenderTargetProperties.__depthDisposeCallback();\n\n\t\t\t}\n\n\t\t\t// set up dispose listeners to track when the currently attached buffer is implicitly unbound\n\t\t\tif ( depthTexture ) {\n\n\t\t\t\tconst disposeEvent = () => {\n\n\t\t\t\t\tdelete renderTargetProperties.__boundDepthTexture;\n\t\t\t\t\tdelete renderTargetProperties.__depthDisposeCallback;\n\t\t\t\t\tdepthTexture.removeEventListener( 'dispose', disposeEvent );\n\n\t\t\t\t};\n\n\t\t\t\tdepthTexture.addEventListener( 'dispose', disposeEvent );\n\t\t\t\trenderTargetProperties.__depthDisposeCallback = disposeEvent;\n\n\t\t\t}\n\n\t\t\trenderTargetProperties.__boundDepthTexture = depthTexture;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\t// For cube render targets with depth texture, setup each face\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, i );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst mipmaps = renderTarget.texture.mipmaps;\n\n\t\t\t\tif ( mipmaps && mipmaps.length > 0 ) {\n\n\t\t\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer[ i ] === undefined ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// attach buffer if it's been created already\n\t\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer[ i ];\n\t\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst mipmaps = renderTarget.texture.mipmaps;\n\n\t\t\t\tif ( mipmaps && mipmaps.length > 0 ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer === undefined ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// attach buffer if it's been created already\n\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer;\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\tif ( ! isMultipleRenderTargets ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindTexture( glTextureType, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( glTextureType, attachment );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment ) ) {\n\n\t\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture );\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tconst targetType = getTargetType( renderTarget );\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( targetType, webglTexture );\n\t\t\t\tgenerateMipmap( targetType );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tconst invalidationArrayRead = [];\n\tconst invalidationArrayDraw = [];\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.samples > 0 ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = renderTarget.textures;\n\t\t\t\tconst width = renderTarget.width;\n\t\t\t\tconst height = renderTarget.height;\n\t\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\t\t\t// If MRT we need to remove FBO attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tconst mipmaps = renderTarget.texture.mipmaps;\n\n\t\t\t\tif ( mipmaps && mipmaps.length > 0 ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTarget.resolveDepthBuffer ) {\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\n\t\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\n\n\t\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\t\tif ( supportsInvalidateFramebuffer === true ) {\n\n\t\t\t\t\t\tinvalidationArrayRead.length = 0;\n\t\t\t\t\t\tinvalidationArrayDraw.length = 0;\n\n\t\t\t\t\t\tinvalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {\n\n\t\t\t\t\t\t\tinvalidationArrayRead.push( depthStyle );\n\t\t\t\t\t\t\tinvalidationArrayDraw.push( depthStyle );\n\n\t\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t} else {\n\n\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\twarn( 'WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\terror( 'WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction getDimensions( image ) {\n\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\n\n\t\t\t// if intrinsic data are not available, fallback to width/height\n\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\n\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\n\n\t\t\t_imageDimensions.width = image.displayWidth;\n\t\t\t_imageDimensions.height = image.displayHeight;\n\n\t\t} else {\n\n\t\t\t_imageDimensions.width = image.width;\n\t\t\t_imageDimensions.height = image.height;\n\n\t\t}\n\n\t\treturn _imageDimensions;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\tthis.getTextureUnits = getTextureUnits;\n\tthis.setTextureUnits = setTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n\tthis.isReversedDepthBuffer = function () {\n\n\t\treturn state.buffers.depth.getReversed();\n\n\t};\n\n}\n\nfunction WebGLUtils( gl, extensions ) {\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\n\t\tif ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBFormat ) return gl.RGB;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( transfer === SRGBTransfer ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC\n\n\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format || p === R11_EAC_Format || p === SIGNED_R11_EAC_Format || p === RG11_EAC_Format || p === SIGNED_RG11_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\t\t\t\tif ( p === R11_EAC_Format ) return extension.COMPRESSED_R11_EAC;\n\t\t\t\tif ( p === SIGNED_R11_EAC_Format ) return extension.COMPRESSED_SIGNED_R11_EAC;\n\t\t\t\tif ( p === RG11_EAC_Format ) return extension.COMPRESSED_RG11_EAC;\n\t\t\t\tif ( p === SIGNED_RG11_EAC_Format ) return extension.COMPRESSED_SIGNED_RG11_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nconst _occlusion_vertex = `\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`;\n\nconst _occlusion_fragment = `\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}`;\n\n/**\n * A XR module that manages the access to the Depth Sensing API.\n */\nclass WebXRDepthSensing {\n\n\t/**\n\t * Constructs a new depth sensing module.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * An opaque texture representing the depth of the user's environment.\n\t\t *\n\t\t * @type {?ExternalTexture}\n\t\t */\n\t\tthis.texture = null;\n\n\t\t/**\n\t\t * A plane mesh for visualizing the depth texture.\n\t\t *\n\t\t * @type {?Mesh}\n\t\t */\n\t\tthis.mesh = null;\n\n\t\t/**\n\t\t * The depth near value.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.depthNear = 0;\n\n\t\t/**\n\t\t * The depth near far.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.depthFar = 0;\n\n\t}\n\n\t/**\n\t * Inits the depth sensing module\n\t *\n\t * @param {XRWebGLDepthInformation} depthData - The XR depth data.\n\t * @param {XRRenderState} renderState - The XR render state.\n\t */\n\tinit( depthData, renderState ) {\n\n\t\tif ( this.texture === null ) {\n\n\t\t\tconst texture = new ExternalTexture( depthData.texture );\n\n\t\t\tif ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {\n\n\t\t\t\tthis.depthNear = depthData.depthNear;\n\t\t\t\tthis.depthFar = depthData.depthFar;\n\n\t\t\t}\n\n\t\t\tthis.texture = texture;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a plane mesh that visualizes the depth texture.\n\t *\n\t * @param {ArrayCamera} cameraXR - The XR camera.\n\t * @return {?Mesh} The plane mesh.\n\t */\n\tgetMesh( cameraXR ) {\n\n\t\tif ( this.texture !== null ) {\n\n\t\t\tif ( this.mesh === null ) {\n\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\n\t\t\t\tconst material = new ShaderMaterial( {\n\t\t\t\t\tvertexShader: _occlusion_vertex,\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\n\t\t\t\t\tuniforms: {\n\t\t\t\t\t\tdepthColor: { value: this.texture },\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this.mesh;\n\n\t}\n\n\t/**\n\t * Resets the module\n\t */\n\treset() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t}\n\n\t/**\n\t * Returns a texture representing the depth of the user's environment.\n\t *\n\t * @return {?ExternalTexture} The depth texture.\n\t */\n\tgetDepthTexture() {\n\n\t\treturn this.texture;\n\n\t}\n\n}\n\n/**\n * This class represents an abstraction of the WebXR Device API and is\n * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public\n * interface that allows users to enable/disable XR and perform XR related\n * tasks like for instance retrieving controllers.\n *\n * @augments EventDispatcher\n * @hideconstructor\n */\nclass WebXRManager extends EventDispatcher {\n\n\t/**\n\t * Constructs a new WebGL renderer.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGL2RenderingContext} gl - The rendering context.\n\t */\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\n\t\tconst supportsGlBinding = typeof XRWebGLBinding !== 'undefined';\n\n\t\tconst depthSensing = new WebXRDepthSensing();\n\t\tconst cameraAccessTextures = {};\n\t\tconst attributes = gl.getContextAttributes();\n\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\t/**\n\t\t * Whether the manager's XR camera should be automatically updated or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.cameraAutoUpdate = true;\n\n\t\t/**\n\t\t * This flag notifies the renderer to be ready for XR rendering. Set it to `true`\n\t\t * if you are going to use XR in your app.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.enabled = false;\n\n\t\t/**\n\t\t * Whether XR presentation is active or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default false\n\t\t */\n\t\tthis.isPresenting = false;\n\n\t\t/**\n\t\t * Returns a group representing the `target ray` space of the XR controller.\n\t\t * Use this space for visualizing 3D objects that support the user in pointing\n\t\t * tasks like UI interaction.\n\t\t *\n\t\t * @param {number} index - The index of the controller.\n\t\t * @return {Group} A group representing the `target ray` space.\n\t\t */\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\t/**\n\t\t * Returns a group representing the `grip` space of the XR controller.\n\t\t * Use this space for visualizing 3D objects that support the user in pointing\n\t\t * tasks like UI interaction.\n\t\t *\n\t\t * Note: If you want to show something in the user's hand AND offer a\n\t\t * pointing ray at the same time, you'll want to attached the handheld object\n\t\t * to the group returned by `getControllerGrip()` and the ray to the\n\t\t * group returned by `getController()`. The idea is to have two\n\t\t * different groups in two different coordinate spaces for the same WebXR\n\t\t * controller.\n\t\t *\n\t\t * @param {number} index - The index of the controller.\n\t\t * @return {Group} A group representing the `grip` space.\n\t\t */\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\t/**\n\t\t * Returns a group representing the `hand` space of the XR controller.\n\t\t * Use this space for visualizing 3D objects that support the user in pointing\n\t\t * tasks like UI interaction.\n\t\t *\n\t\t * @param {number} index - The index of the controller.\n\t\t * @return {Group} A group representing the `hand` space.\n\t\t */\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === -1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\tdepthSensing.reset();\n\t\t\tfor ( const key in cameraAccessTextures ) {\n\n\t\t\t\tdelete cameraAccessTextures[ key ];\n\n\t\t\t}\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, false );\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\t/**\n\t\t * Sets the framebuffer scale factor.\n\t\t *\n\t\t * This method can not be used during a XR session.\n\t\t *\n\t\t * @param {number} value - The framebuffer scale factor.\n\t\t */\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\twarn( 'WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical\n\t\t * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can\n\t\t * improve tracking. Default is `local-floor`. Valid values can be found here\n\t\t * https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types.\n\t\t *\n\t\t * This method can not be used during a XR session.\n\t\t *\n\t\t * @param {string} value - The reference space type.\n\t\t */\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\twarn( 'WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the XR reference space.\n\t\t *\n\t\t * @return {XRReferenceSpace} The XR reference space.\n\t\t */\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\t/**\n\t\t * Sets a custom XR reference space.\n\t\t *\n\t\t * @param {XRReferenceSpace} space - The XR reference space.\n\t\t */\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current base layer.\n\t\t *\n\t\t * This is an `XRProjectionLayer` when the targeted XR device supports the\n\t\t * WebXR Layers API, or an `XRWebGLLayer` otherwise.\n\t\t *\n\t\t * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.\n\t\t */\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current XR binding.\n\t\t *\n\t\t * Creates a new binding if needed and the browser is\n\t\t * capable of doing so.\n\t\t *\n\t\t * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.\n\t\t */\n\t\tthis.getBinding = function () {\n\n\t\t\tif ( glBinding === null && supportsGlBinding ) {\n\n\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t}\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current XR frame.\n\t\t *\n\t\t * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.\n\t\t */\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current XR session.\n\t\t *\n\t\t * @return {?XRSession} The XR session. Returns `null` when used outside a XR session.\n\t\t */\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\t/**\n\t\t * After a XR session has been requested usually with one of the `*Button` modules, it\n\t\t * is injected into the renderer with this method. This method triggers the start of\n\t\t * the actual XR rendering.\n\t\t *\n\t\t * @async\n\t\t * @param {XRSession} value - The XR session to set.\n\t\t * @return {Promise} A Promise that resolves when the session has been set.\n\t\t */\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\n\t\t\t\t// Check that the browser implements the necessary APIs to use an\n\t\t\t\t// XRProjectionLayer rather than an XRWebGLLayer\n\t\t\t\tconst supportsLayers = supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype;\n\n\t\t\t\tif ( ! supportsLayers ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tresolveDepthBuffer: ( glBaseLayer.ignoreDepthValues === false ),\n\t\t\t\t\t\t\tresolveStencilBuffer: ( glBaseLayer.ignoreDepthValues === false )\n\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = this.getBinding();\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0,\n\t\t\t\t\t\t\tresolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false ),\n\t\t\t\t\t\t\tresolveStencilBuffer: ( glProjLayer.ignoreDepthValues === false )\n\t\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the environment blend mode from the current XR session.\n\t\t *\n\t\t * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session.\n\t\t */\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current depth texture computed via depth sensing.\n\t\t *\n\t\t * See {@link WebXRDepthSensing#getDepthTexture}.\n\t\t *\n\t\t * @return {?Texture} The depth texture.\n\t\t */\n\t\tthis.getDepthTexture = function () {\n\n\t\t\treturn depthSensing.getDepthTexture();\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === -1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === -1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t *\n\t\t * @param {ArrayCamera} camera - The camera to update.\n\t\t * @param {PerspectiveCamera} cameraL - The left camera.\n\t\t * @param {PerspectiveCamera} cameraR - The right camera.\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Check if the projection uses an infinite far plane.\n\t\t\tif ( projL[ 10 ] === -1 ) {\n\n\t\t\t\t// Use the projection matrix from the left eye.\n\t\t\t\t// The camera offset is sufficient to include the view volumes\n\t\t\t\t// of both eyes (assuming symmetric projections).\n\t\t\t\tcamera.projectionMatrix.copy( cameraL.projectionMatrix );\n\t\t\t\tcamera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );\n\n\t\t\t} else {\n\n\t\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t\t// although must now be relative to the new union camera.\n\t\t\t\tconst near2 = near + zOffset;\n\t\t\t\tconst far2 = far + zOffset;\n\t\t\t\tconst left2 = left - xOffset;\n\t\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\t/**\n\t\t * Updates the state of the XR camera. Use this method on app level if you\n\t\t * set `cameraAutoUpdate` to `false`. The method requires the non-XR\n\t\t * camera of the scene as a parameter. The passed in camera's transformation\n\t\t * is automatically adjusted to the position of the XR camera when calling\n\t\t * this method.\n\t\t *\n\t\t * @param {Camera} camera - The camera.\n\t\t */\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tlet depthNear = camera.near;\n\t\t\tlet depthFar = camera.far;\n\n\t\t\tif ( depthSensing.texture !== null ) {\n\n\t\t\t\tif ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;\n\t\t\t\tif ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;\n\n\t\t\t}\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = depthNear;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = depthFar;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\t// inherit camera layers and enable eye layers (1 = left, 2 = right)\n\t\t\tcameraXR.layers.mask = camera.layers.mask | 0b110;\n\t\t\tcameraL.layers.mask = cameraXR.layers.mask & -5;\n\t\t\tcameraR.layers.mask = cameraXR.layers.mask & -3;\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\t/**\n\t\t * Returns an instance of {@link ArrayCamera} which represents the XR camera\n\t\t * of the active XR session. For each view it holds a separate camera object.\n\t\t *\n\t\t * The camera's `fov` is currently not used and does not reflect the fov of\n\t\t * the XR camera. If you need the fov on app level, you have to compute in\n\t\t * manually from the XR camera's projection matrices.\n\t\t *\n\t\t * @return {ArrayCamera} The XR camera.\n\t\t */\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the amount of foveation used by the XR compositor for the projection layer.\n\t\t *\n\t\t * @return {number|undefined} The amount of foveation.\n\t\t */\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the foveation value.\n\t\t *\n\t\t * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution)\n\t\t * and `1` means maximum foveation (the edges render at lower resolution).\n\t\t */\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Returns `true` if depth sensing is supported.\n\t\t *\n\t\t * @return {boolean} Whether depth sensing is supported or not.\n\t\t */\n\t\tthis.hasDepthSensing = function () {\n\n\t\t\treturn depthSensing.texture !== null;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the depth sensing mesh.\n\t\t *\n\t\t * See {@link WebXRDepthSensing#getMesh}.\n\t\t *\n\t\t * @return {Mesh} The depth sensing mesh.\n\t\t */\n\t\tthis.getDepthSensingMesh = function () {\n\n\t\t\treturn depthSensing.getMesh( cameraXR );\n\n\t\t};\n\n\t\t/**\n\t\t * Retrieves an opaque texture from the view-aligned {@link XRCamera}.\n\t\t * Only available during the current animation loop.\n\t\t *\n\t\t * @param {XRCamera} xrCamera - The camera to query.\n\t\t * @return {?Texture} An opaque texture representing the current raw camera frame.\n\t\t */\n\t\tthis.getCameraTexture = function ( xrCamera ) {\n\n\t\t\treturn cameraAccessTextures[ xrCamera ];\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\n\t\t\t\tconst gpuDepthSensingEnabled = enabledFeatures &&\n\t\t\t\t\tenabledFeatures.includes( 'depth-sensing' ) &&\n\t\t\t\t\tsession.depthUsage == 'gpu-optimized';\n\n\t\t\t\tif ( gpuDepthSensingEnabled && supportsGlBinding ) {\n\n\t\t\t\t\tglBinding = scope.getBinding();\n\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\n\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\n\n\t\t\t\t\t\tdepthSensing.init( depthData, session.renderState );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst cameraAccessEnabled = enabledFeatures &&\n\t\t\t\t enabledFeatures.includes( 'camera-access' );\n\n\t\t\t\tif ( cameraAccessEnabled && supportsGlBinding ) {\n\n\t\t\t\t\trenderer.state.unbindTexture();\n\n\t\t\t\t\tglBinding = scope.getBinding();\n\n\t\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\t\tconst camera = views[ i ].camera;\n\n\t\t\t\t\t\tif ( camera ) {\n\n\t\t\t\t\t\t\tlet cameraTex = cameraAccessTextures[ camera ];\n\n\t\t\t\t\t\t\tif ( ! cameraTex ) {\n\n\t\t\t\t\t\t\t\tcameraTex = new ExternalTexture();\n\t\t\t\t\t\t\t\tcameraAccessTextures[ camera ] = cameraTex;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst glTexture = glBinding.getCameraImage( camera );\n\t\t\t\t\t\t\tcameraTex.sourceTexture = glTexture;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _m = /*@__PURE__*/ new Matrix3();\n\n_m.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isNodeMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t} else if ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t\tif ( material.envMap ) {\n\n\t\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t\tif ( material.envMap ) {\n\n\t\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= -1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tconst envMap = materialProperties.envMap;\n\t\tconst envMapRotation = materialProperties.envMapRotation;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\t// note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( envMapRotation ) ).transpose();\n\n\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\n\n\t\t\t\tuniforms.envMapRotation.value.premultiply( _m );\n\n\t\t\t}\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tif ( material.envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.dispersion > 0 ) {\n\n\t\t\tuniforms.dispersion.value = material.dispersion;\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === -1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\terror( 'WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else if ( ArrayBuffer.isView( value ) ) {\n\n\t\t\t\t\t\t\t// copy the buffer data using \"set\"\n\t\t\t\t\t\t\tuniform.__data.set( new value.constructor( value.buffer, value.byteOffset, uniform.__data.length ) );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else if ( ArrayBuffer.isView( value ) ) {\n\n\t\t\t\tcache[ indexString ] = value.slice();\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else if ( ArrayBuffer.isView( value ) ) {\n\n\t\t\t\t// always update the array buffers\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\n\t\t\t\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\tconst chunkOffset = offset % chunkSize; // offset in the current chunk\n\t\t\t\t\tconst chunkPadding = chunkOffset % info.boundary; // required padding to match boundary\n\t\t\t\t\tconst chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data\n\n\t\t\t\t\toffset += chunkPadding;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkStart );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\twarn( 'WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else if ( ArrayBuffer.isView( value ) ) {\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = value.byteLength;\n\n\t\t} else {\n\n\t\t\twarn( 'WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\n/**\n * Precomputed DFG LUT for Image-Based Lighting\n * Resolution: 16x16\n * Samples: 4096 per texel\n * Format: RG16F (2 half floats per texel: scale, bias)\n */\n\n\nconst DATA = new Uint16Array( [\n\t0x30b5, 0x3ad1, 0x314c, 0x3a4d, 0x33d2, 0x391c, 0x35ef, 0x3828, 0x37f3, 0x36a6, 0x38d1, 0x3539, 0x3979, 0x3410, 0x39f8, 0x3252, 0x3a53, 0x30f0, 0x3a94, 0x2fc9, 0x3abf, 0x2e35, 0x3ada, 0x2d05, 0x3ae8, 0x2c1f, 0x3aed, 0x2ae0, 0x3aea, 0x29d1, 0x3ae1, 0x28ff,\n\t0x3638, 0x38e4, 0x364a, 0x38ce, 0x3699, 0x385e, 0x374e, 0x372c, 0x3839, 0x35a4, 0x38dc, 0x3462, 0x396e, 0x32c4, 0x39de, 0x3134, 0x3a2b, 0x3003, 0x3a59, 0x2e3a, 0x3a6d, 0x2ce1, 0x3a6e, 0x2bba, 0x3a5f, 0x2a33, 0x3a49, 0x290a, 0x3a2d, 0x2826, 0x3a0a, 0x26e8,\n\t0x3894, 0x36d7, 0x3897, 0x36c9, 0x38a3, 0x3675, 0x38bc, 0x35ac, 0x38ee, 0x349c, 0x393e, 0x3332, 0x3997, 0x3186, 0x39e2, 0x3038, 0x3a13, 0x2e75, 0x3a29, 0x2cf5, 0x3a2d, 0x2bac, 0x3a21, 0x29ff, 0x3a04, 0x28bc, 0x39dc, 0x2790, 0x39ad, 0x261a, 0x3978, 0x24fa,\n\t0x39ac, 0x34a8, 0x39ac, 0x34a3, 0x39ae, 0x3480, 0x39ae, 0x3423, 0x39b1, 0x330e, 0x39c2, 0x31a9, 0x39e0, 0x3063, 0x39fc, 0x2eb5, 0x3a0c, 0x2d1d, 0x3a14, 0x2bcf, 0x3a07, 0x29ff, 0x39e9, 0x28a3, 0x39be, 0x273c, 0x3989, 0x25b3, 0x394a, 0x2488, 0x3907, 0x2345,\n\t0x3a77, 0x3223, 0x3a76, 0x321f, 0x3a73, 0x3204, 0x3a6a, 0x31b3, 0x3a58, 0x3114, 0x3a45, 0x303b, 0x3a34, 0x2eb6, 0x3a26, 0x2d31, 0x3a1e, 0x2bef, 0x3a0b, 0x2a0d, 0x39ec, 0x28a1, 0x39c0, 0x271b, 0x3987, 0x2580, 0x3944, 0x2449, 0x38fa, 0x22bd, 0x38ac, 0x2155,\n\t0x3b07, 0x2fca, 0x3b06, 0x2fca, 0x3b00, 0x2fb8, 0x3af4, 0x2f7c, 0x3adb, 0x2eea, 0x3ab4, 0x2e00, 0x3a85, 0x2cec, 0x3a5e, 0x2bc5, 0x3a36, 0x2a00, 0x3a0d, 0x2899, 0x39dc, 0x2707, 0x39a0, 0x2562, 0x395a, 0x2424, 0x390b, 0x2268, 0x38b7, 0x20fd, 0x385f, 0x1fd1,\n\t0x3b69, 0x2cb9, 0x3b68, 0x2cbb, 0x3b62, 0x2cbb, 0x3b56, 0x2cae, 0x3b3b, 0x2c78, 0x3b0d, 0x2c0a, 0x3acf, 0x2ae3, 0x3a92, 0x2998, 0x3a54, 0x2867, 0x3a17, 0x26d0, 0x39d3, 0x253c, 0x3989, 0x2402, 0x3935, 0x2226, 0x38dc, 0x20bd, 0x387d, 0x1f54, 0x381d, 0x1db3,\n\t0x3ba9, 0x296b, 0x3ba8, 0x296f, 0x3ba3, 0x297b, 0x3b98, 0x2987, 0x3b7f, 0x2976, 0x3b4e, 0x2927, 0x3b0e, 0x2895, 0x3ac2, 0x27b7, 0x3a73, 0x263b, 0x3a23, 0x24e7, 0x39d0, 0x239b, 0x3976, 0x21d9, 0x3917, 0x207e, 0x38b2, 0x1ee7, 0x384b, 0x1d53, 0x37c7, 0x1c1e,\n\t0x3bd2, 0x25cb, 0x3bd1, 0x25d3, 0x3bcd, 0x25f0, 0x3bc2, 0x261f, 0x3bad, 0x2645, 0x3b7d, 0x262d, 0x3b3e, 0x25c4, 0x3aec, 0x250f, 0x3a93, 0x243a, 0x3a32, 0x22ce, 0x39d0, 0x215b, 0x3969, 0x202a, 0x38fe, 0x1e6e, 0x388f, 0x1cf1, 0x381f, 0x1b9b, 0x3762, 0x19dd,\n\t0x3be9, 0x21ab, 0x3be9, 0x21b7, 0x3be5, 0x21e5, 0x3bdd, 0x2241, 0x3bc9, 0x22a7, 0x3ba0, 0x22ec, 0x3b62, 0x22cd, 0x3b0f, 0x2247, 0x3aae, 0x2175, 0x3a44, 0x2088, 0x39d4, 0x1f49, 0x3960, 0x1dbe, 0x38e9, 0x1c77, 0x3870, 0x1ae8, 0x37f1, 0x1953, 0x3708, 0x181b,\n\t0x3bf6, 0x1cea, 0x3bf6, 0x1cfb, 0x3bf3, 0x1d38, 0x3bec, 0x1dbd, 0x3bda, 0x1e7c, 0x3bb7, 0x1f25, 0x3b7d, 0x1f79, 0x3b2c, 0x1f4c, 0x3ac6, 0x1ea6, 0x3a55, 0x1dbb, 0x39da, 0x1cbd, 0x395a, 0x1b9d, 0x38d8, 0x1a00, 0x3855, 0x18ac, 0x37ab, 0x173c, 0x36b7, 0x1598,\n\t0x3bfc, 0x1736, 0x3bfc, 0x1759, 0x3bf9, 0x17e7, 0x3bf4, 0x1896, 0x3be4, 0x1997, 0x3bc6, 0x1aa8, 0x3b91, 0x1b84, 0x3b43, 0x1bd2, 0x3ade, 0x1b8a, 0x3a65, 0x1acd, 0x39e2, 0x19d3, 0x3957, 0x18cd, 0x38ca, 0x17b3, 0x383e, 0x1613, 0x376d, 0x14bf, 0x366f, 0x135e,\n\t0x3bff, 0x101b, 0x3bff, 0x1039, 0x3bfc, 0x10c8, 0x3bf9, 0x1226, 0x3bea, 0x1428, 0x3bcf, 0x1584, 0x3b9f, 0x16c5, 0x3b54, 0x179a, 0x3af0, 0x17ce, 0x3a76, 0x1771, 0x39ea, 0x16a4, 0x3956, 0x15a7, 0x38bf, 0x14a7, 0x3829, 0x1379, 0x3735, 0x11ea, 0x362d, 0x10a1,\n\t0x3c00, 0x061b, 0x3c00, 0x066a, 0x3bfe, 0x081c, 0x3bfa, 0x0a4c, 0x3bed, 0x0d16, 0x3bd5, 0x0fb3, 0x3ba9, 0x114d, 0x3b63, 0x127c, 0x3b01, 0x132f, 0x3a85, 0x1344, 0x39f4, 0x12d2, 0x3957, 0x120d, 0x38b5, 0x1122, 0x3817, 0x103c, 0x3703, 0x0ed3, 0x35f0, 0x0d6d,\n\t0x3c00, 0x007a, 0x3c00, 0x0089, 0x3bfe, 0x011d, 0x3bfb, 0x027c, 0x3bf0, 0x04fa, 0x3bda, 0x0881, 0x3bb1, 0x0acd, 0x3b6f, 0x0c97, 0x3b10, 0x0d7b, 0x3a93, 0x0df1, 0x39fe, 0x0def, 0x3959, 0x0d8a, 0x38af, 0x0ce9, 0x3808, 0x0c31, 0x36d5, 0x0af0, 0x35b9, 0x09a3,\n\t0x3c00, 0x0000, 0x3c00, 0x0001, 0x3bff, 0x0015, 0x3bfb, 0x0059, 0x3bf2, 0x00fd, 0x3bdd, 0x01df, 0x3bb7, 0x031c, 0x3b79, 0x047c, 0x3b1d, 0x05d4, 0x3aa0, 0x06d5, 0x3a08, 0x075a, 0x395d, 0x075e, 0x38aa, 0x06f7, 0x37f4, 0x0648, 0x36ac, 0x0576, 0x3586, 0x049f\n] );\n\nlet lut = null;\n\nfunction getDFGLUT() {\n\n\tif ( lut === null ) {\n\n\t\tlut = new DataTexture( DATA, 16, 16, RGFormat, HalfFloatType );\n\t\tlut.name = 'DFG_LUT';\n\t\tlut.minFilter = LinearFilter;\n\t\tlut.magFilter = LinearFilter;\n\t\tlut.wrapS = ClampToEdgeWrapping;\n\t\tlut.wrapT = ClampToEdgeWrapping;\n\t\tlut.generateMipmaps = false;\n\t\tlut.needsUpdate = true;\n\n\t}\n\n\treturn lut;\n\n}\n\n/**\n * This renderer uses WebGL 2 to display scenes.\n *\n * WebGL 1 is not supported since `r163`.\n */\nclass WebGLRenderer {\n\n\t/**\n\t * Constructs a new WebGL renderer.\n\t *\n\t * @param {WebGLRenderer~Options} [parameters] - The configuration parameter.\n\t */\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = false,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t\treversedDepthBuffer = false,\n\t\t\toutputBufferType = UnsignedByteType,\n\t\t} = parameters;\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\n\n\t\t\t}\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst _outputBufferType = outputBufferType;\n\n\t\tconst INTEGER_FORMATS = new Set( [\n\t\t\tRGBAIntegerFormat,\n\t\t\tRGIntegerFormat,\n\t\t\tRedIntegerFormat\n\t\t] );\n\n\t\tconst UNSIGNED_TYPES = new Set( [\n\t\t\tUnsignedByteType,\n\t\t\tUnsignedIntType,\n\t\t\tUnsignedShortType,\n\t\t\tUnsignedInt248Type,\n\t\t\tUnsignedShort4444Type,\n\t\t\tUnsignedShort5551Type\n\t\t] );\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\t\tconst objectPosition = new Vector3();\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// internal render target for non-UnsignedByteType color buffer\n\n\t\tlet output = null;\n\n\t\t// public properties\n\n\t\t/**\n\t\t * A canvas where the renderer draws its output. This is automatically created by the renderer\n\t\t * in the constructor (if not provided already); you just need to add it to your page like so:\n\t\t * ```js\n\t\t * document.body.appendChild( renderer.domElement );\n\t\t * ```\n\t\t *\n\t\t * @type {HTMLCanvasElement|OffscreenCanvas}\n\t\t */\n\t\tthis.domElement = canvas;\n\n\t\t/**\n\t\t * A object with debug configuration settings.\n\t\t *\n\t\t * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are\n\t\t * checked for errors during compilation and linkage process. It may be useful to disable\n\t\t * this check in production for performance gain. It is strongly recommended to keep these\n\t\t * checks enabled during development. If the shader does not compile and link, it will not\n\t\t * work and associated material will not render.\n\t\t * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that\n\t\t * can be used for custom error reporting. The callback receives the WebGL context, an instance\n\t\t * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.\n\t\t * Assigning a custom function disables the default error reporting.\n\t\t *\n\t\t * @type {Object}\n\t\t */\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled.\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\t/**\n\t\t * Whether the renderer should automatically clear its output before rendering a frame or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoClear = true;\n\n\t\t/**\n\t\t * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear\n\t\t * the color buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoClearColor = true;\n\n\t\t/**\n\t\t * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear\n\t\t * the depth buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoClearDepth = true;\n\n\t\t/**\n\t\t * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear\n\t\t * the stencil buffer or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\t/**\n\t\t * Whether the renderer should sort objects or not.\n\t\t *\n\t\t * Note: Sorting is used to attempt to properly render objects that have some\n\t\t * degree of transparency. By definition, sorting objects may not work in all\n\t\t * cases. Depending on the needs of application, it may be necessary to turn\n\t\t * off sorting and use other methods to deal with transparency rendering e.g.\n\t\t * manually determining each object's rendering order.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\t/**\n\t\t * User-defined clipping planes specified in world space. These planes apply globally.\n\t\t * Points in space whose dot product with the plane is negative are cut away.\n\t\t *\n\t\t * @type {Array<Plane>}\n\t\t */\n\t\tthis.clippingPlanes = [];\n\n\t\t/**\n\t\t * Whether the renderer respects object-level clipping planes or not.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.localClippingEnabled = false;\n\n\t\t// tone mapping\n\n\t\t/**\n\t\t * The tone mapping technique of the renderer.\n\t\t *\n\t\t * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)}\n\t\t * @default NoToneMapping\n\t\t */\n\t\tthis.toneMapping = NoToneMapping;\n\n\t\t/**\n\t\t * Exposure level of tone mapping.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// transmission\n\n\t\t/**\n\t\t * The normalized resolution scale for the transmission render target, measured in percentage\n\t\t * of viewport dimensions. Lowering this value can result in significant performance improvements\n\t\t * when using {@link MeshPhysicalMaterial#transmission}.\n\t\t *\n\t\t * @type {number}\n\t\t * @default 1\n\t\t */\n\t\tthis.transmissionResolutionScale = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\t\tlet _nodesHandler = null;\n\n\t\t// internal state cache\n\n\t\tthis._outputColorSpace = SRGBColorSpace;\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = -1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _vector4 = new Vector4();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tlet _renderBackground = false;\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextName, contextAttributes ) {\n\n\t\t\treturn canvas.getContext( contextName, contextAttributes );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextName = 'webgl2';\n\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextName ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} catch ( e ) {\n\n\t\t\terror( 'WebGLRenderer: ' + e.message );\n\t\t\tthrow e;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, environments, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\t\t\textensions.init();\n\n\t\t\tutils = new WebGLUtils( _gl, extensions );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );\n\n\t\t\tstate = new WebGLState( _gl, extensions );\n\n\t\t\tif ( capabilities.reversedDepthBuffer && reversedDepthBuffer ) {\n\n\t\t\t\tstate.buffers.depth.setReversed( true );\n\n\t\t\t}\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tenvironments = new WebGLEnvironments( _this );\n\t\t\tattributes = new WebGLAttributes( _gl );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, bindingStates, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, environments, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions );\n\t\t\tbackground = new WebGLBackground( _this, environments, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t/**\n\t\t\t * Holds details about the capabilities of the current rendering context.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#capabilities\n\t\t\t * @type {WebGLRenderer~Capabilities}\n\t\t\t */\n\t\t\t_this.capabilities = capabilities;\n\n\t\t\t/**\n\t\t\t * Provides methods for retrieving and testing WebGL extensions.\n\t\t\t *\n\t\t\t * - `get(extensionName:string)`: Used to check whether a WebGL extension is supported\n\t\t\t * and return the extension object if available.\n\t\t\t * - `has(extensionName:string)`: returns `true` if the extension is supported.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#extensions\n\t\t\t * @type {Object}\n\t\t\t */\n\t\t\t_this.extensions = extensions;\n\n\t\t\t/**\n\t\t\t * Used to track properties of other objects like native WebGL objects.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#properties\n\t\t\t * @type {Object}\n\t\t\t */\n\t\t\t_this.properties = properties;\n\n\t\t\t/**\n\t\t\t * Manages the render lists of the renderer.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#renderLists\n\t\t\t * @type {Object}\n\t\t\t */\n\t\t\t_this.renderLists = renderLists;\n\n\n\n\t\t\t/**\n\t\t\t * Interface for managing shadows.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#shadowMap\n\t\t\t * @type {WebGLRenderer~ShadowMap}\n\t\t\t */\n\t\t\t_this.shadowMap = shadowMap;\n\n\t\t\t/**\n\t\t\t * Interface for managing the WebGL state.\n\t\t\t *\n\t\t\t * @name WebGLRenderer#state\n\t\t\t * @type {Object}\n\t\t\t */\n\t\t\t_this.state = state;\n\n\t\t\t/**\n\t\t\t * Holds a series of statistical information about the GPU memory\n\t\t\t * and the rendering process. Useful for debugging and monitoring.\n\t\t\t *\n\t\t\t * By default these data are reset at each render call but when having\n\t\t\t * multiple render passes per frame (e.g. when using post processing) it can\n\t\t\t * be preferred to reset with a custom pattern. First, set `autoReset` to\n\t\t\t * `false`.\n\t\t\t * ```js\n\t\t\t * renderer.info.autoReset = false;\n\t\t\t * ```\n\t\t\t * Call `reset()` whenever you have finished to render a single frame.\n\t\t\t * ```js\n\t\t\t * renderer.info.reset();\n\t\t\t * ```\n\t\t\t *\n\t\t\t * @name WebGLRenderer#info\n\t\t\t * @type {WebGLRenderer~Info}\n\t\t\t */\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// initialize internal render target for non-UnsignedByteType color buffer\n\n\t\tif ( _outputBufferType !== UnsignedByteType ) {\n\n\t\t\toutput = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );\n\n\t\t}\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\t/**\n\t\t * A reference to the XR manager.\n\t\t *\n\t\t * @type {WebXRManager}\n\t\t */\n\t\tthis.xr = xr;\n\n\t\t/**\n\t\t * Returns the rendering context.\n\t\t *\n\t\t * @return {WebGL2RenderingContext} The rendering context.\n\t\t */\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the rendering context attributes.\n\t\t *\n\t\t * @return {WebGLContextAttributes} The rendering context attributes.\n\t\t */\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\t/**\n\t\t * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension.\n\t\t */\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\t/**\n\t\t * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension.\n\t\t */\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the pixel ratio.\n\t\t *\n\t\t * @return {number} The pixel ratio.\n\t\t */\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the given pixel ratio and resizes the canvas if necessary.\n\t\t *\n\t\t * @param {number} value - The pixel ratio.\n\t\t */\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.\n\t\t *\n\t\t * @param {Vector2} target - The method writes the result in this target object.\n\t\t * @return {Vector2} The renderer's size in logical pixels.\n\t\t */\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\t/**\n\t\t * Resizes the output canvas to (width, height) with device pixel ratio taken\n\t\t * into account, and also sets the viewport to fit that size, starting in (0,\n\t\t * 0). Setting `updateStyle` to false prevents any style changes to the output canvas.\n\t\t *\n\t\t * @param {number} width - The width in logical pixels.\n\t\t * @param {number} height - The height in logical pixels.\n\t\t * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.\n\t\t */\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\twarn( 'WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tif ( output !== null ) {\n\n\t\t\t\toutput.setSize( canvas.width, canvas.height );\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.\n\t\t *\n\t\t * @param {Vector2} target - The method writes the result in this target object.\n\t\t * @return {Vector2} The drawing buffer size.\n\t\t */\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\t/**\n\t\t * This method allows to define the drawing buffer size by specifying\n\t\t * width, height and pixel ratio all at once. The size of the drawing\n\t\t * buffer is computed with this formula:\n\t\t * ```js\n\t\t * size.x = width * pixelRatio;\n\t\t * size.y = height * pixelRatio;\n\t\t * ```\n\t\t *\n\t\t * @param {number} width - The width in logical pixels.\n\t\t * @param {number} height - The height in logical pixels.\n\t\t * @param {number} pixelRatio - The pixel ratio.\n\t\t */\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the post-processing effects to be applied after rendering.\n\t\t *\n\t\t * @param {Array} effects - An array of post-processing effects.\n\t\t */\n\t\tthis.setEffects = function ( effects ) {\n\n\t\t\tif ( _outputBufferType === UnsignedByteType ) {\n\n\t\t\t\terror( 'THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( effects ) {\n\n\t\t\t\tfor ( let i = 0; i < effects.length; i ++ ) {\n\n\t\t\t\t\tif ( effects[ i ].isOutputPass === true ) {\n\n\t\t\t\t\t\twarn( 'THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\toutput.setEffects( effects || [] );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the current viewport definition.\n\t\t *\n\t\t * @param {Vector2} target - The method writes the result in this target object.\n\t\t * @return {Vector2} The current viewport definition.\n\t\t */\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the viewport definition.\n\t\t *\n\t\t * @param {Vector4} target - The method writes the result in this target object.\n\t\t * @return {Vector4} The viewport definition.\n\t\t */\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`.\n\t\t *\n\t\t * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.\n\t\t * Or alternatively a four-component vector specifying all the parameters of the viewport.\n\t\t * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.\n\t\t * @param {number} width - The width of the viewport in logical pixel unit.\n\t\t * @param {number} height - The height of the viewport in logical pixel unit.\n\t\t */\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the scissor region.\n\t\t *\n\t\t * @param {Vector4} target - The method writes the result in this target object.\n\t\t * @return {Vector4} The scissor region.\n\t\t */\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`.\n\t\t *\n\t\t * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit.\n\t\t * Or alternatively a four-component vector specifying all the parameters of the scissor region.\n\t\t * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit.\n\t\t * @param {number} width - The width of the scissor region in logical pixel unit.\n\t\t * @param {number} height - The height of the scissor region in logical pixel unit.\n\t\t */\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns `true` if the scissor test is enabled.\n\t\t *\n\t\t * @return {boolean} Whether the scissor test is enabled or not.\n\t\t */\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\t/**\n\t\t * Enable or disable the scissor test. When this is enabled, only the pixels\n\t\t * within the defined scissor area will be affected by further renderer\n\t\t * actions.\n\t\t *\n\t\t * @param {boolean} boolean - Whether the scissor test is enabled or not.\n\t\t */\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets a custom opaque sort function for the render lists. Pass `null`\n\t\t * to use the default `painterSortStable` function.\n\t\t *\n\t\t * @param {?Function} method - The opaque sort function.\n\t\t */\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\t/**\n\t\t * Sets a custom transparent sort function for the render lists. Pass `null`\n\t\t * to use the default `reversePainterSortStable` function.\n\t\t *\n\t\t * @param {?Function} method - The opaque sort function.\n\t\t */\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\t/**\n\t\t * Returns the clear color.\n\t\t *\n\t\t * @param {Color} target - The method writes the result in this target object.\n\t\t * @return {Color} The clear color.\n\t\t */\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the clear color and alpha.\n\t\t *\n\t\t * @param {Color} color - The clear color.\n\t\t * @param {number} [alpha=1] - The clear alpha.\n\t\t */\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor( ...arguments );\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the clear alpha. Ranges within `[0,1]`.\n\t\t *\n\t\t * @return {number} The clear alpha.\n\t\t */\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\t/**\n\t\t * Sets the clear alpha.\n\t\t *\n\t\t * @param {number} alpha - The clear alpha.\n\t\t */\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha( ...arguments );\n\n\t\t};\n\n\t\t/**\n\t\t * Tells the renderer to clear its color, depth or stencil drawing buffer(s).\n\t\t * This method initializes the buffers to the current clear color values.\n\t\t *\n\t\t * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.\n\t\t * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.\n\t\t * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.\n\t\t */\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = INTEGER_FORMATS.has( targetFormat );\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = UNSIGNED_TYPES.has( targetType );\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) {\n\n\t\t\t\tbits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.depth.setMask( true );\n\n\t\t\t}\n\n\t\t\tif ( stencil ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\n\n\t\t\tif ( bits !== 0 ) {\n\n\t\t\t\t_gl.clear( bits );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`.\n\t\t */\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\t/**\n\t\t * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`.\n\t\t */\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\t/**\n\t\t * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`.\n\t\t */\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t/**\n\t\t * Sets a compatibility node builder for rendering node materials with WebGLRenderer.\n\t\t * This enables using TSL (Three.js Shading Language) node materials to prepare\n\t\t * for migration to WebGPURenderer.\n\t\t *\n\t\t * @param {WebGLNodesHandler} nodesHandler - The node builder instance.\n\t\t */\n\t\tthis.setNodesHandler = function ( nodesHandler ) {\n\n\t\t\tnodesHandler.setRenderer( this );\n\t\t\t_nodesHandler = nodesHandler;\n\n\t\t};\n\n\t\t/**\n\t\t * Frees the GPU-related resources allocated by this instance. Call this\n\t\t * method whenever this instance is no longer used in your app.\n\t\t */\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tbackground.dispose();\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tenvironments.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tlog( 'WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tlog( 'WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\terror( 'WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tif ( ! extensions.get( 'WEBGL_multi_draw' ) ) {\n\n\t\t\t\t\tconst starts = object._multiDrawStarts;\n\t\t\t\t\tconst counts = object._multiDrawCounts;\n\t\t\t\t\tconst drawCount = object._multiDrawCount;\n\t\t\t\t\tconst bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;\n\t\t\t\t\tconst uniforms = properties.get( material ).currentProgram.getUniforms();\n\t\t\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\t\t\tuniforms.setValue( _gl, '_gl_DrawID', i );\n\t\t\t\t\t\trenderer.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tfunction prepareMaterial( material, scene, object ) {\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t/**\n\t\t * Compiles all materials in the scene with the camera. This is useful to precompile shaders\n\t\t * before the first rendering. If you want to add a 3D object to an existing scene, use the third\n\t\t * optional parameter for applying the target scene.\n\t\t *\n\t\t * Note that the (target) scene's lighting and environment must be configured before calling this method.\n\t\t *\n\t\t * @param {Object3D} scene - The scene or another type of 3D object to precompile.\n\t\t * @param {Camera} camera - The camera.\n\t\t * @param {?Scene} [targetScene=null] - The target scene.\n\t\t * @return {Set<Material>} The precompiled materials.\n\t\t */\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tcurrentRenderState.setupLights();\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tif ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {\n\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tcurrentRenderState = renderStateStack.pop();\n\n\t\t\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\t/**\n\t\t * Asynchronous version of {@link WebGLRenderer#compile}.\n\t\t *\n\t\t * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence,\n\t\t * it is recommended to use this version of `compile()` whenever possible.\n\t\t *\n\t\t * @async\n\t\t * @param {Object3D} scene - The scene or another type of 3D object to precompile.\n\t\t * @param {Camera} camera - The camera.\n\t\t * @param {?Scene} [targetScene=null] - The target scene.\n\t\t * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation.\n\t\t */\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\t/**\n\t\t * Applications are advised to always define the animation loop\n\t\t * with this method and not manually with `requestAnimationFrame()`\n\t\t * for best compatibility.\n\t\t *\n\t\t * @param {?onAnimationCallback} callback - The application's animation loop.\n\t\t */\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\t/**\n\t\t * Renders the given scene (or other type of 3D object) using the given camera.\n\t\t *\n\t\t * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget}\n\t\t * or to the canvas as usual.\n\t\t *\n\t\t * By default render buffers are cleared before rendering but you can prevent\n\t\t * this by setting the property `autoClear` to `false`. If you want to prevent\n\t\t * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth`\n\t\t * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}.\n\t\t *\n\t\t * @param {Object3D} scene - The scene to render.\n\t\t * @param {Camera} camera - The camera.\n\t\t */\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\terror( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update node builder if available\n\t\t\tif ( _nodesHandler !== null ) {\n\n\t\t\t\t_nodesHandler.renderStart( scene, camera );\n\n\t\t\t}\n\n\t\t\t// use internal render target for HalfFloatType color buffer (only when tone mapping is enabled)\n\n\t\t\tconst isXRPresenting = xr.enabled === true && xr.isPresenting === true;\n\n\t\t\tconst useOutput = output !== null && ( _currentRenderTarget === null || isXRPresenting ) && output.begin( _this, _currentRenderTarget );\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true && ( output === null || output.isCompositing() === false ) ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\tcurrentRenderState.state.textureUnits = textures.getTextureUnits();\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix, WebGLCoordinateSystem, camera.reversedDepth );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tconst depthSensingMesh = _this.xr.getDepthSensingMesh();\n\n\t\t\t\tif ( depthSensingMesh !== null ) {\n\n\t\t\t\t\tprojectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;\n\t\t\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.addToRenderList( currentRenderList, scene );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\t\t\t// render scene (skip if first effect is a render pass - it will render the scene itself)\n\n\t\t\tconst skipSceneRender = useOutput && output.hasRenderPass();\n\n\t\t\tif ( skipSceneRender === false ) {\n\n\t\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\n\t\t\t\tcurrentRenderState.setupLights();\n\n\t\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\t\tif ( transmissiveObjects.length > 0 ) {\n\n\t\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\t\t\trenderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null && _currentActiveMipmapLevel === 0 ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t// copy from internal render target to canvas using fullscreen quad\n\n\t\t\tif ( useOutput ) {\n\n\t\t\t\toutput.end( _this );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = -1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t\ttextures.setTextureUnits( currentRenderState.state.textureUnits );\n\n\t\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t\tif ( _nodesHandler !== null ) {\n\n\t\t\t\t_nodesHandler.renderEnd();\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLightProbeGrid ) {\n\n\t\t\t\t\tcurrentRenderState.pushLightProbeGrid( object );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector4.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector4.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector4.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector4\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst { opaque: opaqueObjects, transmissive: transmissiveObjects, transparent: transparentObjects } = currentRenderList;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {\n\n\t\t\t\tconst hasHalfFloatSupport = extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' );\n\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: hasHalfFloatSupport ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: Math.max( 4, capabilities.samples ), // to avoid feedback loops, the transmission render target requires a resolve, see #26177\n\t\t\t\t\tstencilBuffer: stencil,\n\t\t\t\t\tresolveDepthBuffer: false,\n\t\t\t\t\tresolveStencilBuffer: false,\n\t\t\t\t\tcolorSpace: ColorManagement.workingColorSpace,\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];\n\n\t\t\tconst activeViewport = camera.viewport || _currentViewport;\n\t\t\ttransmissionRenderTarget.setSize( activeViewport.z * _this.transmissionResolutionScale, activeViewport.w * _this.transmissionResolutionScale );\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\tconst currentActiveCubeFace = _this.getActiveCubeFace();\n\t\t\tconst currentActiveMipmapLevel = _this.getActiveMipmapLevel();\n\n\t\t\t_this.setRenderTarget( transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\t// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).\n\t\t\t// Transmission render pass requires viewport to match the transmissionRenderTarget.\n\t\t\tconst currentCameraViewport = camera.viewport;\n\t\t\tif ( camera.viewport !== undefined ) camera.viewport = undefined;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131\n\n\t\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\t\tconst { object, geometry, material, group } = renderItem;\n\n\t\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\tif ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst { object, geometry, group } = renderItem;\n\t\t\t\tlet material = renderItem.material;\n\n\t\t\t\tif ( material.allowOverride === true && overrideMaterial !== null ) {\n\n\t\t\t\t\tmaterial = overrideMaterial;\n\n\t\t\t\t}\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\n\t\t\tconst usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );\n\t\t\tmaterialProperties.envMap = environments.get( material.envMap || materialProperties.environment, usePMREM );\n\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\t// Use node builder for node materials if available\n\t\t\t\tif ( _nodesHandler !== null && material.isNodeMaterial ) {\n\n\t\t\t\t\t_nodesHandler.build( material, object, parameters );\n\n\t\t\t\t}\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tmaterialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.batching = parameters.batching;\n\t\t\tmaterialProperties.batchingColor = parameters.batchingColor;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction findLightProbeGrid( volumes, object ) {\n\n\t\t\tif ( volumes.length === 0 ) return null;\n\n\t\t\tif ( volumes.length === 1 ) {\n\n\t\t\t\treturn volumes[ 0 ].texture !== null ? volumes[ 0 ] : null;\n\n\t\t\t}\n\n\t\t\tobjectPosition.setFromMatrixPosition( object.matrixWorld );\n\n\t\t\tfor ( let i = 0, l = volumes.length; i < l; i ++ ) {\n\n\t\t\t\tconst v = volumes[ i ];\n\n\t\t\t\tif ( v.texture !== null && v.boundingBox.containsPoint( objectPosition ) ) return v;\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace );\n\t\t\tconst usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );\n\t\t\tconst envMap = environments.get( material.envMap || environment, usePMREM );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( !! materialProperties.lightProbeGrid !== ( currentRenderState.state.lightProbeGridArray.length > 0 ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t\t// notify the node builder that the program has changed so uniforms and update nodes can\n\t\t\t\t// be cached and triggered.\n\t\t\t\tif ( _nodesHandler && material.isNodeMaterial ) {\n\n\t\t\t\t\t_nodesHandler.onUpdateProgram( material, program, materialProperties );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\tconst objectVolume = findLightProbeGrid( currentRenderState.state.lightProbeGridArray, object );\n\n\t\t\t\tif ( materialProperties.lightProbeGrid !== objectVolume ) {\n\n\t\t\t\t\tmaterialProperties.lightProbeGrid = objectVolume;\n\t\t\t\t\trefreshMaterial = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\t// common camera uniforms\n\n\t\t\t\tconst reversedDepthBuffer = state.buffers.depth.getReversed();\n\n\t\t\t\tif ( reversedDepthBuffer && camera.reversedDepth !== true ) {\n\n\t\t\t\t\tcamera._reversedDepth = true;\n\t\t\t\t\tcamera.updateProjectionMatrix();\n\n\t\t\t\t}\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Pre-allocate texture units for shadow samplers before setting data textures\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// Set shadow map uniforms first to ensure they get the first texture units\n\t\t\t\tif ( lights.state.directionalShadowMap.length > 0 ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'directionalShadowMap', lights.state.directionalShadowMap, textures );\n\n\t\t\t\t}\n\n\t\t\t\tif ( lights.state.spotShadowMap.length > 0 ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'spotShadowMap', lights.state.spotShadowMap, textures );\n\n\t\t\t\t}\n\n\t\t\t\tif ( lights.state.pointShadowMap.length > 0 ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'pointShadowMap', lights.state.pointShadowMap, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingIdTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingColorTexture' );\n\t\t\t\tif ( object._colorsTexture !== null ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\tif ( ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) && material.envMap === null && scene.environment !== null ) {\n\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\n\n\t\t\t}\n\n\t\t\t// Set DFG LUT for physically-based materials\n\t\t\tif ( m_uniforms.dfgLUT !== undefined ) {\n\n\t\t\t\tm_uniforms.dfgLUT.value = getDFGLUT();\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );\n\n\t\t\t\t// light probe volume\n\n\t\t\t\tif ( materialProperties.needsLights && materialProperties.lightProbeGrid ) {\n\n\t\t\t\t\tconst volume = materialProperties.lightProbeGrid;\n\n\t\t\t\t\tm_uniforms.probesSH.value = volume.texture;\n\t\t\t\t\tm_uniforms.probesMin.value.copy( volume.boundingBox.min );\n\t\t\t\t\tm_uniforms.probesMax.value.copy( volume.boundingBox.max );\n\t\t\t\t\tm_uniforms.probesResolution.value.copy( volume.resolution );\n\n\t\t\t\t}\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.uniformsGroups !== undefined ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\t/**\n\t\t * Returns the active cube face.\n\t\t *\n\t\t * @return {number} The active cube face.\n\t\t */\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the active mipmap level.\n\t\t *\n\t\t * @return {number} The active mipmap level.\n\t\t */\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\t/**\n\t\t * Returns the active render target.\n\t\t *\n\t\t * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target\n\t\t * is currently set.\n\t\t */\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;\n\t\t\tif ( renderTargetProperties.__autoAllocateDepthBuffer === false ) {\n\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t}\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = renderTargetProperties.__autoAllocateDepthBuffer ? undefined : depthTexture;\n\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tconst _scratchFrameBuffer = _gl.createFramebuffer();\n\n\t\t/**\n\t\t * Sets the active rendertarget.\n\t\t *\n\t\t * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given,\n\t\t * the canvas is set as the active render target instead.\n\t\t * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target.\n\t\t * Indicates the z layer to render in to when using 3D or array render targets.\n\t\t * @param {number} [activeMipmapLevel=0] - The active mipmap level.\n\t\t */\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// Externally-managed framebuffer (e.g. XR)\n\t\t\t\t\t// Bind to the stored framebuffer (may be null for default, or a WebGLFramebuffer)\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t\t\tstate.viewport( _currentViewport );\n\t\t\t\t\tstate.scissor( _currentScissor );\n\t\t\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\t\t\t_currentMaterialId = -1;\n\n\t\t\t\t\treturn;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t} else if ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\t// check if the depth texture is already bound to the frame buffer and that it's been initialized\n\t\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\t\t\tif ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {\n\n\t\t\t\t\t\t// check if the depth texture is compatible\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdepthTexture !== null &&\n\t\t\t\t\t\t\tproperties.has( depthTexture ) &&\n\t\t\t\t\t\t\t( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )\n\t\t\t\t\t\t) {\n\n\t\t\t\t\t\t\tthrow new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Swap the depth buffer to the currently attached one\n\t\t\t\t\t\ttextures.setupDepthRenderbuffer( renderTarget );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\t// Use a scratch frame buffer if rendering to a mip level to avoid depth buffers\n\t\t\t// being bound that are different sizes.\n\t\t\tif ( activeMipmapLevel !== 0 ) {\n\n\t\t\t\tframebuffer = _scratchFrameBuffer;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst layer = activeCubeFace;\n\n\t\t\t\tfor ( let i = 0; i < renderTarget.textures.length; i ++ ) {\n\n\t\t\t\t\tconst textureProperties = properties.get( renderTarget.textures[ i ] );\n\n\t\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );\n\n\t\t\t\t}\n\n\t\t\t} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {\n\n\t\t\t\t// Only bind the frame buffer if we are using a scratch frame buffer to render to a mipmap.\n\t\t\t\t// If we rebind the texture when using a multi sample buffer then an error about inconsistent samples will be thrown.\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = -1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\t/**\n\t\t * Reads the pixel data from the given render target into the given buffer.\n\t\t *\n\t\t * @param {WebGLRenderTarget} renderTarget - The render target to read from.\n\t\t * @param {number} x - The `x` coordinate of the copy region's origin.\n\t\t * @param {number} y - The `y` coordinate of the copy region's origin.\n\t\t * @param {number} width - The width of the copy region.\n\t\t * @param {number} height - The height of the copy region.\n\t\t * @param {TypedArray} buffer - The result buffer.\n\t\t * @param {number} [activeCubeFaceIndex] - The active cube face index.\n\t\t * @param {number} [textureIndex=0] - The texture index of an MRT render target.\n\t\t */\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\terror( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.textures[ textureIndex ];\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\t// when using MRT, select the correct color buffer for the subsequent read command\n\n\t\t\t\t\tif ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );\n\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\terror( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\terror( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}.\n\t\t *\n\t\t * It is recommended to use this version of `readRenderTargetPixels()` whenever possible.\n\t\t *\n\t\t * @async\n\t\t * @param {WebGLRenderTarget} renderTarget - The render target to read from.\n\t\t * @param {number} x - The `x` coordinate of the copy region's origin.\n\t\t * @param {number} y - The `y` coordinate of the copy region's origin.\n\t\t * @param {number} width - The width of the copy region.\n\t\t * @param {number} height - The height of the copy region.\n\t\t * @param {TypedArray} buffer - The result buffer.\n\t\t * @param {number} [activeCubeFaceIndex] - The active cube face index.\n\t\t * @param {number} [textureIndex=0] - The texture index of an MRT render target.\n\t\t * @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.\n\t\t */\n\t\tthis.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t// set the active frame buffer to the one we want to read\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t\tconst texture = renderTarget.textures[ textureIndex ];\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\t// when using MRT, select the correct color buffer for the subsequent read command\n\n\t\t\t\t\tif ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );\n\n\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst glBuffer = _gl.createBuffer();\n\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );\n\n\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );\n\n\t\t\t\t\t// reset the frame buffer to the currently set buffer before waiting\n\t\t\t\t\tconst currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );\n\n\t\t\t\t\t// check if the commands have finished every 8 ms\n\t\t\t\t\tconst sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );\n\n\t\t\t\t\t_gl.flush();\n\n\t\t\t\t\tawait probeAsync( _gl, sync, 4 );\n\n\t\t\t\t\t// read the data and delete the buffer\n\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );\n\t\t\t\t\t_gl.deleteBuffer( glBuffer );\n\t\t\t\t\t_gl.deleteSync( sync );\n\n\t\t\t\t\treturn buffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Copies pixels from the current bound framebuffer into the given texture.\n\t\t *\n\t\t * @param {FramebufferTexture} texture - The texture.\n\t\t * @param {?Vector2} [position=null] - The start position of the copy operation.\n\t\t * @param {number} [level=0] - The mip level. The default represents the base mip.\n\t\t */\n\t\tthis.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\tconst x = position !== null ? position.x : 0;\n\t\t\tconst y = position !== null ? position.y : 0;\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tconst _srcFramebuffer = _gl.createFramebuffer();\n\t\tconst _dstFramebuffer = _gl.createFramebuffer();\n\n\t\t/**\n\t\t * Copies data of the given source texture into a destination texture.\n\t\t *\n\t\t * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized\n\t\t * {@link WebGLRenderer#initRenderTarget}.\n\t\t *\n\t\t * @param {Texture} srcTexture - The source texture.\n\t\t * @param {Texture} dstTexture - The destination texture.\n\t\t * @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.\n\t\t * @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.\n\t\t * @param {number} [srcLevel=0] - The source mipmap level to copy.\n\t\t * @param {?number} [dstLevel=0] - The destination mipmap level.\n\t\t */\n\t\tthis.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = 0 ) {\n\n\t\t\t// gather the necessary dimensions to copy\n\t\t\tlet width, height, depth, minX, minY, minZ;\n\t\t\tlet dstX, dstY, dstZ;\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ dstLevel ] : srcTexture.image;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tdepth = srcRegion.isBox3 ? srcRegion.max.z - srcRegion.min.z : 1;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\t\t\t\tminZ = srcRegion.isBox3 ? srcRegion.min.z : 0;\n\n\t\t\t} else {\n\n\t\t\t\tconst levelScale = Math.pow( 2, - srcLevel );\n\t\t\t\twidth = Math.floor( image.width * levelScale );\n\t\t\t\theight = Math.floor( image.height * levelScale );\n\t\t\t\tif ( srcTexture.isDataArrayTexture ) {\n\n\t\t\t\t\tdepth = image.depth;\n\n\t\t\t\t} else if ( srcTexture.isData3DTexture ) {\n\n\t\t\t\t\tdepth = Math.floor( image.depth * levelScale );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdepth = 1;\n\n\t\t\t\t}\n\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\t\t\t\tminZ = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\t\t\t\tdstZ = dstPosition.z;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\t\t\t\tdstZ = 0;\n\n\t\t\t}\n\n\t\t\t// Set up the destination target\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D;\n\n\t\t\t}\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 ); // see #33153\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\tstate.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\tstate.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\t// used for copying data from cpu\n\t\t\tconst currentUnpackRowLen = state.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = state.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = state.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = state.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = state.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tstate.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\tstate.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );\n\n\t\t\t// set up the src texture\n\t\t\tconst isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;\n\t\t\tconst isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;\n\t\t\tif ( srcTexture.isDepthTexture ) {\n\n\t\t\t\tconst srcTextureProperties = properties.get( srcTexture );\n\t\t\t\tconst dstTextureProperties = properties.get( dstTexture );\n\t\t\t\tconst srcRenderTargetProperties = properties.get( srcTextureProperties.__renderTarget );\n\t\t\t\tconst dstRenderTargetProperties = properties.get( dstTextureProperties.__renderTarget );\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, srcRenderTargetProperties.__webglFramebuffer );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, dstRenderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < depth; i ++ ) {\n\n\t\t\t\t\t// if the source or destination are a 3d target then a layer needs to be bound\n\t\t\t\t\tif ( isSrc3D ) {\n\n\t\t\t\t\t\t_gl.framebufferTextureLayer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( srcTexture ).__webglTexture, srcLevel, minZ + i );\n\t\t\t\t\t\t_gl.framebufferTextureLayer( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( dstTexture ).__webglTexture, dstLevel, dstZ + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.blitFramebuffer( minX, minY, width, height, dstX, dstY, width, height, _gl.DEPTH_BUFFER_BIT, _gl.NEAREST );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t} else if ( srcLevel !== 0 || srcTexture.isRenderTargetTexture || properties.has( srcTexture ) ) {\n\n\t\t\t\t// get the appropriate frame buffers\n\t\t\t\tconst srcTextureProperties = properties.get( srcTexture );\n\t\t\t\tconst dstTextureProperties = properties.get( dstTexture );\n\n\t\t\t\t// bind the frame buffer targets\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, _srcFramebuffer );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, _dstFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < depth; i ++ ) {\n\n\t\t\t\t\t// assign the correct layers and mip maps to the frame buffers\n\t\t\t\t\tif ( isSrc3D ) {\n\n\t\t\t\t\t\t_gl.framebufferTextureLayer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, srcTextureProperties.__webglTexture, srcLevel, minZ + i );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, srcTextureProperties.__webglTexture, srcLevel );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isDst3D ) {\n\n\t\t\t\t\t\t_gl.framebufferTextureLayer( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, dstTextureProperties.__webglTexture, dstLevel, dstZ + i );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, dstTextureProperties.__webglTexture, dstLevel );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// copy the data using the fastest function that can achieve the copy\n\t\t\t\t\tif ( srcLevel !== 0 ) {\n\n\t\t\t\t\t\t_gl.blitFramebuffer( minX, minY, width, height, dstX, dstY, width, height, _gl.COLOR_BUFFER_BIT, _gl.NEAREST );\n\n\t\t\t\t\t} else if ( isDst3D ) {\n\n\t\t\t\t\t\t_gl.copyTexSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ + i, minX, minY, width, height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_gl.copyTexSubImage2D( glTarget, dstLevel, dstX, dstY, minX, minY, width, height );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// unbind read, draw buffers\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t} else {\n\n\t\t\t\tif ( isDst3D ) {\n\n\t\t\t\t\t// copy data into the 3d texture\n\t\t\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t\t\t_gl.texSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t\t\t} else if ( dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_gl.texSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// copy data into the 2d texture\n\t\t\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, width, height, glFormat, glType, image.data );\n\n\t\t\t\t\t} else if ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, image.width, image.height, glFormat, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, width, height, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// reset values\n\t\t\tstate.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\n\t\t\tstate.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\tstate.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( dstLevel === 0 && dstTexture.generateMipmaps ) {\n\n\t\t\t\t_gl.generateMipmap( glTarget );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\t/**\n\t\t * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data\n\t\t * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been\n\t\t * rendered to.\n\t\t *\n\t\t * @param {WebGLRenderTarget} target - The render target.\n\t\t */\n\t\tthis.initRenderTarget = function ( target ) {\n\n\t\t\tif ( properties.get( target ).__webglFramebuffer === undefined ) {\n\n\t\t\t\ttextures.setupRenderTarget( target );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Initializes the given texture. Useful for preloading a texture rather than waiting until first\n\t\t * render (which can cause noticeable lags due to decode and GPU upload overhead).\n\t\t *\n\t\t * @param {Texture} texture - The texture.\n\t\t */\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\t/**\n\t\t * Can be used to reset the internal WebGL state. This method is mostly\n\t\t * relevant for applications which share a single WebGL context across\n\t\t * multiple WebGL libraries.\n\t\t */\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Defines the coordinate system of the renderer.\n\t *\n\t * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`.\n\t *\n\t * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem}\n\t * @default WebGLCoordinateSystem\n\t * @readonly\n\t */\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\t/**\n\t * Defines the output color space of the renderer.\n\t *\n\t * @type {SRGBColorSpace|LinearSRGBColorSpace}\n\t * @default SRGBColorSpace\n\t */\n\tget outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = ColorManagement._getDrawingBufferColorSpace( colorSpace );\n\t\tgl.unpackColorSpace = ColorManagement._getUnpackColorSpace();\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, ExternalTexture, Float32BufferAttribute, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement, error, log, warn, warnOnce };\n", "import {\n\tBufferAttribute,\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tInstancedBufferAttribute,\n\tInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tTriangleFanDrawMode,\n\tTriangleStripDrawMode,\n\tTrianglesDrawMode,\n\tVector3,\n} from 'three';\n\n/**\n * @module BufferGeometryUtils\n * @three_import import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js';\n */\n\n/**\n * Computes vertex tangents using the MikkTSpace algorithm. MikkTSpace generates the same tangents consistently,\n * and is used in most modelling tools and normal map bakers. Use MikkTSpace for materials with normal maps,\n * because inconsistent tangents may lead to subtle visual issues in the normal map, particularly around mirrored\n * UV seams.\n *\n * In comparison to this method, {@link BufferGeometry#computeTangents} (a custom algorithm) generates tangents that\n * probably will not match the tangents in other software. The custom algorithm is sufficient for general use with a\n * custom material, and may be faster than MikkTSpace.\n *\n * Returns the original BufferGeometry. Indexed geometries will be de-indexed. Requires position, normal, and uv attributes.\n *\n * @param {BufferGeometry} geometry - The geometry to compute tangents for.\n * @param {Object} MikkTSpace - Instance of `examples/jsm/libs/mikktspace.module.js`, or `mikktspace` npm package.\n * Await `MikkTSpace.ready` before use.\n * @param {boolean} [negateSign=true] - Whether to negate the sign component (.w) of each tangent.\n * Required for normal map conventions in some formats, including glTF.\n * @return {BufferGeometry} The updated geometry.\n */\nfunction computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {\n\n\tif ( ! MikkTSpace || ! MikkTSpace.isReady ) {\n\n\t\tthrow new Error( 'BufferGeometryUtils: Initialized MikkTSpace library required.' );\n\n\t}\n\n\tif ( ! geometry.hasAttribute( 'position' ) || ! geometry.hasAttribute( 'normal' ) || ! geometry.hasAttribute( 'uv' ) ) {\n\n\t\tthrow new Error( 'BufferGeometryUtils: Tangents require \"position\", \"normal\", and \"uv\" attributes.' );\n\n\t}\n\n\tfunction getAttributeArray( attribute ) {\n\n\t\tif ( attribute.normalized || attribute.isInterleavedBufferAttribute ) {\n\n\t\t\tconst dstArray = new Float32Array( attribute.count * attribute.itemSize );\n\n\t\t\tfor ( let i = 0, j = 0; i < attribute.count; i ++ ) {\n\n\t\t\t\tdstArray[ j ++ ] = attribute.getX( i );\n\t\t\t\tdstArray[ j ++ ] = attribute.getY( i );\n\n\t\t\t\tif ( attribute.itemSize > 2 ) {\n\n\t\t\t\t\tdstArray[ j ++ ] = attribute.getZ( i );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn dstArray;\n\n\t\t}\n\n\t\tif ( attribute.array instanceof Float32Array ) {\n\n\t\t\treturn attribute.array;\n\n\t\t}\n\n\t\treturn new Float32Array( attribute.array );\n\n\t}\n\n\t// MikkTSpace algorithm requires non-indexed input.\n\n\tconst _geometry = geometry.index ? geometry.toNonIndexed() : geometry;\n\n\t// Compute vertex tangents.\n\n\tconst tangents = MikkTSpace.generateTangents(\n\n\t\tgetAttributeArray( _geometry.attributes.position ),\n\t\tgetAttributeArray( _geometry.attributes.normal ),\n\t\tgetAttributeArray( _geometry.attributes.uv )\n\n\t);\n\n\t// Texture coordinate convention of glTF differs from the apparent\n\t// default of the MikkTSpace library; .w component must be flipped.\n\n\tif ( negateSign ) {\n\n\t\tfor ( let i = 3; i < tangents.length; i += 4 ) {\n\n\t\t\ttangents[ i ] *= - 1;\n\n\t\t}\n\n\t}\n\n\t//\n\n\t_geometry.setAttribute( 'tangent', new BufferAttribute( tangents, 4 ) );\n\n\tif ( geometry !== _geometry ) {\n\n\t\tgeometry.copy( _geometry );\n\n\t}\n\n\treturn geometry;\n\n}\n\n/**\n * Merges a set of geometries into a single instance. All geometries must have compatible attributes.\n *\n * @param {Array<BufferGeometry>} geometries - The geometries to merge.\n * @param {boolean} [useGroups=false] - Whether to use groups or not.\n * @return {?BufferGeometry} The merged geometry. Returns `null` if the merge does not succeed.\n */\nfunction mergeGeometries( geometries, useGroups = false ) {\n\n\tconst isIndexed = geometries[ 0 ].index !== null;\n\n\tconst attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );\n\tconst morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );\n\n\tconst attributes = {};\n\tconst morphAttributes = {};\n\n\tconst morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;\n\n\tconst mergedGeometry = new BufferGeometry();\n\n\tlet offset = 0;\n\n\tfor ( let i = 0; i < geometries.length; ++ i ) {\n\n\t\tconst geometry = geometries[ i ];\n\t\tlet attributesCount = 0;\n\n\t\t// ensure that all geometries are indexed, or none\n\n\t\tif ( isIndexed !== ( geometry.index !== null ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// gather attributes, exit early if they're different\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tif ( ! attributesUsed.has( name ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure \"' + name + '\" attribute exists among all geometries, or in none of them.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tif ( attributes[ name ] === undefined ) attributes[ name ] = [];\n\n\t\t\tattributes[ name ].push( geometry.attributes[ name ] );\n\n\t\t\tattributesCount ++;\n\n\t\t}\n\n\t\t// ensure geometries have the same number of attributes\n\n\t\tif ( attributesCount !== attributesUsed.size ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// gather morph attributes, exit early if they're different\n\n\t\tif ( morphTargetsRelative !== geometry.morphTargetsRelative ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tif ( ! morphAttributesUsed.has( name ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tif ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];\n\n\t\t\tmorphAttributes[ name ].push( geometry.morphAttributes[ name ] );\n\n\t\t}\n\n\t\tif ( useGroups ) {\n\n\t\t\tlet count;\n\n\t\t\tif ( isIndexed ) {\n\n\t\t\t\tcount = geometry.index.count;\n\n\t\t\t} else if ( geometry.attributes.position !== undefined ) {\n\n\t\t\t\tcount = geometry.attributes.position.count;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tmergedGeometry.addGroup( offset, count, i );\n\n\t\t\toffset += count;\n\n\t\t}\n\n\t}\n\n\t// merge indices\n\n\tif ( isIndexed ) {\n\n\t\tlet indexOffset = 0;\n\t\tconst mergedIndex = [];\n\n\t\tfor ( let i = 0; i < geometries.length; ++ i ) {\n\n\t\t\tconst index = geometries[ i ].index;\n\n\t\t\tfor ( let j = 0; j < index.count; ++ j ) {\n\n\t\t\t\tmergedIndex.push( index.getX( j ) + indexOffset );\n\n\t\t\t}\n\n\t\t\tindexOffset += geometries[ i ].attributes.position.count;\n\n\t\t}\n\n\t\tmergedGeometry.setIndex( mergedIndex );\n\n\t}\n\n\t// merge attributes\n\n\tfor ( const name in attributes ) {\n\n\t\tconst mergedAttribute = mergeAttributes( attributes[ name ] );\n\n\t\tif ( ! mergedAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + name + ' attribute.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tmergedGeometry.setAttribute( name, mergedAttribute );\n\n\t}\n\n\t// merge morph attributes\n\n\tfor ( const name in morphAttributes ) {\n\n\t\tconst numMorphTargets = morphAttributes[ name ][ 0 ].length;\n\t\tif ( numMorphTargets === 0 ) continue;\n\n\t\tmergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n\t\tmergedGeometry.morphAttributes[ name ] = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; ++ i ) {\n\n\t\t\tconst morphAttributesToMerge = [];\n\n\t\t\tfor ( let j = 0; j < morphAttributes[ name ].length; ++ j ) {\n\n\t\t\t\tmorphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );\n\n\t\t\t}\n\n\t\t\tconst mergedMorphAttribute = mergeAttributes( morphAttributesToMerge );\n\n\t\t\tif ( ! mergedMorphAttribute ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tmergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );\n\n\t\t}\n\n\t}\n\n\treturn mergedGeometry;\n\n}\n\n/**\n * Merges a set of attributes into a single instance. All attributes must have compatible properties and types.\n * Instances of {@link InterleavedBufferAttribute} are not supported.\n *\n * @param {Array<BufferAttribute>} attributes - The attributes to merge.\n * @return {?BufferAttribute} The merged attribute. Returns `null` if the merge does not succeed.\n */\nfunction mergeAttributes( attributes ) {\n\n\tlet TypedArray;\n\tlet itemSize;\n\tlet normalized;\n\tlet gpuType = - 1;\n\tlet arrayLength = 0;\n\n\tfor ( let i = 0; i < attributes.length; ++ i ) {\n\n\t\tconst attribute = attributes[ i ];\n\n\t\tif ( TypedArray === undefined ) TypedArray = attribute.array.constructor;\n\t\tif ( TypedArray !== attribute.array.constructor ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( itemSize === undefined ) itemSize = attribute.itemSize;\n\t\tif ( itemSize !== attribute.itemSize ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( normalized === undefined ) normalized = attribute.normalized;\n\t\tif ( normalized !== attribute.normalized ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( gpuType === - 1 ) gpuType = attribute.gpuType;\n\t\tif ( gpuType !== attribute.gpuType ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tarrayLength += attribute.count * itemSize;\n\n\t}\n\n\tconst array = new TypedArray( arrayLength );\n\tconst result = new BufferAttribute( array, itemSize, normalized );\n\tlet offset = 0;\n\n\tfor ( let i = 0; i < attributes.length; ++ i ) {\n\n\t\tconst attribute = attributes[ i ];\n\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\tconst tupleOffset = offset / itemSize;\n\t\t\tfor ( let j = 0, l = attribute.count; j < l; j ++ ) {\n\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tconst value = attribute.getComponent( j, c );\n\t\t\t\t\tresult.setComponent( j + tupleOffset, c, value );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tarray.set( attribute.array, offset );\n\n\t\t}\n\n\t\toffset += attribute.count * itemSize;\n\n\t}\n\n\tif ( gpuType !== undefined ) {\n\n\t\tresult.gpuType = gpuType;\n\n\t}\n\n\treturn result;\n\n}\n\n/**\n * Performs a deep clone of the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The attribute to clone.\n * @return {BufferAttribute} The cloned attribute.\n */\nfunction deepCloneAttribute( attribute ) {\n\n\tif ( attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute ) {\n\n\t\treturn deinterleaveAttribute( attribute );\n\n\t}\n\n\tif ( attribute.isInstancedBufferAttribute ) {\n\n\t\treturn new InstancedBufferAttribute().copy( attribute );\n\n\t}\n\n\treturn new BufferAttribute().copy( attribute );\n\n}\n\n/**\n * Interleaves a set of attributes and returns a new array of corresponding attributes that share a\n * single {@link InterleavedBuffer} instance. All attributes must have compatible types.\n *\n * @param {Array<BufferAttribute>} attributes - The attributes to interleave.\n * @return {?Array<InterleavedBufferAttribute>} An array of interleaved attributes. If interleave does not succeed, the method returns `null`.\n */\nfunction interleaveAttributes( attributes ) {\n\n\t// Interleaves the provided attributes into an InterleavedBuffer and returns\n\t// a set of InterleavedBufferAttributes for each attribute\n\tlet TypedArray;\n\tlet arrayLength = 0;\n\tlet stride = 0;\n\n\t// calculate the length and type of the interleavedBuffer\n\tfor ( let i = 0, l = attributes.length; i < l; ++ i ) {\n\n\t\tconst attribute = attributes[ i ];\n\n\t\tif ( TypedArray === undefined ) TypedArray = attribute.array.constructor;\n\t\tif ( TypedArray !== attribute.array.constructor ) {\n\n\t\t\tconsole.error( 'AttributeBuffers of different types cannot be interleaved' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tarrayLength += attribute.array.length;\n\t\tstride += attribute.itemSize;\n\n\t}\n\n\t// Create the set of buffer attributes\n\tconst interleavedBuffer = new InterleavedBuffer( new TypedArray( arrayLength ), stride );\n\tlet offset = 0;\n\tconst res = [];\n\tconst getters = [ 'getX', 'getY', 'getZ', 'getW' ];\n\tconst setters = [ 'setX', 'setY', 'setZ', 'setW' ];\n\n\tfor ( let j = 0, l = attributes.length; j < l; j ++ ) {\n\n\t\tconst attribute = attributes[ j ];\n\t\tconst itemSize = attribute.itemSize;\n\t\tconst count = attribute.count;\n\t\tconst iba = new InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );\n\t\tres.push( iba );\n\n\t\toffset += itemSize;\n\n\t\t// Move the data for each attribute into the new interleavedBuffer\n\t\t// at the appropriate offset\n\t\tfor ( let c = 0; c < count; c ++ ) {\n\n\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\tiba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\n/**\n * Returns a new, non-interleaved version of the given attribute.\n *\n * @param {InterleavedBufferAttribute} attribute - The interleaved attribute.\n * @return {BufferAttribute} The non-interleaved attribute.\n */\nfunction deinterleaveAttribute( attribute ) {\n\n\tconst cons = attribute.data.array.constructor;\n\tconst count = attribute.count;\n\tconst itemSize = attribute.itemSize;\n\tconst normalized = attribute.normalized;\n\n\tconst array = new cons( count * itemSize );\n\tlet newAttribute;\n\tif ( attribute.isInstancedInterleavedBufferAttribute ) {\n\n\t\tnewAttribute = new InstancedBufferAttribute( array, itemSize, normalized, attribute.meshPerAttribute );\n\n\t} else {\n\n\t\tnewAttribute = new BufferAttribute( array, itemSize, normalized );\n\n\t}\n\n\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\tnewAttribute.setX( i, attribute.getX( i ) );\n\n\t\tif ( itemSize >= 2 ) {\n\n\t\t\tnewAttribute.setY( i, attribute.getY( i ) );\n\n\t\t}\n\n\t\tif ( itemSize >= 3 ) {\n\n\t\t\tnewAttribute.setZ( i, attribute.getZ( i ) );\n\n\t\t}\n\n\t\tif ( itemSize >= 4 ) {\n\n\t\t\tnewAttribute.setW( i, attribute.getW( i ) );\n\n\t\t}\n\n\t}\n\n\treturn newAttribute;\n\n}\n\n/**\n * Deinterleaves all attributes on the given geometry.\n *\n * @param {BufferGeometry} geometry - The geometry to deinterleave.\n */\nfunction deinterleaveGeometry( geometry ) {\n\n\tconst attributes = geometry.attributes;\n\tconst morphTargets = geometry.morphTargets;\n\tconst attrMap = new Map();\n\n\tfor ( const key in attributes ) {\n\n\t\tconst attr = attributes[ key ];\n\t\tif ( attr.isInterleavedBufferAttribute ) {\n\n\t\t\tif ( ! attrMap.has( attr ) ) {\n\n\t\t\t\tattrMap.set( attr, deinterleaveAttribute( attr ) );\n\n\t\t\t}\n\n\t\t\tattributes[ key ] = attrMap.get( attr );\n\n\t\t}\n\n\t}\n\n\tfor ( const key in morphTargets ) {\n\n\t\tconst attr = morphTargets[ key ];\n\t\tif ( attr.isInterleavedBufferAttribute ) {\n\n\t\t\tif ( ! attrMap.has( attr ) ) {\n\n\t\t\t\tattrMap.set( attr, deinterleaveAttribute( attr ) );\n\n\t\t\t}\n\n\t\t\tmorphTargets[ key ] = attrMap.get( attr );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Returns the amount of bytes used by all attributes to represent the geometry.\n *\n * @param {BufferGeometry} geometry - The geometry.\n * @return {number} The estimate bytes used.\n */\nfunction estimateBytesUsed( geometry ) {\n\n\t// Return the estimated memory used by this geometry in bytes\n\t// Calculate using itemSize, count, and BYTES_PER_ELEMENT to account\n\t// for InterleavedBufferAttributes.\n\tlet mem = 0;\n\tfor ( const name in geometry.attributes ) {\n\n\t\tconst attr = geometry.getAttribute( name );\n\t\tmem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n\n\t}\n\n\tconst indices = geometry.getIndex();\n\tmem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n\treturn mem;\n\n}\n\n/**\n * Returns a new geometry with vertices for which all similar vertex attributes (within tolerance) are merged.\n *\n * @param {BufferGeometry} geometry - The geometry to merge vertices for.\n * @param {number} [tolerance=1e-4] - The tolerance value.\n * @return {BufferGeometry} - The new geometry with merged vertices.\n */\nfunction mergeVertices( geometry, tolerance = 1e-4 ) {\n\n\ttolerance = Math.max( tolerance, Number.EPSILON );\n\n\t// Generate an index buffer if the geometry doesn't have one, or optimize it\n\t// if it's already available.\n\tconst hashToIndex = {};\n\tconst indices = geometry.getIndex();\n\tconst positions = geometry.getAttribute( 'position' );\n\tconst vertexCount = indices ? indices.count : positions.count;\n\n\t// next value for triangle indices\n\tlet nextIndex = 0;\n\n\t// attributes and new attribute arrays\n\tconst attributeNames = Object.keys( geometry.attributes );\n\tconst tmpAttributes = {};\n\tconst tmpMorphAttributes = {};\n\tconst newIndices = [];\n\tconst getters = [ 'getX', 'getY', 'getZ', 'getW' ];\n\tconst setters = [ 'setX', 'setY', 'setZ', 'setW' ];\n\n\t// Initialize the arrays, allocating space conservatively. Extra\n\t// space will be trimmed in the last step.\n\tfor ( let i = 0, l = attributeNames.length; i < l; i ++ ) {\n\n\t\tconst name = attributeNames[ i ];\n\t\tconst attr = geometry.attributes[ name ];\n\n\t\ttmpAttributes[ name ] = new attr.constructor(\n\t\t\tnew attr.array.constructor( attr.count * attr.itemSize ),\n\t\t\tattr.itemSize,\n\t\t\tattr.normalized\n\t\t);\n\n\t\tconst morphAttributes = geometry.morphAttributes[ name ];\n\t\tif ( morphAttributes ) {\n\n\t\t\tif ( ! tmpMorphAttributes[ name ] ) tmpMorphAttributes[ name ] = [];\n\t\t\tmorphAttributes.forEach( ( morphAttr, i ) => {\n\n\t\t\t\tconst array = new morphAttr.array.constructor( morphAttr.count * morphAttr.itemSize );\n\t\t\t\ttmpMorphAttributes[ name ][ i ] = new morphAttr.constructor( array, morphAttr.itemSize, morphAttr.normalized );\n\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n\t// convert the error tolerance to an amount of decimal places to truncate to\n\tconst halfTolerance = tolerance * 0.5;\n\tconst exponent = Math.log10( 1 / tolerance );\n\tconst hashMultiplier = Math.pow( 10, exponent );\n\tconst hashAdditive = halfTolerance * hashMultiplier;\n\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\tconst index = indices ? indices.getX( i ) : i;\n\n\t\t// Generate a hash for the vertex attributes at the current index 'i'\n\t\tlet hash = '';\n\t\tfor ( let j = 0, l = attributeNames.length; j < l; j ++ ) {\n\n\t\t\tconst name = attributeNames[ j ];\n\t\t\tconst attribute = geometry.getAttribute( name );\n\t\t\tconst itemSize = attribute.itemSize;\n\n\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\t// double tilde truncates the decimal value\n\t\t\t\thash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * hashMultiplier + hashAdditive ) },`;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Add another reference to the vertex if it's already\n\t\t// used by another index\n\t\tif ( hash in hashToIndex ) {\n\n\t\t\tnewIndices.push( hashToIndex[ hash ] );\n\n\t\t} else {\n\n\t\t\t// copy data to the new index in the temporary attributes\n\t\t\tfor ( let j = 0, l = attributeNames.length; j < l; j ++ ) {\n\n\t\t\t\tconst name = attributeNames[ j ];\n\t\t\t\tconst attribute = geometry.getAttribute( name );\n\t\t\t\tconst morphAttributes = geometry.morphAttributes[ name ];\n\t\t\t\tconst itemSize = attribute.itemSize;\n\t\t\t\tconst newArray = tmpAttributes[ name ];\n\t\t\t\tconst newMorphArrays = tmpMorphAttributes[ name ];\n\n\t\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\t\tconst getterFunc = getters[ k ];\n\t\t\t\t\tconst setterFunc = setters[ k ];\n\t\t\t\t\tnewArray[ setterFunc ]( nextIndex, attribute[ getterFunc ]( index ) );\n\n\t\t\t\t\tif ( morphAttributes ) {\n\n\t\t\t\t\t\tfor ( let m = 0, ml = morphAttributes.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\t\tnewMorphArrays[ m ][ setterFunc ]( nextIndex, morphAttributes[ m ][ getterFunc ]( index ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\thashToIndex[ hash ] = nextIndex;\n\t\t\tnewIndices.push( nextIndex );\n\t\t\tnextIndex ++;\n\n\t\t}\n\n\t}\n\n\t// generate result BufferGeometry\n\tconst result = geometry.clone();\n\tfor ( const name in geometry.attributes ) {\n\n\t\tconst tmpAttribute = tmpAttributes[ name ];\n\n\t\tresult.setAttribute( name, new tmpAttribute.constructor(\n\t\t\ttmpAttribute.array.slice( 0, nextIndex * tmpAttribute.itemSize ),\n\t\t\ttmpAttribute.itemSize,\n\t\t\ttmpAttribute.normalized,\n\t\t) );\n\n\t\tif ( ! ( name in tmpMorphAttributes ) ) continue;\n\n\t\tfor ( let j = 0; j < tmpMorphAttributes[ name ].length; j ++ ) {\n\n\t\t\tconst tmpMorphAttribute = tmpMorphAttributes[ name ][ j ];\n\n\t\t\tresult.morphAttributes[ name ][ j ] = new tmpMorphAttribute.constructor(\n\t\t\t\ttmpMorphAttribute.array.slice( 0, nextIndex * tmpMorphAttribute.itemSize ),\n\t\t\t\ttmpMorphAttribute.itemSize,\n\t\t\t\ttmpMorphAttribute.normalized,\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\t// indices\n\n\tresult.setIndex( newIndices );\n\n\treturn result;\n\n}\n\n/**\n * Returns a new indexed geometry based on `TrianglesDrawMode` draw mode.\n * This mode corresponds to the `gl.TRIANGLES` primitive in WebGL.\n *\n * @param {BufferGeometry} geometry - The geometry to convert.\n * @param {number} drawMode - The current draw mode.\n * @return {BufferGeometry} The new geometry using `TrianglesDrawMode`.\n */\nfunction toTrianglesDrawMode( geometry, drawMode ) {\n\n\tif ( drawMode === TrianglesDrawMode ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );\n\t\treturn geometry;\n\n\t}\n\n\tif ( drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode ) {\n\n\t\tlet index = geometry.getIndex();\n\n\t\t// generate index if not present\n\n\t\tif ( index === null ) {\n\n\t\t\tconst indices = [];\n\n\t\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t\tif ( position !== undefined ) {\n\n\t\t\t\tfor ( let i = 0; i < position.count; i ++ ) {\n\n\t\t\t\t\tindices.push( i );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setIndex( indices );\n\t\t\t\tindex = geometry.getIndex();\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );\n\t\t\t\treturn geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst numberOfTriangles = index.count - 2;\n\t\tconst newIndices = [];\n\n\t\tif ( drawMode === TriangleFanDrawMode ) {\n\n\t\t\t// gl.TRIANGLE_FAN\n\n\t\t\tfor ( let i = 1; i <= numberOfTriangles; i ++ ) {\n\n\t\t\t\tnewIndices.push( index.getX( 0 ) );\n\t\t\t\tnewIndices.push( index.getX( i ) );\n\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// gl.TRIANGLE_STRIP\n\n\t\t\tfor ( let i = 0; i < numberOfTriangles; i ++ ) {\n\n\t\t\t\tif ( i % 2 === 0 ) {\n\n\t\t\t\t\tnewIndices.push( index.getX( i ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 2 ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tnewIndices.push( index.getX( i + 2 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( ( newIndices.length / 3 ) !== numberOfTriangles ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );\n\n\t\t}\n\n\t\t// build final geometry\n\n\t\tconst newGeometry = geometry.clone();\n\t\tnewGeometry.setIndex( newIndices );\n\t\tnewGeometry.clearGroups();\n\n\t\treturn newGeometry;\n\n\t} else {\n\n\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );\n\t\treturn geometry;\n\n\t}\n\n}\n\n/**\n * Calculates the morphed attributes of a morphed/skinned BufferGeometry.\n *\n * Helpful for Raytracing or Decals (i.e. a `DecalGeometry` applied to a morphed Object with a `BufferGeometry`\n * will use the original `BufferGeometry`, not the morphed/skinned one, generating an incorrect result.\n * Using this function to create a shadow `Object3`D the `DecalGeometry` can be correctly generated).\n *\n * @param {Mesh|Line|Points} object - The 3D object to compute morph attributes for.\n * @return {Object} An object with original position/normal attributes and morphed ones.\n */\nfunction computeMorphedAttributes( object ) {\n\n\tconst _vA = new Vector3();\n\tconst _vB = new Vector3();\n\tconst _vC = new Vector3();\n\n\tconst _tempA = new Vector3();\n\tconst _tempB = new Vector3();\n\tconst _tempC = new Vector3();\n\n\tconst _morphA = new Vector3();\n\tconst _morphB = new Vector3();\n\tconst _morphC = new Vector3();\n\n\tfunction _calculateMorphedAttributeData(\n\t\tobject,\n\t\tattribute,\n\t\tmorphAttribute,\n\t\tmorphTargetsRelative,\n\t\ta,\n\t\tb,\n\t\tc,\n\t\tmodifiedAttributeArray\n\t) {\n\n\t\t_vA.fromBufferAttribute( attribute, a );\n\t\t_vB.fromBufferAttribute( attribute, b );\n\t\t_vC.fromBufferAttribute( attribute, c );\n\n\t\tconst morphInfluences = object.morphTargetInfluences;\n\n\t\tif ( morphAttribute && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\t\t\t_morphB.set( 0, 0, 0 );\n\t\t\t_morphC.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morph = morphAttribute[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morph, a );\n\t\t\t\t_tempB.fromBufferAttribute( morph, b );\n\t\t\t\t_tempC.fromBufferAttribute( morph, c );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\t\t\t\t\t_morphB.addScaledVector( _tempB, influence );\n\t\t\t\t\t_morphC.addScaledVector( _tempC, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( _vA ), influence );\n\t\t\t\t\t_morphB.addScaledVector( _tempB.sub( _vB ), influence );\n\t\t\t\t\t_morphC.addScaledVector( _tempC.sub( _vC ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_vA.add( _morphA );\n\t\t\t_vB.add( _morphB );\n\t\t\t_vC.add( _morphC );\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tobject.applyBoneTransform( a, _vA );\n\t\t\tobject.applyBoneTransform( b, _vB );\n\t\t\tobject.applyBoneTransform( c, _vC );\n\n\t\t}\n\n\t\tmodifiedAttributeArray[ a * 3 + 0 ] = _vA.x;\n\t\tmodifiedAttributeArray[ a * 3 + 1 ] = _vA.y;\n\t\tmodifiedAttributeArray[ a * 3 + 2 ] = _vA.z;\n\t\tmodifiedAttributeArray[ b * 3 + 0 ] = _vB.x;\n\t\tmodifiedAttributeArray[ b * 3 + 1 ] = _vB.y;\n\t\tmodifiedAttributeArray[ b * 3 + 2 ] = _vB.z;\n\t\tmodifiedAttributeArray[ c * 3 + 0 ] = _vC.x;\n\t\tmodifiedAttributeArray[ c * 3 + 1 ] = _vC.y;\n\t\tmodifiedAttributeArray[ c * 3 + 2 ] = _vC.z;\n\n\t}\n\n\tconst geometry = object.geometry;\n\tconst material = object.material;\n\n\tlet a, b, c;\n\tconst index = geometry.index;\n\tconst positionAttribute = geometry.attributes.position;\n\tconst morphPosition = geometry.morphAttributes.position;\n\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\tconst normalAttribute = geometry.attributes.normal;\n\tconst morphNormal = geometry.morphAttributes.normal;\n\n\tconst groups = geometry.groups;\n\tconst drawRange = geometry.drawRange;\n\tlet i, j, il, jl;\n\tlet group;\n\tlet start, end;\n\n\tconst modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );\n\tconst modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );\n\n\tif ( index !== null ) {\n\n\t\t// indexed buffer geometry\n\n\t\tif ( Array.isArray( material ) ) {\n\n\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\tgroup = groups[ i ];\n\n\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\ta = index.getX( j );\n\t\t\t\t\tb = index.getX( j + 1 );\n\t\t\t\t\tc = index.getX( j + 2 );\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tpositionAttribute,\n\t\t\t\t\t\tmorphPosition,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedPosition\n\t\t\t\t\t);\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tnormalAttribute,\n\t\t\t\t\t\tmorphNormal,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedNormal\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\tend = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\ta = index.getX( i );\n\t\t\t\tb = index.getX( i + 1 );\n\t\t\t\tc = index.getX( i + 2 );\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tpositionAttribute,\n\t\t\t\t\tmorphPosition,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedPosition\n\t\t\t\t);\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tnormalAttribute,\n\t\t\t\t\tmorphNormal,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedNormal\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// non-indexed buffer geometry\n\n\t\tif ( Array.isArray( material ) ) {\n\n\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\tgroup = groups[ i ];\n\n\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\ta = j;\n\t\t\t\t\tb = j + 1;\n\t\t\t\t\tc = j + 2;\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tpositionAttribute,\n\t\t\t\t\t\tmorphPosition,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedPosition\n\t\t\t\t\t);\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tnormalAttribute,\n\t\t\t\t\t\tmorphNormal,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedNormal\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\tend = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\ta = i;\n\t\t\t\tb = i + 1;\n\t\t\t\tc = i + 2;\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tpositionAttribute,\n\t\t\t\t\tmorphPosition,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedPosition\n\t\t\t\t);\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tnormalAttribute,\n\t\t\t\t\tmorphNormal,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedNormal\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tconst morphedPositionAttribute = new Float32BufferAttribute( modifiedPosition, 3 );\n\tconst morphedNormalAttribute = new Float32BufferAttribute( modifiedNormal, 3 );\n\n\treturn {\n\n\t\tpositionAttribute: positionAttribute,\n\t\tnormalAttribute: normalAttribute,\n\t\tmorphedPositionAttribute: morphedPositionAttribute,\n\t\tmorphedNormalAttribute: morphedNormalAttribute\n\n\t};\n\n}\n\n/**\n * Merges the {@link BufferGeometry#groups} for the given geometry.\n *\n * @param {BufferGeometry} geometry - The geometry to modify.\n * @return {BufferGeometry} - The updated geometry\n */\nfunction mergeGroups( geometry ) {\n\n\tif ( geometry.groups.length === 0 ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge.' );\n\t\treturn geometry;\n\n\t}\n\n\tlet groups = geometry.groups;\n\n\t// sort groups by material index\n\n\tgroups = groups.sort( ( a, b ) => {\n\n\t\tif ( a.materialIndex !== b.materialIndex ) return a.materialIndex - b.materialIndex;\n\n\t\treturn a.start - b.start;\n\n\t} );\n\n\t// create index for non-indexed geometries\n\n\tif ( geometry.getIndex() === null ) {\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\t\tconst indices = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i += 3 ) {\n\n\t\t\tindices.push( i, i + 1, i + 2 );\n\n\t\t}\n\n\t\tgeometry.setIndex( indices );\n\n\t}\n\n\t// sort index\n\n\tconst index = geometry.getIndex();\n\n\tconst newIndices = [];\n\n\tfor ( let i = 0; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tconst groupStart = group.start;\n\t\tconst groupLength = groupStart + group.count;\n\n\t\tfor ( let j = groupStart; j < groupLength; j ++ ) {\n\n\t\t\tnewIndices.push( index.getX( j ) );\n\n\t\t}\n\n\t}\n\n\tgeometry.dispose(); // Required to force buffer recreation\n\tgeometry.setIndex( newIndices );\n\n\t// update groups indices\n\n\tlet start = 0;\n\n\tfor ( let i = 0; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tgroup.start = start;\n\t\tstart += group.count;\n\n\t}\n\n\t// merge groups\n\n\tlet currentGroup = groups[ 0 ];\n\n\tgeometry.groups = [ currentGroup ];\n\n\tfor ( let i = 1; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tif ( currentGroup.materialIndex === group.materialIndex ) {\n\n\t\t\tcurrentGroup.count += group.count;\n\n\t\t} else {\n\n\t\t\tcurrentGroup = group;\n\t\t\tgeometry.groups.push( currentGroup );\n\n\t\t}\n\n\t}\n\n\treturn geometry;\n\n}\n\n/**\n * Modifies the supplied geometry if it is non-indexed, otherwise creates a new,\n * non-indexed geometry. Returns the geometry with smooth normals everywhere except\n * faces that meet at an angle greater than the crease angle.\n *\n * @param {BufferGeometry} geometry - The geometry to modify.\n * @param {number} [creaseAngle=Math.PI/3] - The crease angle in radians.\n * @return {BufferGeometry} - The updated geometry\n */\nfunction toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {\n\n\tconst creaseDot = Math.cos( creaseAngle );\n\tconst hashMultiplier = ( 1 + 1e-10 ) * 1e2;\n\n\t// reusable vectors\n\tconst verts = [ new Vector3(), new Vector3(), new Vector3() ];\n\tconst tempVec1 = new Vector3();\n\tconst tempVec2 = new Vector3();\n\tconst tempNorm = new Vector3();\n\tconst tempNorm2 = new Vector3();\n\n\t// hashes a vector\n\tfunction hashVertex( v ) {\n\n\t\tconst x = ~ ~ ( v.x * hashMultiplier );\n\t\tconst y = ~ ~ ( v.y * hashMultiplier );\n\t\tconst z = ~ ~ ( v.z * hashMultiplier );\n\t\treturn `${x},${y},${z}`;\n\n\t}\n\n\t// BufferGeometry.toNonIndexed() warns if the geometry is non-indexed\n\t// and returns the original geometry\n\tconst resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;\n\tconst posAttr = resultGeometry.attributes.position;\n\tconst vertexMap = {};\n\n\t// find all the normals shared by commonly located vertices\n\tfor ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {\n\n\t\tconst i3 = 3 * i;\n\t\tconst a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );\n\t\tconst b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );\n\t\tconst c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );\n\n\t\ttempVec1.subVectors( c, b );\n\t\ttempVec2.subVectors( a, b );\n\n\t\t// add the normal to the map for all vertices\n\t\tconst normal = new Vector3().crossVectors( tempVec1, tempVec2 ).normalize();\n\t\tfor ( let n = 0; n < 3; n ++ ) {\n\n\t\t\tconst vert = verts[ n ];\n\t\t\tconst hash = hashVertex( vert );\n\t\t\tif ( ! ( hash in vertexMap ) ) {\n\n\t\t\t\tvertexMap[ hash ] = [];\n\n\t\t\t}\n\n\t\t\tvertexMap[ hash ].push( normal );\n\n\t\t}\n\n\t}\n\n\t// average normals from all vertices that share a common location if they are within the\n\t// provided crease threshold\n\tconst normalArray = new Float32Array( posAttr.count * 3 );\n\tconst normAttr = new BufferAttribute( normalArray, 3, false );\n\tfor ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {\n\n\t\t// get the face normal for this vertex\n\t\tconst i3 = 3 * i;\n\t\tconst a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );\n\t\tconst b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );\n\t\tconst c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );\n\n\t\ttempVec1.subVectors( c, b );\n\t\ttempVec2.subVectors( a, b );\n\n\t\ttempNorm.crossVectors( tempVec1, tempVec2 ).normalize();\n\n\t\t// average all normals that meet the threshold and set the normal value\n\t\tfor ( let n = 0; n < 3; n ++ ) {\n\n\t\t\tconst vert = verts[ n ];\n\t\t\tconst hash = hashVertex( vert );\n\t\t\tconst otherNormals = vertexMap[ hash ];\n\t\t\ttempNorm2.set( 0, 0, 0 );\n\n\t\t\tfor ( let k = 0, lk = otherNormals.length; k < lk; k ++ ) {\n\n\t\t\t\tconst otherNorm = otherNormals[ k ];\n\t\t\t\tif ( tempNorm.dot( otherNorm ) > creaseDot ) {\n\n\t\t\t\t\ttempNorm2.add( otherNorm );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttempNorm2.normalize();\n\t\t\tnormAttr.setXYZ( i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z );\n\n\t\t}\n\n\t}\n\n\tresultGeometry.setAttribute( 'normal', normAttr );\n\treturn resultGeometry;\n\n}\n\nexport {\n\tcomputeMikkTSpaceTangents,\n\tmergeGeometries,\n\tmergeAttributes,\n\tdeepCloneAttribute,\n\tdeinterleaveAttribute,\n\tdeinterleaveGeometry,\n\tinterleaveAttributes,\n\testimateBytesUsed,\n\tmergeVertices,\n\ttoTrianglesDrawMode,\n\tcomputeMorphedAttributes,\n\tmergeGroups,\n\ttoCreasedNormals\n};\n", "import {\n\tAnimationClip,\n\tAnimationMixer,\n\tMatrix4,\n\tQuaternion,\n\tQuaternionKeyframeTrack,\n\tSkeletonHelper,\n\tVector3,\n\tVectorKeyframeTrack\n} from 'three';\n\n/**\n * @module SkeletonUtils\n * @three_import import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js';\n */\n\nfunction getBoneName( bone, options ) {\n\n\tif ( options.getBoneName !== undefined ) {\n\n\t\treturn options.getBoneName( bone );\n\n\t}\n\n\treturn options.names[ bone.name ];\n\n}\n\n/**\n * Retargets the skeleton from the given source to the target.\n *\n * Both `target` and `source` can be a 3D object with a skeleton property (e.g. a skinned mesh)\n * or a {@link Skeleton} directly.\n *\n * @param {Object3D|Skeleton} target - The target object.\n * @param {Object3D|Skeleton} source - The source object.\n * @param {module:SkeletonUtils~RetargetOptions} options - The options.\n */\nfunction retarget( target, source, options = {} ) {\n\n\tconst quat = new Quaternion(),\n\t\tscale = new Vector3(),\n\t\trelativeMatrix = new Matrix4(),\n\t\tglobalMatrix = new Matrix4();\n\n\toptions.preserveBoneMatrix = options.preserveBoneMatrix !== undefined ? options.preserveBoneMatrix : true;\n\toptions.preserveBonePositions = options.preserveBonePositions !== undefined ? options.preserveBonePositions : true;\n\toptions.useTargetMatrix = options.useTargetMatrix !== undefined ? options.useTargetMatrix : false;\n\toptions.hip = options.hip !== undefined ? options.hip : 'hip';\n\toptions.hipInfluence = options.hipInfluence !== undefined ? options.hipInfluence : new Vector3( 1, 1, 1 );\n\toptions.scale = options.scale !== undefined ? options.scale : 1;\n\toptions.names = options.names || {};\n\n\tconst sourceBones = source.isObject3D ? source.skeleton.bones : getBones( source ),\n\t\tbones = target.isObject3D ? target.skeleton.bones : getBones( target );\n\n\tlet bone, name, boneTo,\n\t\tbonesPosition;\n\n\t// reset bones\n\n\tif ( target.isObject3D ) {\n\n\t\ttarget.skeleton.pose();\n\n\t} else {\n\n\t\toptions.useTargetMatrix = true;\n\t\toptions.preserveBoneMatrix = false;\n\n\t}\n\n\tif ( options.preserveBonePositions ) {\n\n\t\tbonesPosition = [];\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tbonesPosition.push( bones[ i ].position.clone() );\n\n\t\t}\n\n\t}\n\n\tif ( options.preserveBoneMatrix ) {\n\n\t\t// reset matrix\n\n\t\ttarget.updateMatrixWorld();\n\n\t\ttarget.matrixWorld.identity();\n\n\t\t// reset children matrix\n\n\t\tfor ( let i = 0; i < target.children.length; ++ i ) {\n\n\t\t\ttarget.children[ i ].updateMatrixWorld( true );\n\n\t\t}\n\n\t}\n\n\tfor ( let i = 0; i < bones.length; ++ i ) {\n\n\t\tbone = bones[ i ];\n\t\tname = getBoneName( bone, options );\n\n\t\tboneTo = getBoneByName( name, sourceBones );\n\n\t\tglobalMatrix.copy( bone.matrixWorld );\n\n\t\tif ( boneTo ) {\n\n\t\t\tboneTo.updateMatrixWorld();\n\n\t\t\tif ( options.useTargetMatrix ) {\n\n\t\t\t\trelativeMatrix.copy( boneTo.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\trelativeMatrix.copy( target.matrixWorld ).invert();\n\t\t\t\trelativeMatrix.multiply( boneTo.matrixWorld );\n\n\t\t\t}\n\n\t\t\t// ignore scale to extract rotation\n\n\t\t\tscale.setFromMatrixScale( relativeMatrix );\n\t\t\trelativeMatrix.scale( scale.set( 1 / scale.x, 1 / scale.y, 1 / scale.z ) );\n\n\t\t\t// apply to global matrix\n\n\t\t\tglobalMatrix.makeRotationFromQuaternion( quat.setFromRotationMatrix( relativeMatrix ) );\n\n\t\t\tif ( target.isObject3D ) {\n\n\t\t\t\tif ( options.localOffsets ) {\n\n\t\t\t\t\tif ( options.localOffsets[ bone.name ] ) {\n\n\t\t\t\t\t\tglobalMatrix.multiply( options.localOffsets[ bone.name ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tglobalMatrix.copyPosition( relativeMatrix );\n\n\t\t}\n\n\t\tif ( name === options.hip ) {\n\n\t\t\tglobalMatrix.elements[ 12 ] *= options.scale * options.hipInfluence.x;\n\t\t\tglobalMatrix.elements[ 13 ] *= options.scale * options.hipInfluence.y;\n\t\t\tglobalMatrix.elements[ 14 ] *= options.scale * options.hipInfluence.z;\n\n\t\t\tif ( options.hipPosition !== undefined ) {\n\n\t\t\t\tglobalMatrix.elements[ 12 ] += options.hipPosition.x * options.scale;\n\t\t\t\tglobalMatrix.elements[ 13 ] += options.hipPosition.y * options.scale;\n\t\t\t\tglobalMatrix.elements[ 14 ] += options.hipPosition.z * options.scale;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( bone.parent ) {\n\n\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\tbone.matrix.multiply( globalMatrix );\n\n\t\t} else {\n\n\t\t\tbone.matrix.copy( globalMatrix );\n\n\t\t}\n\n\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\tbone.updateMatrixWorld();\n\n\t}\n\n\tif ( options.preserveBonePositions ) {\n\n\t\tfor ( let i = 0; i < bones.length; ++ i ) {\n\n\t\t\tbone = bones[ i ];\n\t\t\tname = getBoneName( bone, options ) || bone.name;\n\n\t\t\tif ( name !== options.hip ) {\n\n\t\t\t\tbone.position.copy( bonesPosition[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif ( options.preserveBoneMatrix ) {\n\n\t\t// restore matrix\n\n\t\ttarget.updateMatrixWorld( true );\n\n\t}\n\n}\n\n/**\n * Retargets the animation clip of the source to the target 3D object.\n *\n * The `source` can be a 3D object with a skeleton property (e.g. a skinned mesh)\n * or a {@link Skeleton} directly.\n *\n * @param {Object3D} target - The target 3D object. Must have a `skeleton` property.\n * @param {Object3D|Skeleton} source - The source object.\n * @param {AnimationClip} clip - The animation clip.\n * @param {module:SkeletonUtils~RetargetOptions} options - The options.\n * @return {AnimationClip} The retargeted animation clip.\n */\nfunction retargetClip( target, source, clip, options = {} ) {\n\n\toptions.useFirstFramePosition = options.useFirstFramePosition !== undefined ? options.useFirstFramePosition : false;\n\n\t// Calculate the fps from the source clip based on the track with the most frames, unless fps is already provided.\n\toptions.fps = options.fps !== undefined ? options.fps : ( Math.max( ...clip.tracks.map( track => track.times.length ) ) / clip.duration );\n\toptions.names = options.names || [];\n\n\tif ( ! source.isObject3D ) {\n\n\t\tsource = getHelperFromSkeleton( source );\n\n\t}\n\n\tconst numFrames = Math.round( clip.duration * ( options.fps / 1000 ) * 1000 ),\n\t\tdelta = clip.duration / ( numFrames - 1 ),\n\t\tconvertedTracks = [],\n\t\tmixer = new AnimationMixer( source ),\n\t\tbones = getBones( target.skeleton ),\n\t\tboneDatas = [];\n\n\tlet positionOffset,\n\t\tbone, boneTo, boneData,\n\t\tname;\n\n\tmixer.clipAction( clip ).play();\n\n\t// trim\n\n\tlet start = 0, end = numFrames;\n\n\tif ( options.trim !== undefined ) {\n\n\t\tstart = Math.round( options.trim[ 0 ] * options.fps );\n\t\tend = Math.min( Math.round( options.trim[ 1 ] * options.fps ), numFrames ) - start;\n\n\t\tmixer.update( options.trim[ 0 ] );\n\n\t} else {\n\n\t\tmixer.update( 0 );\n\n\t}\n\n\tsource.updateMatrixWorld();\n\n\t//\n\n\tfor ( let frame = 0; frame < end; ++ frame ) {\n\n\t\tconst time = frame * delta;\n\n\t\tretarget( target, source, options );\n\n\t\tfor ( let j = 0; j < bones.length; ++ j ) {\n\n\t\t\tbone = bones[ j ];\n\t\t\tname = getBoneName( bone, options ) || bone.name;\n\t\t\tboneTo = getBoneByName( name, source.skeleton );\n\n\t\t\tif ( boneTo ) {\n\n\t\t\t\tboneData = boneDatas[ j ] = boneDatas[ j ] || { bone: bone };\n\n\t\t\t\tif ( options.hip === name ) {\n\n\t\t\t\t\tif ( ! boneData.pos ) {\n\n\t\t\t\t\t\tboneData.pos = {\n\t\t\t\t\t\t\ttimes: new Float32Array( end ),\n\t\t\t\t\t\t\tvalues: new Float32Array( end * 3 )\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( options.useFirstFramePosition ) {\n\n\t\t\t\t\t\tif ( frame === 0 ) {\n\n\t\t\t\t\t\t\tpositionOffset = bone.position.clone();\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbone.position.sub( positionOffset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tboneData.pos.times[ frame ] = time;\n\n\t\t\t\t\tbone.position.toArray( boneData.pos.values, frame * 3 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! boneData.quat ) {\n\n\t\t\t\t\tboneData.quat = {\n\t\t\t\t\t\ttimes: new Float32Array( end ),\n\t\t\t\t\t\tvalues: new Float32Array( end * 4 )\n\t\t\t\t\t};\n\n\t\t\t\t}\n\n\t\t\t\tboneData.quat.times[ frame ] = time;\n\n\t\t\t\tbone.quaternion.toArray( boneData.quat.values, frame * 4 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( frame === end - 2 ) {\n\n\t\t\t// last mixer update before final loop iteration\n\t\t\t// make sure we do not go over or equal to clip duration\n\t\t\tmixer.update( delta - 0.0000001 );\n\n\t\t} else {\n\n\t\t\tmixer.update( delta );\n\n\t\t}\n\n\t\tsource.updateMatrixWorld();\n\n\t}\n\n\tfor ( let i = 0; i < boneDatas.length; ++ i ) {\n\n\t\tboneData = boneDatas[ i ];\n\n\t\tif ( boneData ) {\n\n\t\t\tif ( boneData.pos ) {\n\n\t\t\t\tconvertedTracks.push( new VectorKeyframeTrack(\n\t\t\t\t\t'.bones[' + boneData.bone.name + '].position',\n\t\t\t\t\tboneData.pos.times,\n\t\t\t\t\tboneData.pos.values\n\t\t\t\t) );\n\n\t\t\t}\n\n\t\t\tconvertedTracks.push( new QuaternionKeyframeTrack(\n\t\t\t\t'.bones[' + boneData.bone.name + '].quaternion',\n\t\t\t\tboneData.quat.times,\n\t\t\t\tboneData.quat.values\n\t\t\t) );\n\n\t\t}\n\n\t}\n\n\tmixer.uncacheAction( clip );\n\n\treturn new AnimationClip( clip.name, - 1, convertedTracks );\n\n}\n\n/**\n * Clones the given 3D object and its descendants, ensuring that any `SkinnedMesh` instances are\n * correctly associated with their bones. Bones are also cloned, and must be descendants of the\n * object passed to this method. Other data, like geometries and materials, are reused by reference.\n *\n * @param {Object3D} source - The 3D object to clone.\n * @return {Object3D} The cloned 3D object.\n */\nfunction clone( source ) {\n\n\tconst sourceLookup = new Map();\n\tconst cloneLookup = new Map();\n\n\tconst clone = source.clone();\n\n\tparallelTraverse( source, clone, function ( sourceNode, clonedNode ) {\n\n\t\tsourceLookup.set( clonedNode, sourceNode );\n\t\tcloneLookup.set( sourceNode, clonedNode );\n\n\t} );\n\n\tclone.traverse( function ( node ) {\n\n\t\tif ( ! node.isSkinnedMesh ) return;\n\n\t\tconst clonedMesh = node;\n\t\tconst sourceMesh = sourceLookup.get( node );\n\t\tconst sourceBones = sourceMesh.skeleton.bones;\n\n\t\tclonedMesh.skeleton = sourceMesh.skeleton.clone();\n\t\tclonedMesh.bindMatrix.copy( sourceMesh.bindMatrix );\n\n\t\tclonedMesh.skeleton.bones = sourceBones.map( function ( bone ) {\n\n\t\t\treturn cloneLookup.get( bone );\n\n\t\t} );\n\n\t\tclonedMesh.bind( clonedMesh.skeleton, clonedMesh.bindMatrix );\n\n\t} );\n\n\treturn clone;\n\n}\n\n// internal helper\n\nfunction getBoneByName( name, skeleton ) {\n\n\tfor ( let i = 0, bones = getBones( skeleton ); i < bones.length; i ++ ) {\n\n\t\tif ( name === bones[ i ].name )\n\n\t\t\treturn bones[ i ];\n\n\t}\n\n}\n\nfunction getBones( skeleton ) {\n\n\treturn Array.isArray( skeleton ) ? skeleton : skeleton.bones;\n\n}\n\n\nfunction getHelperFromSkeleton( skeleton ) {\n\n\tconst source = new SkeletonHelper( skeleton.bones[ 0 ] );\n\tsource.skeleton = skeleton;\n\n\treturn source;\n\n}\n\nfunction parallelTraverse( a, b, callback ) {\n\n\tcallback( a, b );\n\n\tfor ( let i = 0; i < a.children.length; i ++ ) {\n\n\t\tparallelTraverse( a.children[ i ], b.children[ i ], callback );\n\n\t}\n\n}\n\n/**\n * Retarget options of `SkeletonUtils`.\n *\n * @typedef {Object} module:SkeletonUtils~RetargetOptions\n * @property {boolean} [useFirstFramePosition=false] - Whether to use the position of the first frame or not.\n * @property {number} [fps] - The FPS of the clip.\n * @property {Object<string,string>} [names] - A dictionary for mapping target to source bone names.\n * @property {function(string):string} [getBoneName] - A function for mapping bone names. Alternative to `names`.\n * @property {Array<number>} [trim] - Whether to trim the clip or not. If set the array should hold two values for the start and end.\n * @property {boolean} [preserveBoneMatrix=true] - Whether to preserve bone matrices or not.\n * @property {boolean} [preserveBonePositions=true] - Whether to preserve bone positions or not.\n * @property {boolean} [useTargetMatrix=false] - Whether to use the target matrix or not.\n * @property {string} [hip='hip'] - The name of the source's hip bone.\n * @property {Vector3} [hipInfluence=(1,1,1)] - The hip influence.\n * @property {number} [scale=1] - The scale.\n * @property {Object<string,Matrix4>} [localOffsets] - Per-bone local offset matrices, keyed by bone name.\n * @property {Vector3} [hipPosition] - An additional position offset applied to the hip bone.\n **/\n\nexport {\n\tretarget,\n\tretargetClip,\n\tclone,\n};\n", "import {\n\tAnimationClip,\n\tBone,\n\tBox3,\n\tBufferAttribute,\n\tBufferGeometry,\n\tClampToEdgeWrapping,\n\tColor,\n\tColorManagement,\n\tDirectionalLight,\n\tDoubleSide,\n\tFileLoader,\n\tFrontSide,\n\tGroup,\n\tImageBitmapLoader,\n\tInstancedMesh,\n\tInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tInterpolant,\n\tInterpolateDiscrete,\n\tInterpolateLinear,\n\tLine,\n\tLineBasicMaterial,\n\tLineLoop,\n\tLineSegments,\n\tLinearFilter,\n\tLinearMipmapLinearFilter,\n\tLinearMipmapNearestFilter,\n\tLinearSRGBColorSpace,\n\tLoader,\n\tLoaderUtils,\n\tMaterial,\n\tMathUtils,\n\tMatrix4,\n\tMesh,\n\tMeshBasicMaterial,\n\tMeshPhysicalMaterial,\n\tMeshStandardMaterial,\n\tMirroredRepeatWrapping,\n\tNearestFilter,\n\tNearestMipmapLinearFilter,\n\tNearestMipmapNearestFilter,\n\tNumberKeyframeTrack,\n\tObject3D,\n\tOrthographicCamera,\n\tPerspectiveCamera,\n\tPointLight,\n\tPoints,\n\tPointsMaterial,\n\tPropertyBinding,\n\tQuaternion,\n\tQuaternionKeyframeTrack,\n\tRepeatWrapping,\n\tSkeleton,\n\tSkinnedMesh,\n\tSphere,\n\tSpotLight,\n\tTexture,\n\tTextureLoader,\n\tTriangleFanDrawMode,\n\tTriangleStripDrawMode,\n\tVector2,\n\tVector3,\n\tVectorKeyframeTrack,\n\tSRGBColorSpace,\n\tInstancedBufferAttribute\n} from 'three';\nimport { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';\nimport { clone } from '../utils/SkeletonUtils.js';\n\n/**\n * A loader for the glTF 2.0 format.\n *\n * [glTF](https://www.khronos.org/gltf/) (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0)\n * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb)\n * format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver\n * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights,\n * and/or cameras.\n *\n * `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not\n * automatically GC-collected when they are no longer referenced, and they require special handling during\n * the disposal process.\n *\n * `GLTFLoader` supports the following glTF 2.0 extensions:\n * - KHR_draco_mesh_compression\n * - KHR_lights_punctual\n * - KHR_materials_anisotropy\n * - KHR_materials_clearcoat\n * - KHR_materials_dispersion\n * - KHR_materials_emissive_strength\n * - KHR_materials_ior\n * - KHR_materials_specular\n * - KHR_materials_transmission\n * - KHR_materials_iridescence\n * - KHR_materials_unlit\n * - KHR_materials_volume\n * - KHR_mesh_quantization\n * - KHR_meshopt_compression\n * - KHR_texture_basisu\n * - KHR_texture_transform\n * - EXT_materials_bump\n * - EXT_meshopt_compression\n * - EXT_mesh_gpu_instancing\n * - EXT_texture_avif\n * - EXT_texture_webp\n *\n * The following glTF 2.0 extension is supported by an external user plugin:\n * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions)\n * - [MSFT_texture_dds](https://github.com/takahirox/three-gltf-extensions)\n * - [KHR_animation_pointer](https://github.com/needle-tools/three-animation-pointer)\n * - [NEEDLE_progressive](https://github.com/needle-tools/gltf-progressive)\n *\n * ```js\n * const loader = new GLTFLoader();\n *\n * // Optional: Provide a DRACOLoader instance to decode compressed mesh data\n * const dracoLoader = new DRACOLoader();\n * dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' );\n * loader.setDRACOLoader( dracoLoader );\n *\n * const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' );\n * scene.add( gltf.scene );\n * ```\n *\n * @augments Loader\n * @three_import import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';\n */\nclass GLTFLoader extends Loader {\n\n\t/**\n\t * Constructs a new glTF loader.\n\t *\n\t * @param {LoadingManager} [manager] - The loading manager.\n\t */\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.dracoLoader = null;\n\t\tthis.ktx2Loader = null;\n\t\tthis.meshoptDecoder = null;\n\n\t\tthis.pluginCallbacks = [];\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsClearcoatExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsDispersionExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureBasisUExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureWebPExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureAVIFExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsSheenExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsTransmissionExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsVolumeExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsIorExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsEmissiveStrengthExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsSpecularExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsIridescenceExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsAnisotropyExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsBumpExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFLightsExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMeshoptCompression( parser, EXTENSIONS.EXT_MESHOPT_COMPRESSION );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMeshoptCompression( parser, EXTENSIONS.KHR_MESHOPT_COMPRESSION );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMeshGpuInstancing( parser );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Starts loading from the given URL and passes the loaded glTF asset\n\t * to the `onLoad()` callback.\n\t *\n\t * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n\t * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.\n\t * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet resourcePath;\n\n\t\tif ( this.resourcePath !== '' ) {\n\n\t\t\tresourcePath = this.resourcePath;\n\n\t\t} else if ( this.path !== '' ) {\n\n\t\t\t// If a base path is set, resources will be relative paths from that plus the relative path of the gltf file\n\t\t\t// Example path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'\n\t\t\t// resourcePath = 'https://my-cnd-server.com/assets/models/'\n\t\t\t// referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'\n\t\t\t// referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'\n\t\t\tconst relativeUrl = LoaderUtils.extractUrlBase( url );\n\t\t\tresourcePath = LoaderUtils.resolveURL( relativeUrl, this.path );\n\n\t\t} else {\n\n\t\t\tresourcePath = LoaderUtils.extractUrlBase( url );\n\n\t\t}\n\n\t\t// Tells the LoadingManager to track an extra item, which resolves after\n\t\t// the model is fully loaded. This means the count of items loaded will\n\t\t// be incorrect, but ensures manager.onLoad() does not fire early.\n\t\tthis.manager.itemStart( url );\n\n\t\tconst _onError = function ( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t};\n\n\t\tconst loader = new FileLoader( this.manager );\n\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tloader.load( url, function ( data ) {\n\n\t\t\ttry {\n\n\t\t\t\tscope.parse( data, resourcePath, function ( gltf ) {\n\n\t\t\t\t\tonLoad( gltf );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}, _onError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\t_onError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, _onError );\n\n\t}\n\n\t/**\n\t * Sets the given Draco loader to this loader. Required for decoding assets\n\t * compressed with the `KHR_draco_mesh_compression` extension.\n\t *\n\t * @param {DRACOLoader} dracoLoader - The Draco loader to set.\n\t * @return {GLTFLoader} A reference to this loader.\n\t */\n\tsetDRACOLoader( dracoLoader ) {\n\n\t\tthis.dracoLoader = dracoLoader;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given KTX2 loader to this loader. Required for loading KTX2\n\t * compressed textures.\n\t *\n\t * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.\n\t * @return {GLTFLoader} A reference to this loader.\n\t */\n\tsetKTX2Loader( ktx2Loader ) {\n\n\t\tthis.ktx2Loader = ktx2Loader;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the given meshopt decoder. Required for decoding assets\n\t * compressed with the `EXT_meshopt_compression` extension.\n\t *\n\t * @param {Object} meshoptDecoder - The meshopt decoder to set.\n\t * @return {GLTFLoader} A reference to this loader.\n\t */\n\tsetMeshoptDecoder( meshoptDecoder ) {\n\n\t\tthis.meshoptDecoder = meshoptDecoder;\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Registers a plugin callback. This API is internally used to implement the various\n\t * glTF extensions but can also used by third-party code to add additional logic\n\t * to the loader.\n\t *\n\t * @param {function(parser:GLTFParser)} callback - The callback function to register.\n\t * @return {GLTFLoader} A reference to this loader.\n\t */\n\tregister( callback ) {\n\n\t\tif ( this.pluginCallbacks.indexOf( callback ) === - 1 ) {\n\n\t\t\tthis.pluginCallbacks.push( callback );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Unregisters a plugin callback.\n\t *\n\t * @param {Function} callback - The callback function to unregister.\n\t * @return {GLTFLoader} A reference to this loader.\n\t */\n\tunregister( callback ) {\n\n\t\tif ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) {\n\n\t\t\tthis.pluginCallbacks.splice( this.pluginCallbacks.indexOf( callback ), 1 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Parses the given glTF data and returns the resulting group.\n\t *\n\t * @param {string|ArrayBuffer} data - The raw glTF data.\n\t * @param {string} path - The URL base path.\n\t * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.\n\t * @param {onErrorCallback} onError - Executed when errors occur.\n\t */\n\tparse( data, path, onLoad, onError ) {\n\n\t\tlet json;\n\t\tconst extensions = {};\n\t\tconst plugins = {};\n\t\tconst textDecoder = new TextDecoder();\n\n\t\tif ( typeof data === 'string' ) {\n\n\t\t\tjson = JSON.parse( data );\n\n\t\t} else if ( data instanceof ArrayBuffer ) {\n\n\t\t\tconst magic = textDecoder.decode( new Uint8Array( data, 0, 4 ) );\n\n\t\t\tif ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {\n\n\t\t\t\ttry {\n\n\t\t\t\t\textensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );\n\n\t\t\t\t} catch ( error ) {\n\n\t\t\t\t\tif ( onError ) onError( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tjson = JSON.parse( extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content );\n\n\t\t\t} else {\n\n\t\t\t\tjson = JSON.parse( textDecoder.decode( data ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tjson = data;\n\n\t\t}\n\n\t\tif ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {\n\n\t\t\tif ( onError ) onError( new Error( 'THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.' ) );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst parser = new GLTFParser( json, {\n\n\t\t\tpath: path || this.resourcePath || '',\n\t\t\tcrossOrigin: this.crossOrigin,\n\t\t\trequestHeader: this.requestHeader,\n\t\t\tmanager: this.manager,\n\t\t\tktx2Loader: this.ktx2Loader,\n\t\t\tmeshoptDecoder: this.meshoptDecoder\n\n\t\t} );\n\n\t\tparser.fileLoader.setRequestHeader( this.requestHeader );\n\n\t\tfor ( let i = 0; i < this.pluginCallbacks.length; i ++ ) {\n\n\t\t\tconst plugin = this.pluginCallbacks[ i ]( parser );\n\n\t\t\tif ( ! plugin.name ) console.error( 'THREE.GLTFLoader: Invalid plugin found: missing name' );\n\n\t\t\tplugins[ plugin.name ] = plugin;\n\n\t\t\t// Workaround to avoid determining as unknown extension\n\t\t\t// in addUnknownExtensionsToUserData().\n\t\t\t// Remove this workaround if we move all the existing\n\t\t\t// extension handlers to plugin system\n\t\t\textensions[ plugin.name ] = true;\n\n\t\t}\n\n\t\tif ( json.extensionsUsed ) {\n\n\t\t\tfor ( let i = 0; i < json.extensionsUsed.length; ++ i ) {\n\n\t\t\t\tconst extensionName = json.extensionsUsed[ i ];\n\t\t\t\tconst extensionsRequired = json.extensionsRequired || [];\n\n\t\t\t\tswitch ( extensionName ) {\n\n\t\t\t\t\tcase EXTENSIONS.KHR_MATERIALS_UNLIT:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFMaterialsUnlitExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFTextureTransformExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_MESH_QUANTIZATION:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFMeshQuantizationExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( extensionsRequired.indexOf( extensionName ) >= 0 && plugins[ extensionName ] === undefined ) {\n\n\t\t\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tparser.setExtensions( extensions );\n\t\tparser.setPlugins( plugins );\n\t\tparser.parse( onLoad, onError );\n\n\t}\n\n\t/**\n\t * Async version of {@link GLTFLoader#parse}.\n\t *\n\t * @async\n\t * @param {string|ArrayBuffer} data - The raw glTF data.\n\t * @param {string} path - The URL base path.\n\t * @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.\n\t */\n\tparseAsync( data, path ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.parse( data, path, resolve, reject );\n\n\t\t} );\n\n\t}\n\n}\n\n/* GLTFREGISTRY */\n\nfunction GLTFRegistry() {\n\n\tlet objects = {};\n\n\treturn\t{\n\n\t\tget: function ( key ) {\n\n\t\t\treturn objects[ key ];\n\n\t\t},\n\n\t\tadd: function ( key, object ) {\n\n\t\t\tobjects[ key ] = object;\n\n\t\t},\n\n\t\tremove: function ( key ) {\n\n\t\t\tdelete objects[ key ];\n\n\t\t},\n\n\t\tremoveAll: function () {\n\n\t\t\tobjects = {};\n\n\t\t}\n\n\t};\n\n}\n\n/*********************************/\n/********** EXTENSIONS ***********/\n/*********************************/\n\nfunction getMaterialExtension( parser, materialIndex, extensionName ) {\n\n\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\tif ( materialDef.extensions && materialDef.extensions[ extensionName ] ) {\n\n\t\treturn materialDef.extensions[ extensionName ];\n\n\t}\n\n\treturn null;\n\n}\n\nconst EXTENSIONS = {\n\tKHR_BINARY_GLTF: 'KHR_binary_glTF',\n\tKHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',\n\tKHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',\n\tKHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',\n\tKHR_MATERIALS_DISPERSION: 'KHR_materials_dispersion',\n\tKHR_MATERIALS_IOR: 'KHR_materials_ior',\n\tKHR_MATERIALS_SHEEN: 'KHR_materials_sheen',\n\tKHR_MATERIALS_SPECULAR: 'KHR_materials_specular',\n\tKHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',\n\tKHR_MATERIALS_IRIDESCENCE: 'KHR_materials_iridescence',\n\tKHR_MATERIALS_ANISOTROPY: 'KHR_materials_anisotropy',\n\tKHR_MATERIALS_UNLIT: 'KHR_materials_unlit',\n\tKHR_MATERIALS_VOLUME: 'KHR_materials_volume',\n\tKHR_TEXTURE_BASISU: 'KHR_texture_basisu',\n\tKHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',\n\tKHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',\n\tKHR_MATERIALS_EMISSIVE_STRENGTH: 'KHR_materials_emissive_strength',\n\tEXT_MATERIALS_BUMP: 'EXT_materials_bump',\n\tEXT_TEXTURE_WEBP: 'EXT_texture_webp',\n\tEXT_TEXTURE_AVIF: 'EXT_texture_avif',\n\tEXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',\n\tKHR_MESHOPT_COMPRESSION: 'KHR_meshopt_compression',\n\tEXT_MESH_GPU_INSTANCING: 'EXT_mesh_gpu_instancing'\n};\n\n/**\n * Punctual Lights Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n *\n * @private\n */\nclass GLTFLightsExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n\n\t\t// Object3D instance caches\n\t\tthis.cache = { refs: {}, uses: {} };\n\n\t}\n\n\t_markDefs() {\n\n\t\tconst parser = this.parser;\n\t\tconst nodeDefs = this.parser.json.nodes || [];\n\n\t\tfor ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {\n\n\t\t\tconst nodeDef = nodeDefs[ nodeIndex ];\n\n\t\t\tif ( nodeDef.extensions\n\t\t\t\t\t&& nodeDef.extensions[ this.name ]\n\t\t\t\t\t&& nodeDef.extensions[ this.name ].light !== undefined ) {\n\n\t\t\t\tparser._addNodeRef( this.cache, nodeDef.extensions[ this.name ].light );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_loadLight( lightIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst cacheKey = 'light:' + lightIndex;\n\t\tlet dependency = parser.cache.get( cacheKey );\n\n\t\tif ( dependency ) return dependency;\n\n\t\tconst json = parser.json;\n\t\tconst extensions = ( json.extensions && json.extensions[ this.name ] ) || {};\n\t\tconst lightDefs = extensions.lights || [];\n\t\tconst lightDef = lightDefs[ lightIndex ];\n\t\tlet lightNode;\n\n\t\tconst color = new Color( 0xffffff );\n\n\t\tif ( lightDef.color !== undefined ) color.setRGB( lightDef.color[ 0 ], lightDef.color[ 1 ], lightDef.color[ 2 ], LinearSRGBColorSpace );\n\n\t\tconst range = lightDef.range !== undefined ? lightDef.range : 0;\n\n\t\tswitch ( lightDef.type ) {\n\n\t\t\tcase 'directional':\n\t\t\t\tlightNode = new DirectionalLight( color );\n\t\t\t\tlightNode.target.position.set( 0, 0, - 1 );\n\t\t\t\tlightNode.add( lightNode.target );\n\t\t\t\tbreak;\n\n\t\t\tcase 'point':\n\t\t\t\tlightNode = new PointLight( color );\n\t\t\t\tlightNode.distance = range;\n\t\t\t\tbreak;\n\n\t\t\tcase 'spot':\n\t\t\t\tlightNode = new SpotLight( color );\n\t\t\t\tlightNode.distance = range;\n\t\t\t\t// Handle spotlight properties.\n\t\t\t\tlightDef.spot = lightDef.spot || {};\n\t\t\t\tlightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;\n\t\t\t\tlightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;\n\t\t\t\tlightNode.angle = lightDef.spot.outerConeAngle;\n\t\t\t\tlightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n\t\t\t\tlightNode.target.position.set( 0, 0, - 1 );\n\t\t\t\tlightNode.add( lightNode.target );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: Unexpected light type: ' + lightDef.type );\n\n\t\t}\n\n\t\t// Some lights (e.g. spot) default to a position other than the origin. Reset the position\n\t\t// here, because node-level parsing will only override position if explicitly specified.\n\t\tlightNode.position.set( 0, 0, 0 );\n\n\t\tassignExtrasToUserData( lightNode, lightDef );\n\n\t\tif ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;\n\n\t\tlightNode.name = parser.createUniqueName( lightDef.name || ( 'light_' + lightIndex ) );\n\n\t\tdependency = Promise.resolve( lightNode );\n\n\t\tparser.cache.add( cacheKey, dependency );\n\n\t\treturn dependency;\n\n\t}\n\n\tgetDependency( type, index ) {\n\n\t\tif ( type !== 'light' ) return;\n\n\t\treturn this._loadLight( index );\n\n\t}\n\n\tcreateNodeAttachment( nodeIndex ) {\n\n\t\tconst self = this;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\t\tconst lightDef = ( nodeDef.extensions && nodeDef.extensions[ this.name ] ) || {};\n\t\tconst lightIndex = lightDef.light;\n\n\t\tif ( lightIndex === undefined ) return null;\n\n\t\treturn this._loadLight( lightIndex ).then( function ( light ) {\n\n\t\t\treturn parser._getNodeRef( self.cache, lightIndex, light );\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * Unlit Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n *\n * @private\n */\nclass GLTFMaterialsUnlitExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_UNLIT;\n\n\t}\n\n\tgetMaterialType() {\n\n\t\treturn MeshBasicMaterial;\n\n\t}\n\n\textendParams( materialParams, materialDef, parser ) {\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.color = new Color( 1.0, 1.0, 1.0 );\n\t\tmaterialParams.opacity = 1.0;\n\n\t\tconst metallicRoughness = materialDef.pbrMetallicRoughness;\n\n\t\tif ( metallicRoughness ) {\n\n\t\t\tif ( Array.isArray( metallicRoughness.baseColorFactor ) ) {\n\n\t\t\t\tconst array = metallicRoughness.baseColorFactor;\n\n\t\t\t\tmaterialParams.color.setRGB( array[ 0 ], array[ 1 ], array[ 2 ], LinearSRGBColorSpace );\n\t\t\t\tmaterialParams.opacity = array[ 3 ];\n\n\t\t\t}\n\n\t\t\tif ( metallicRoughness.baseColorTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials Emissive Strength Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md\n *\n * @private\n */\nclass GLTFMaterialsEmissiveStrengthExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tif ( extension.emissiveStrength !== undefined ) {\n\n\t\t\tmaterialParams.emissiveIntensity = extension.emissiveStrength;\n\n\t\t}\n\n\t\treturn Promise.resolve();\n\n\t}\n\n}\n\n/**\n * Clearcoat Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat\n *\n * @private\n */\nclass GLTFMaterialsClearcoatExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tif ( extension.clearcoatFactor !== undefined ) {\n\n\t\t\tmaterialParams.clearcoat = extension.clearcoatFactor;\n\n\t\t}\n\n\t\tif ( extension.clearcoatTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'clearcoatMap', extension.clearcoatTexture ) );\n\n\t\t}\n\n\t\tif ( extension.clearcoatRoughnessFactor !== undefined ) {\n\n\t\t\tmaterialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n\n\t\t}\n\n\t\tif ( extension.clearcoatRoughnessTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture ) );\n\n\t\t}\n\n\t\tif ( extension.clearcoatNormalTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture ) );\n\n\t\t\tif ( extension.clearcoatNormalTexture.scale !== undefined ) {\n\n\t\t\t\tconst scale = extension.clearcoatNormalTexture.scale;\n\n\t\t\t\tmaterialParams.clearcoatNormalScale = new Vector2( scale, scale );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials dispersion Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion\n *\n * @private\n */\nclass GLTFMaterialsDispersionExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tmaterialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0;\n\n\t\treturn Promise.resolve();\n\n\t}\n\n}\n\n/**\n * Iridescence Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence\n *\n * @private\n */\nclass GLTFMaterialsIridescenceExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tif ( extension.iridescenceFactor !== undefined ) {\n\n\t\t\tmaterialParams.iridescence = extension.iridescenceFactor;\n\n\t\t}\n\n\t\tif ( extension.iridescenceTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'iridescenceMap', extension.iridescenceTexture ) );\n\n\t\t}\n\n\t\tif ( extension.iridescenceIor !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceIOR = extension.iridescenceIor;\n\n\t\t}\n\n\t\tif ( materialParams.iridescenceThicknessRange === undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange = [ 100, 400 ];\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessMinimum !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange[ 0 ] = extension.iridescenceThicknessMinimum;\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessMaximum !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange[ 1 ] = extension.iridescenceThicknessMaximum;\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Sheen Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen\n *\n * @private\n */\nclass GLTFMaterialsSheenExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_SHEEN;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.sheenColor = new Color( 0, 0, 0 );\n\t\tmaterialParams.sheenRoughness = 0;\n\t\tmaterialParams.sheen = 1;\n\n\t\tif ( extension.sheenColorFactor !== undefined ) {\n\n\t\t\tconst colorFactor = extension.sheenColorFactor;\n\t\t\tmaterialParams.sheenColor.setRGB( colorFactor[ 0 ], colorFactor[ 1 ], colorFactor[ 2 ], LinearSRGBColorSpace );\n\n\t\t}\n\n\t\tif ( extension.sheenRoughnessFactor !== undefined ) {\n\n\t\t\tmaterialParams.sheenRoughness = extension.sheenRoughnessFactor;\n\n\t\t}\n\n\t\tif ( extension.sheenColorTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\tif ( extension.sheenRoughnessTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Transmission Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission\n * Draft: https://github.com/KhronosGroup/glTF/pull/1698\n *\n * @private\n */\nclass GLTFMaterialsTransmissionExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tif ( extension.transmissionFactor !== undefined ) {\n\n\t\t\tmaterialParams.transmission = extension.transmissionFactor;\n\n\t\t}\n\n\t\tif ( extension.transmissionTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'transmissionMap', extension.transmissionTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials Volume Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume\n *\n * @private\n */\nclass GLTFMaterialsVolumeExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_VOLUME;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;\n\n\t\tif ( extension.thicknessTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'thicknessMap', extension.thicknessTexture ) );\n\n\t\t}\n\n\t\tmaterialParams.attenuationDistance = extension.attenuationDistance || Infinity;\n\n\t\tconst colorArray = extension.attenuationColor || [ 1, 1, 1 ];\n\t\tmaterialParams.attenuationColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace );\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials ior Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior\n *\n * @private\n */\nclass GLTFMaterialsIorExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_IOR;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tmaterialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;\n\n\t\tif ( materialParams.ior === 0 ) materialParams.ior = 1000; // see #26167\n\n\t\treturn Promise.resolve();\n\n\t}\n\n}\n\n/**\n * Materials specular Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular\n *\n * @private\n */\nclass GLTFMaterialsSpecularExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;\n\n\t\tif ( extension.specularTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'specularIntensityMap', extension.specularTexture ) );\n\n\t\t}\n\n\t\tconst colorArray = extension.specularColorFactor || [ 1, 1, 1 ];\n\t\tmaterialParams.specularColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace );\n\n\t\tif ( extension.specularColorTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n\n/**\n * Materials bump Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump\n *\n * @private\n */\nclass GLTFMaterialsBumpExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.EXT_MATERIALS_BUMP;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.bumpScale = extension.bumpFactor !== undefined ? extension.bumpFactor : 1.0;\n\n\t\tif ( extension.bumpTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'bumpMap', extension.bumpTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials anisotropy Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy\n *\n * @private\n */\nclass GLTFMaterialsAnisotropyExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\treturn extension !== null ? MeshPhysicalMaterial : null;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst extension = getMaterialExtension( this.parser, materialIndex, this.name );\n\n\t\tif ( extension === null ) return Promise.resolve();\n\n\t\tconst pending = [];\n\n\t\tif ( extension.anisotropyStrength !== undefined ) {\n\n\t\t\tmaterialParams.anisotropy = extension.anisotropyStrength;\n\n\t\t}\n\n\t\tif ( extension.anisotropyRotation !== undefined ) {\n\n\t\t\tmaterialParams.anisotropyRotation = extension.anisotropyRotation;\n\n\t\t}\n\n\t\tif ( extension.anisotropyTexture !== undefined ) {\n\n\t\t\tpending.push( this.parser.assignTexture( materialParams, 'anisotropyMap', extension.anisotropyTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * BasisU Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n *\n * @private\n */\nclass GLTFTextureBasisUExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_TEXTURE_BASISU;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ this.name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ this.name ];\n\t\tconst loader = parser.options.ktx2Loader;\n\n\t\tif ( ! loader ) {\n\n\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {\n\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );\n\n\t\t\t} else {\n\n\t\t\t\t// Assumes that the extension is optional and that a fallback texture is present\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t}\n\n}\n\n/**\n * WebP Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n *\n * @private\n */\nclass GLTFTextureWebPExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.EXT_TEXTURE_WEBP;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst name = this.name;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ name ];\n\t\tconst source = json.images[ extension.source ];\n\n\t\tlet loader = parser.textureLoader;\n\t\tif ( source.uri ) {\n\n\t\t\tconst handler = parser.options.manager.getHandler( source.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t}\n\n}\n\n/**\n * AVIF Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif\n *\n * @private\n */\nclass GLTFTextureAVIFExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.EXT_TEXTURE_AVIF;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst name = this.name;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ name ];\n\t\tconst source = json.images[ extension.source ];\n\n\t\tlet loader = parser.textureLoader;\n\t\tif ( source.uri ) {\n\n\t\t\tconst handler = parser.options.manager.getHandler( source.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t}\n\n}\n\n/**\n * meshopt BufferView Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n *\n * @private\n */\nclass GLTFMeshoptCompression {\n\n\tconstructor( parser, name ) {\n\n\t\tthis.name = name;\n\t\tthis.parser = parser;\n\n\t}\n\n\tloadBufferView( index ) {\n\n\t\tconst json = this.parser.json;\n\t\tconst bufferView = json.bufferViews[ index ];\n\n\t\tif ( bufferView.extensions && bufferView.extensions[ this.name ] ) {\n\n\t\t\tconst extensionDef = bufferView.extensions[ this.name ];\n\n\t\t\tconst buffer = this.parser.getDependency( 'buffer', extensionDef.buffer );\n\t\t\tconst decoder = this.parser.options.meshoptDecoder;\n\n\t\t\tif ( ! decoder || ! decoder.supported ) {\n\n\t\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {\n\n\t\t\t\t\tthrow new Error( 'THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files' );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Assumes that the extension is optional and that fallback buffer data is present\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn buffer.then( function ( res ) {\n\n\t\t\t\tconst byteOffset = extensionDef.byteOffset || 0;\n\t\t\t\tconst byteLength = extensionDef.byteLength || 0;\n\n\t\t\t\tconst count = extensionDef.count;\n\t\t\t\tconst stride = extensionDef.byteStride;\n\n\t\t\t\tconst source = new Uint8Array( res, byteOffset, byteLength );\n\n\t\t\t\tif ( decoder.decodeGltfBufferAsync ) {\n\n\t\t\t\t\treturn decoder.decodeGltfBufferAsync( count, stride, source, extensionDef.mode, extensionDef.filter ).then( function ( res ) {\n\n\t\t\t\t\t\treturn res.buffer;\n\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync\n\t\t\t\t\treturn decoder.ready.then( function () {\n\n\t\t\t\t\t\tconst result = new ArrayBuffer( count * stride );\n\t\t\t\t\t\tdecoder.decodeGltfBuffer( new Uint8Array( result ), count, stride, source, extensionDef.mode, extensionDef.filter );\n\t\t\t\t\t\treturn result;\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * GPU Instancing Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing\n *\n * @private\n */\nclass GLTFMeshGpuInstancing {\n\n\tconstructor( parser ) {\n\n\t\tthis.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;\n\t\tthis.parser = parser;\n\n\t}\n\n\tcreateNodeMesh( nodeIndex ) {\n\n\t\tconst json = this.parser.json;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tif ( ! nodeDef.extensions || ! nodeDef.extensions[ this.name ] ||\n\t\t\tnodeDef.mesh === undefined ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst meshDef = json.meshes[ nodeDef.mesh ];\n\n\t\t// No Points or Lines + Instancing support yet\n\n\t\tfor ( const primitive of meshDef.primitives ) {\n\n\t\t\tif ( primitive.mode !== WEBGL_CONSTANTS.TRIANGLES &&\n\t\t\t\t primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP &&\n\t\t\t\t primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN &&\n\t\t\t\t primitive.mode !== undefined ) {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst extensionDef = nodeDef.extensions[ this.name ];\n\t\tconst attributesDef = extensionDef.attributes;\n\n\t\t// @TODO: Can we support InstancedMesh + SkinnedMesh?\n\n\t\tconst pending = [];\n\t\tconst attributes = {};\n\n\t\tfor ( const key in attributesDef ) {\n\n\t\t\tpending.push( this.parser.getDependency( 'accessor', attributesDef[ key ] ).then( accessor => {\n\n\t\t\t\tattributes[ key ] = accessor;\n\t\t\t\treturn attributes[ key ];\n\n\t\t\t} ) );\n\n\t\t}\n\n\t\tif ( pending.length < 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tpending.push( this.parser.createNodeMesh( nodeIndex ) );\n\n\t\treturn Promise.all( pending ).then( results => {\n\n\t\t\tconst nodeObject = results.pop();\n\t\t\tconst meshes = nodeObject.isGroup ? nodeObject.children : [ nodeObject ];\n\t\t\tconst count = results[ 0 ].count; // All attribute counts should be same\n\t\t\tconst instancedMeshes = [];\n\n\t\t\tfor ( const mesh of meshes ) {\n\n\t\t\t\t// Temporal variables\n\t\t\t\tconst m = new Matrix4();\n\t\t\t\tconst p = new Vector3();\n\t\t\t\tconst q = new Quaternion();\n\t\t\t\tconst s = new Vector3( 1, 1, 1 );\n\n\t\t\t\tconst instancedMesh = new InstancedMesh( mesh.geometry, mesh.material, count );\n\n\t\t\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\t\t\tif ( attributes.TRANSLATION ) {\n\n\t\t\t\t\t\tp.fromBufferAttribute( attributes.TRANSLATION, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attributes.ROTATION ) {\n\n\t\t\t\t\t\tq.fromBufferAttribute( attributes.ROTATION, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attributes.SCALE ) {\n\n\t\t\t\t\t\ts.fromBufferAttribute( attributes.SCALE, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tinstancedMesh.setMatrixAt( i, m.compose( p, q, s ) );\n\n\t\t\t\t}\n\n\t\t\t\t// Add instance attributes to the geometry, excluding TRS.\n\t\t\t\tfor ( const attributeName in attributes ) {\n\n\t\t\t\t\tif ( attributeName === '_COLOR_0' ) {\n\n\t\t\t\t\t\tconst attr = attributes[ attributeName ];\n\t\t\t\t\t\tinstancedMesh.instanceColor = new InstancedBufferAttribute( attr.array, attr.itemSize, attr.normalized );\n\n\t\t\t\t\t} else if ( attributeName !== 'TRANSLATION' &&\n\t\t\t\t\t\t attributeName !== 'ROTATION' &&\n\t\t\t\t\t\t attributeName !== 'SCALE' ) {\n\n\t\t\t\t\t\tmesh.geometry.setAttribute( attributeName, attributes[ attributeName ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// Just in case\n\t\t\t\tObject3D.prototype.copy.call( instancedMesh, mesh );\n\n\t\t\t\tthis.parser.assignFinalMaterial( instancedMesh );\n\n\t\t\t\tinstancedMeshes.push( instancedMesh );\n\n\t\t\t}\n\n\t\t\tif ( nodeObject.isGroup ) {\n\n\t\t\t\tnodeObject.clear();\n\n\t\t\t\tnodeObject.add( ... instancedMeshes );\n\n\t\t\t\treturn nodeObject;\n\n\t\t\t}\n\n\t\t\treturn instancedMeshes[ 0 ];\n\n\t\t} );\n\n\t}\n\n}\n\n/* BINARY EXTENSION */\nconst BINARY_EXTENSION_HEADER_MAGIC = 'glTF';\nconst BINARY_EXTENSION_HEADER_LENGTH = 12;\nconst BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 };\n\nclass GLTFBinaryExtension {\n\n\tconstructor( data ) {\n\n\t\tthis.name = EXTENSIONS.KHR_BINARY_GLTF;\n\t\tthis.content = null;\n\t\tthis.body = null;\n\n\t\tconst headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );\n\t\tconst textDecoder = new TextDecoder();\n\n\t\tthis.header = {\n\t\t\tmagic: textDecoder.decode( new Uint8Array( data.slice( 0, 4 ) ) ),\n\t\t\tversion: headerView.getUint32( 4, true ),\n\t\t\tlength: headerView.getUint32( 8, true )\n\t\t};\n\n\t\tif ( this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Unsupported glTF-Binary header.' );\n\n\t\t} else if ( this.header.version < 2.0 ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Legacy binary file detected.' );\n\n\t\t}\n\n\t\tconst chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;\n\t\tconst chunkView = new DataView( data, BINARY_EXTENSION_HEADER_LENGTH );\n\t\tlet chunkIndex = 0;\n\n\t\twhile ( chunkIndex < chunkContentsLength ) {\n\n\t\t\tconst chunkLength = chunkView.getUint32( chunkIndex, true );\n\t\t\tchunkIndex += 4;\n\n\t\t\tconst chunkType = chunkView.getUint32( chunkIndex, true );\n\t\t\tchunkIndex += 4;\n\n\t\t\tif ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON ) {\n\n\t\t\t\tconst contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength );\n\t\t\t\tthis.content = textDecoder.decode( contentArray );\n\n\t\t\t} else if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN ) {\n\n\t\t\t\tconst byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n\t\t\t\tthis.body = data.slice( byteOffset, byteOffset + chunkLength );\n\n\t\t\t}\n\n\t\t\t// Clients must ignore chunks with unknown types.\n\n\t\t\tchunkIndex += chunkLength;\n\n\t\t}\n\n\t\tif ( this.content === null ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: JSON content not found.' );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * DRACO Mesh Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n *\n * @private\n */\nclass GLTFDracoMeshCompressionExtension {\n\n\tconstructor( json, dracoLoader ) {\n\n\t\tif ( ! dracoLoader ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );\n\n\t\t}\n\n\t\tthis.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n\t\tthis.json = json;\n\t\tthis.dracoLoader = dracoLoader;\n\t\tthis.dracoLoader.preload();\n\n\t}\n\n\tdecodePrimitive( primitive, parser ) {\n\n\t\tconst json = this.json;\n\t\tconst dracoLoader = this.dracoLoader;\n\t\tconst bufferViewIndex = primitive.extensions[ this.name ].bufferView;\n\t\tconst gltfAttributeMap = primitive.extensions[ this.name ].attributes;\n\t\tconst threeAttributeMap = {};\n\t\tconst attributeNormalizedMap = {};\n\t\tconst attributeTypeMap = {};\n\n\t\tfor ( const attributeName in gltfAttributeMap ) {\n\n\t\t\tconst threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();\n\n\t\t\tthreeAttributeMap[ threeAttributeName ] = gltfAttributeMap[ attributeName ];\n\n\t\t}\n\n\t\tfor ( const attributeName in primitive.attributes ) {\n\n\t\t\tconst threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();\n\n\t\t\tif ( gltfAttributeMap[ attributeName ] !== undefined ) {\n\n\t\t\t\tconst accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];\n\t\t\t\tconst componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\n\t\t\t\tattributeTypeMap[ threeAttributeName ] = componentType.name;\n\t\t\t\tattributeNormalizedMap[ threeAttributeName ] = accessorDef.normalized === true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn parser.getDependency( 'bufferView', bufferViewIndex ).then( function ( bufferView ) {\n\n\t\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\t\tdracoLoader.decodeDracoFile( bufferView, function ( geometry ) {\n\n\t\t\t\t\tfor ( const attributeName in geometry.attributes ) {\n\n\t\t\t\t\t\tconst attribute = geometry.attributes[ attributeName ];\n\t\t\t\t\t\tconst normalized = attributeNormalizedMap[ attributeName ];\n\n\t\t\t\t\t\tif ( normalized !== undefined ) attribute.normalized = normalized;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( geometry );\n\n\t\t\t\t}, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace, reject );\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * Texture Transform Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform\n *\n * @private\n */\nclass GLTFTextureTransformExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n\n\t}\n\n\textendTexture( texture, transform ) {\n\n\t\tif ( ( transform.texCoord === undefined || transform.texCoord === texture.channel )\n\t\t\t&& transform.offset === undefined\n\t\t\t&& transform.rotation === undefined\n\t\t\t&& transform.scale === undefined ) {\n\n\t\t\t// See https://github.com/mrdoob/three.js/issues/21819.\n\t\t\treturn texture;\n\n\t\t}\n\n\t\ttexture = texture.clone();\n\n\t\tif ( transform.texCoord !== undefined ) {\n\n\t\t\ttexture.channel = transform.texCoord;\n\n\t\t}\n\n\t\tif ( transform.offset !== undefined ) {\n\n\t\t\ttexture.offset.fromArray( transform.offset );\n\n\t\t}\n\n\t\tif ( transform.rotation !== undefined ) {\n\n\t\t\ttexture.rotation = transform.rotation;\n\n\t\t}\n\n\t\tif ( transform.scale !== undefined ) {\n\n\t\t\ttexture.repeat.fromArray( transform.scale );\n\n\t\t}\n\n\t\ttexture.needsUpdate = true;\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Mesh Quantization Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization\n *\n * @private\n */\nclass GLTFMeshQuantizationExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_MESH_QUANTIZATION;\n\n\t}\n\n}\n\n/*********************************/\n/********** INTERPOLATION ********/\n/*********************************/\n\n// Spline Interpolation\n// Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation\nclass GLTFCubicSplineInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// Copies a sample value to the result buffer. See description of glTF\n\t\t// CUBICSPLINE values layout in interpolate_() function below.\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tvalueSize = this.valueSize,\n\t\t\toffset = index * valueSize * 3 + valueSize;\n\n\t\tfor ( let i = 0; i !== valueSize; i ++ ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer;\n\t\tconst values = this.sampleValues;\n\t\tconst stride = this.valueSize;\n\n\t\tconst stride2 = stride * 2;\n\t\tconst stride3 = stride * 3;\n\n\t\tconst td = t1 - t0;\n\n\t\tconst p = ( t - t0 ) / td;\n\t\tconst pp = p * p;\n\t\tconst ppp = pp * p;\n\n\t\tconst offset1 = i1 * stride3;\n\t\tconst offset0 = offset1 - stride3;\n\n\t\tconst s2 = - 2 * ppp + 3 * pp;\n\t\tconst s3 = ppp - pp;\n\t\tconst s0 = 1 - s2;\n\t\tconst s1 = s3 - pp + p;\n\n\t\t// Layout of keyframe output values for CUBICSPLINE animations:\n\t\t// [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]\n\t\tfor ( let i = 0; i !== stride; i ++ ) {\n\n\t\t\tconst p0 = values[ offset0 + i + stride ]; // splineVertex_k\n\t\t\tconst m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)\n\t\t\tconst p1 = values[ offset1 + i + stride ]; // splineVertex_k+1\n\t\t\tconst m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)\n\n\t\t\tresult[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nconst _quaternion = new Quaternion();\n\nclass GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = super.interpolate_( i1, t0, t, t1 );\n\n\t\t_quaternion.fromArray( result ).normalize().toArray( result );\n\n\t\treturn result;\n\n\t}\n\n}\n\n\n/*********************************/\n/********** INTERNALS ************/\n/*********************************/\n\n/* CONSTANTS */\n\nconst WEBGL_CONSTANTS = {\n\tFLOAT: 5126,\n\t//FLOAT_MAT2: 35674,\n\tFLOAT_MAT3: 35675,\n\tFLOAT_MAT4: 35676,\n\tFLOAT_VEC2: 35664,\n\tFLOAT_VEC3: 35665,\n\tFLOAT_VEC4: 35666,\n\tLINEAR: 9729,\n\tREPEAT: 10497,\n\tSAMPLER_2D: 35678,\n\tPOINTS: 0,\n\tLINES: 1,\n\tLINE_LOOP: 2,\n\tLINE_STRIP: 3,\n\tTRIANGLES: 4,\n\tTRIANGLE_STRIP: 5,\n\tTRIANGLE_FAN: 6,\n\tUNSIGNED_BYTE: 5121,\n\tUNSIGNED_SHORT: 5123\n};\n\nconst WEBGL_COMPONENT_TYPES = {\n\t5120: Int8Array,\n\t5121: Uint8Array,\n\t5122: Int16Array,\n\t5123: Uint16Array,\n\t5125: Uint32Array,\n\t5126: Float32Array\n};\n\nconst WEBGL_FILTERS = {\n\t9728: NearestFilter,\n\t9729: LinearFilter,\n\t9984: NearestMipmapNearestFilter,\n\t9985: LinearMipmapNearestFilter,\n\t9986: NearestMipmapLinearFilter,\n\t9987: LinearMipmapLinearFilter\n};\n\nconst WEBGL_WRAPPINGS = {\n\t33071: ClampToEdgeWrapping,\n\t33648: MirroredRepeatWrapping,\n\t10497: RepeatWrapping\n};\n\nconst WEBGL_TYPE_SIZES = {\n\t'SCALAR': 1,\n\t'VEC2': 2,\n\t'VEC3': 3,\n\t'VEC4': 4,\n\t'MAT2': 4,\n\t'MAT3': 9,\n\t'MAT4': 16\n};\n\nconst ATTRIBUTES = {\n\tPOSITION: 'position',\n\tNORMAL: 'normal',\n\tTANGENT: 'tangent',\n\tTEXCOORD_0: 'uv',\n\tTEXCOORD_1: 'uv1',\n\tTEXCOORD_2: 'uv2',\n\tTEXCOORD_3: 'uv3',\n\tCOLOR_0: 'color',\n\tWEIGHTS_0: 'skinWeight',\n\tJOINTS_0: 'skinIndex',\n};\n\nconst PATH_PROPERTIES = {\n\tscale: 'scale',\n\ttranslation: 'position',\n\trotation: 'quaternion',\n\tweights: 'morphTargetInfluences'\n};\n\nconst INTERPOLATION = {\n\tCUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n\t\t // keyframe track will be initialized with a default interpolation type, then modified.\n\tLINEAR: InterpolateLinear,\n\tSTEP: InterpolateDiscrete\n};\n\nconst ALPHA_MODES = {\n\tOPAQUE: 'OPAQUE',\n\tMASK: 'MASK',\n\tBLEND: 'BLEND'\n};\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material\n *\n * @private\n * @param {Object<string, Material>} cache\n * @return {Material}\n */\nfunction createDefaultMaterial( cache ) {\n\n\tif ( cache[ 'DefaultMaterial' ] === undefined ) {\n\n\t\tcache[ 'DefaultMaterial' ] = new MeshStandardMaterial( {\n\t\t\tcolor: 0xFFFFFF,\n\t\t\temissive: 0x000000,\n\t\t\tmetalness: 1,\n\t\t\troughness: 1,\n\t\t\ttransparent: false,\n\t\t\tdepthTest: true,\n\t\t\tside: FrontSide\n\t\t} );\n\n\t}\n\n\treturn cache[ 'DefaultMaterial' ];\n\n}\n\nfunction addUnknownExtensionsToUserData( knownExtensions, object, objectDef ) {\n\n\t// Add unknown glTF extensions to an object's userData.\n\n\tfor ( const name in objectDef.extensions ) {\n\n\t\tif ( knownExtensions[ name ] === undefined ) {\n\n\t\t\tobject.userData.gltfExtensions = object.userData.gltfExtensions || {};\n\t\t\tobject.userData.gltfExtensions[ name ] = objectDef.extensions[ name ];\n\n\t\t}\n\n\t}\n\n}\n\n/**\n *\n * @private\n * @param {Object3D|Material|BufferGeometry|Object|AnimationClip} object\n * @param {GLTF.definition} gltfDef\n */\nfunction assignExtrasToUserData( object, gltfDef ) {\n\n\tif ( gltfDef.extras !== undefined ) {\n\n\t\tif ( typeof gltfDef.extras === 'object' ) {\n\n\t\t\tObject.assign( object.userData, gltfDef.extras );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets\n *\n * @private\n * @param {BufferGeometry} geometry\n * @param {Array<GLTF.Target>} targets\n * @param {GLTFParser} parser\n * @return {Promise<BufferGeometry>}\n */\nfunction addMorphTargets( geometry, targets, parser ) {\n\n\tlet hasMorphPosition = false;\n\tlet hasMorphNormal = false;\n\tlet hasMorphColor = false;\n\n\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\tconst target = targets[ i ];\n\n\t\tif ( target.POSITION !== undefined ) hasMorphPosition = true;\n\t\tif ( target.NORMAL !== undefined ) hasMorphNormal = true;\n\t\tif ( target.COLOR_0 !== undefined ) hasMorphColor = true;\n\n\t\tif ( hasMorphPosition && hasMorphNormal && hasMorphColor ) break;\n\n\t}\n\n\tif ( ! hasMorphPosition && ! hasMorphNormal && ! hasMorphColor ) return Promise.resolve( geometry );\n\n\tconst pendingPositionAccessors = [];\n\tconst pendingNormalAccessors = [];\n\tconst pendingColorAccessors = [];\n\n\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\tconst target = targets[ i ];\n\n\t\tif ( hasMorphPosition ) {\n\n\t\t\tconst pendingAccessor = target.POSITION !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.POSITION )\n\t\t\t\t: geometry.attributes.position;\n\n\t\t\tpendingPositionAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t\tif ( hasMorphNormal ) {\n\n\t\t\tconst pendingAccessor = target.NORMAL !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.NORMAL )\n\t\t\t\t: geometry.attributes.normal;\n\n\t\t\tpendingNormalAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t\tif ( hasMorphColor ) {\n\n\t\t\tconst pendingAccessor = target.COLOR_0 !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.COLOR_0 )\n\t\t\t\t: geometry.attributes.color;\n\n\t\t\tpendingColorAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t}\n\n\treturn Promise.all( [\n\t\tPromise.all( pendingPositionAccessors ),\n\t\tPromise.all( pendingNormalAccessors ),\n\t\tPromise.all( pendingColorAccessors )\n\t] ).then( function ( accessors ) {\n\n\t\tconst morphPositions = accessors[ 0 ];\n\t\tconst morphNormals = accessors[ 1 ];\n\t\tconst morphColors = accessors[ 2 ];\n\n\t\tif ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;\n\t\tif ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;\n\t\tif ( hasMorphColor ) geometry.morphAttributes.color = morphColors;\n\t\tgeometry.morphTargetsRelative = true;\n\n\t\treturn geometry;\n\n\t} );\n\n}\n\n/**\n *\n * @private\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\nfunction updateMorphTargets( mesh, meshDef ) {\n\n\tmesh.updateMorphTargets();\n\n\tif ( meshDef.weights !== undefined ) {\n\n\t\tfor ( let i = 0, il = meshDef.weights.length; i < il; i ++ ) {\n\n\t\t\tmesh.morphTargetInfluences[ i ] = meshDef.weights[ i ];\n\n\t\t}\n\n\t}\n\n\t// .extras has user-defined data, so check that .extras.targetNames is an array.\n\tif ( meshDef.extras && Array.isArray( meshDef.extras.targetNames ) ) {\n\n\t\tconst targetNames = meshDef.extras.targetNames;\n\n\t\tif ( mesh.morphTargetInfluences.length === targetNames.length ) {\n\n\t\t\tmesh.morphTargetDictionary = {};\n\n\t\t\tfor ( let i = 0, il = targetNames.length; i < il; i ++ ) {\n\n\t\t\t\tmesh.morphTargetDictionary[ targetNames[ i ] ] = i;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.' );\n\n\t\t}\n\n\t}\n\n}\n\nfunction createPrimitiveKey( primitiveDef ) {\n\n\tlet geometryKey;\n\n\tconst dracoExtension = primitiveDef.extensions && primitiveDef.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ];\n\n\tif ( dracoExtension ) {\n\n\t\tgeometryKey = 'draco:' + dracoExtension.bufferView\n\t\t\t\t+ ':' + dracoExtension.indices\n\t\t\t\t+ ':' + createAttributesKey( dracoExtension.attributes );\n\n\t} else {\n\n\t\tgeometryKey = primitiveDef.indices + ':' + createAttributesKey( primitiveDef.attributes ) + ':' + primitiveDef.mode;\n\n\t}\n\n\tif ( primitiveDef.targets !== undefined ) {\n\n\t\tfor ( let i = 0, il = primitiveDef.targets.length; i < il; i ++ ) {\n\n\t\t\tgeometryKey += ':' + createAttributesKey( primitiveDef.targets[ i ] );\n\n\t\t}\n\n\t}\n\n\treturn geometryKey;\n\n}\n\nfunction createAttributesKey( attributes ) {\n\n\tlet attributesKey = '';\n\n\tconst keys = Object.keys( attributes ).sort();\n\n\tfor ( let i = 0, il = keys.length; i < il; i ++ ) {\n\n\t\tattributesKey += keys[ i ] + ':' + attributes[ keys[ i ] ] + ';';\n\n\t}\n\n\treturn attributesKey;\n\n}\n\nfunction getNormalizedComponentScale( constructor ) {\n\n\t// Reference:\n\t// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n\n\tswitch ( constructor ) {\n\n\t\tcase Int8Array:\n\t\t\treturn 1 / 127;\n\n\t\tcase Uint8Array:\n\t\t\treturn 1 / 255;\n\n\t\tcase Int16Array:\n\t\t\treturn 1 / 32767;\n\n\t\tcase Uint16Array:\n\t\t\treturn 1 / 65535;\n\n\t\tdefault:\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Unsupported normalized accessor component type.' );\n\n\t}\n\n}\n\nfunction getImageURIMimeType( uri ) {\n\n\tif ( uri.search( /\\.jpe?g($|\\?)/i ) > 0 || uri.search( /^data\\:image\\/jpeg/ ) === 0 ) return 'image/jpeg';\n\tif ( uri.search( /\\.webp($|\\?)/i ) > 0 || uri.search( /^data\\:image\\/webp/ ) === 0 ) return 'image/webp';\n\tif ( uri.search( /\\.ktx2($|\\?)/i ) > 0 || uri.search( /^data\\:image\\/ktx2/ ) === 0 ) return 'image/ktx2';\n\n\treturn 'image/png';\n\n}\n\nconst _identityMatrix = new Matrix4();\n\n/* GLTF PARSER */\n\nclass GLTFParser {\n\n\tconstructor( json = {}, options = {} ) {\n\n\t\tthis.json = json;\n\t\tthis.extensions = {};\n\t\tthis.plugins = {};\n\t\tthis.options = options;\n\n\t\t// loader object cache\n\t\tthis.cache = new GLTFRegistry();\n\n\t\t// associations between Three.js objects and glTF elements\n\t\tthis.associations = new Map();\n\n\t\t// BufferGeometry caching\n\t\tthis.primitiveCache = {};\n\n\t\t// Node cache\n\t\tthis.nodeCache = {};\n\n\t\t// Object3D instance caches\n\t\tthis.meshCache = { refs: {}, uses: {} };\n\t\tthis.cameraCache = { refs: {}, uses: {} };\n\t\tthis.lightCache = { refs: {}, uses: {} };\n\n\t\tthis.sourceCache = {};\n\t\tthis.textureCache = {};\n\n\t\t// Track node names, to ensure no duplicates\n\t\tthis.nodeNamesUsed = {};\n\n\t\t// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the\n\t\t// expensive work of uploading a texture to the GPU off the main thread.\n\n\t\tlet isSafari = false;\n\t\tlet safariVersion = - 1;\n\t\tlet isFirefox = false;\n\t\tlet firefoxVersion = - 1;\n\n\t\tif ( typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined' ) {\n\n\t\t\tconst userAgent = navigator.userAgent;\n\n\t\t\tisSafari = /^((?!chrome|android).)*safari/i.test( userAgent ) === true;\n\t\t\tconst safariMatch = userAgent.match( /Version\\/(\\d+)/ );\n\t\t\tsafariVersion = isSafari && safariMatch ? parseInt( safariMatch[ 1 ], 10 ) : - 1;\n\n\t\t\tisFirefox = userAgent.indexOf( 'Firefox' ) > - 1;\n\t\t\tfirefoxVersion = isFirefox ? userAgent.match( /Firefox\\/([0-9]+)\\./ )[ 1 ] : - 1;\n\n\t\t}\n\n\t\tif ( typeof createImageBitmap === 'undefined' || ( isSafari && safariVersion < 17 ) || ( isFirefox && firefoxVersion < 98 ) ) {\n\n\t\t\tthis.textureLoader = new TextureLoader( this.options.manager );\n\n\t\t} else {\n\n\t\t\tthis.textureLoader = new ImageBitmapLoader( this.options.manager );\n\n\t\t}\n\n\t\tthis.textureLoader.setCrossOrigin( this.options.crossOrigin );\n\t\tthis.textureLoader.setRequestHeader( this.options.requestHeader );\n\n\t\tthis.fileLoader = new FileLoader( this.options.manager );\n\t\tthis.fileLoader.setResponseType( 'arraybuffer' );\n\n\t\tif ( this.options.crossOrigin === 'use-credentials' ) {\n\n\t\t\tthis.fileLoader.setWithCredentials( true );\n\n\t\t}\n\n\t}\n\n\tsetExtensions( extensions ) {\n\n\t\tthis.extensions = extensions;\n\n\t}\n\n\tsetPlugins( plugins ) {\n\n\t\tthis.plugins = plugins;\n\n\t}\n\n\tparse( onLoad, onError ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\n\t\t// Clear the loader cache\n\t\tthis.cache.removeAll();\n\t\tthis.nodeCache = {};\n\n\t\t// Mark the special nodes/meshes in json for efficient parse\n\t\tthis._invokeAll( function ( ext ) {\n\n\t\t\treturn ext._markDefs && ext._markDefs();\n\n\t\t} );\n\n\t\tPromise.all( this._invokeAll( function ( ext ) {\n\n\t\t\treturn ext.beforeRoot && ext.beforeRoot();\n\n\t\t} ) ).then( function () {\n\n\t\t\treturn Promise.all( [\n\n\t\t\t\tparser.getDependencies( 'scene' ),\n\t\t\t\tparser.getDependencies( 'animation' ),\n\t\t\t\tparser.getDependencies( 'camera' ),\n\n\t\t\t] );\n\n\t\t} ).then( function ( dependencies ) {\n\n\t\t\tconst result = {\n\t\t\t\tscene: dependencies[ 0 ][ json.scene || 0 ],\n\t\t\t\tscenes: dependencies[ 0 ],\n\t\t\t\tanimations: dependencies[ 1 ],\n\t\t\t\tcameras: dependencies[ 2 ],\n\t\t\t\tasset: json.asset,\n\t\t\t\tparser: parser,\n\t\t\t\tuserData: {}\n\t\t\t};\n\n\t\t\taddUnknownExtensionsToUserData( extensions, result, json );\n\n\t\t\tassignExtrasToUserData( result, json );\n\n\t\t\treturn Promise.all( parser._invokeAll( function ( ext ) {\n\n\t\t\t\treturn ext.afterRoot && ext.afterRoot( result );\n\n\t\t\t} ) ).then( function () {\n\n\t\t\t\tfor ( const scene of result.scenes ) {\n\n\t\t\t\t\tscene.updateMatrixWorld();\n\n\t\t\t\t}\n\n\t\t\t\tonLoad( result );\n\n\t\t\t} );\n\n\t\t} ).catch( onError );\n\n\t}\n\n\t/**\n\t * Marks the special nodes/meshes in json for efficient parse.\n\t *\n\t * @private\n\t */\n\t_markDefs() {\n\n\t\tconst nodeDefs = this.json.nodes || [];\n\t\tconst skinDefs = this.json.skins || [];\n\t\tconst meshDefs = this.json.meshes || [];\n\n\t\t// Nothing in the node definition indicates whether it is a Bone or an\n\t\t// Object3D. Use the skins' joint references to mark bones.\n\t\tfor ( let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex ++ ) {\n\n\t\t\tconst joints = skinDefs[ skinIndex ].joints;\n\n\t\t\tfor ( let i = 0, il = joints.length; i < il; i ++ ) {\n\n\t\t\t\tnodeDefs[ joints[ i ] ].isBone = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Iterate over all nodes, marking references to shared resources,\n\t\t// as well as skeleton joints.\n\t\tfor ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {\n\n\t\t\tconst nodeDef = nodeDefs[ nodeIndex ];\n\n\t\t\tif ( nodeDef.mesh !== undefined ) {\n\n\t\t\t\tthis._addNodeRef( this.meshCache, nodeDef.mesh );\n\n\t\t\t\t// Nothing in the mesh definition indicates whether it is\n\t\t\t\t// a SkinnedMesh or Mesh. Use the node's mesh reference\n\t\t\t\t// to mark SkinnedMesh if node has skin.\n\t\t\t\tif ( nodeDef.skin !== undefined ) {\n\n\t\t\t\t\tmeshDefs[ nodeDef.mesh ].isSkinnedMesh = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( nodeDef.camera !== undefined ) {\n\n\t\t\t\tthis._addNodeRef( this.cameraCache, nodeDef.camera );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Counts references to shared node / Object3D resources. These resources\n\t * can be reused, or \"instantiated\", at multiple nodes in the scene\n\t * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n\t * be marked. Non-scenegraph resources (like Materials, Geometries, and\n\t * Textures) can be reused directly and are not marked here.\n\t *\n\t * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n\t *\n\t * @private\n\t * @param {Object} cache\n\t * @param {Object3D} index\n\t */\n\t_addNodeRef( cache, index ) {\n\n\t\tif ( index === undefined ) return;\n\n\t\tif ( cache.refs[ index ] === undefined ) {\n\n\t\t\tcache.refs[ index ] = cache.uses[ index ] = 0;\n\n\t\t}\n\n\t\tcache.refs[ index ] ++;\n\n\t}\n\n\t/**\n\t * Returns a reference to a shared resource, cloning it if necessary.\n\t *\n\t * @private\n\t * @param {Object} cache\n\t * @param {number} index\n\t * @param {Object} object\n\t * @return {Object}\n\t */\n\t_getNodeRef( cache, index, object ) {\n\n\t\tif ( cache.refs[ index ] <= 1 ) return object;\n\n\t\tconst ref = object.clone();\n\n\t\t// Propagates mappings to the cloned object, prevents mappings on the\n\t\t// original object from being lost.\n\t\tconst updateMappings = ( original, clone ) => {\n\n\t\t\tconst mappings = this.associations.get( original );\n\t\t\tif ( mappings != null ) {\n\n\t\t\t\tthis.associations.set( clone, mappings );\n\n\t\t\t}\n\n\t\t\tfor ( const [ i, child ] of original.children.entries() ) {\n\n\t\t\t\tupdateMappings( child, clone.children[ i ] );\n\n\t\t\t}\n\n\t\t};\n\n\t\tupdateMappings( object, ref );\n\n\t\tref.name += '_instance_' + ( cache.uses[ index ] ++ );\n\n\t\treturn ref;\n\n\t}\n\n\t_invokeOne( func ) {\n\n\t\tconst extensions = Object.values( this.plugins );\n\t\textensions.push( this );\n\n\t\tfor ( let i = 0; i < extensions.length; i ++ ) {\n\n\t\t\tconst result = func( extensions[ i ] );\n\n\t\t\tif ( result ) return result;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t_invokeAll( func ) {\n\n\t\tconst extensions = Object.values( this.plugins );\n\t\textensions.unshift( this );\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0; i < extensions.length; i ++ ) {\n\n\t\t\tconst result = func( extensions[ i ] );\n\n\t\t\tif ( result ) pending.push( result );\n\n\t\t}\n\n\t\treturn pending;\n\n\t}\n\n\t/**\n\t * Requests the specified dependency asynchronously, with caching.\n\t *\n\t * @private\n\t * @param {string} type\n\t * @param {number} index\n\t * @return {Promise<Object3D|Material|Texture|AnimationClip|ArrayBuffer|Object>}\n\t */\n\tgetDependency( type, index ) {\n\n\t\tconst cacheKey = type + ':' + index;\n\t\tlet dependency = this.cache.get( cacheKey );\n\n\t\tif ( ! dependency ) {\n\n\t\t\tswitch ( type ) {\n\n\t\t\t\tcase 'scene':\n\t\t\t\t\tdependency = this.loadScene( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'node':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadNode && ext.loadNode( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'mesh':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadMesh && ext.loadMesh( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'accessor':\n\t\t\t\t\tdependency = this.loadAccessor( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bufferView':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadBufferView && ext.loadBufferView( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'buffer':\n\t\t\t\t\tdependency = this.loadBuffer( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'material':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadMaterial && ext.loadMaterial( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'texture':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadTexture && ext.loadTexture( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'skin':\n\t\t\t\t\tdependency = this.loadSkin( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'animation':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadAnimation && ext.loadAnimation( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'camera':\n\t\t\t\t\tdependency = this.loadCamera( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext != this && ext.getDependency && ext.getDependency( type, index );\n\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( ! dependency ) {\n\n\t\t\t\t\t\tthrow new Error( 'Unknown type: ' + type );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tthis.cache.add( cacheKey, dependency );\n\n\t\t}\n\n\t\treturn dependency;\n\n\t}\n\n\t/**\n\t * Requests all dependencies of the specified type asynchronously, with caching.\n\t *\n\t * @private\n\t * @param {string} type\n\t * @return {Promise<Array<Object>>}\n\t */\n\tgetDependencies( type ) {\n\n\t\tlet dependencies = this.cache.get( type );\n\n\t\tif ( ! dependencies ) {\n\n\t\t\tconst parser = this;\n\t\t\tconst defs = this.json[ type + ( type === 'mesh' ? 'es' : 's' ) ] || [];\n\n\t\t\tdependencies = Promise.all( defs.map( function ( def, index ) {\n\n\t\t\t\treturn parser.getDependency( type, index );\n\n\t\t\t} ) );\n\n\t\t\tthis.cache.add( type, dependencies );\n\n\t\t}\n\n\t\treturn dependencies;\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t *\n\t * @private\n\t * @param {number} bufferIndex\n\t * @return {Promise<ArrayBuffer>}\n\t */\n\tloadBuffer( bufferIndex ) {\n\n\t\tconst bufferDef = this.json.buffers[ bufferIndex ];\n\t\tconst loader = this.fileLoader;\n\n\t\tif ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );\n\n\t\t}\n\n\t\t// If present, GLB container is required to be the first buffer.\n\t\tif ( bufferDef.uri === undefined && bufferIndex === 0 ) {\n\n\t\t\treturn Promise.resolve( this.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body );\n\n\t\t}\n\n\t\tconst options = this.options;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tloader.load( LoaderUtils.resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {\n\n\t\t\t\treject( new Error( 'THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".' ) );\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t *\n\t * @private\n\t * @param {number} bufferViewIndex\n\t * @return {Promise<ArrayBuffer>}\n\t */\n\tloadBufferView( bufferViewIndex ) {\n\n\t\tconst bufferViewDef = this.json.bufferViews[ bufferViewIndex ];\n\n\t\treturn this.getDependency( 'buffer', bufferViewDef.buffer ).then( function ( buffer ) {\n\n\t\t\tconst byteLength = bufferViewDef.byteLength || 0;\n\t\t\tconst byteOffset = bufferViewDef.byteOffset || 0;\n\t\t\treturn buffer.slice( byteOffset, byteOffset + byteLength );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n\t *\n\t * @private\n\t * @param {number} accessorIndex\n\t * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}\n\t */\n\tloadAccessor( accessorIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\n\t\tconst accessorDef = this.json.accessors[ accessorIndex ];\n\n\t\tif ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {\n\n\t\t\tconst itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];\n\t\t\tconst TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\t\t\tconst normalized = accessorDef.normalized === true;\n\n\t\t\tconst array = new TypedArray( accessorDef.count * itemSize );\n\t\t\treturn Promise.resolve( new BufferAttribute( array, itemSize, normalized ) );\n\n\t\t}\n\n\t\tconst pendingBufferViews = [];\n\n\t\tif ( accessorDef.bufferView !== undefined ) {\n\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.bufferView ) );\n\n\t\t} else {\n\n\t\t\tpendingBufferViews.push( null );\n\n\t\t}\n\n\t\tif ( accessorDef.sparse !== undefined ) {\n\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.indices.bufferView ) );\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.values.bufferView ) );\n\n\t\t}\n\n\t\treturn Promise.all( pendingBufferViews ).then( function ( bufferViews ) {\n\n\t\t\tconst bufferView = bufferViews[ 0 ];\n\n\t\t\tconst itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];\n\t\t\tconst TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\n\t\t\t// For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.\n\t\t\tconst elementBytes = TypedArray.BYTES_PER_ELEMENT;\n\t\t\tconst itemBytes = elementBytes * itemSize;\n\t\t\tconst byteOffset = accessorDef.byteOffset || 0;\n\t\t\tconst byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[ accessorDef.bufferView ].byteStride : undefined;\n\t\t\tconst normalized = accessorDef.normalized === true;\n\t\t\tlet array, bufferAttribute;\n\n\t\t\t// The buffer is not interleaved if the stride is the item size in bytes.\n\t\t\tif ( byteStride && byteStride !== itemBytes ) {\n\n\t\t\t\t// Each \"slice\" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer\n\t\t\t\t// This makes sure that IBA.count reflects accessor.count properly\n\t\t\t\tconst ibSlice = Math.floor( byteOffset / byteStride );\n\t\t\t\tconst ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;\n\t\t\t\tlet ib = parser.cache.get( ibCacheKey );\n\n\t\t\t\tif ( ! ib ) {\n\n\t\t\t\t\tarray = new TypedArray( bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes );\n\n\t\t\t\t\t// Integer parameters to IB/IBA are in array elements, not bytes.\n\t\t\t\t\tib = new InterleavedBuffer( array, byteStride / elementBytes );\n\n\t\t\t\t\tparser.cache.add( ibCacheKey, ib );\n\n\t\t\t\t}\n\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized );\n\n\t\t\t} else {\n\n\t\t\t\tif ( bufferView === null ) {\n\n\t\t\t\t\tarray = new TypedArray( accessorDef.count * itemSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tarray = new TypedArray( bufferView, byteOffset, accessorDef.count * itemSize );\n\n\t\t\t\t}\n\n\t\t\t\tbufferAttribute = new BufferAttribute( array, itemSize, normalized );\n\n\t\t\t}\n\n\t\t\t// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n\t\t\tif ( accessorDef.sparse !== undefined ) {\n\n\t\t\t\tconst itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;\n\t\t\t\tconst TypedArrayIndices = WEBGL_COMPONENT_TYPES[ accessorDef.sparse.indices.componentType ];\n\n\t\t\t\tconst byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n\t\t\t\tconst byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n\n\t\t\t\tconst sparseIndices = new TypedArrayIndices( bufferViews[ 1 ], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices );\n\t\t\t\tconst sparseValues = new TypedArray( bufferViews[ 2 ], byteOffsetValues, accessorDef.sparse.count * itemSize );\n\n\t\t\t\tif ( bufferView !== null ) {\n\n\t\t\t\t\t// Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n\t\t\t\t\tbufferAttribute = new BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized );\n\n\t\t\t\t}\n\n\t\t\t\t// Ignore normalized since we copy from sparse\n\t\t\t\tbufferAttribute.normalized = false;\n\n\t\t\t\tfor ( let i = 0, il = sparseIndices.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst index = sparseIndices[ i ];\n\n\t\t\t\t\tbufferAttribute.setX( index, sparseValues[ i * itemSize ] );\n\t\t\t\t\tif ( itemSize >= 2 ) bufferAttribute.setY( index, sparseValues[ i * itemSize + 1 ] );\n\t\t\t\t\tif ( itemSize >= 3 ) bufferAttribute.setZ( index, sparseValues[ i * itemSize + 2 ] );\n\t\t\t\t\tif ( itemSize >= 4 ) bufferAttribute.setW( index, sparseValues[ i * itemSize + 3 ] );\n\t\t\t\t\tif ( itemSize >= 5 ) throw new Error( 'THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.' );\n\n\t\t\t\t}\n\n\t\t\t\tbufferAttribute.normalized = normalized;\n\n\t\t\t}\n\n\t\t\treturn bufferAttribute;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n\t *\n\t * @private\n\t * @param {number} textureIndex\n\t * @return {Promise<?Texture>}\n\t */\n\tloadTexture( textureIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst options = this.options;\n\t\tconst textureDef = json.textures[ textureIndex ];\n\t\tconst sourceIndex = textureDef.source;\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tlet loader = this.textureLoader;\n\n\t\tif ( sourceDef.uri ) {\n\n\t\t\tconst handler = options.manager.getHandler( sourceDef.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn this.loadTextureImage( textureIndex, sourceIndex, loader );\n\n\t}\n\n\tloadTextureImage( textureIndex, sourceIndex, loader ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tconst cacheKey = ( sourceDef.uri || sourceDef.bufferView ) + ':' + textureDef.sampler;\n\n\t\tif ( this.textureCache[ cacheKey ] ) {\n\n\t\t\t// See https://github.com/mrdoob/three.js/issues/21559.\n\t\t\treturn this.textureCache[ cacheKey ];\n\n\t\t}\n\n\t\tconst promise = this.loadImageSource( sourceIndex, loader ).then( function ( texture ) {\n\n\t\t\ttexture.flipY = false;\n\n\t\t\ttexture.name = textureDef.name || sourceDef.name || '';\n\n\t\t\tif ( texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith( 'data:image/' ) === false ) {\n\n\t\t\t\ttexture.name = sourceDef.uri;\n\n\t\t\t}\n\n\t\t\tconst samplers = json.samplers || {};\n\t\t\tconst sampler = samplers[ textureDef.sampler ] || {};\n\n\t\t\ttexture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || LinearFilter;\n\t\t\ttexture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || LinearMipmapLinearFilter;\n\t\t\ttexture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || RepeatWrapping;\n\t\t\ttexture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || RepeatWrapping;\n\t\t\ttexture.generateMipmaps = ! texture.isCompressedTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t\t\tparser.associations.set( texture, { textures: textureIndex } );\n\n\t\t\treturn texture;\n\n\t\t} ).catch( function () {\n\n\t\t\treturn null;\n\n\t\t} );\n\n\t\tthis.textureCache[ cacheKey ] = promise;\n\n\t\treturn promise;\n\n\t}\n\n\tloadImageSource( sourceIndex, loader ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst options = this.options;\n\n\t\tif ( this.sourceCache[ sourceIndex ] !== undefined ) {\n\n\t\t\treturn this.sourceCache[ sourceIndex ].then( ( texture ) => texture.clone() );\n\n\t\t}\n\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tconst URL = self.URL || self.webkitURL;\n\n\t\tlet sourceURI = sourceDef.uri || '';\n\t\tlet isObjectURL = false;\n\n\t\tif ( sourceDef.bufferView !== undefined ) {\n\n\t\t\t// Load binary image data from bufferView, if provided.\n\n\t\t\tsourceURI = parser.getDependency( 'bufferView', sourceDef.bufferView ).then( function ( bufferView ) {\n\n\t\t\t\tisObjectURL = true;\n\t\t\t\tconst blob = new Blob( [ bufferView ], { type: sourceDef.mimeType } );\n\t\t\t\tsourceURI = URL.createObjectURL( blob );\n\t\t\t\treturn sourceURI;\n\n\t\t\t} );\n\n\t\t} else if ( sourceDef.uri === undefined ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView' );\n\n\t\t}\n\n\t\tconst promise = Promise.resolve( sourceURI ).then( function ( sourceURI ) {\n\n\t\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\t\tlet onLoad = resolve;\n\n\t\t\t\tif ( loader.isImageBitmapLoader === true ) {\n\n\t\t\t\t\tonLoad = function ( imageBitmap ) {\n\n\t\t\t\t\t\tconst texture = new Texture( imageBitmap );\n\t\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\t\tresolve( texture );\n\n\t\t\t\t\t};\n\n\t\t\t\t}\n\n\t\t\t\tloader.load( LoaderUtils.resolveURL( sourceURI, options.path ), onLoad, undefined, reject );\n\n\t\t\t} );\n\n\t\t} ).then( function ( texture ) {\n\n\t\t\t// Clean up resources and configure Texture.\n\n\t\t\tif ( isObjectURL === true ) {\n\n\t\t\t\tURL.revokeObjectURL( sourceURI );\n\n\t\t\t}\n\n\t\t\tassignExtrasToUserData( texture, sourceDef );\n\n\t\t\ttexture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType( sourceDef.uri );\n\n\t\t\treturn texture;\n\n\t\t} ).catch( function ( error ) {\n\n\t\t\tconsole.error( 'THREE.GLTFLoader: Couldn\\'t load texture', sourceURI );\n\t\t\tthrow error;\n\n\t\t} );\n\n\t\tthis.sourceCache[ sourceIndex ] = promise;\n\t\treturn promise;\n\n\t}\n\n\t/**\n\t * Asynchronously assigns a texture to the given material parameters.\n\t *\n\t * @private\n\t * @param {Object} materialParams\n\t * @param {string} mapName\n\t * @param {Object} mapDef\n\t * @param {string} [colorSpace]\n\t * @return {Promise<Texture>}\n\t */\n\tassignTexture( materialParams, mapName, mapDef, colorSpace ) {\n\n\t\tconst parser = this;\n\n\t\treturn this.getDependency( 'texture', mapDef.index ).then( function ( texture ) {\n\n\t\t\tif ( ! texture ) return null;\n\n\t\t\tif ( mapDef.texCoord !== undefined && mapDef.texCoord > 0 ) {\n\n\t\t\t\ttexture = texture.clone();\n\t\t\t\ttexture.channel = mapDef.texCoord;\n\n\t\t\t}\n\n\t\t\tif ( parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] ) {\n\n\t\t\t\tconst transform = mapDef.extensions !== undefined ? mapDef.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] : undefined;\n\n\t\t\t\tif ( transform ) {\n\n\t\t\t\t\tconst gltfReference = parser.associations.get( texture );\n\t\t\t\t\ttexture = parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ].extendTexture( texture, transform );\n\t\t\t\t\tparser.associations.set( texture, gltfReference );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = colorSpace;\n\n\t\t\t}\n\n\t\t\tmaterialParams[ mapName ] = texture;\n\n\t\t\treturn texture;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Assigns final material to a Mesh, Line, or Points instance. The instance\n\t * already has a material (generated from the glTF material options alone)\n\t * but reuse of the same glTF material may require multiple threejs materials\n\t * to accommodate different primitive types, defines, etc. New materials will\n\t * be created if necessary, and reused from a cache.\n\t *\n\t * @private\n\t * @param {Object3D} mesh Mesh, Line, or Points instance.\n\t */\n\tassignFinalMaterial( mesh ) {\n\n\t\tconst geometry = mesh.geometry;\n\t\tlet material = mesh.material;\n\n\t\tconst useDerivativeTangents = geometry.attributes.tangent === undefined;\n\t\tconst useVertexColors = geometry.attributes.color !== undefined;\n\t\tconst useFlatShading = geometry.attributes.normal === undefined;\n\n\t\tif ( mesh.isPoints ) {\n\n\t\t\tconst cacheKey = 'PointsMaterial:' + material.uuid;\n\n\t\t\tlet pointsMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! pointsMaterial ) {\n\n\t\t\t\tpointsMaterial = new PointsMaterial();\n\t\t\t\tMaterial.prototype.copy.call( pointsMaterial, material );\n\t\t\t\tpointsMaterial.color.copy( material.color );\n\t\t\t\tpointsMaterial.map = material.map;\n\t\t\t\tpointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px\n\n\t\t\t\tthis.cache.add( cacheKey, pointsMaterial );\n\n\t\t\t}\n\n\t\t\tmaterial = pointsMaterial;\n\n\t\t} else if ( mesh.isLine ) {\n\n\t\t\tconst cacheKey = 'LineBasicMaterial:' + material.uuid;\n\n\t\t\tlet lineMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! lineMaterial ) {\n\n\t\t\t\tlineMaterial = new LineBasicMaterial();\n\t\t\t\tMaterial.prototype.copy.call( lineMaterial, material );\n\t\t\t\tlineMaterial.color.copy( material.color );\n\t\t\t\tlineMaterial.map = material.map;\n\n\t\t\t\tthis.cache.add( cacheKey, lineMaterial );\n\n\t\t\t}\n\n\t\t\tmaterial = lineMaterial;\n\n\t\t}\n\n\t\t// Clone the material if it will be modified\n\t\tif ( useDerivativeTangents || useVertexColors || useFlatShading ) {\n\n\t\t\tlet cacheKey = 'ClonedMaterial:' + material.uuid + ':';\n\n\t\t\tif ( useDerivativeTangents ) cacheKey += 'derivative-tangents:';\n\t\t\tif ( useVertexColors ) cacheKey += 'vertex-colors:';\n\t\t\tif ( useFlatShading ) cacheKey += 'flat-shading:';\n\n\t\t\tlet cachedMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! cachedMaterial ) {\n\n\t\t\t\tcachedMaterial = material.clone();\n\n\t\t\t\tif ( useVertexColors ) cachedMaterial.vertexColors = true;\n\t\t\t\tif ( useFlatShading ) cachedMaterial.flatShading = true;\n\n\t\t\t\tif ( useDerivativeTangents ) {\n\n\t\t\t\t\t// https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n\t\t\t\t\tif ( cachedMaterial.normalScale ) cachedMaterial.normalScale.y *= - 1;\n\t\t\t\t\tif ( cachedMaterial.clearcoatNormalScale ) cachedMaterial.clearcoatNormalScale.y *= - 1;\n\n\t\t\t\t}\n\n\t\t\t\tthis.cache.add( cacheKey, cachedMaterial );\n\n\t\t\t\tthis.associations.set( cachedMaterial, this.associations.get( material ) );\n\n\t\t\t}\n\n\t\t\tmaterial = cachedMaterial;\n\n\t\t}\n\n\t\tmesh.material = material;\n\n\t}\n\n\tgetMaterialType( /* materialIndex */ ) {\n\n\t\treturn MeshStandardMaterial;\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n\t *\n\t * @private\n\t * @param {number} materialIndex\n\t * @return {Promise<Material>}\n\t */\n\tloadMaterial( materialIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\t\tconst materialDef = json.materials[ materialIndex ];\n\n\t\tlet materialType;\n\t\tconst materialParams = {};\n\t\tconst materialExtensions = materialDef.extensions || {};\n\n\t\tconst pending = [];\n\n\t\tif ( materialExtensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ] ) {\n\n\t\t\tconst kmuExtension = extensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ];\n\t\t\tmaterialType = kmuExtension.getMaterialType();\n\t\t\tpending.push( kmuExtension.extendParams( materialParams, materialDef, parser ) );\n\n\t\t} else {\n\n\t\t\t// Specification:\n\t\t\t// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material\n\n\t\t\tconst metallicRoughness = materialDef.pbrMetallicRoughness || {};\n\n\t\t\tmaterialParams.color = new Color( 1.0, 1.0, 1.0 );\n\t\t\tmaterialParams.opacity = 1.0;\n\n\t\t\tif ( Array.isArray( metallicRoughness.baseColorFactor ) ) {\n\n\t\t\t\tconst array = metallicRoughness.baseColorFactor;\n\n\t\t\t\tmaterialParams.color.setRGB( array[ 0 ], array[ 1 ], array[ 2 ], LinearSRGBColorSpace );\n\t\t\t\tmaterialParams.opacity = array[ 3 ];\n\n\t\t\t}\n\n\t\t\tif ( metallicRoughness.baseColorTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );\n\n\t\t\t}\n\n\t\t\tmaterialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;\n\t\t\tmaterialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;\n\n\t\t\tif ( metallicRoughness.metallicRoughnessTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture ) );\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture ) );\n\n\t\t\t}\n\n\t\t\tmaterialType = this._invokeOne( function ( ext ) {\n\n\t\t\t\treturn ext.getMaterialType && ext.getMaterialType( materialIndex );\n\n\t\t\t} );\n\n\t\t\tpending.push( Promise.all( this._invokeAll( function ( ext ) {\n\n\t\t\t\treturn ext.extendMaterialParams && ext.extendMaterialParams( materialIndex, materialParams );\n\n\t\t\t} ) ) );\n\n\t\t}\n\n\t\tif ( materialDef.doubleSided === true ) {\n\n\t\t\tmaterialParams.side = DoubleSide;\n\n\t\t}\n\n\t\tconst alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;\n\n\t\tif ( alphaMode === ALPHA_MODES.BLEND ) {\n\n\t\t\tmaterialParams.transparent = true;\n\n\t\t\t// See: https://github.com/mrdoob/three.js/issues/17706\n\t\t\tmaterialParams.depthWrite = false;\n\n\t\t} else {\n\n\t\t\tmaterialParams.transparent = false;\n\n\t\t\tif ( alphaMode === ALPHA_MODES.MASK ) {\n\n\t\t\t\tmaterialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture ) );\n\n\t\t\tmaterialParams.normalScale = new Vector2( 1, 1 );\n\n\t\t\tif ( materialDef.normalTexture.scale !== undefined ) {\n\n\t\t\t\tconst scale = materialDef.normalTexture.scale;\n\n\t\t\t\tmaterialParams.normalScale.set( scale, scale );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture ) );\n\n\t\t\tif ( materialDef.occlusionTexture.strength !== undefined ) {\n\n\t\t\t\tmaterialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tconst emissiveFactor = materialDef.emissiveFactor;\n\t\t\tmaterialParams.emissive = new Color().setRGB( emissiveFactor[ 0 ], emissiveFactor[ 1 ], emissiveFactor[ 2 ], LinearSRGBColorSpace );\n\n\t\t}\n\n\t\tif ( materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function () {\n\n\t\t\tconst material = new materialType( materialParams );\n\n\t\t\tif ( materialDef.name ) material.name = materialDef.name;\n\n\t\t\tassignExtrasToUserData( material, materialDef );\n\n\t\t\tparser.associations.set( material, { materials: materialIndex } );\n\n\t\t\tif ( materialDef.extensions ) addUnknownExtensionsToUserData( extensions, material, materialDef );\n\n\t\t\treturn material;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * When Object3D instances are targeted by animation, they need unique names.\n\t *\n\t * @private\n\t * @param {string} originalName\n\t * @return {string}\n\t */\n\tcreateUniqueName( originalName ) {\n\n\t\tconst sanitizedName = PropertyBinding.sanitizeNodeName( originalName || '' );\n\n\t\tif ( sanitizedName in this.nodeNamesUsed ) {\n\n\t\t\treturn sanitizedName + '_' + ( ++ this.nodeNamesUsed[ sanitizedName ] );\n\n\t\t} else {\n\n\t\t\tthis.nodeNamesUsed[ sanitizedName ] = 0;\n\n\t\t\treturn sanitizedName;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n\t *\n\t * Creates BufferGeometries from primitives.\n\t *\n\t * @private\n\t * @param {Array<GLTF.Primitive>} primitives\n\t * @return {Promise<Array<BufferGeometry>>}\n\t */\n\tloadGeometries( primitives ) {\n\n\t\tconst parser = this;\n\t\tconst extensions = this.extensions;\n\t\tconst cache = this.primitiveCache;\n\n\t\tfunction createDracoPrimitive( primitive ) {\n\n\t\t\treturn extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ]\n\t\t\t\t.decodePrimitive( primitive, parser )\n\t\t\t\t.then( function ( geometry ) {\n\n\t\t\t\t\treturn addPrimitiveAttributes( geometry, primitive, parser );\n\n\t\t\t\t} );\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = primitives.length; i < il; i ++ ) {\n\n\t\t\tconst primitive = primitives[ i ];\n\t\t\tconst cacheKey = createPrimitiveKey( primitive );\n\n\t\t\t// See if we've already created this geometry\n\t\t\tconst cached = cache[ cacheKey ];\n\n\t\t\tif ( cached ) {\n\n\t\t\t\t// Use the cached geometry if it exists\n\t\t\t\tpending.push( cached.promise );\n\n\t\t\t} else {\n\n\t\t\t\tlet geometryPromise;\n\n\t\t\t\tif ( primitive.extensions && primitive.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ] ) {\n\n\t\t\t\t\t// Use DRACO geometry if available\n\t\t\t\t\tgeometryPromise = createDracoPrimitive( primitive );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise create a new geometry\n\t\t\t\t\tgeometryPromise = addPrimitiveAttributes( new BufferGeometry(), primitive, parser );\n\n\t\t\t\t}\n\n\t\t\t\t// Cache this geometry\n\t\t\t\tcache[ cacheKey ] = { primitive: primitive, promise: geometryPromise };\n\n\t\t\t\tpending.push( geometryPromise );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n\t *\n\t * @private\n\t * @param {number} meshIndex\n\t * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}\n\t */\n\tloadMesh( meshIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\n\t\tconst meshDef = json.meshes[ meshIndex ];\n\t\tconst primitives = meshDef.primitives;\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = primitives.length; i < il; i ++ ) {\n\n\t\t\tconst material = primitives[ i ].material === undefined\n\t\t\t\t? createDefaultMaterial( this.cache )\n\t\t\t\t: this.getDependency( 'material', primitives[ i ].material );\n\n\t\t\tpending.push( material );\n\n\t\t}\n\n\t\tpending.push( parser.loadGeometries( primitives ) );\n\n\t\treturn Promise.all( pending ).then( function ( results ) {\n\n\t\t\tconst materials = results.slice( 0, results.length - 1 );\n\t\t\tconst geometries = results[ results.length - 1 ];\n\n\t\t\tconst meshes = [];\n\n\t\t\tfor ( let i = 0, il = geometries.length; i < il; i ++ ) {\n\n\t\t\t\tconst geometry = geometries[ i ];\n\t\t\t\tconst primitive = primitives[ i ];\n\n\t\t\t\t// 1. create Mesh\n\n\t\t\t\tlet mesh;\n\n\t\t\t\tconst material = materials[ i ];\n\n\t\t\t\tif ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||\n\t\t\t\t\t\tprimitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||\n\t\t\t\t\t\tprimitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||\n\t\t\t\t\t\tprimitive.mode === undefined ) {\n\n\t\t\t\t\t// .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n\t\t\t\t\tmesh = meshDef.isSkinnedMesh === true\n\t\t\t\t\t\t? new SkinnedMesh( geometry, material )\n\t\t\t\t\t\t: new Mesh( geometry, material );\n\n\t\t\t\t\tif ( mesh.isSkinnedMesh === true ) {\n\n\t\t\t\t\t\t// normalize skin weights to fix malformed assets (see #15319)\n\t\t\t\t\t\tmesh.normalizeSkinWeights();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ) {\n\n\t\t\t\t\t\tmesh.geometry = toTrianglesDrawMode( mesh.geometry, TriangleStripDrawMode );\n\n\t\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ) {\n\n\t\t\t\t\t\tmesh.geometry = toTrianglesDrawMode( mesh.geometry, TriangleFanDrawMode );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {\n\n\t\t\t\t\tmesh = new LineSegments( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {\n\n\t\t\t\t\tmesh = new Line( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {\n\n\t\t\t\t\tmesh = new LineLoop( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) {\n\n\t\t\t\t\tmesh = new Points( geometry, material );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode );\n\n\t\t\t\t}\n\n\t\t\t\tif ( Object.keys( mesh.geometry.morphAttributes ).length > 0 ) {\n\n\t\t\t\t\tupdateMorphTargets( mesh, meshDef );\n\n\t\t\t\t}\n\n\t\t\t\tmesh.name = parser.createUniqueName( meshDef.name || ( 'mesh_' + meshIndex ) );\n\n\t\t\t\tassignExtrasToUserData( mesh, meshDef );\n\n\t\t\t\tif ( primitive.extensions ) addUnknownExtensionsToUserData( extensions, mesh, primitive );\n\n\t\t\t\tparser.assignFinalMaterial( mesh );\n\n\t\t\t\tmeshes.push( mesh );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, il = meshes.length; i < il; i ++ ) {\n\n\t\t\t\tparser.associations.set( meshes[ i ], {\n\t\t\t\t\tmeshes: meshIndex,\n\t\t\t\t\tprimitives: i\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tif ( meshes.length === 1 ) {\n\n\t\t\t\tif ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, meshes[ 0 ], meshDef );\n\n\t\t\t\treturn meshes[ 0 ];\n\n\t\t\t}\n\n\t\t\tconst group = new Group();\n\n\t\t\tif ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, group, meshDef );\n\n\t\t\tparser.associations.set( group, { meshes: meshIndex } );\n\n\t\t\tfor ( let i = 0, il = meshes.length; i < il; i ++ ) {\n\n\t\t\t\tgroup.add( meshes[ i ] );\n\n\t\t\t}\n\n\t\t\treturn group;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n\t *\n\t * @private\n\t * @param {number} cameraIndex\n\t * @return {Promise<Camera>|undefined}\n\t */\n\tloadCamera( cameraIndex ) {\n\n\t\tlet camera;\n\t\tconst cameraDef = this.json.cameras[ cameraIndex ];\n\t\tconst params = cameraDef[ cameraDef.type ];\n\n\t\tif ( ! params ) {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing camera parameters.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( cameraDef.type === 'perspective' ) {\n\n\t\t\tcamera = new PerspectiveCamera( MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );\n\n\t\t} else if ( cameraDef.type === 'orthographic' ) {\n\n\t\t\tcamera = new OrthographicCamera( - params.xmag, params.xmag, params.ymag, - params.ymag, params.znear, params.zfar );\n\n\t\t}\n\n\t\tif ( cameraDef.name ) camera.name = this.createUniqueName( cameraDef.name );\n\n\t\tassignExtrasToUserData( camera, cameraDef );\n\n\t\treturn Promise.resolve( camera );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n\t *\n\t * @private\n\t * @param {number} skinIndex\n\t * @return {Promise<Skeleton>}\n\t */\n\tloadSkin( skinIndex ) {\n\n\t\tconst skinDef = this.json.skins[ skinIndex ];\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = skinDef.joints.length; i < il; i ++ ) {\n\n\t\t\tpending.push( this._loadNodeShallow( skinDef.joints[ i ] ) );\n\n\t\t}\n\n\t\tif ( skinDef.inverseBindMatrices !== undefined ) {\n\n\t\t\tpending.push( this.getDependency( 'accessor', skinDef.inverseBindMatrices ) );\n\n\t\t} else {\n\n\t\t\tpending.push( null );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function ( results ) {\n\n\t\t\tconst inverseBindMatrices = results.pop();\n\t\t\tconst jointNodes = results;\n\n\t\t\t// Note that bones (joint nodes) may or may not be in the\n\t\t\t// scene graph at this time.\n\n\t\t\tconst bones = [];\n\t\t\tconst boneInverses = [];\n\n\t\t\tfor ( let i = 0, il = jointNodes.length; i < il; i ++ ) {\n\n\t\t\t\tconst jointNode = jointNodes[ i ];\n\n\t\t\t\tif ( jointNode ) {\n\n\t\t\t\t\tbones.push( jointNode );\n\n\t\t\t\t\tconst mat = new Matrix4();\n\n\t\t\t\t\tif ( inverseBindMatrices !== null ) {\n\n\t\t\t\t\t\tmat.fromArray( inverseBindMatrices.array, i * 16 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tboneInverses.push( mat );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new Skeleton( bones, boneInverses );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n\t *\n\t * @private\n\t * @param {number} animationIndex\n\t * @return {Promise<AnimationClip>}\n\t */\n\tloadAnimation( animationIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\n\t\tconst animationDef = json.animations[ animationIndex ];\n\t\tconst animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex;\n\n\t\tconst pendingNodes = [];\n\t\tconst pendingInputAccessors = [];\n\t\tconst pendingOutputAccessors = [];\n\t\tconst pendingSamplers = [];\n\t\tconst pendingTargets = [];\n\n\t\tfor ( let i = 0, il = animationDef.channels.length; i < il; i ++ ) {\n\n\t\t\tconst channel = animationDef.channels[ i ];\n\t\t\tconst sampler = animationDef.samplers[ channel.sampler ];\n\t\t\tconst target = channel.target;\n\t\t\tconst name = target.node;\n\t\t\tconst input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input;\n\t\t\tconst output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output;\n\n\t\t\tif ( target.node === undefined ) continue;\n\n\t\t\tpendingNodes.push( this.getDependency( 'node', name ) );\n\t\t\tpendingInputAccessors.push( this.getDependency( 'accessor', input ) );\n\t\t\tpendingOutputAccessors.push( this.getDependency( 'accessor', output ) );\n\t\t\tpendingSamplers.push( sampler );\n\t\t\tpendingTargets.push( target );\n\n\t\t}\n\n\t\treturn Promise.all( [\n\n\t\t\tPromise.all( pendingNodes ),\n\t\t\tPromise.all( pendingInputAccessors ),\n\t\t\tPromise.all( pendingOutputAccessors ),\n\t\t\tPromise.all( pendingSamplers ),\n\t\t\tPromise.all( pendingTargets )\n\n\t\t] ).then( function ( dependencies ) {\n\n\t\t\tconst nodes = dependencies[ 0 ];\n\t\t\tconst inputAccessors = dependencies[ 1 ];\n\t\t\tconst outputAccessors = dependencies[ 2 ];\n\t\t\tconst samplers = dependencies[ 3 ];\n\t\t\tconst targets = dependencies[ 4 ];\n\n\t\t\tconst tracks = [];\n\n\t\t\tfor ( let i = 0, il = nodes.length; i < il; i ++ ) {\n\n\t\t\t\tconst node = nodes[ i ];\n\t\t\t\tconst inputAccessor = inputAccessors[ i ];\n\t\t\t\tconst outputAccessor = outputAccessors[ i ];\n\t\t\t\tconst sampler = samplers[ i ];\n\t\t\t\tconst target = targets[ i ];\n\n\t\t\t\tif ( node === undefined ) continue;\n\n\t\t\t\tif ( node.updateMatrix ) {\n\n\t\t\t\t\tnode.updateMatrix();\n\n\t\t\t\t}\n\n\t\t\t\tconst createdTracks = parser._createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target );\n\n\t\t\t\tif ( createdTracks ) {\n\n\t\t\t\t\tfor ( let k = 0; k < createdTracks.length; k ++ ) {\n\n\t\t\t\t\t\ttracks.push( createdTracks[ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst animation = new AnimationClip( animationName, undefined, tracks );\n\n\t\t\tassignExtrasToUserData( animation, animationDef );\n\n\t\t\treturn animation;\n\n\t\t} );\n\n\t}\n\n\tcreateNodeMesh( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tif ( nodeDef.mesh === undefined ) return null;\n\n\t\treturn parser.getDependency( 'mesh', nodeDef.mesh ).then( function ( mesh ) {\n\n\t\t\tconst node = parser._getNodeRef( parser.meshCache, nodeDef.mesh, mesh );\n\n\t\t\t// if weights are provided on the node, override weights on the mesh.\n\t\t\tif ( nodeDef.weights !== undefined ) {\n\n\t\t\t\tnode.traverse( function ( o ) {\n\n\t\t\t\t\tif ( ! o.isMesh ) return;\n\n\t\t\t\t\tfor ( let i = 0, il = nodeDef.weights.length; i < il; i ++ ) {\n\n\t\t\t\t\t\to.morphTargetInfluences[ i ] = nodeDef.weights[ i ];\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n\t *\n\t * @private\n\t * @param {number} nodeIndex\n\t * @return {Promise<Object3D>}\n\t */\n\tloadNode( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tconst nodePending = parser._loadNodeShallow( nodeIndex );\n\n\t\tconst childPending = [];\n\t\tconst childrenDef = nodeDef.children || [];\n\n\t\tfor ( let i = 0, il = childrenDef.length; i < il; i ++ ) {\n\n\t\t\tchildPending.push( parser.getDependency( 'node', childrenDef[ i ] ) );\n\n\t\t}\n\n\t\tconst skeletonPending = nodeDef.skin === undefined\n\t\t\t? Promise.resolve( null )\n\t\t\t: parser.getDependency( 'skin', nodeDef.skin );\n\n\t\treturn Promise.all( [\n\t\t\tnodePending,\n\t\t\tPromise.all( childPending ),\n\t\t\tskeletonPending\n\t\t] ).then( function ( results ) {\n\n\t\t\tconst node = results[ 0 ];\n\t\t\tconst children = results[ 1 ];\n\t\t\tconst skeleton = results[ 2 ];\n\n\t\t\tif ( skeleton !== null ) {\n\n\t\t\t\t// This full traverse should be fine because\n\t\t\t\t// child glTF nodes have not been added to this node yet.\n\t\t\t\tnode.traverse( function ( mesh ) {\n\n\t\t\t\t\tif ( ! mesh.isSkinnedMesh ) return;\n\n\t\t\t\t\tmesh.bind( skeleton, _identityMatrix );\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, il = children.length; i < il; i ++ ) {\n\n\t\t\t\tnode.add( children[ i ] );\n\n\t\t\t}\n\n\t\t\t// Reconstruct pivot from container pattern created by GLTFExporter\n\t\t\t// The container has position+pivot, rotation, scale; child has -pivot offset and mesh\n\t\t\tif ( node.userData.pivot !== undefined && children.length > 0 ) {\n\n\t\t\t\tconst pivot = node.userData.pivot;\n\t\t\t\tconst pivotChild = children[ 0 ];\n\n\t\t\t\t// Set pivot on container and adjust transforms\n\t\t\t\tnode.pivot = new Vector3().fromArray( pivot );\n\n\t\t\t\t// Adjust container position: stored as position + pivot, so subtract pivot\n\t\t\t\tnode.position.x -= pivot[ 0 ];\n\t\t\t\tnode.position.y -= pivot[ 1 ];\n\t\t\t\tnode.position.z -= pivot[ 2 ];\n\n\t\t\t\t// Remove the child's -pivot offset since pivot now handles it\n\t\t\t\tpivotChild.position.set( 0, 0, 0 );\n\n\t\t\t\tdelete node.userData.pivot;\n\n\t\t\t}\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t}\n\n\t// ._loadNodeShallow() parses a single node.\n\t// skin and child nodes are created and added in .loadNode() (no '_' prefix).\n\t_loadNodeShallow( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\t\tconst parser = this;\n\n\t\t// This method is called from .loadNode() and .loadSkin().\n\t\t// Cache a node to avoid duplication.\n\n\t\tif ( this.nodeCache[ nodeIndex ] !== undefined ) {\n\n\t\t\treturn this.nodeCache[ nodeIndex ];\n\n\t\t}\n\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\t// reserve node's name before its dependencies, so the root has the intended name.\n\t\tconst nodeName = nodeDef.name ? parser.createUniqueName( nodeDef.name ) : '';\n\n\t\tconst pending = [];\n\n\t\tconst meshPromise = parser._invokeOne( function ( ext ) {\n\n\t\t\treturn ext.createNodeMesh && ext.createNodeMesh( nodeIndex );\n\n\t\t} );\n\n\t\tif ( meshPromise ) {\n\n\t\t\tpending.push( meshPromise );\n\n\t\t}\n\n\t\tif ( nodeDef.camera !== undefined ) {\n\n\t\t\tpending.push( parser.getDependency( 'camera', nodeDef.camera ).then( function ( camera ) {\n\n\t\t\t\treturn parser._getNodeRef( parser.cameraCache, nodeDef.camera, camera );\n\n\t\t\t} ) );\n\n\t\t}\n\n\t\tparser._invokeAll( function ( ext ) {\n\n\t\t\treturn ext.createNodeAttachment && ext.createNodeAttachment( nodeIndex );\n\n\t\t} ).forEach( function ( promise ) {\n\n\t\t\tpending.push( promise );\n\n\t\t} );\n\n\t\tthis.nodeCache[ nodeIndex ] = Promise.all( pending ).then( function ( objects ) {\n\n\t\t\tlet node;\n\n\t\t\t// .isBone isn't in glTF spec. See ._markDefs\n\t\t\tif ( nodeDef.isBone === true ) {\n\n\t\t\t\tnode = new Bone();\n\n\t\t\t} else if ( objects.length > 1 ) {\n\n\t\t\t\tnode = new Group();\n\n\t\t\t} else if ( objects.length === 1 ) {\n\n\t\t\t\tnode = objects[ 0 ];\n\n\t\t\t} else {\n\n\t\t\t\tnode = new Object3D();\n\n\t\t\t}\n\n\t\t\tif ( node !== objects[ 0 ] ) {\n\n\t\t\t\tfor ( let i = 0, il = objects.length; i < il; i ++ ) {\n\n\t\t\t\t\tnode.add( objects[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( nodeDef.name ) {\n\n\t\t\t\tnode.userData.name = nodeDef.name;\n\t\t\t\tnode.name = nodeName;\n\n\t\t\t}\n\n\t\t\tassignExtrasToUserData( node, nodeDef );\n\n\t\t\tif ( nodeDef.extensions ) addUnknownExtensionsToUserData( extensions, node, nodeDef );\n\n\t\t\tif ( nodeDef.matrix !== undefined ) {\n\n\t\t\t\tconst matrix = new Matrix4();\n\t\t\t\tmatrix.fromArray( nodeDef.matrix );\n\t\t\t\tnode.applyMatrix4( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tif ( nodeDef.translation !== undefined ) {\n\n\t\t\t\t\tnode.position.fromArray( nodeDef.translation );\n\n\t\t\t\t}\n\n\t\t\t\tif ( nodeDef.rotation !== undefined ) {\n\n\t\t\t\t\tnode.quaternion.fromArray( nodeDef.rotation );\n\n\t\t\t\t}\n\n\t\t\t\tif ( nodeDef.scale !== undefined ) {\n\n\t\t\t\t\tnode.scale.fromArray( nodeDef.scale );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ! parser.associations.has( node ) ) {\n\n\t\t\t\tparser.associations.set( node, {} );\n\n\t\t\t} else if ( nodeDef.mesh !== undefined && parser.meshCache.refs[ nodeDef.mesh ] > 1 ) {\n\n\t\t\t\tconst mapping = parser.associations.get( node );\n\t\t\t\tparser.associations.set( node, { ...mapping } );\n\n\t\t\t}\n\n\t\t\tparser.associations.get( node ).nodes = nodeIndex;\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t\treturn this.nodeCache[ nodeIndex ];\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n\t *\n\t * @private\n\t * @param {number} sceneIndex\n\t * @return {Promise<Group>}\n\t */\n\tloadScene( sceneIndex ) {\n\n\t\tconst extensions = this.extensions;\n\t\tconst sceneDef = this.json.scenes[ sceneIndex ];\n\t\tconst parser = this;\n\n\t\t// Loader returns Group, not Scene.\n\t\t// See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n\t\tconst scene = new Group();\n\t\tif ( sceneDef.name ) scene.name = parser.createUniqueName( sceneDef.name );\n\n\t\tassignExtrasToUserData( scene, sceneDef );\n\n\t\tif ( sceneDef.extensions ) addUnknownExtensionsToUserData( extensions, scene, sceneDef );\n\n\t\tconst nodeIds = sceneDef.nodes || [];\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = nodeIds.length; i < il; i ++ ) {\n\n\t\t\tpending.push( parser.getDependency( 'node', nodeIds[ i ] ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function ( nodes ) {\n\n\t\t\tfor ( let i = 0, il = nodes.length; i < il; i ++ ) {\n\n\t\t\t\tconst node = nodes[ i ];\n\n\t\t\t\t// If the node already has a parent, it means it's being reused across multiple scenes.\n\t\t\t\t// Clone it to avoid the second scene's add() removing it from the first scene.\n\t\t\t\t// See: https://github.com/mrdoob/three.js/issues/27993\n\t\t\t\tif ( node.parent !== null ) {\n\n\t\t\t\t\tscene.add( clone( node ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tscene.add( node );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Removes dangling associations, associations that reference a node that\n\t\t\t// didn't make it into the scene.\n\t\t\tconst reduceAssociations = ( node ) => {\n\n\t\t\t\tconst reducedAssociations = new Map();\n\n\t\t\t\tfor ( const [ key, value ] of parser.associations ) {\n\n\t\t\t\t\tif ( key instanceof Material || key instanceof Texture ) {\n\n\t\t\t\t\t\treducedAssociations.set( key, value );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tnode.traverse( ( node ) => {\n\n\t\t\t\t\tconst mappings = parser.associations.get( node );\n\n\t\t\t\t\tif ( mappings != null ) {\n\n\t\t\t\t\t\treducedAssociations.set( node, mappings );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\treturn reducedAssociations;\n\n\t\t\t};\n\n\t\t\tparser.associations = reduceAssociations( scene );\n\n\t\t\treturn scene;\n\n\t\t} );\n\n\t}\n\n\t_createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target ) {\n\n\t\tconst tracks = [];\n\n\t\tconst targetName = node.name ? node.name : node.uuid;\n\t\tconst targetNames = [];\n\n\t\tfunction collectMorphTargets( object ) {\n\n\t\t\tif ( object.morphTargetInfluences ) {\n\n\t\t\t\ttargetNames.push( object.name ? object.name : object.uuid );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tif ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {\n\n\t\t\tcollectMorphTargets( node );\n\n\t\t\t// for multi-primitive meshes, the node is a Group containing the sub-meshes\n\n\t\t\tif ( node.isGroup ) {\n\n\t\t\t\tnode.children.forEach( collectMorphTargets );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\ttargetNames.push( targetName );\n\n\t\t}\n\n\t\tlet TypedKeyframeTrack;\n\n\t\tswitch ( PATH_PROPERTIES[ target.path ] ) {\n\n\t\t\tcase PATH_PROPERTIES.weights:\n\n\t\t\t\tTypedKeyframeTrack = NumberKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tcase PATH_PROPERTIES.rotation:\n\n\t\t\t\tTypedKeyframeTrack = QuaternionKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tcase PATH_PROPERTIES.translation:\n\t\t\tcase PATH_PROPERTIES.scale:\n\n\t\t\t\tTypedKeyframeTrack = VectorKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tswitch ( outputAccessor.itemSize ) {\n\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tTypedKeyframeTrack = NumberKeyframeTrack;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\tcase 3:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tTypedKeyframeTrack = VectorKeyframeTrack;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tconst interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;\n\n\n\t\tconst outputArray = this._getArrayFromAccessor( outputAccessor );\n\n\t\tfor ( let j = 0, jl = targetNames.length; j < jl; j ++ ) {\n\n\t\t\tconst track = new TypedKeyframeTrack(\n\t\t\t\ttargetNames[ j ] + '.' + PATH_PROPERTIES[ target.path ],\n\t\t\t\tinputAccessor.array,\n\t\t\t\toutputArray,\n\t\t\t\tinterpolation\n\t\t\t);\n\n\t\t\t// Override interpolation with custom factory method.\n\t\t\tif ( sampler.interpolation === 'CUBICSPLINE' ) {\n\n\t\t\t\tthis._createCubicSplineTrackInterpolant( track );\n\n\t\t\t}\n\n\t\t\ttracks.push( track );\n\n\t\t}\n\n\t\treturn tracks;\n\n\t}\n\n\t_getArrayFromAccessor( accessor ) {\n\n\t\tlet outputArray = accessor.array;\n\n\t\tif ( accessor.normalized ) {\n\n\t\t\tconst scale = getNormalizedComponentScale( outputArray.constructor );\n\t\t\tconst scaled = new Float32Array( outputArray.length );\n\n\t\t\tfor ( let j = 0, jl = outputArray.length; j < jl; j ++ ) {\n\n\t\t\t\tscaled[ j ] = outputArray[ j ] * scale;\n\n\t\t\t}\n\n\t\t\toutputArray = scaled;\n\n\t\t}\n\n\t\treturn outputArray;\n\n\t}\n\n\t_createCubicSplineTrackInterpolant( track ) {\n\n\t\ttrack.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline( result ) {\n\n\t\t\t// A CUBICSPLINE keyframe in glTF has three output values for each input value,\n\t\t\t// representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()\n\t\t\t// must be divided by three to get the interpolant's sampleSize argument.\n\n\t\t\tconst interpolantType = ( this instanceof QuaternionKeyframeTrack ) ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;\n\n\t\t\treturn new interpolantType( this.times, this.values, this.getValueSize() / 3, result );\n\n\t\t};\n\n\t\t// Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n\t\ttrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;\n\n\t}\n\n}\n\n/**\n *\n * @private\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\nfunction computeBounds( geometry, primitiveDef, parser ) {\n\n\tconst attributes = primitiveDef.attributes;\n\n\tconst box = new Box3();\n\n\tif ( attributes.POSITION !== undefined ) {\n\n\t\tconst accessor = parser.json.accessors[ attributes.POSITION ];\n\n\t\tconst min = accessor.min;\n\t\tconst max = accessor.max;\n\n\t\t// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n\t\tif ( min !== undefined && max !== undefined ) {\n\n\t\t\tbox.set(\n\t\t\t\tnew Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),\n\t\t\t\tnew Vector3( max[ 0 ], max[ 1 ], max[ 2 ] )\n\t\t\t);\n\n\t\t\tif ( accessor.normalized ) {\n\n\t\t\t\tconst boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );\n\t\t\t\tbox.min.multiplyScalar( boxScale );\n\t\t\t\tbox.max.multiplyScalar( boxScale );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );\n\n\t\t\treturn;\n\n\t\t}\n\n\t} else {\n\n\t\treturn;\n\n\t}\n\n\tconst targets = primitiveDef.targets;\n\n\tif ( targets !== undefined ) {\n\n\t\tconst maxDisplacement = new Vector3();\n\t\tconst vector = new Vector3();\n\n\t\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\t\tconst target = targets[ i ];\n\n\t\t\tif ( target.POSITION !== undefined ) {\n\n\t\t\t\tconst accessor = parser.json.accessors[ target.POSITION ];\n\t\t\t\tconst min = accessor.min;\n\t\t\t\tconst max = accessor.max;\n\n\t\t\t\t// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n\t\t\t\tif ( min !== undefined && max !== undefined ) {\n\n\t\t\t\t\t// we need to get max of absolute components because target weight is [-1,1]\n\t\t\t\t\tvector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );\n\t\t\t\t\tvector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );\n\t\t\t\t\tvector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );\n\n\n\t\t\t\t\tif ( accessor.normalized ) {\n\n\t\t\t\t\t\tconst boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );\n\t\t\t\t\t\tvector.multiplyScalar( boxScale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative\n\t\t\t\t\t// to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets\n\t\t\t\t\t// are used to implement key-frame animations and as such only two are active at a time - this results in very large\n\t\t\t\t\t// boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.\n\t\t\t\t\tmaxDisplacement.max( vector );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.\n\t\tbox.expandByVector( maxDisplacement );\n\n\t}\n\n\tgeometry.boundingBox = box;\n\n\tconst sphere = new Sphere();\n\n\tbox.getCenter( sphere.center );\n\tsphere.radius = box.min.distanceTo( box.max ) / 2;\n\n\tgeometry.boundingSphere = sphere;\n\n}\n\n/**\n *\n * @private\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n * @return {Promise<BufferGeometry>}\n */\nfunction addPrimitiveAttributes( geometry, primitiveDef, parser ) {\n\n\tconst attributes = primitiveDef.attributes;\n\n\tconst pending = [];\n\n\tfunction assignAttributeAccessor( accessorIndex, attributeName ) {\n\n\t\treturn parser.getDependency( 'accessor', accessorIndex )\n\t\t\t.then( function ( accessor ) {\n\n\t\t\t\tgeometry.setAttribute( attributeName, accessor );\n\n\t\t\t} );\n\n\t}\n\n\tfor ( const gltfAttributeName in attributes ) {\n\n\t\tconst threeAttributeName = ATTRIBUTES[ gltfAttributeName ] || gltfAttributeName.toLowerCase();\n\n\t\t// Skip attributes already provided by e.g. Draco extension.\n\t\tif ( threeAttributeName in geometry.attributes ) continue;\n\n\t\tpending.push( assignAttributeAccessor( attributes[ gltfAttributeName ], threeAttributeName ) );\n\n\t}\n\n\tif ( primitiveDef.indices !== undefined && ! geometry.index ) {\n\n\t\tconst accessor = parser.getDependency( 'accessor', primitiveDef.indices ).then( function ( accessor ) {\n\n\t\t\tgeometry.setIndex( accessor );\n\n\t\t} );\n\n\t\tpending.push( accessor );\n\n\t}\n\n\tif ( ColorManagement.workingColorSpace !== LinearSRGBColorSpace && 'COLOR_0' in attributes ) {\n\n\t\tconsole.warn( `THREE.GLTFLoader: Converting vertex colors from \"srgb-linear\" to \"${ColorManagement.workingColorSpace}\" not supported.` );\n\n\t}\n\n\tassignExtrasToUserData( geometry, primitiveDef );\n\n\tcomputeBounds( geometry, primitiveDef, parser );\n\n\treturn Promise.all( pending ).then( function () {\n\n\t\treturn primitiveDef.targets !== undefined\n\t\t\t? addMorphTargets( geometry, primitiveDef.targets, parser )\n\t\t\t: geometry;\n\n\t} );\n\n}\n\n/**\n * Loader result of `GLTFLoader`.\n *\n * @typedef {Object} GLTFLoader~LoadObject\n * @property {Array<AnimationClip>} animations - An array of animation clips.\n * @property {Object} asset - Meta data about the loaded asset.\n * @property {Array<Camera>} cameras - An array of cameras.\n * @property {GLTFParser} parser - A reference to the internal parser.\n * @property {Group} scene - The default scene.\n * @property {Array<Group>} scenes - glTF assets might define multiple scenes.\n * @property {Object} userData - Additional data.\n **/\n\nexport { GLTFLoader };\n", "import {\n \tBackSide,\n \tBoxGeometry,\n \tInstancedMesh,\n \tMesh,\n\tMeshLambertMaterial,\n \tMeshStandardMaterial,\n \tPointLight,\n \tScene,\n \tObject3D,\n} from 'three';\n\n/**\n * This class represents a scene with a basic room setup that can be used as\n * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's\n * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment}\n * or directly as an environment map to PBR materials.\n *\n * The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts)\n * component from the `model-viewer` project.\n *\n * ```js\n * const environment = new RoomEnvironment();\n * const pmremGenerator = new THREE.PMREMGenerator( renderer );\n *\n * const envMap = pmremGenerator.fromScene( environment ).texture;\n * scene.environment = envMap;\n * ```\n *\n * @augments Scene\n * @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';\n */\nclass RoomEnvironment extends Scene {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.name = 'RoomEnvironment';\n\t\tthis.position.y = - 3.5;\n\n\t\tconst geometry = new BoxGeometry();\n\t\tgeometry.deleteAttribute( 'uv' );\n\n\t\tconst roomMaterial = new MeshStandardMaterial( { side: BackSide } );\n\t\tconst boxMaterial = new MeshStandardMaterial();\n\n\t\tconst mainLight = new PointLight( 0xffffff, 900, 28, 2 );\n\t\tmainLight.position.set( 0.418, 16.199, 0.300 );\n\t\tthis.add( mainLight );\n\n\t\tconst room = new Mesh( geometry, roomMaterial );\n\t\troom.position.set( - 0.757, 13.219, 0.717 );\n\t\troom.scale.set( 31.713, 28.305, 28.591 );\n\t\tthis.add( room );\n\n\t\tconst boxes = new InstancedMesh( geometry, boxMaterial, 6 );\n\t\tconst transform = new Object3D();\n\n\t\t// box1\n\t\ttransform.position.set( - 10.906, 2.009, 1.846 );\n\t\ttransform.rotation.set( 0, - 0.195, 0 );\n\t\ttransform.scale.set( 2.328, 7.905, 4.651 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 0, transform.matrix );\n\n\t\t// box2\n\t\ttransform.position.set( - 5.607, - 0.754, - 0.758 );\n\t\ttransform.rotation.set( 0, 0.994, 0 );\n\t\ttransform.scale.set( 1.970, 1.534, 3.955 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 1, transform.matrix );\n\n\t\t// box3\n\t\ttransform.position.set( 6.167, 0.857, 7.803 );\n\t\ttransform.rotation.set( 0, 0.561, 0 );\n\t\ttransform.scale.set( 3.927, 6.285, 3.687 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 2, transform.matrix );\n\n\t\t// box4\n\t\ttransform.position.set( - 2.017, 0.018, 6.124 );\n\t\ttransform.rotation.set( 0, 0.333, 0 );\n\t\ttransform.scale.set( 2.002, 4.566, 2.064 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 3, transform.matrix );\n\n\t\t// box5\n\t\ttransform.position.set( 2.291, - 0.756, - 2.621 );\n\t\ttransform.rotation.set( 0, - 0.286, 0 );\n\t\ttransform.scale.set( 1.546, 1.552, 1.496 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 4, transform.matrix );\n\n\t\t// box6\n\t\ttransform.position.set( - 2.193, - 0.369, - 5.547 );\n\t\ttransform.rotation.set( 0, 0.516, 0 );\n\t\ttransform.scale.set( 3.875, 3.487, 2.986 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 5, transform.matrix );\n\n\t\tthis.add( boxes );\n\n\n\t\t// -x right\n\t\tconst light1 = new Mesh( geometry, createAreaLightMaterial( 50 ) );\n\t\tlight1.position.set( - 16.116, 14.37, 8.208 );\n\t\tlight1.scale.set( 0.1, 2.428, 2.739 );\n\t\tthis.add( light1 );\n\n\t\t// -x left\n\t\tconst light2 = new Mesh( geometry, createAreaLightMaterial( 50 ) );\n\t\tlight2.position.set( - 16.109, 18.021, - 8.207 );\n\t\tlight2.scale.set( 0.1, 2.425, 2.751 );\n\t\tthis.add( light2 );\n\n\t\t// +x\n\t\tconst light3 = new Mesh( geometry, createAreaLightMaterial( 17 ) );\n\t\tlight3.position.set( 14.904, 12.198, - 1.832 );\n\t\tlight3.scale.set( 0.15, 4.265, 6.331 );\n\t\tthis.add( light3 );\n\n\t\t// +z\n\t\tconst light4 = new Mesh( geometry, createAreaLightMaterial( 43 ) );\n\t\tlight4.position.set( - 0.462, 8.89, 14.520 );\n\t\tlight4.scale.set( 4.38, 5.441, 0.088 );\n\t\tthis.add( light4 );\n\n\t\t// -z\n\t\tconst light5 = new Mesh( geometry, createAreaLightMaterial( 20 ) );\n\t\tlight5.position.set( 3.235, 11.486, - 12.541 );\n\t\tlight5.scale.set( 2.5, 2.0, 0.1 );\n\t\tthis.add( light5 );\n\n\t\t// +y\n\t\tconst light6 = new Mesh( geometry, createAreaLightMaterial( 100 ) );\n\t\tlight6.position.set( 0.0, 20.0, 0.0 );\n\t\tlight6.scale.set( 1.0, 0.1, 1.0 );\n\t\tthis.add( light6 );\n\n\t}\n\n\t/**\n\t * Frees internal resources. This method should be called\n\t * when the environment is no longer required.\n\t */\n\tdispose() {\n\n\t\tconst resources = new Set();\n\n\t\tthis.traverse( ( object ) => {\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tresources.add( object.geometry );\n\t\t\t\tresources.add( object.material );\n\n\t\t\t}\n\n\t\t} );\n\n\t\tfor ( const resource of resources ) {\n\n\t\t\tresource.dispose();\n\n\t\t}\n\n\t}\n\n}\n\nfunction createAreaLightMaterial( intensity ) {\n\n\t// create an emissive-only material. see #31348\n\tconst material = new MeshLambertMaterial( {\n\t\tcolor: 0x000000,\n\t\temissive: 0xffffff,\n\t\temissiveIntensity: intensity\n\t} );\n\n\treturn material;\n\n}\n\nexport { RoomEnvironment };\n", "/**\n * Lipsync driver: @three-ws/concierge (shared lineage: page-agent-sdk/src/lipsync.js)\n * =====================================\n *\n * Text \u2192 viseme heuristic. No audio analysis, no microphone, no network. We\n * tokenize the spoken text into a timed viseme sequence and lerp the matching\n * morph targets each frame, so the mouth shapes track the words the speech\n * engine is saying. This is the same approach three.ws ships in production\n * (src/runtime/lipsync.js); it is reproduced here so the package stays\n * dependency-free apart from `three`.\n *\n * Three mouth drivers, chosen from the discovered morph targets:\n * - 'arkit': full Oculus/ARKit viseme set (best).\n * - 'jaw': only jawOpen/mouthOpen, amplitude-style open/close.\n * - none: no morphs \u2192 returns a no-op timeline; the stage carries the\n * talk visually through body animation instead.\n */\n\nconst ARKIT_VISEMES = [\n\t'viseme_aa', 'viseme_CH', 'viseme_DD', 'viseme_E', 'viseme_FF',\n\t'viseme_I', 'viseme_kk', 'viseme_nn', 'viseme_O', 'viseme_PP',\n\t'viseme_RR', 'viseme_sil', 'viseme_SS', 'viseme_TH', 'viseme_U',\n];\nconst JAW_FALLBACKS = ['jawOpen', 'mouthOpen'];\n\nconst CHAR_TO_VISEME = {\n\ta: 'viseme_aa', e: 'viseme_E', i: 'viseme_I', o: 'viseme_O', u: 'viseme_U',\n\tb: 'viseme_PP', m: 'viseme_PP', p: 'viseme_PP',\n\tf: 'viseme_FF', v: 'viseme_FF',\n\td: 'viseme_DD', t: 'viseme_DD', n: 'viseme_DD', l: 'viseme_DD',\n\tk: 'viseme_kk', g: 'viseme_kk', c: 'viseme_kk', q: 'viseme_kk',\n\ts: 'viseme_SS', z: 'viseme_SS', x: 'viseme_SS',\n\tr: 'viseme_RR', w: 'viseme_U', y: 'viseme_I', h: 'viseme_E', j: 'viseme_CH',\n};\nconst DIGRAPH_TO_VISEME = { th: 'viseme_TH', ch: 'viseme_CH', sh: 'viseme_CH' };\n\nconst MS_PER_PHONEME = 80;\nconst WORD_GAP_MS = 120;\nconst PUNCT_GAP_MS = 200;\nconst LERP = 0.35;\n\n/**\n * Build a map of morph-target name \u2192 [{ mesh, index }] for the avatar root.\n * @param {import('three').Object3D} root\n * @returns {{ mode: 'arkit'|'jaw', map: Map<string, {mesh:any,index:number}[]> }|null}\n */\nexport function buildMorphMap(root) {\n\tconst arkit = new Map();\n\tconst jaw = new Map();\n\troot?.traverse?.((node) => {\n\t\tif (!node.isMesh || !node.morphTargetDictionary || !node.morphTargetInfluences) return;\n\t\tconst dict = node.morphTargetDictionary;\n\t\tfor (const name of ARKIT_VISEMES) {\n\t\t\tif (dict[name] === undefined) continue;\n\t\t\tif (!arkit.has(name)) arkit.set(name, []);\n\t\t\tarkit.get(name).push({ mesh: node, index: dict[name] });\n\t\t}\n\t\tfor (const name of JAW_FALLBACKS) {\n\t\t\tif (dict[name] === undefined) continue;\n\t\t\tif (!jaw.has(name)) jaw.set(name, []);\n\t\t\tjaw.get(name).push({ mesh: node, index: dict[name] });\n\t\t}\n\t});\n\tif (arkit.size) return { mode: 'arkit', map: arkit };\n\tif (jaw.size) return { mode: 'jaw', map: jaw };\n\treturn null;\n}\n\nfunction tokenize(text) {\n\tconst seq = [];\n\tconst lower = String(text || '').toLowerCase();\n\tlet t = 0;\n\tfor (let i = 0; i < lower.length; ) {\n\t\tconst pair = i + 1 < lower.length ? lower[i] + lower[i + 1] : '';\n\t\tif (DIGRAPH_TO_VISEME[pair]) {\n\t\t\tseq.push({ viseme: DIGRAPH_TO_VISEME[pair], startMs: t, endMs: t + MS_PER_PHONEME * 2 });\n\t\t\tt += MS_PER_PHONEME * 2;\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tconst ch = lower[i];\n\t\tif (CHAR_TO_VISEME[ch]) {\n\t\t\tseq.push({ viseme: CHAR_TO_VISEME[ch], startMs: t, endMs: t + MS_PER_PHONEME });\n\t\t\tt += MS_PER_PHONEME;\n\t\t} else if (/\\s/.test(ch)) {\n\t\t\tt += WORD_GAP_MS;\n\t\t} else if (/[.,!?;:]/.test(ch)) {\n\t\t\tt += PUNCT_GAP_MS;\n\t\t}\n\t\ti++;\n\t}\n\treturn seq;\n}\n\n/** Rough natural duration of `text` in ms, used to pace the no-morph case. */\nexport function estimateDurationMs(text) {\n\tconst seq = tokenize(text);\n\treturn seq.length ? seq[seq.length - 1].endMs : 0;\n}\n\n/**\n * Start a lipsync timeline. The returned object exposes:\n * - tick(nowMs): call every frame; advances + lerps morph influences.\n * - stop(): reset all influences to 0 and mark done.\n * - done: true once the sequence has fully played.\n *\n * The caller owns the clock so the timeline can be synced to the speech engine\n * (we start it on utterance `start`, advance on the render loop, stop on `end`).\n *\n * @param {string} text\n * @param {ReturnType<typeof buildMorphMap>|null} morph\n * @param {{ rate?: number }} [opts] rate>1 speeds the mouth to match faster TTS\n */\nexport function createLipsync(text, morph, opts = {}) {\n\tconst rate = opts.rate && opts.rate > 0 ? opts.rate : 1;\n\tconst seq = morph ? tokenize(text) : [];\n\tconst totalMs = seq.length ? seq[seq.length - 1].endMs : 0;\n\tlet startMs = -1;\n\tlet done = false;\n\n\t// Per-morph smoothed influence so we can lerp toward targets each frame.\n\tconst current = morph ? new Map([...morph.map.keys()].map((k) => [k, 0])) : new Map();\n\n\tfunction apply(name, value) {\n\t\tconst entries = morph?.map.get(name);\n\t\tif (!entries) return;\n\t\tfor (const { mesh, index } of entries) mesh.morphTargetInfluences[index] = value;\n\t}\n\n\tfunction tick(nowMs) {\n\t\tif (!morph || done) return;\n\t\tif (startMs < 0) startMs = nowMs;\n\t\tconst elapsed = (nowMs - startMs) * rate;\n\n\t\t// Determine the active viseme target for this instant.\n\t\tlet active = null;\n\t\tif (elapsed <= totalMs) {\n\t\t\tfor (const ph of seq) {\n\t\t\t\tif (elapsed >= ph.startMs && elapsed < ph.endMs) { active = ph.viseme; break; }\n\t\t\t}\n\t\t}\n\n\t\t// In jaw mode there's no per-viseme shape, any active phoneme opens the\n\t\t// jaw on an envelope; silence closes it.\n\t\tfor (const name of current.keys()) {\n\t\t\tlet target = 0;\n\t\t\tif (morph.mode === 'arkit') {\n\t\t\t\ttarget = name === active ? 0.92 : 0;\n\t\t\t} else {\n\t\t\t\t// jaw: open while speaking, with a gentle per-phoneme pulse\n\t\t\t\ttarget = active ? 0.45 + 0.25 * Math.abs(Math.sin(elapsed / 70)) : 0;\n\t\t\t}\n\t\t\tconst next = current.get(name) + (target - current.get(name)) * LERP;\n\t\t\tcurrent.set(name, next);\n\t\t\tapply(name, next);\n\t\t}\n\n\t\tif (elapsed > totalMs + 120) done = true;\n\t}\n\n\tfunction stop() {\n\t\tdone = true;\n\t\tfor (const name of current.keys()) {\n\t\t\tcurrent.set(name, 0);\n\t\t\tapply(name, 0);\n\t\t}\n\t}\n\n\treturn { tick, stop, get done() { return done; }, get totalMs() { return totalMs; } };\n}\n", "/**\n * AvatarStage: @three-ws/concierge (shared lineage: page-agent-sdk/src/stage.js)\n * ==================================\n *\n * The 3D surface: a transparent WebGL canvas that loads a rigged glTF agent,\n * frames it (bust / upper / full), and keeps it alive with skeletal idle motion\n *, a played idle clip when the GLB ships one, otherwise a procedural breathing\n * + sway + blink loop so the agent never looks like a frozen statue (the whole\n * reason we require rigged avatars). It exposes the morph map + a per-frame hook\n * so the lipsync driver and speech narrator can drive the mouth in sync.\n *\n * Peer-depends on `three` only. Addons resolve through the consumer's bundler\n * (or the import map / inlined build for <script> usage).\n */\n\nimport {\n\tScene, PerspectiveCamera, WebGLRenderer, AmbientLight, DirectionalLight,\n\tBox3, Vector3, Color, Clock, PMREMGenerator, AnimationMixer, LoopRepeat,\n\tACESFilmicToneMapping, SRGBColorSpace, MathUtils,\n} from 'three';\nimport { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';\nimport { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';\nimport { buildMorphMap } from './lipsync.js';\n\n// Catalog rigs served by three.ws (e.g. cz.glb) carry EXT_meshopt_compression;\n// GLTFLoader throws \"setMeshoptDecoder must be called\" without a decoder.\n// Lazy + memoized so pages using only uncompressed rigs skip the wasm init.\nlet _meshoptPromise = null;\nfunction getMeshoptDecoder() {\n\tif (!_meshoptPromise) {\n\t\t_meshoptPromise = import('three/addons/libs/meshopt_decoder.module.js').then((m) => m.MeshoptDecoder);\n\t}\n\treturn _meshoptPromise;\n}\n\nconst FRAMING = {\n\t// [vertical fraction of model height to center on, distance multiplier]\n\tbust: { center: 0.86, dist: 0.62, fov: 28 },\n\tupper: { center: 0.72, dist: 1.0, fov: 30 },\n\tfull: { center: 0.5, dist: 1.9, fov: 32 },\n};\n\nconst BLINK_MORPHS = ['eyeBlinkLeft', 'eyeBlinkRight', 'eyesClosed', 'blink'];\n\nexport class AvatarStage {\n\t/**\n\t * @param {HTMLElement} container Element the canvas fills.\n\t * @param {{ background?: string }} [opts]\n\t */\n\tconstructor(container, opts = {}) {\n\t\tthis.container = container;\n\t\tthis._opts = opts;\n\n\t\tthis.scene = new Scene();\n\t\tthis._applyBackground(opts.background);\n\n\t\tthis.canvas = document.createElement('canvas');\n\t\tthis.canvas.style.cssText = 'display:block;width:100%;height:100%;outline:none';\n\t\tcontainer.appendChild(this.canvas);\n\n\t\tconst w = container.clientWidth || 320;\n\t\tconst h = container.clientHeight || 360;\n\n\t\tthis.camera = new PerspectiveCamera(30, w / h, 0.05, 200);\n\t\tthis.camera.position.set(0, 1.5, 2.2);\n\n\t\tthis.renderer = new WebGLRenderer({\n\t\t\tcanvas: this.canvas, antialias: true, alpha: true, powerPreference: 'high-performance',\n\t\t});\n\t\tthis.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));\n\t\tthis.renderer.setSize(w, h, false);\n\t\tthis.renderer.outputColorSpace = SRGBColorSpace;\n\t\tthis.renderer.toneMapping = ACESFilmicToneMapping;\n\t\tthis.renderer.toneMappingExposure = 1.05;\n\n\t\tconst pmrem = new PMREMGenerator(this.renderer);\n\t\tthis._envTex = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;\n\t\tthis.scene.environment = this._envTex;\n\t\tpmrem.dispose();\n\n\t\tthis.scene.add(new AmbientLight(0xffffff, 0.6));\n\t\tconst key = new DirectionalLight(0xffffff, 1.4);\n\t\tkey.position.set(1.5, 3, 2.5);\n\t\tthis.scene.add(key);\n\t\tconst rim = new DirectionalLight(0x99bbff, 0.5);\n\t\trim.position.set(-2, 2, -2);\n\t\tthis.scene.add(rim);\n\n\t\tthis.clock = new Clock();\n\t\tthis.mixer = null;\n\t\tthis.model = null;\n\t\tthis.morph = null;\n\t\tthis._idleAction = null;\n\t\tthis._talkAction = null;\n\t\tthis._speaking = false;\n\t\tthis._loadToken = 0;\n\t\tthis._frameHooks = new Set();\n\t\tthis._headBone = null;\n\t\tthis._blinkTargets = [];\n\t\tthis._nextBlink = 1 + Math.random() * 3;\n\t\tthis._blinkT = -1;\n\t\tthis._reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches || false;\n\n\t\tthis._resizeObs = new ResizeObserver(() => this._resize());\n\t\tthis._resizeObs.observe(container);\n\n\t\t// Pause the render loop when the tab is backgrounded or the agent scrolls\n\t\t// offscreen, a docked WebGL canvas should never burn GPU it can't be seen on.\n\t\tthis._visible = !document.hidden;\n\t\tthis._onscreen = true;\n\t\tthis._render = this._render.bind(this);\n\t\tthis._onVisibility = () => { this._visible = !document.hidden; this._kick(); };\n\t\tdocument.addEventListener('visibilitychange', this._onVisibility);\n\t\tthis._inViewObs = new IntersectionObserver(\n\t\t\t(entries) => { this._onscreen = entries.some((e) => e.isIntersecting); this._kick(); },\n\t\t\t{ threshold: 0 },\n\t\t);\n\t\tthis._inViewObs.observe(container);\n\n\t\tthis._raf = 0;\n\t\tthis._raf = requestAnimationFrame(this._render);\n\t}\n\n\t/** (Re)start the render loop if it is paused and the stage is currently visible. */\n\t_kick() {\n\t\tif (this._raf || !this.renderer || !this._visible || !this._onscreen) return;\n\t\tthis.clock.getDelta(); // discard the idle gap so motion resumes smoothly\n\t\tthis._raf = requestAnimationFrame(this._render);\n\t}\n\n\t/** Register a per-frame callback `(dtSeconds, nowMs) => void`. Returns an unsubscribe. */\n\tonFrame(fn) {\n\t\tthis._frameHooks.add(fn);\n\t\treturn () => this._frameHooks.delete(fn);\n\t}\n\n\t/**\n\t * Load a rigged GLB. Replaces any current model. Resolves once framed.\n\t * @param {string} url\n\t * @param {{ framing?: 'bust'|'upper'|'full' }} [opts]\n\t */\n\tasync load(url, opts = {}) {\n\t\tconst token = ++this._loadToken;\n\t\tconst loader = new GLTFLoader();\n\t\tloader.setMeshoptDecoder(await getMeshoptDecoder());\n\t\tconst gltf = await loader.loadAsync(url);\n\t\tif (token !== this._loadToken) return null; // superseded\n\n\t\tif (this.model) {\n\t\t\tthis.scene.remove(this.model);\n\t\t\tthis._disposeObject(this.model);\n\t\t}\n\t\tif (this.mixer) { this.mixer.stopAllAction(); this.mixer.uncacheRoot(this.model); }\n\t\tthis.mixer = null;\n\t\tthis._idleAction = null;\n\t\tthis._talkAction = null;\n\n\t\tthis.model = gltf.scene;\n\t\tthis.scene.add(this.model);\n\t\tthis.morph = buildMorphMap(this.model);\n\t\tthis._collectRigRefs(this.model);\n\n\t\t// Animation: prefer a named idle clip; keep any talk clip for speaking.\n\t\tif (gltf.animations?.length) {\n\t\t\tthis.mixer = new AnimationMixer(this.model);\n\t\t\tconst idle = pickClip(gltf.animations, ['idle', 'breathing', 'stand', 'rest']) || gltf.animations[0];\n\t\t\tconst talk = pickClip(gltf.animations, ['talk', 'talking', 'speak', 'gesture', 'wave']);\n\t\t\tif (idle) {\n\t\t\t\tthis._idleAction = this.mixer.clipAction(idle);\n\t\t\t\tthis._idleAction.setLoop(LoopRepeat, Infinity).play();\n\t\t\t}\n\t\t\tif (talk && talk !== idle) {\n\t\t\t\tthis._talkAction = this.mixer.clipAction(talk);\n\t\t\t\tthis._talkAction.setLoop(LoopRepeat, Infinity);\n\t\t\t\tthis._talkAction.enabled = true;\n\t\t\t\tthis._talkAction.setEffectiveWeight(0);\n\t\t\t\tthis._talkAction.play();\n\t\t\t}\n\t\t}\n\n\t\tthis._frame(opts.framing || 'upper');\n\t\treturn gltf;\n\t}\n\n\t/** Begin/halt the talking visual state (animation weight + body emphasis). */\n\tsetSpeaking(on) {\n\t\tthis._speaking = !!on;\n\t\tif (this._talkAction) {\n\t\t\t// Crossfade talk-clip weight; idle stays underneath.\n\t\t\tthis._talkAction.setEffectiveWeight(on ? 0.85 : 0);\n\t\t}\n\t}\n\n\t_collectRigRefs(root) {\n\t\tthis._headBone = null;\n\t\tthis._blinkTargets = [];\n\t\troot.traverse((node) => {\n\t\t\tif (node.isBone && /head/i.test(node.name) && !/headtop|end/i.test(node.name) && !this._headBone) {\n\t\t\t\tthis._headBone = node;\n\t\t\t\tnode.userData._restQ = node.quaternion.clone();\n\t\t\t}\n\t\t\tif (node.isMesh && node.morphTargetDictionary) {\n\t\t\t\tfor (const name of BLINK_MORPHS) {\n\t\t\t\t\tconst idx = node.morphTargetDictionary[name];\n\t\t\t\t\tif (idx !== undefined) this._blinkTargets.push({ mesh: node, index: idx });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t_frame(framing) {\n\t\tconst conf = FRAMING[framing] || FRAMING.upper;\n\t\tconst box = new Box3().setFromObject(this.model);\n\t\tconst size = new Vector3();\n\t\tconst center = new Vector3();\n\t\tbox.getSize(size);\n\t\tbox.getCenter(center);\n\t\tconst height = size.y || 1.7;\n\t\tconst focusY = box.min.y + height * conf.center;\n\t\tconst focusX = center.x;\n\t\tconst maxDim = Math.max(size.x, height) || 1;\n\n\t\tthis.camera.fov = conf.fov;\n\t\tconst fov = (conf.fov * Math.PI) / 180;\n\t\tconst dist = ((maxDim / 2) / Math.tan(fov / 2)) * conf.dist;\n\t\tthis.camera.position.set(focusX, focusY, box.max.z + dist);\n\t\tthis.camera.near = Math.max(0.01, dist / 100);\n\t\tthis.camera.far = dist * 50;\n\t\tthis.camera.lookAt(focusX, focusY, center.z);\n\t\tthis.camera.updateProjectionMatrix();\n\t\tthis._focus = new Vector3(focusX, focusY, center.z);\n\t}\n\n\t_proceduralIdle(t) {\n\t\tif (this.mixer || this._reduce || !this.model) return; // clip-driven or static\n\t\t// Subtle breathing on the whole model + head sway when no skeletal clip.\n\t\tconst breathe = Math.sin(t * 1.6) * 0.006;\n\t\tthis.model.position.y = breathe;\n\t\tif (this._headBone && this._headBone.userData._restQ) {\n\t\t\tconst sway = Math.sin(t * 0.6) * 0.05;\n\t\t\tconst nod = Math.sin(t * 0.9) * 0.03 + (this._speaking ? Math.sin(t * 6) * 0.04 : 0);\n\t\t\tthis._headBone.quaternion.copy(this._headBone.userData._restQ);\n\t\t\tthis._headBone.rotateY(sway);\n\t\t\tthis._headBone.rotateX(nod);\n\t\t}\n\t}\n\n\t_blink(dt, t) {\n\t\tif (!this._blinkTargets.length || this._reduce) return;\n\t\tif (this._blinkT < 0) {\n\t\t\tthis._nextBlink -= dt;\n\t\t\tif (this._nextBlink <= 0) { this._blinkT = 0; this._nextBlink = 2 + Math.random() * 4; }\n\t\t\treturn;\n\t\t}\n\t\tthis._blinkT += dt;\n\t\tconst dur = 0.16;\n\t\tconst v = this._blinkT < dur / 2\n\t\t\t? this._blinkT / (dur / 2)\n\t\t\t: 1 - (this._blinkT - dur / 2) / (dur / 2);\n\t\tconst w = MathUtils.clamp(v, 0, 1);\n\t\tfor (const { mesh, index } of this._blinkTargets) mesh.morphTargetInfluences[index] = w;\n\t\tif (this._blinkT >= dur) this._blinkT = -1;\n\t}\n\n\t_render() {\n\t\t// Re-arm only while visible & onscreen; _kick() resumes when that changes.\n\t\tif (!this.renderer || !this._visible || !this._onscreen) { this._raf = 0; return; }\n\t\tthis._raf = requestAnimationFrame(this._render);\n\t\tconst dt = Math.min(this.clock.getDelta(), 0.05);\n\t\tconst t = this.clock.elapsedTime;\n\t\tconst nowMs = t * 1000;\n\t\tthis.mixer?.update(dt);\n\t\tthis._proceduralIdle(t);\n\t\tthis._blink(dt, t);\n\t\tfor (const fn of this._frameHooks) {\n\t\t\ttry { fn(dt, nowMs); } catch { /* a misbehaving hook must not kill the loop */ }\n\t\t}\n\t\tthis.renderer.render(this.scene, this.camera);\n\t}\n\n\t_resize() {\n\t\tif (!this.renderer || !this.camera) return;\n\t\tconst w = this.container.clientWidth || 1;\n\t\tconst h = this.container.clientHeight || 1;\n\t\tthis.renderer.setSize(w, h, false);\n\t\tthis.camera.aspect = w / h;\n\t\tthis.camera.updateProjectionMatrix();\n\t}\n\n\t_applyBackground(value) {\n\t\tif (!value || value === 'transparent') { this.scene.background = null; return; }\n\t\ttry { this.scene.background = new Color(value); } catch { this.scene.background = null; }\n\t}\n\n\t_disposeObject(obj) {\n\t\tobj.traverse?.((n) => {\n\t\t\tn.geometry?.dispose?.();\n\t\t\tconst mats = Array.isArray(n.material) ? n.material : [n.material];\n\t\t\tmats.forEach((m) => {\n\t\t\t\tif (!m) return;\n\t\t\t\tfor (const v of Object.values(m)) if (v?.isTexture) v.dispose();\n\t\t\t\tm.dispose?.();\n\t\t\t});\n\t\t});\n\t}\n\n\tdispose() {\n\t\tcancelAnimationFrame(this._raf);\n\t\tthis._raf = 0;\n\t\tthis._resizeObs?.disconnect();\n\t\tthis._inViewObs?.disconnect();\n\t\tdocument.removeEventListener('visibilitychange', this._onVisibility);\n\t\tthis._frameHooks.clear();\n\t\tif (this.model) { this.scene.remove(this.model); this._disposeObject(this.model); }\n\t\tthis._envTex?.dispose();\n\t\tthis._envTex = null;\n\t\tthis.renderer?.dispose();\n\t\tthis.renderer?.forceContextLoss?.();\n\t\tthis.renderer = null;\n\t\tthis.canvas?.remove();\n\t\tthis.scene = null;\n\t\tthis.camera = null;\n\t\tthis.model = null;\n\t}\n}\n\nfunction pickClip(clips, hints) {\n\tfor (const hint of hints) {\n\t\tconst found = clips.find((c) => c.name && c.name.toLowerCase().includes(hint));\n\t\tif (found) return found;\n\t}\n\treturn null;\n}\n", "/**\n * SpeechNarrator: @three-ws/concierge (shared lineage: page-agent-sdk/src/narrator.js)\n * =====================================\n *\n * Speaks queued text aloud with the Web Speech API and keeps the avatar's mouth\n * in sync. There is no backend, no API key, no audio file: TTS is synthesized\n * in the browser, and the lipsync timeline is advanced on the stage's render\n * loop so visemes track the spoken words.\n *\n * Graceful by design:\n * - No speechSynthesis (or muted): we still run the lipsync timeline for the\n * text's estimated duration so the avatar visibly \"talks\" and captions\n * show, the page narration never silently stalls.\n * - Voice list loads async on some platforms; we wait for `voiceschanged`.\n */\n\nimport { createLipsync, estimateDurationMs } from './lipsync.js';\n\nconst hasTTS = typeof window !== 'undefined' && 'speechSynthesis' in window;\n\nexport class SpeechNarrator {\n\t/**\n\t * @param {import('./stage.js').AvatarStage} stage\n\t * @param {{ muted?: boolean, onState?: (s:'idle'|'speaking')=>void,\n\t * onCaption?: (text:string|null)=>void, onError?: (e:Error)=>void }} [opts]\n\t */\n\tconstructor(stage, opts = {}) {\n\t\tthis.stage = stage;\n\t\tthis.muted = !!opts.muted;\n\t\tthis.onState = opts.onState || (() => {});\n\t\tthis.onCaption = opts.onCaption || (() => {});\n\t\tthis.onError = opts.onError || (() => {});\n\n\t\tthis.agent = null; // current RiggedAgent (for voice selection)\n\t\tthis._queue = [];\n\t\tthis._active = null; // { lipsync, utter, fallbackTimer, resolve }\n\t\tthis._frameUnsub = stage.onFrame((dt, nowMs) => this._tick(nowMs));\n\t\tthis._voices = [];\n\n\t\tif (hasTTS) {\n\t\t\tthis._onVoices = this._loadVoices.bind(this);\n\t\t\tthis._loadVoices();\n\t\t\twindow.speechSynthesis.addEventListener?.('voiceschanged', this._onVoices);\n\t\t}\n\t}\n\n\t/** Switch the active agent so future utterances use its voice profile. */\n\tsetAgent(agent) {\n\t\tthis.agent = agent;\n\t}\n\n\tsetMuted(muted) {\n\t\tthis.muted = !!muted;\n\t\tif (muted && hasTTS) window.speechSynthesis.cancel();\n\t}\n\n\t/**\n\t * Queue text to speak. Returns a promise that resolves when this line ends\n\t * (or is skipped/cancelled). Multiple calls play in order.\n\t * @param {string} text\n\t * @param {{ interrupt?: boolean }} [opts]\n\t * @returns {Promise<void>}\n\t */\n\tspeak(text, opts = {}) {\n\t\tconst clean = String(text || '').trim();\n\t\tif (!clean) return Promise.resolve();\n\t\tif (opts.interrupt) this.cancel();\n\t\treturn new Promise((resolve) => {\n\t\t\tthis._queue.push({ text: clean, resolve });\n\t\t\tif (!this._active) this._next();\n\t\t});\n\t}\n\n\t/** Stop everything and clear the queue. */\n\tcancel() {\n\t\tif (hasTTS) window.speechSynthesis.cancel();\n\t\tthis._finishActive(true);\n\t\tfor (const item of this._queue.splice(0)) item.resolve();\n\t\tthis.onCaption(null);\n\t\tthis.stage.setSpeaking(false);\n\t\tthis.onState('idle');\n\t}\n\n\tget speaking() {\n\t\treturn !!this._active;\n\t}\n\n\t_next() {\n\t\tconst item = this._queue.shift();\n\t\tif (!item) { this.onState('idle'); this.onCaption(null); this.stage.setSpeaking(false); return; }\n\n\t\tconst rate = this.agent?.voice?.rate || 1;\n\t\tconst lipsync = createLipsync(item.text, this.stage.morph, { rate });\n\t\tconst active = { text: item.text, lipsync, resolve: item.resolve, utter: null, fallbackTimer: 0 };\n\t\tthis._active = active;\n\n\t\tthis.stage.setSpeaking(true);\n\t\tthis.onState('speaking');\n\t\tthis.onCaption(item.text);\n\n\t\tif (hasTTS && !this.muted) {\n\t\t\tconst utter = new SpeechSynthesisUtterance(item.text);\n\t\t\tconst v = this._pickVoice();\n\t\t\tif (v) utter.voice = v;\n\t\t\tutter.lang = this.agent?.voice?.lang || v?.lang || 'en-US';\n\t\t\tutter.pitch = clamp(this.agent?.voice?.pitch ?? 1, 0, 2);\n\t\t\tutter.rate = clamp(this.agent?.voice?.rate ?? 1, 0.1, 3);\n\t\t\tutter.onend = () => this._finishActive(false);\n\t\t\tutter.onerror = (e) => {\n\t\t\t\t// Some engines fire 'interrupted'/'canceled' as errors on cancel , \n\t\t\t\t// only surface genuine synthesis failures, then fall back visually.\n\t\t\t\tif (e?.error && !/interrupt|cancel/i.test(e.error)) {\n\t\t\t\t\tthis.onError(new Error('speech-synthesis: ' + e.error));\n\t\t\t\t\tthis._runVisualFallback(active);\n\t\t\t\t} else {\n\t\t\t\t\tthis._finishActive(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tactive.utter = utter;\n\t\t\t// Safety net: if neither onend nor onerror fires (known flaky on some\n\t\t\t// mobile engines), close out after the estimated duration + slack.\n\t\t\tconst guardMs = estimateDurationMs(item.text) * (1 / (utter.rate || 1)) + 1500;\n\t\t\tactive.fallbackTimer = window.setTimeout(() => this._finishActive(false), Math.max(2500, guardMs));\n\t\t\ttry {\n\t\t\t\twindow.speechSynthesis.speak(utter);\n\t\t\t} catch (err) {\n\t\t\t\tthis.onError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\tthis._runVisualFallback(active);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._runVisualFallback(active);\n\t\t}\n\t}\n\n\t/** No audio (muted / unsupported): play the lipsync visually then advance. */\n\t_runVisualFallback(active) {\n\t\tif (active !== this._active) return;\n\t\t// Estimate from the morph timeline when present, else from raw text so\n\t\t// no-morph (animation-lipsync) agents still hold the caption long enough.\n\t\tconst ms = active.lipsync.totalMs\n\t\t\t? active.lipsync.totalMs + 350\n\t\t\t: Math.max(1200, estimateDurationMs(active.text) + 350);\n\t\tactive.fallbackTimer = window.setTimeout(() => this._finishActive(false), ms);\n\t}\n\n\t_tick(nowMs) {\n\t\tthis._active?.lipsync?.tick(nowMs);\n\t}\n\n\t_finishActive(silent) {\n\t\tconst active = this._active;\n\t\tif (!active) return;\n\t\tthis._active = null;\n\t\tif (active.fallbackTimer) clearTimeout(active.fallbackTimer);\n\t\tactive.lipsync?.stop();\n\t\ttry { active.resolve(); } catch { /* consumer callback */ }\n\t\tif (!silent) this._next();\n\t}\n\n\t_loadVoices() {\n\t\tif (!hasTTS) return;\n\t\tthis._voices = window.speechSynthesis.getVoices() || [];\n\t}\n\n\t_pickVoice() {\n\t\tif (!this._voices.length) this._loadVoices();\n\t\tconst prof = this.agent?.voice || {};\n\t\tconst voices = this._voices;\n\t\tif (!voices.length) return null;\n\t\t// 1) explicit name matches, in priority order\n\t\tfor (const needle of prof.match || []) {\n\t\t\tconst v = voices.find((x) => x.name?.toLowerCase().includes(needle.toLowerCase()));\n\t\t\tif (v) return v;\n\t\t}\n\t\t// 2) language match\n\t\tif (prof.lang) {\n\t\t\tconst v = voices.find((x) => x.lang?.toLowerCase().startsWith(prof.lang.toLowerCase().slice(0, 2)));\n\t\t\tif (v) return v;\n\t\t}\n\t\t// 3) first local voice, else first available\n\t\treturn voices.find((x) => x.localService) || voices[0];\n\t}\n\n\tdispose() {\n\t\tthis.cancel();\n\t\tthis._frameUnsub?.();\n\t\tif (hasTTS) window.speechSynthesis.removeEventListener?.('voiceschanged', this._onVoices);\n\t}\n}\n\nfunction clamp(n, lo, hi) {\n\treturn Math.max(lo, Math.min(hi, Number(n)));\n}\n", "/**\n * Concierge catalog: @three-ws/concierge\n * =======================================\n *\n * Every entry is a skeleton-rigged humanoid GLB with verified face morphs or a\n * talk animation, served from the three.ws origin (the repo's public/ web\n * root). The concierge frames the avatar as a bust inside the chat panel and\n * drives blink + viseme lipsync, so an unrigged mesh would read as a dead\n * statue, those are excluded by rule, same as @three-ws/page-agent.\n *\n * Override `assetBase` (or an entry's `url`) to self-host the GLBs.\n */\n\n/** Default CDN base. Real, public three.ws assets, `public/avatars/*.glb`. */\nexport const DEFAULT_ASSET_BASE = 'https://three.ws/avatars/';\n\n/**\n * @typedef {Object} ConciergeAvatar\n * @property {string} id Stable slug used in attributes / localStorage.\n * @property {string} name Display name shown in the header + picker.\n * @property {string} tagline One-line personality hook for the picker card.\n * @property {string} file GLB filename under the asset base.\n * @property {string} [url] Absolute override; wins over assetBase+file.\n * @property {'viseme'|'jaw'|'animation'} lipsync Mouth driver.\n * @property {'bust'|'upper'|'full'} framing Camera crop in the panel.\n * @property {{ lang?: string, pitch?: number, rate?: number, match?: string[] }} voice\n * @property {string} accent Default accent color for this avatar's chrome.\n */\n\n/** @type {ConciergeAvatar[]} */\nexport const AVATARS = [\n\t{\n\t\tid: 'sol',\n\t\tname: 'Sol',\n\t\ttagline: 'Calm, clear product guide',\n\t\tfile: 'realistic-halfbody.glb',\n\t\tlipsync: 'viseme',\n\t\tframing: 'bust',\n\t\tvoice: { lang: 'en-US', pitch: 1.0, rate: 1.0, match: ['samantha', 'jenny', 'aria', 'google us english'] },\n\t\taccent: '#6366f1',\n\t},\n\t{\n\t\tid: 'nova',\n\t\tname: 'Nova',\n\t\ttagline: 'Upbeat, friendly host',\n\t\tfile: 'selfie-girl.glb',\n\t\tlipsync: 'viseme',\n\t\tframing: 'upper',\n\t\tvoice: { lang: 'en-US', pitch: 1.12, rate: 1.04, match: ['jenny', 'aria', 'samantha', 'google us english'] },\n\t\taccent: '#ec4899',\n\t},\n\t{\n\t\tid: 'vera',\n\t\tname: 'Vera',\n\t\ttagline: 'Composed, professional',\n\t\tfile: 'realistic-female.glb',\n\t\tlipsync: 'viseme',\n\t\tframing: 'bust',\n\t\tvoice: { lang: 'en-GB', pitch: 1.0, rate: 0.98, match: ['libby', 'sonia', 'google uk english female', 'serena'] },\n\t\taccent: '#14b8a6',\n\t},\n\t{\n\t\tid: 'atlas',\n\t\tname: 'Atlas',\n\t\ttagline: 'Confident, grounded',\n\t\tfile: 'realistic-male.glb',\n\t\tlipsync: 'viseme',\n\t\tframing: 'bust',\n\t\tvoice: { lang: 'en-US', pitch: 0.92, rate: 0.98, match: ['guy', 'eric', 'google us english', 'daniel'] },\n\t\taccent: '#3b82f6',\n\t},\n\t{\n\t\tid: 'echo',\n\t\tname: 'Echo',\n\t\ttagline: 'Neutral, even-keeled',\n\t\tfile: 'default.glb',\n\t\tlipsync: 'viseme',\n\t\tframing: 'upper',\n\t\tvoice: { lang: 'en-US', pitch: 1.0, rate: 1.0, match: ['google us english', 'samantha', 'guy'] },\n\t\taccent: '#8b5cf6',\n\t},\n];\n\nexport const DEFAULT_AVATAR_ID = 'sol';\n\n/** Look up a catalog entry by id; unknown ids resolve to the default. */\nexport function getAvatar(id) {\n\treturn AVATARS.find((a) => a.id === id) || AVATARS.find((a) => a.id === DEFAULT_AVATAR_ID);\n}\n\n/** Resolve the GLB URL for an entry (absolute `url` wins over assetBase). */\nexport function avatarUrl(entry, assetBase = DEFAULT_ASSET_BASE) {\n\tif (!entry) return null;\n\tif (entry.url) return entry.url;\n\tconst base = assetBase.endsWith('/') ? assetBase : assetBase + '/';\n\treturn base + entry.file;\n}\n\n/**\n * Normalize a host-supplied custom avatar (a plain GLB URL or a partial entry)\n * into a full catalog-shaped entry so the runtime treats it uniformly.\n */\nexport function customAvatarEntry(urlOrEntry) {\n\tif (!urlOrEntry) return null;\n\tif (typeof urlOrEntry === 'string') {\n\t\treturn {\n\t\t\tid: 'custom',\n\t\t\tname: 'Assistant',\n\t\t\ttagline: 'Custom avatar',\n\t\t\turl: urlOrEntry,\n\t\t\tlipsync: 'viseme',\n\t\t\tframing: 'bust',\n\t\t\tvoice: { lang: 'en-US', pitch: 1, rate: 1, match: [] },\n\t\t\taccent: '#6366f1',\n\t\t};\n\t}\n\treturn { ...getAvatar(DEFAULT_AVATAR_ID), id: 'custom', name: 'Assistant', ...urlOrEntry };\n}\n", "/**\n * Site-context harvester: @three-ws/concierge\n * ============================================\n *\n * The concierge grounds its answers in the page it is embedded on, with no\n * crawler, no index, and no server-side setup: at ask-time it reads the live\n * DOM, title, meta description, headings, nav labels, and the main content , \n * and ships a bounded snapshot to the answer endpoint. A host can top this up\n * with a `knowledge` string (FAQ, policies, product facts) that is always\n * included ahead of the harvested page text.\n *\n * Pure DOM-in / JSON-out so it is unit-testable with a fake document.\n */\n\nexport const MAX_CONTENT_CHARS = 6000;\nexport const MAX_KNOWLEDGE_CHARS = 8000;\n\nconst SKIP_SELECTOR =\n\t'script,style,noscript,template,svg,iframe,canvas,[aria-hidden=\"true\"],[hidden],[data-concierge-ignore]';\n\nfunction cleanText(s) {\n\treturn String(s || '')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n}\n\n/** Collect visible text from a root, skipping chrome/noise elements. */\nfunction harvestText(root, budget) {\n\tif (!root) return '';\n\tconst clone = root.cloneNode(true);\n\tfor (const el of clone.querySelectorAll(SKIP_SELECTOR)) el.remove();\n\t// The concierge's own UI must never feed back into its context.\n\tfor (const el of clone.querySelectorAll('[data-three-concierge]')) el.remove();\n\treturn cleanText(clone.textContent).slice(0, budget);\n}\n\n/**\n * Build the site snapshot for one ask.\n * @param {Document} doc\n * @param {{ knowledge?: string, siteName?: string }} [opts]\n * @returns {{ url: string, title: string, description: string, headings: string[],\n * nav: string[], content: string, name: string }}\n */\nexport function harvestSiteContext(doc, opts = {}) {\n\tif (!doc) return { url: '', title: '', description: '', headings: [], nav: [], content: '', name: '' };\n\n\tconst title = cleanText(doc.title).slice(0, 200);\n\tconst description = cleanText(\n\t\tdoc.querySelector('meta[name=\"description\"]')?.getAttribute('content') ||\n\t\t\tdoc.querySelector('meta[property=\"og:description\"]')?.getAttribute('content'),\n\t).slice(0, 500);\n\n\tconst headings = [...doc.querySelectorAll('h1, h2, h3')]\n\t\t.map((h) => cleanText(h.textContent))\n\t\t.filter((t) => t && t.length <= 120)\n\t\t.slice(0, 24);\n\n\tconst nav = [...doc.querySelectorAll('nav a, header a')]\n\t\t.map((a) => cleanText(a.textContent))\n\t\t.filter((t) => t && t.length <= 40);\n\tconst uniqueNav = [...new Set(nav)].slice(0, 24);\n\n\tconst main =\n\t\tdoc.querySelector('main') || doc.querySelector('[role=\"main\"]') || doc.querySelector('article') || doc.body;\n\tconst content = harvestText(main, MAX_CONTENT_CHARS);\n\n\tconst name =\n\t\tcleanText(doc.querySelector('meta[property=\"og:site_name\"]')?.getAttribute('content')) ||\n\t\t(opts.siteName ? cleanText(opts.siteName) : '') ||\n\t\t(typeof location !== 'undefined' ? location.hostname : '');\n\n\treturn {\n\t\turl: typeof location !== 'undefined' ? location.href.split('#')[0] : '',\n\t\ttitle,\n\t\tdescription,\n\t\theadings,\n\t\tnav: uniqueNav,\n\t\tcontent,\n\t\tname: name.slice(0, 120),\n\t};\n}\n\n/**\n * Merge host knowledge + harvested page into the `site` payload the\n * /api/concierge endpoint accepts. Knowledge leads (it is curated), the live\n * page fills the remaining budget.\n */\nexport function buildSitePayload(doc, opts = {}) {\n\tconst ctx = harvestSiteContext(doc, opts);\n\tconst knowledge = cleanText(opts.knowledge).slice(0, MAX_KNOWLEDGE_CHARS);\n\tlet content = ctx.content;\n\tif (knowledge) {\n\t\tconst remaining = Math.max(0, MAX_CONTENT_CHARS - Math.min(knowledge.length, MAX_CONTENT_CHARS));\n\t\tcontent = content.slice(0, remaining);\n\t}\n\treturn {\n\t\turl: ctx.url,\n\t\tname: ctx.name,\n\t\ttitle: ctx.title,\n\t\tdescription: ctx.description,\n\t\theadings: ctx.headings,\n\t\tnav: ctx.nav,\n\t\tknowledge,\n\t\tcontent,\n\t};\n}\n", "/**\n * Streaming answer client: @three-ws/concierge\n * =============================================\n *\n * POSTs the visitor's question + conversation history + the harvested site\n * snapshot to the answer endpoint and reads the SSE reply incrementally, so\n * tokens render (and speak) as they arrive instead of after the full answer.\n *\n * Wire format (matches /api/concierge on three.ws):\n * \u2192 POST { message, history[], site{...}, persona?, lang? }\n * \u2190 SSE data: { type: 'chunk', text } repeated\n * data: { type: 'done', provider?, model? }\n * data: { type: 'error', error }\n *\n * Any OpenAI-compatible endpoint can be substituted by hosts that run their\n * own backend, set `endpoint` and keep the same request/SSE contract.\n */\n\nexport const DEFAULT_ENDPOINT = 'https://three.ws/api/concierge';\n\nexport const MAX_HISTORY_TURNS = 20;\nexport const MAX_MESSAGE_CHARS = 2000;\n\n/**\n * Parse one SSE frame body (the text after `data: `) into an event object.\n * Returns null for keep-alives / malformed frames, the stream must survive\n * both without surfacing an error to the visitor.\n */\nexport function parseSseEvent(raw) {\n\tconst s = String(raw || '').trim();\n\tif (!s || s === '[DONE]') return null;\n\ttry {\n\t\tconst evt = JSON.parse(s);\n\t\treturn evt && typeof evt === 'object' ? evt : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Incremental SSE buffer: feed it network chunks, get complete events out.\n * Split on blank lines per the SSE spec; multi-line `data:` fields join.\n */\nexport function createSseBuffer(onEvent) {\n\tlet buf = '';\n\treturn {\n\t\tpush(text) {\n\t\t\tbuf += text;\n\t\t\tlet idx;\n\t\t\twhile ((idx = buf.indexOf('\\n\\n')) !== -1) {\n\t\t\t\tconst frame = buf.slice(0, idx);\n\t\t\t\tbuf = buf.slice(idx + 2);\n\t\t\t\tconst data = frame\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.filter((l) => l.startsWith('data:'))\n\t\t\t\t\t.map((l) => l.slice(5).trim())\n\t\t\t\t\t.join('\\n');\n\t\t\t\tconst evt = parseSseEvent(data);\n\t\t\t\tif (evt) onEvent(evt);\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Ask the concierge a question.\n *\n * @param {{ endpoint?: string, message: string,\n * history?: {role:'user'|'assistant', content:string}[],\n * site?: object, persona?: string, lang?: string,\n * signal?: AbortSignal,\n * onChunk?: (text:string)=>void }} opts\n * @returns {Promise<{ text: string, provider?: string, model?: string }>}\n */\nexport async function askConcierge(opts) {\n\tconst endpoint = opts.endpoint || DEFAULT_ENDPOINT;\n\tconst history = (opts.history || [])\n\t\t.slice(-MAX_HISTORY_TURNS)\n\t\t.map((m) => ({ role: m.role, content: String(m.content).slice(0, 4000) }));\n\n\tconst res = await fetch(endpoint, {\n\t\tmethod: 'POST',\n\t\theaders: { 'content-type': 'application/json' },\n\t\tbody: JSON.stringify({\n\t\t\tmessage: String(opts.message).slice(0, MAX_MESSAGE_CHARS),\n\t\t\thistory,\n\t\t\tsite: opts.site || {},\n\t\t\tpersona: opts.persona || undefined,\n\t\t\tlang: opts.lang || (typeof navigator !== 'undefined' ? navigator.language : undefined),\n\t\t}),\n\t\tsignal: opts.signal,\n\t});\n\n\tif (!res.ok) {\n\t\tlet detail = '';\n\t\ttry {\n\t\t\tconst body = await res.json();\n\t\t\tdetail = body?.error || body?.message || '';\n\t\t} catch {\n\t\t\t/* non-JSON error body */\n\t\t}\n\t\tconst err = new Error(detail || `concierge endpoint returned HTTP ${res.status}`);\n\t\terr.status = res.status;\n\t\tthrow err;\n\t}\n\n\tlet text = '';\n\tlet meta = {};\n\tlet streamError = null;\n\tconst sse = createSseBuffer((evt) => {\n\t\tif (evt.type === 'chunk' && typeof evt.text === 'string') {\n\t\t\ttext += evt.text;\n\t\t\topts.onChunk?.(evt.text);\n\t\t} else if (evt.type === 'done') {\n\t\t\tmeta = { provider: evt.provider, model: evt.model };\n\t\t} else if (evt.type === 'error') {\n\t\t\tstreamError = new Error(evt.error || 'concierge stream error');\n\t\t}\n\t});\n\n\tconst reader = res.body.getReader();\n\tconst decoder = new TextDecoder();\n\tfor (;;) {\n\t\tconst { done, value } = await reader.read();\n\t\tif (done) break;\n\t\tsse.push(decoder.decode(value, { stream: true }));\n\t}\n\tsse.push(decoder.decode());\n\n\tif (streamError && !text) throw streamError;\n\treturn { text, ...meta };\n}\n", "/**\n * Markdown-lite renderer: @three-ws/concierge\n * ============================================\n *\n * Answers stream back as plain text with light markdown (bold, code, links,\n * lists). This renders that subset to safe HTML: every piece of source text is\n * escaped BEFORE markup is applied, links are restricted to http(s)/mailto and\n * always open in a new tab with rel hardening. No innerHTML of raw model\n * output, ever.\n */\n\nconst ESC = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;', \"'\": '&#39;' };\n\nexport function escapeHtml(s) {\n\treturn String(s ?? '').replace(/[&<>\"']/g, (c) => ESC[c]);\n}\n\nfunction safeHref(url) {\n\tconst u = String(url || '').trim();\n\tif (/^(https?:\\/\\/|mailto:|\\/)/i.test(u)) return u;\n\treturn null;\n}\n\nfunction inline(md) {\n\tlet out = escapeHtml(md);\n\t// `code`\n\tout = out.replace(/`([^`]+)`/g, '<code>$1</code>');\n\t// **bold** then *italic*\n\tout = out.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n\tout = out.replace(/(^|[\\s(])\\*([^*\\n]+)\\*(?=[\\s).,!?:;]|$)/g, '$1<em>$2</em>');\n\t// [label](url), href is validated; the label is already escaped\n\tout = out.replace(/\\[([^\\]]+)\\]\\(([^)\\s]+)\\)/g, (m, label, url) => {\n\t\tconst href = safeHref(url);\n\t\treturn href\n\t\t\t? `<a href=\"${escapeHtml(href)}\" target=\"_blank\" rel=\"noopener noreferrer\">${label}</a>`\n\t\t\t: label;\n\t});\n\treturn out;\n}\n\n/**\n * Render markdown-lite `text` to an HTML string (paragraphs, bullet/numbered\n * lists, fenced code blocks, inline marks). Safe against HTML injection.\n */\nexport function renderMarkdown(text) {\n\tconst src = String(text ?? '').replace(/\\r\\n/g, '\\n');\n\tconst blocks = [];\n\tconst lines = src.split('\\n');\n\tlet i = 0;\n\n\twhile (i < lines.length) {\n\t\tconst line = lines[i];\n\n\t\tif (/^```/.test(line)) {\n\t\t\tconst buf = [];\n\t\t\ti++;\n\t\t\twhile (i < lines.length && !/^```/.test(lines[i])) buf.push(lines[i++]);\n\t\t\ti++; // closing fence (or EOF)\n\t\t\tblocks.push(`<pre><code>${escapeHtml(buf.join('\\n'))}</code></pre>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (/^\\s*[-*]\\s+/.test(line)) {\n\t\t\tconst items = [];\n\t\t\twhile (i < lines.length && /^\\s*[-*]\\s+/.test(lines[i])) {\n\t\t\t\titems.push(`<li>${inline(lines[i].replace(/^\\s*[-*]\\s+/, ''))}</li>`);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tblocks.push(`<ul>${items.join('')}</ul>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (/^\\s*\\d+[.)]\\s+/.test(line)) {\n\t\t\tconst items = [];\n\t\t\twhile (i < lines.length && /^\\s*\\d+[.)]\\s+/.test(lines[i])) {\n\t\t\t\titems.push(`<li>${inline(lines[i].replace(/^\\s*\\d+[.)]\\s+/, ''))}</li>`);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tblocks.push(`<ol>${items.join('')}</ol>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!line.trim()) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Paragraph: consume until a blank line or a structural line.\n\t\tconst buf = [];\n\t\twhile (i < lines.length && lines[i].trim() && !/^```|^\\s*[-*]\\s+|^\\s*\\d+[.)]\\s+/.test(lines[i])) {\n\t\t\tbuf.push(lines[i++]);\n\t\t}\n\t\tblocks.push(`<p>${inline(buf.join(' '))}</p>`);\n\t}\n\n\treturn blocks.join('');\n}\n\n/**\n * Strip markdown for the voice channel, what the narrator speaks should be\n * the words, not the syntax.\n */\nexport function stripMarkdown(text) {\n\treturn String(text ?? '')\n\t\t.replace(/```[\\s\\S]*?```/g, ' code sample. ')\n\t\t.replace(/`([^`]+)`/g, '$1')\n\t\t.replace(/\\*\\*([^*]+)\\*\\*/g, '$1')\n\t\t.replace(/\\*([^*\\n]+)\\*/g, '$1')\n\t\t.replace(/\\[([^\\]]+)\\]\\([^)\\s]+\\)/g, '$1')\n\t\t.replace(/^[\\s]*[-*]\\s+/gm, '')\n\t\t.replace(/^[\\s]*\\d+[.)]\\s+/gm, '')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n}\n", "/**\n * Voice input: @three-ws/concierge\n * =================================\n *\n * Thin wrapper over the Web Speech API's SpeechRecognition (webkit-prefixed on\n * Chromium). Push-to-talk: start() listens for one utterance, streams interim\n * transcripts for live feedback, and resolves the final transcript. Degrades\n * to `supported: false` where the API is absent (Firefox, most webviews) so\n * the widget can hide the mic button instead of showing a dead control.\n */\n\nfunction RecognitionCtor() {\n\tif (typeof window === 'undefined') return null;\n\treturn window.SpeechRecognition || window.webkitSpeechRecognition || null;\n}\n\nexport function micSupported() {\n\treturn !!RecognitionCtor();\n}\n\n/**\n * @param {{ lang?: string,\n * onInterim?: (transcript:string)=>void,\n * onState?: (s:'listening'|'idle')=>void,\n * onError?: (e:Error)=>void }} [opts]\n */\nexport function createMic(opts = {}) {\n\tconst Ctor = RecognitionCtor();\n\tlet rec = null;\n\tlet finalText = '';\n\tlet resolveDone = null;\n\n\tfunction stopInternal() {\n\t\tif (!rec) return;\n\t\ttry {\n\t\t\trec.stop();\n\t\t} catch {\n\t\t\t/* already stopped */\n\t\t}\n\t}\n\n\treturn {\n\t\tsupported: !!Ctor,\n\t\tget listening() {\n\t\t\treturn !!rec;\n\t\t},\n\n\t\t/** Listen for one utterance; resolves the final transcript ('' on abort). */\n\t\tstart() {\n\t\t\tif (!Ctor || rec) return Promise.resolve('');\n\t\t\tfinalText = '';\n\t\t\trec = new Ctor();\n\t\t\trec.lang = opts.lang || (typeof navigator !== 'undefined' ? navigator.language : 'en-US');\n\t\t\trec.interimResults = true;\n\t\t\trec.continuous = false;\n\t\t\trec.maxAlternatives = 1;\n\n\t\t\topts.onState?.('listening');\n\t\t\treturn new Promise((resolve) => {\n\t\t\t\tresolveDone = resolve;\n\t\t\t\trec.onresult = (e) => {\n\t\t\t\t\tlet interim = '';\n\t\t\t\t\tfor (let i = e.resultIndex; i < e.results.length; i++) {\n\t\t\t\t\t\tconst r = e.results[i];\n\t\t\t\t\t\tif (r.isFinal) finalText += r[0].transcript;\n\t\t\t\t\t\telse interim += r[0].transcript;\n\t\t\t\t\t}\n\t\t\t\t\topts.onInterim?.(finalText + interim);\n\t\t\t\t};\n\t\t\t\trec.onerror = (e) => {\n\t\t\t\t\t// 'no-speech'/'aborted' are normal outcomes of a quiet mic, not faults.\n\t\t\t\t\tif (e?.error && !/no-speech|aborted/i.test(e.error)) {\n\t\t\t\t\t\topts.onError?.(new Error('speech-recognition: ' + e.error));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\trec.onend = () => {\n\t\t\t\t\trec = null;\n\t\t\t\t\topts.onState?.('idle');\n\t\t\t\t\tconst out = finalText.trim();\n\t\t\t\t\tresolveDone?.(out);\n\t\t\t\t\tresolveDone = null;\n\t\t\t\t};\n\t\t\t\ttry {\n\t\t\t\t\trec.start();\n\t\t\t\t} catch (err) {\n\t\t\t\t\trec = null;\n\t\t\t\t\topts.onState?.('idle');\n\t\t\t\t\topts.onError?.(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t\tresolve('');\n\t\t\t\t\tresolveDone = null;\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\t/** Stop listening; the in-flight start() promise resolves with what was heard. */\n\t\tstop() {\n\t\t\tstopInternal();\n\t\t},\n\n\t\tdispose() {\n\t\t\tstopInternal();\n\t\t\trec = null;\n\t\t},\n\t};\n}\n", "/**\n * Styles: @three-ws/concierge\n * ============================\n *\n * One injected stylesheet, scoped under .tc- prefixes and namespaced CSS\n * variables so host pages are never polluted. Themes: dark and light, chosen\n * by `data-tc-theme` on the root (the widget resolves 'auto' from\n * prefers-color-scheme and live-updates). Accent is one variable hosts set\n * from config, every tint derives via color-mix so a single hex restyles the\n * whole widget.\n */\n\nexport const CSS = `\n.tc-root{\n\t--tc-accent:#6366f1;\n\t--tc-bg:#0b0c12;\n\t--tc-surface:#12141d;\n\t--tc-surface-2:#191c28;\n\t--tc-border:rgba(255,255,255,.09);\n\t--tc-text:#eceef6;\n\t--tc-text-dim:#8b93ab;\n\t--tc-user-text:#fff;\n\t--tc-shadow:0 24px 64px rgba(0,0,0,.5),0 4px 16px rgba(0,0,0,.35);\n\t--tc-radius:16px;\n\tposition:fixed;z-index:2147482800;display:flex;flex-direction:column;align-items:flex-end;gap:12px;\n\tfont-family:ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;\n\t-webkit-font-smoothing:antialiased;line-height:1.45;\n\t-webkit-user-select:none;user-select:none;\n}\n.tc-root[data-tc-theme=light]{\n\t--tc-bg:#ffffff;\n\t--tc-surface:#f4f5f9;\n\t--tc-surface-2:#eceef5;\n\t--tc-border:rgba(15,18,32,.10);\n\t--tc-text:#171923;\n\t--tc-text-dim:#5f677e;\n\t--tc-shadow:0 24px 64px rgba(20,24,40,.18),0 4px 16px rgba(20,24,40,.10);\n}\n.tc-root[data-tc-pos=bottom-right]{right:20px;bottom:20px}\n.tc-root[data-tc-pos=bottom-left]{left:20px;bottom:20px;align-items:flex-start}\n.tc-root *,.tc-root *::before,.tc-root *::after{box-sizing:border-box}\n.tc-root button{font:inherit;border:none;background:none;color:inherit;cursor:pointer;padding:0}\n.tc-root button:focus-visible,.tc-root textarea:focus-visible,.tc-root a:focus-visible{outline:2px solid var(--tc-accent);outline-offset:2px;border-radius:6px}\n\n/* \u2500\u2500 Launcher \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.tc-launcher{position:relative;width:56px;height:56px;border-radius:50%;display:grid;place-items:center;color:#fff;\n\tbackground:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 88%,#fff 12%),color-mix(in srgb,var(--tc-accent) 82%,#000 18%));\n\tbox-shadow:0 10px 30px color-mix(in srgb,var(--tc-accent) 45%,transparent),0 2px 8px rgba(0,0,0,.25);\n\ttransition:transform .18s ease,box-shadow .18s ease,filter .18s ease}\n.tc-launcher::before{content:'';position:absolute;inset:0;border-radius:50%;background:linear-gradient(180deg,rgba(255,255,255,.32),transparent 55%);pointer-events:none}\n.tc-launcher:hover{transform:translateY(-2px) scale(1.04);filter:brightness(1.07)}\n.tc-launcher:active{transform:scale(.96)}\n.tc-launcher svg{width:24px;height:24px;transition:transform .25s ease}\n.tc-root.is-open .tc-launcher svg{transform:rotate(90deg)}\n.tc-pulse{position:absolute;inset:-4px;border-radius:50%;background:color-mix(in srgb,var(--tc-accent) 55%,transparent);animation:tc-pulse 2.6s ease-out infinite;pointer-events:none}\n.tc-root.is-open .tc-pulse{display:none}\n@keyframes tc-pulse{0%{transform:scale(.9);opacity:.55}70%{transform:scale(1.45);opacity:0}100%{transform:scale(1.45);opacity:0}}\n\n/* \u2500\u2500 Teaser bubble \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.tc-teaser{max-width:240px;background:var(--tc-bg);color:var(--tc-text);border:1px solid var(--tc-border);border-radius:14px;\n\tpadding:10px 34px 10px 14px;font-size:13.5px;box-shadow:var(--tc-shadow);position:relative;\n\topacity:0;transform:translateY(8px);transition:opacity .3s ease,transform .3s ease;cursor:pointer}\n.tc-teaser.is-in{opacity:1;transform:translateY(0)}\n.tc-teaser-close{position:absolute;top:6px;right:6px;width:20px;height:20px;display:grid;place-items:center;color:var(--tc-text-dim);border-radius:50%}\n.tc-teaser-close:hover{color:var(--tc-text);background:var(--tc-surface-2)}\n\n/* \u2500\u2500 Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.tc-panel{width:380px;max-width:calc(100vw - 2.5rem);max-height:min(72vh,680px);display:flex;flex-direction:column;overflow:hidden;\n\tbackground:var(--tc-bg);color:var(--tc-text);border:1px solid var(--tc-border);border-radius:var(--tc-radius);box-shadow:var(--tc-shadow);\n\topacity:0;transform:translateY(14px) scale(.97);transform-origin:100% 100%;\n\ttransition:opacity .24s ease,transform .24s cubic-bezier(.2,.9,.3,1.1)}\n.tc-root[data-tc-pos=bottom-left] .tc-panel{transform-origin:0 100%}\n.tc-root.is-open .tc-panel{opacity:1;transform:translateY(0) scale(1)}\n.tc-panel[hidden]{display:none}\n\n/* Header */\n.tc-head{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 14px;border-bottom:1px solid var(--tc-border);background:var(--tc-surface)}\n.tc-head-id{display:flex;align-items:center;gap:9px;min-width:0}\n.tc-head-dot{width:8px;height:8px;border-radius:50%;background:#34d399;box-shadow:0 0 0 3px color-mix(in srgb,#34d399 22%,transparent);flex-shrink:0}\n.tc-head-name{font-weight:650;font-size:14px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tc-head-sub{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--tc-text-dim);text-transform:lowercase}\n.tc-head-actions{display:flex;align-items:center;gap:2px;flex-shrink:0}\n.tc-icon-btn{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:var(--tc-text-dim);transition:color .15s ease,background .15s ease}\n.tc-icon-btn:hover{color:var(--tc-text);background:var(--tc-surface-2)}\n.tc-icon-btn[aria-pressed=true]{color:var(--tc-accent)}\n.tc-icon-btn svg{width:16px;height:16px}\n\n/* Stage (3D avatar) */\n.tc-stage{flex-shrink:0;position:relative;height:150px;border-bottom:1px solid var(--tc-border);\n\tbackground:\n\t\tradial-gradient(120px 90px at 50% 100%,color-mix(in srgb,var(--tc-accent) 26%,transparent),transparent 72%),\n\t\tlinear-gradient(180deg,color-mix(in srgb,var(--tc-surface) 55%,transparent),var(--tc-bg));\n\ttransition:height .25s ease}\n.tc-root.is-compact .tc-stage{height:0;border-bottom:none;overflow:hidden}\n.tc-stage-canvas{position:absolute;inset:0}\n.tc-stage-glow{position:absolute;left:50%;bottom:8px;width:120px;height:22px;transform:translateX(-50%);border-radius:50%;\n\tbackground:color-mix(in srgb,var(--tc-accent) 30%,transparent);filter:blur(12px);opacity:.5;pointer-events:none}\n.tc-stage-skel{position:absolute;left:50%;bottom:10px;width:84px;height:112px;transform:translateX(-50%);\n\tborder-radius:44% 44% 38% 38%/56% 56% 44% 44%;overflow:hidden;opacity:0;transition:opacity .25s ease;pointer-events:none;\n\tbackground:linear-gradient(180deg,color-mix(in srgb,var(--tc-accent) 16%,transparent),transparent)}\n.tc-stage.is-loading .tc-stage-skel{opacity:1}\n.tc-stage-skel::after{content:'';position:absolute;inset:0;background:linear-gradient(110deg,transparent 18%,rgba(255,255,255,.2) 46%,transparent 72%);transform:translateX(-120%);animation:tc-shimmer 1.2s ease-in-out infinite}\n@keyframes tc-shimmer{to{transform:translateX(120%)}}\n.tc-stage-caption{position:absolute;left:10px;right:10px;bottom:8px;text-align:center;font-size:11.5px;color:var(--tc-text-dim);\n\toverflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}\n.tc-stage-caption.is-in{opacity:1}\n\n/* Messages */\n.tc-thread{flex:1;min-height:120px;overflow-y:auto;overscroll-behavior:contain;padding:14px;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin;scrollbar-color:var(--tc-surface-2) transparent}\n.tc-msg{max-width:86%;padding:9px 12px;border-radius:14px;font-size:13.5px;-webkit-user-select:text;user-select:text;\n\toverflow-wrap:anywhere;animation:tc-msg-in .22s ease both}\n@keyframes tc-msg-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}\n.tc-msg.is-user{align-self:flex-end;color:var(--tc-user-text);border-bottom-right-radius:5px;\n\tbackground:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 90%,#fff 10%),color-mix(in srgb,var(--tc-accent) 80%,#000 20%))}\n.tc-msg.is-bot{align-self:flex-start;background:var(--tc-surface);border:1px solid var(--tc-border);border-bottom-left-radius:5px}\n.tc-msg.is-error{border-color:color-mix(in srgb,#f87171 45%,transparent);background:color-mix(in srgb,#f87171 9%,var(--tc-surface))}\n.tc-msg p{margin:0 0 8px}.tc-msg p:last-child{margin:0}\n.tc-msg ul,.tc-msg ol{margin:0 0 8px;padding-left:18px}.tc-msg ul:last-child,.tc-msg ol:last-child{margin-bottom:0}\n.tc-msg li{margin:2px 0}\n.tc-msg a{color:var(--tc-accent);text-decoration:underline;text-underline-offset:2px}\n.tc-msg code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;background:color-mix(in srgb,var(--tc-accent) 12%,transparent);padding:1px 5px;border-radius:5px}\n.tc-msg pre{margin:0 0 8px;padding:10px;border-radius:9px;background:var(--tc-surface-2);overflow-x:auto}\n.tc-msg pre:last-child{margin-bottom:0}\n.tc-msg pre code{background:none;padding:0}\n.tc-caret{display:inline-block;width:7px;height:14px;margin-left:2px;vertical-align:-2px;background:var(--tc-accent);border-radius:2px;animation:tc-caret 1s steps(2) infinite}\n@keyframes tc-caret{50%{opacity:0}}\n.tc-typing{align-self:flex-start;display:inline-flex;gap:4px;padding:11px 13px;border-radius:14px;border-bottom-left-radius:5px;background:var(--tc-surface);border:1px solid var(--tc-border)}\n.tc-typing i{width:6px;height:6px;border-radius:50%;background:var(--tc-text-dim);animation:tc-blink 1.2s ease-in-out infinite}\n.tc-typing i:nth-child(2){animation-delay:.18s}.tc-typing i:nth-child(3){animation-delay:.36s}\n@keyframes tc-blink{0%,66%,100%{opacity:.35;transform:translateY(0)}33%{opacity:1;transform:translateY(-3px)}}\n.tc-retry{align-self:flex-start;margin-top:-4px;font-size:12px;color:var(--tc-accent);padding:3px 8px;border-radius:7px}\n.tc-retry:hover{background:var(--tc-surface-2)}\n\n/* Empty state + chips */\n.tc-empty{margin:auto 0;text-align:center;padding:12px 6px;display:flex;flex-direction:column;gap:6px;align-items:center}\n.tc-empty-title{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;color:var(--tc-text-dim)}\n.tc-chips{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;padding:4px 0}\n.tc-chip{font-size:12px;color:var(--tc-text);background:var(--tc-surface);border:1px solid var(--tc-border);border-radius:999px;padding:6px 11px;\n\ttransition:border-color .15s ease,background .15s ease,transform .15s ease}\n.tc-chip:hover{border-color:color-mix(in srgb,var(--tc-accent) 55%,transparent);background:var(--tc-surface-2);transform:translateY(-1px)}\n\n/* Input row */\n.tc-input{flex-shrink:0;display:flex;align-items:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--tc-border);background:var(--tc-surface)}\n.tc-input textarea{flex:1;resize:none;background:transparent;border:none;color:var(--tc-text);font:inherit;font-size:13.5px;line-height:1.5;\n\tpadding:6px 2px;max-height:110px;min-height:30px;overflow-y:auto;-webkit-user-select:text;user-select:text}\n.tc-input textarea::placeholder{color:var(--tc-text-dim)}\n.tc-input textarea:focus{outline:none}\n.tc-input textarea:disabled{opacity:.5}\n.tc-mic,.tc-send{flex-shrink:0;width:34px;height:34px;border-radius:10px;display:grid;place-items:center;transition:background .15s ease,color .15s ease,transform .12s ease}\n.tc-mic{color:var(--tc-text-dim);background:var(--tc-surface-2)}\n.tc-mic:hover{color:var(--tc-text)}\n.tc-mic.is-live{color:#fff;background:#ef4444;animation:tc-mic 1.4s ease-in-out infinite}\n@keyframes tc-mic{50%{box-shadow:0 0 0 6px color-mix(in srgb,#ef4444 25%,transparent)}}\n.tc-send{color:#fff;background:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 88%,#fff 12%),color-mix(in srgb,var(--tc-accent) 80%,#000 20%))}\n.tc-send:hover{filter:brightness(1.08)}\n.tc-send:active{transform:scale(.94)}\n.tc-send:disabled{opacity:.4;cursor:not-allowed;filter:none}\n.tc-mic svg,.tc-send svg{width:15px;height:15px}\n\n/* Footer */\n.tc-foot{flex-shrink:0;text-align:center;padding:5px 0 7px;background:var(--tc-surface)}\n.tc-foot a{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--tc-text-dim);text-decoration:none;transition:color .15s ease}\n.tc-foot a:hover{color:var(--tc-accent)}\n\n/* Picker */\n.tc-picker{position:absolute;inset:auto 0 0 0;top:0;z-index:5;background:color-mix(in srgb,var(--tc-bg) 88%,transparent);backdrop-filter:blur(8px);\n\tdisplay:flex;flex-direction:column;padding:14px;overflow-y:auto;opacity:0;pointer-events:none;transition:opacity .2s ease}\n.tc-picker.is-in{opacity:1;pointer-events:auto}\n.tc-picker-title{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var(--tc-text-dim);margin:0 0 10px;text-transform:lowercase}\n.tc-picker-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}\n.tc-picker-card{display:flex;flex-direction:column;gap:2px;text-align:left;padding:10px 12px;border-radius:11px;background:var(--tc-surface);border:1px solid var(--tc-border);transition:border-color .15s ease,transform .15s ease}\n.tc-picker-card:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--tc-accent) 55%,transparent)}\n.tc-picker-card.is-current{border-color:var(--tc-accent);box-shadow:0 0 0 1px var(--tc-accent)}\n.tc-picker-name{font-size:13px;font-weight:600}\n.tc-picker-tag{font-size:11px;color:var(--tc-text-dim)}\n\n/* Small screens: full-width sheet */\n@media (max-width:480px){\n\t.tc-root[data-tc-pos=bottom-right],.tc-root[data-tc-pos=bottom-left]{right:12px;left:12px;bottom:12px;align-items:stretch}\n\t.tc-panel{width:100%;max-width:none;max-height:min(78vh,640px)}\n\t.tc-launcher{align-self:flex-end}\n\t.tc-root[data-tc-pos=bottom-left] .tc-launcher{align-self:flex-start}\n}\n@media (prefers-reduced-motion:reduce){\n\t.tc-panel,.tc-msg,.tc-teaser,.tc-launcher,.tc-stage{transition:none;animation:none}\n\t.tc-pulse,.tc-typing i,.tc-caret{animation:none}\n}\n`;\n\nlet injected = false;\nexport function ensureStyles(doc = typeof document !== 'undefined' ? document : null) {\n\tif (injected || !doc) return;\n\tinjected = true;\n\tconst style = doc.createElement('style');\n\tstyle.id = 'three-concierge-style';\n\tstyle.textContent = CSS;\n\tdoc.head.appendChild(style);\n}\n", "/**\n * Concierge: @three-ws/concierge\n * ===============================\n *\n * The embeddable AI concierge: a floating launcher that opens a chat panel\n * with a rigged 3D avatar bust (blinks, idles, lipsyncs), streaming answers\n * grounded in the live page, browser-native voice out, and push-to-talk voice\n * in. One class owns the whole lifecycle; `<three-concierge>` and the script\n * auto-init are thin wrappers over it.\n *\n * Design decisions that matter:\n * - The WebGL stage is built lazily on FIRST OPEN. A closed widget costs the\n * host page zero GPU and no GLB download.\n * - Answers stream sentence-by-sentence into the voice channel, so the\n * avatar starts speaking while the rest of the reply is still arriving.\n * - The conversation persists in sessionStorage per origin, so a page\n * navigation does not amnesia the thread.\n */\n\nimport { AvatarStage } from './stage.js';\nimport { SpeechNarrator } from './narrator.js';\nimport { AVATARS, DEFAULT_AVATAR_ID, DEFAULT_ASSET_BASE, getAvatar, avatarUrl, customAvatarEntry } from './catalog.js';\nimport { buildSitePayload } from './context.js';\nimport { askConcierge, DEFAULT_ENDPOINT, MAX_HISTORY_TURNS } from './client.js';\nimport { renderMarkdown, stripMarkdown, escapeHtml } from './markdown.js';\nimport { createMic, micSupported } from './mic.js';\nimport { ensureStyles } from './styles.js';\n\nconst LS_AVATAR = 'tc:avatar';\nconst LS_MUTED = 'tc:muted';\nconst SS_THREAD = 'tc:thread';\nconst SS_TEASED = 'tc:teased';\n\nconst ICONS = {\n\tspark:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z\"/></svg>',\n\tclose:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\"/></svg>',\n\tsound:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z\"/></svg>',\n\tsoundOff:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z\"/></svg>',\n\tswap:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5\"/></svg>',\n\tcollapse:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 15.75l7.5-7.5 7.5 7.5\"/></svg>',\n\tmic:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"1.8\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z\"/></svg>',\n\tsend:\n\t\t'<svg fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2.2\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5\"/></svg>',\n};\n\nfunction storageGet(store, key) {\n\ttry {\n\t\treturn window[store].getItem(key);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction storageSet(store, key, value) {\n\ttry {\n\t\twindow[store].setItem(key, value);\n\t} catch {\n\t\t/* storage unavailable (private mode / blocked), degrade to in-memory */\n\t}\n}\n\n/** Split streamed text into complete sentences for the voice channel. */\nexport function drainSentences(buffer) {\n\tconst sentences = [];\n\tlet rest = buffer;\n\tlet m;\n\tconst re = /[^.!?\\n]*[.!?\\n]+[\"')\\]]?\\s*/g;\n\tlet consumed = 0;\n\twhile ((m = re.exec(rest)) !== null) {\n\t\tconst s = m[0].trim();\n\t\tif (s) sentences.push(s);\n\t\tconsumed = re.lastIndex;\n\t}\n\treturn { sentences, rest: rest.slice(consumed) };\n}\n\nexport class Concierge {\n\t/**\n\t * @param {{\n\t * endpoint?: string, avatar?: string, avatars?: string[],\n\t * customAvatar?: string|object, assetBase?: string,\n\t * name?: string, siteName?: string, greeting?: string,\n\t * suggestions?: string[], knowledge?: string, persona?: string,\n\t * accent?: string, position?: 'bottom-right'|'bottom-left',\n\t * theme?: 'auto'|'dark'|'light', open?: boolean, muted?: boolean,\n\t * picker?: boolean, teaser?: boolean, zIndex?: number, lang?: string,\n\t * }} [config]\n\t */\n\tconstructor(config = {}) {\n\t\tthis.config = {\n\t\t\tendpoint: config.endpoint || DEFAULT_ENDPOINT,\n\t\t\tassetBase: config.assetBase || DEFAULT_ASSET_BASE,\n\t\t\tavatars: Array.isArray(config.avatars) && config.avatars.length\n\t\t\t\t? AVATARS.filter((a) => config.avatars.includes(a.id))\n\t\t\t\t: AVATARS,\n\t\t\tname: config.name || '',\n\t\t\tsiteName: config.siteName || '',\n\t\t\tgreeting: config.greeting || '',\n\t\t\tsuggestions: Array.isArray(config.suggestions) ? config.suggestions.slice(0, 4) : [],\n\t\t\tknowledge: config.knowledge || '',\n\t\t\tpersona: config.persona || '',\n\t\t\taccent: config.accent || '',\n\t\t\tposition: config.position === 'bottom-left' ? 'bottom-left' : 'bottom-right',\n\t\t\ttheme: ['dark', 'light'].includes(config.theme) ? config.theme : 'auto',\n\t\t\topen: !!config.open,\n\t\t\tmuted: !!config.muted,\n\t\t\tpicker: config.picker !== false,\n\t\t\tteaser: config.teaser !== false,\n\t\t\tzIndex: config.zIndex,\n\t\t\tlang: config.lang || '',\n\t\t};\n\n\t\tthis._custom = config.customAvatar ? customAvatarEntry(config.customAvatar) : null;\n\t\tconst savedId = storageGet('localStorage', LS_AVATAR);\n\t\tthis.avatar = this._custom || getAvatarFrom(this.config.avatars, config.avatar || savedId);\n\n\t\tthis.open = false;\n\t\tthis.busy = false;\n\t\tthis.muted = this.config.muted || storageGet('localStorage', LS_MUTED) === '1';\n\t\tthis.messages = this._restoreThread();\n\t\tthis._listeners = new Map();\n\t\tthis._stage = null;\n\t\tthis._narrator = null;\n\t\tthis._mic = null;\n\t\tthis._abort = null;\n\t\tthis._destroyed = false;\n\n\t\tif (typeof window === 'undefined' || typeof document === 'undefined') return;\n\t\tthis._build();\n\t\tif (this.config.open) this.setOpen(true);\n\t\telse if (this.config.teaser) this._scheduleTeaser();\n\t\tthis._emit('ready', { avatar: this.avatar.id });\n\t}\n\n\t// \u2500\u2500 Events \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ton(event, fn) {\n\t\tif (!this._listeners.has(event)) this._listeners.set(event, new Set());\n\t\tthis._listeners.get(event).add(fn);\n\t\treturn () => this._listeners.get(event)?.delete(fn);\n\t}\n\t_emit(event, detail) {\n\t\tfor (const fn of this._listeners.get(event) || []) {\n\t\t\ttry {\n\t\t\t\tfn(detail);\n\t\t\t} catch {\n\t\t\t\t/* listener errors must not break the widget */\n\t\t\t}\n\t\t}\n\t}\n\n\t// \u2500\u2500 DOM \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\t_build() {\n\t\tensureStyles();\n\t\tconst root = document.createElement('div');\n\t\troot.className = 'tc-root';\n\t\troot.setAttribute('data-three-concierge', '');\n\t\troot.setAttribute('data-tc-pos', this.config.position);\n\t\tif (this.config.zIndex) root.style.zIndex = String(this.config.zIndex);\n\t\tif (this.config.accent) root.style.setProperty('--tc-accent', this.config.accent);\n\t\tthis._applyTheme(root);\n\n\t\tconst name = this.config.name || this.avatar.name;\n\t\troot.innerHTML = `\n\t\t\t<section class=\"tc-panel\" role=\"dialog\" aria-modal=\"false\" aria-label=\"${escapeHtml(name)}, site assistant\" hidden>\n\t\t\t\t<header class=\"tc-head\">\n\t\t\t\t\t<div class=\"tc-head-id\">\n\t\t\t\t\t\t<span class=\"tc-head-dot\" aria-hidden=\"true\"></span>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<div class=\"tc-head-name\"></div>\n\t\t\t\t\t\t\t<div class=\"tc-head-sub\">// ai concierge</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"tc-head-actions\">\n\t\t\t\t\t\t<button type=\"button\" class=\"tc-icon-btn tc-btn-mute\" aria-label=\"Toggle voice\" aria-pressed=\"false\">${ICONS.sound}</button>\n\t\t\t\t\t\t${this.config.picker && !this._custom ? `<button type=\"button\" class=\"tc-icon-btn tc-btn-swap\" aria-label=\"Choose a different avatar\">${ICONS.swap}</button>` : ''}\n\t\t\t\t\t\t<button type=\"button\" class=\"tc-icon-btn tc-btn-compact\" aria-label=\"Toggle avatar view\" aria-pressed=\"false\">${ICONS.collapse}</button>\n\t\t\t\t\t\t<button type=\"button\" class=\"tc-icon-btn tc-btn-close\" aria-label=\"Close assistant\">${ICONS.close}</button>\n\t\t\t\t\t</div>\n\t\t\t\t</header>\n\t\t\t\t<div class=\"tc-stage is-loading\" aria-hidden=\"true\">\n\t\t\t\t\t<div class=\"tc-stage-glow\"></div>\n\t\t\t\t\t<div class=\"tc-stage-skel\"></div>\n\t\t\t\t\t<div class=\"tc-stage-canvas\"></div>\n\t\t\t\t\t<div class=\"tc-stage-caption\"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"tc-thread\" aria-live=\"polite\"></div>\n\t\t\t\t<div class=\"tc-input\">\n\t\t\t\t\t<textarea rows=\"1\" maxlength=\"2000\" placeholder=\"Ask anything\u2026\" aria-label=\"Your question\"></textarea>\n\t\t\t\t\t${micSupported() ? `<button type=\"button\" class=\"tc-mic\" aria-label=\"Ask by voice\" aria-pressed=\"false\">${ICONS.mic}</button>` : ''}\n\t\t\t\t\t<button type=\"button\" class=\"tc-send\" aria-label=\"Send\" disabled>${ICONS.send}</button>\n\t\t\t\t</div>\n\t\t\t\t<footer class=\"tc-foot\"><a href=\"https://three.ws/concierge\" target=\"_blank\" rel=\"noopener noreferrer\">powered by three.ws</a></footer>\n\t\t\t\t<div class=\"tc-picker\" role=\"listbox\" aria-label=\"Choose your concierge\" hidden>\n\t\t\t\t\t<p class=\"tc-picker-title\">// choose your concierge</p>\n\t\t\t\t\t<div class=\"tc-picker-grid\"></div>\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t\t<button type=\"button\" class=\"tc-launcher\" aria-label=\"Open site assistant\" aria-expanded=\"false\">\n\t\t\t\t<span class=\"tc-pulse\" aria-hidden=\"true\"></span>\n\t\t\t\t${ICONS.spark}\n\t\t\t</button>\n\t\t`;\n\t\tdocument.body.appendChild(root);\n\t\tthis.root = root;\n\n\t\tthis.$ = {\n\t\t\tpanel: root.querySelector('.tc-panel'),\n\t\t\tlauncher: root.querySelector('.tc-launcher'),\n\t\t\theadName: root.querySelector('.tc-head-name'),\n\t\t\tmute: root.querySelector('.tc-btn-mute'),\n\t\t\tswap: root.querySelector('.tc-btn-swap'),\n\t\t\tcompact: root.querySelector('.tc-btn-compact'),\n\t\t\tclose: root.querySelector('.tc-btn-close'),\n\t\t\tstage: root.querySelector('.tc-stage'),\n\t\t\tstageCanvas: root.querySelector('.tc-stage-canvas'),\n\t\t\tcaption: root.querySelector('.tc-stage-caption'),\n\t\t\tthread: root.querySelector('.tc-thread'),\n\t\t\ttextarea: root.querySelector('textarea'),\n\t\t\tmic: root.querySelector('.tc-mic'),\n\t\t\tsend: root.querySelector('.tc-send'),\n\t\t\tpicker: root.querySelector('.tc-picker'),\n\t\t\tpickerGrid: root.querySelector('.tc-picker-grid'),\n\t\t};\n\n\t\tthis.$.headName.textContent = name;\n\t\tthis._syncMuteButton();\n\t\tthis._renderThread();\n\n\t\t// Wiring\n\t\tthis.$.launcher.addEventListener('click', () => this.toggle());\n\t\tthis.$.close.addEventListener('click', () => this.setOpen(false));\n\t\tthis.$.mute.addEventListener('click', () => this.setMuted(!this.muted));\n\t\tthis.$.swap?.addEventListener('click', () => this.togglePicker());\n\t\tthis.$.compact.addEventListener('click', () => this._toggleCompact());\n\t\tthis.$.send.addEventListener('click', () => this._submit());\n\t\tthis.$.textarea.addEventListener('input', () => this._syncInput());\n\t\tthis.$.textarea.addEventListener('keydown', (e) => {\n\t\t\tif (e.key === 'Enter' && !e.shiftKey) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._submit();\n\t\t\t}\n\t\t});\n\t\tthis._onKeydown = (e) => {\n\t\t\tif (e.key === 'Escape' && this.open) {\n\t\t\t\tif (!this.$.picker.hidden) this.togglePicker(false);\n\t\t\t\telse this.setOpen(false);\n\t\t\t}\n\t\t};\n\t\troot.addEventListener('keydown', this._onKeydown);\n\n\t\tif (this.$.mic) {\n\t\t\tthis._mic = createMic({\n\t\t\t\tlang: this.config.lang || undefined,\n\t\t\t\tonInterim: (t) => {\n\t\t\t\t\tthis.$.textarea.value = t;\n\t\t\t\t\tthis._syncInput();\n\t\t\t\t},\n\t\t\t\tonState: (s) => {\n\t\t\t\t\tthis.$.mic.classList.toggle('is-live', s === 'listening');\n\t\t\t\t\tthis.$.mic.setAttribute('aria-pressed', s === 'listening' ? 'true' : 'false');\n\t\t\t\t},\n\t\t\t\tonError: (err) => this._emit('error', err),\n\t\t\t});\n\t\t\tthis.$.mic.addEventListener('click', () => this._toggleMic());\n\t\t}\n\n\t\tif (this.config.theme === 'auto' && window.matchMedia) {\n\t\t\tthis._mq = window.matchMedia('(prefers-color-scheme: dark)');\n\t\t\tthis._onScheme = () => this._applyTheme(root);\n\t\t\tthis._mq.addEventListener?.('change', this._onScheme);\n\t\t}\n\t}\n\n\t_applyTheme(root) {\n\t\tconst theme =\n\t\t\tthis.config.theme !== 'auto'\n\t\t\t\t? this.config.theme\n\t\t\t\t: window.matchMedia?.('(prefers-color-scheme: dark)').matches\n\t\t\t\t\t? 'dark'\n\t\t\t\t\t: 'light';\n\t\troot.setAttribute('data-tc-theme', theme);\n\t}\n\n\t// \u2500\u2500 Open / close \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\tsetOpen(open) {\n\t\tif (this._destroyed || open === this.open) return;\n\t\tthis.open = open;\n\t\tthis.root.classList.toggle('is-open', open);\n\t\tthis.$.launcher.setAttribute('aria-expanded', String(open));\n\t\tthis.$.launcher.setAttribute('aria-label', open ? 'Close site assistant' : 'Open site assistant');\n\t\tif (open) {\n\t\t\tthis._killTeaser();\n\t\t\tthis.$.panel.hidden = false;\n\t\t\trequestAnimationFrame(() => this.root.classList.add('is-open'));\n\t\t\tthis._ensureStage();\n\t\t\tthis.$.textarea.focus({ preventScroll: true });\n\t\t\tthis._scrollThread(false);\n\t\t} else {\n\t\t\tthis._narrator?.cancel();\n\t\t\tthis._mic?.stop();\n\t\t\t// Let the close transition play before hiding.\n\t\t\tconst panel = this.$.panel;\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!this.open) panel.hidden = true;\n\t\t\t}, 240);\n\t\t\tthis.$.launcher.focus({ preventScroll: true });\n\t\t}\n\t\tthis._emit(open ? 'open' : 'close', {});\n\t}\n\ttoggle() {\n\t\tthis.setOpen(!this.open);\n\t}\n\n\t_toggleCompact() {\n\t\tconst compact = this.root.classList.toggle('is-compact');\n\t\tthis.$.compact.setAttribute('aria-pressed', String(compact));\n\t}\n\n\t// \u2500\u2500 Teaser \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\t_scheduleTeaser() {\n\t\tif (storageGet('sessionStorage', SS_TEASED) === '1' || this.messages.length) return;\n\t\tthis._teaserTimer = setTimeout(() => {\n\t\t\tif (this.open || this._destroyed) return;\n\t\t\tstorageSet('sessionStorage', SS_TEASED, '1');\n\t\t\tconst teaser = document.createElement('div');\n\t\t\tteaser.className = 'tc-teaser';\n\t\t\tteaser.setAttribute('role', 'status');\n\t\t\tteaser.innerHTML = `<span></span><button type=\"button\" class=\"tc-teaser-close\" aria-label=\"Dismiss\">${ICONS.close}</button>`;\n\t\t\tteaser.querySelector('span').textContent = this._greetingText();\n\t\t\tthis.root.insertBefore(teaser, this.$.launcher);\n\t\t\trequestAnimationFrame(() => teaser.classList.add('is-in'));\n\t\t\tteaser.addEventListener('click', (e) => {\n\t\t\t\tif (e.target.closest('.tc-teaser-close')) teaser.remove();\n\t\t\t\telse {\n\t\t\t\t\tteaser.remove();\n\t\t\t\t\tthis.setOpen(true);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._teaser = teaser;\n\t\t\tthis._teaserHide = setTimeout(() => this._killTeaser(), 12000);\n\t\t}, 6000);\n\t}\n\t_killTeaser() {\n\t\tclearTimeout(this._teaserTimer);\n\t\tclearTimeout(this._teaserHide);\n\t\tthis._teaser?.remove();\n\t\tthis._teaser = null;\n\t}\n\n\t_greetingText() {\n\t\tif (this.config.greeting) return this.config.greeting;\n\t\tconst site = this.config.siteName || document.querySelector('meta[property=\"og:site_name\"]')?.content || '';\n\t\treturn site ? `Hi! Ask me anything about ${site}.` : 'Hi! Ask me anything about this site.';\n\t}\n\n\t// \u2500\u2500 3D stage (lazy) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\tasync _ensureStage() {\n\t\tif (this._stage || this._stageLoading) return;\n\t\tthis._stageLoading = true;\n\t\ttry {\n\t\t\tthis._stage = new AvatarStage(this.$.stageCanvas, { background: 'transparent' });\n\t\t\tthis._narrator = new SpeechNarrator(this._stage, {\n\t\t\t\tmuted: this.muted,\n\t\t\t\tonCaption: (text) => this._setCaption(text),\n\t\t\t\tonError: () => {\n\t\t\t\t\t/* voice is an enhancement, a TTS engine fault must stay silent */\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis._narrator.setAgent(this.avatar);\n\t\t\tawait this._stage.load(avatarUrl(this.avatar, this.config.assetBase), {\n\t\t\t\tframing: this.avatar.framing || 'bust',\n\t\t\t});\n\t\t\tthis.$.stage.classList.remove('is-loading');\n\t\t} catch (err) {\n\t\t\t// No WebGL / GLB unreachable: hide the stage, keep the chat fully alive.\n\t\t\tthis.root.classList.add('is-compact');\n\t\t\tthis.$.compact.style.display = 'none';\n\t\t\tthis._emit('error', err instanceof Error ? err : new Error(String(err)));\n\t\t} finally {\n\t\t\tthis._stageLoading = false;\n\t\t}\n\t}\n\n\t_setCaption(text) {\n\t\tconst el = this.$.caption;\n\t\tif (!el) return;\n\t\tif (text) {\n\t\t\tel.textContent = text;\n\t\t\tel.classList.add('is-in');\n\t\t} else {\n\t\t\tel.classList.remove('is-in');\n\t\t}\n\t}\n\n\t// \u2500\u2500 Avatar switching \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\tasync setAvatar(id) {\n\t\tconst entry = getAvatarFrom(this.config.avatars, id);\n\t\tif (!entry || entry.id === this.avatar.id) return;\n\t\tthis.avatar = entry;\n\t\tstorageSet('localStorage', LS_AVATAR, entry.id);\n\t\tif (!this.config.name) this.$.headName.textContent = entry.name;\n\t\tthis._narrator?.cancel();\n\t\tthis._narrator?.setAgent(entry);\n\t\tthis._renderPicker();\n\t\tthis._emit('agentchange', { avatar: entry.id });\n\t\tif (this._stage) {\n\t\t\tthis.$.stage.classList.add('is-loading');\n\t\t\ttry {\n\t\t\t\tawait this._stage.load(avatarUrl(entry, this.config.assetBase), { framing: entry.framing || 'bust' });\n\t\t\t} catch (err) {\n\t\t\t\tthis._emit('error', err instanceof Error ? err : new Error(String(err)));\n\t\t\t}\n\t\t\tthis.$.stage.classList.remove('is-loading');\n\t\t}\n\t}\n\n\ttogglePicker(force) {\n\t\tconst show = force !== undefined ? force : this.$.picker.hidden;\n\t\tif (show) {\n\t\t\tthis._renderPicker();\n\t\t\tthis.$.picker.hidden = false;\n\t\t\trequestAnimationFrame(() => this.$.picker.classList.add('is-in'));\n\t\t} else {\n\t\t\tthis.$.picker.classList.remove('is-in');\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.$.picker.hidden = true;\n\t\t\t}, 200);\n\t\t}\n\t}\n\n\t_renderPicker() {\n\t\tconst grid = this.$.pickerGrid;\n\t\tif (!grid) return;\n\t\tgrid.textContent = '';\n\t\tfor (const a of this.config.avatars) {\n\t\t\tconst card = document.createElement('button');\n\t\t\tcard.type = 'button';\n\t\t\tcard.className = 'tc-picker-card' + (a.id === this.avatar.id ? ' is-current' : '');\n\t\t\tcard.setAttribute('role', 'option');\n\t\t\tcard.setAttribute('aria-selected', String(a.id === this.avatar.id));\n\t\t\tcard.innerHTML = `<span class=\"tc-picker-name\"></span><span class=\"tc-picker-tag\"></span>`;\n\t\t\tcard.querySelector('.tc-picker-name').textContent = a.name;\n\t\t\tcard.querySelector('.tc-picker-tag').textContent = a.tagline;\n\t\t\tcard.addEventListener('click', () => {\n\t\t\t\tthis.setAvatar(a.id);\n\t\t\t\tthis.togglePicker(false);\n\t\t\t});\n\t\t\tgrid.appendChild(card);\n\t\t}\n\t}\n\n\t// \u2500\u2500 Voice \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\tsetMuted(muted) {\n\t\tthis.muted = !!muted;\n\t\tstorageSet('localStorage', LS_MUTED, muted ? '1' : '0');\n\t\tthis._narrator?.setMuted(this.muted);\n\t\tthis._syncMuteButton();\n\t}\n\t_syncMuteButton() {\n\t\tconst btn = this.$?.mute;\n\t\tif (!btn) return;\n\t\tbtn.innerHTML = this.muted ? ICONS.soundOff : ICONS.sound;\n\t\tbtn.setAttribute('aria-pressed', String(this.muted));\n\t\tbtn.setAttribute('aria-label', this.muted ? 'Unmute voice' : 'Mute voice');\n\t}\n\n\tasync _toggleMic() {\n\t\tif (!this._mic) return;\n\t\tif (this._mic.listening) {\n\t\t\tthis._mic.stop();\n\t\t\treturn;\n\t\t}\n\t\tthis._narrator?.cancel();\n\t\tconst transcript = await this._mic.start();\n\t\tif (transcript) {\n\t\t\tthis.$.textarea.value = transcript;\n\t\t\tthis._syncInput();\n\t\t\tthis._submit();\n\t\t}\n\t}\n\n\t// \u2500\u2500 Thread rendering \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\t_restoreThread() {\n\t\ttry {\n\t\t\tconst raw = storageGet('sessionStorage', SS_THREAD);\n\t\t\tconst arr = raw ? JSON.parse(raw) : [];\n\t\t\treturn Array.isArray(arr)\n\t\t\t\t? arr.filter((m) => m && (m.role === 'user' || m.role === 'assistant') && typeof m.content === 'string')\n\t\t\t\t: [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t}\n\t_persistThread() {\n\t\tstorageSet('sessionStorage', SS_THREAD, JSON.stringify(this.messages.slice(-MAX_HISTORY_TURNS * 2)));\n\t}\n\n\t_renderThread() {\n\t\tconst thread = this.$.thread;\n\t\tthread.textContent = '';\n\t\tif (!this.messages.length) {\n\t\t\tconst empty = document.createElement('div');\n\t\t\tempty.className = 'tc-empty';\n\t\t\tconst title = document.createElement('p');\n\t\t\ttitle.className = 'tc-empty-title';\n\t\t\ttitle.textContent = this._greetingText();\n\t\t\tempty.appendChild(title);\n\t\t\tconst suggestions = this.config.suggestions.length\n\t\t\t\t? this.config.suggestions\n\t\t\t\t: defaultSuggestions(this.config.siteName);\n\t\t\tif (suggestions.length) {\n\t\t\t\tconst chips = document.createElement('div');\n\t\t\t\tchips.className = 'tc-chips';\n\t\t\t\tfor (const s of suggestions.slice(0, 4)) {\n\t\t\t\t\tconst chip = document.createElement('button');\n\t\t\t\t\tchip.type = 'button';\n\t\t\t\t\tchip.className = 'tc-chip';\n\t\t\t\t\tchip.textContent = s;\n\t\t\t\t\tchip.addEventListener('click', () => this.ask(s));\n\t\t\t\t\tchips.appendChild(chip);\n\t\t\t\t}\n\t\t\t\tempty.appendChild(chips);\n\t\t\t}\n\t\t\tthread.appendChild(empty);\n\t\t\treturn;\n\t\t}\n\t\tfor (const m of this.messages) thread.appendChild(this._bubble(m.role, m.content));\n\t\tthis._scrollThread(false);\n\t}\n\n\t_bubble(role, content, { error = false } = {}) {\n\t\tconst el = document.createElement('div');\n\t\tel.className = `tc-msg is-${role === 'user' ? 'user' : 'bot'}${error ? ' is-error' : ''}`;\n\t\tif (role === 'user') el.textContent = content;\n\t\telse el.innerHTML = renderMarkdown(content);\n\t\treturn el;\n\t}\n\n\t_scrollThread(smooth = true) {\n\t\tconst t = this.$.thread;\n\t\tt.scrollTo({ top: t.scrollHeight, behavior: smooth && !matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'auto' });\n\t}\n\n\t_syncInput() {\n\t\tconst ta = this.$.textarea;\n\t\tta.style.height = 'auto';\n\t\tta.style.height = Math.min(ta.scrollHeight, 110) + 'px';\n\t\tthis.$.send.disabled = this.busy || !ta.value.trim();\n\t}\n\n\t// \u2500\u2500 Ask flow \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\t_submit() {\n\t\tconst text = this.$.textarea.value.trim();\n\t\tif (!text || this.busy) return;\n\t\tthis.$.textarea.value = '';\n\t\tthis._syncInput();\n\t\tthis.ask(text);\n\t}\n\n\t/**\n\t * Ask the concierge a question programmatically. Renders the exchange in the\n\t * panel, streams the answer, speaks it, persists the thread.\n\t * @returns {Promise<string>} the full answer text ('' on failure)\n\t */\n\tasync ask(text) {\n\t\tconst question = String(text || '').trim();\n\t\tif (!question || this.busy || this._destroyed) return '';\n\t\tthis.setOpen(true);\n\t\tthis._narrator?.cancel();\n\n\t\tif (!this.messages.length) this.$.thread.textContent = '';\n\t\tthis.messages.push({ role: 'user', content: question });\n\t\tthis.$.thread.appendChild(this._bubble('user', question));\n\t\tthis._persistThread();\n\t\tthis._emit('message', { role: 'user', content: question });\n\t\tthis._scrollThread();\n\n\t\tthis.busy = true;\n\t\tthis.$.send.disabled = true;\n\n\t\tconst typing = document.createElement('div');\n\t\ttyping.className = 'tc-typing';\n\t\ttyping.setAttribute('aria-label', 'Assistant is thinking');\n\t\ttyping.innerHTML = '<i></i><i></i><i></i>';\n\t\tthis.$.thread.appendChild(typing);\n\t\tthis._scrollThread();\n\n\t\tconst streamEl = document.createElement('div');\n\t\tstreamEl.className = 'tc-msg is-bot';\n\t\tlet streamed = '';\n\t\tlet spoken = ''; // buffer of not-yet-spoken text\n\t\tlet started = false;\n\n\t\tthis._abort = new AbortController();\n\t\tlet answer = '';\n\t\ttry {\n\t\t\tconst result = await askConcierge({\n\t\t\t\tendpoint: this.config.endpoint,\n\t\t\t\tmessage: question,\n\t\t\t\thistory: this.messages.slice(0, -1),\n\t\t\t\tsite: buildSitePayload(document, {\n\t\t\t\t\tknowledge: this.config.knowledge,\n\t\t\t\t\tsiteName: this.config.siteName,\n\t\t\t\t}),\n\t\t\t\tpersona: this.config.persona || undefined,\n\t\t\t\tlang: this.config.lang || undefined,\n\t\t\t\tsignal: this._abort.signal,\n\t\t\t\tonChunk: (chunk) => {\n\t\t\t\t\tif (!started) {\n\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\ttyping.remove();\n\t\t\t\t\t\tthis.$.thread.appendChild(streamEl);\n\t\t\t\t\t}\n\t\t\t\t\tstreamed += chunk;\n\t\t\t\t\tstreamEl.innerHTML = renderMarkdown(streamed) + '<span class=\"tc-caret\" aria-hidden=\"true\"></span>';\n\t\t\t\t\tthis._scrollThread();\n\t\t\t\t\t// Speak completed sentences while the rest still streams.\n\t\t\t\t\tspoken += chunk;\n\t\t\t\t\tconst { sentences, rest } = drainSentences(spoken);\n\t\t\t\t\tspoken = rest;\n\t\t\t\t\tfor (const s of sentences) {\n\t\t\t\t\t\tconst speakable = stripMarkdown(s);\n\t\t\t\t\t\tif (speakable) this._narrator?.speak(speakable);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\tanswer = result.text.trim();\n\t\t\tconst tail = stripMarkdown(spoken);\n\t\t\tif (tail) this._narrator?.speak(tail);\n\n\t\t\ttyping.remove();\n\t\t\tif (!answer) {\n\t\t\t\tstreamEl.remove();\n\t\t\t\tthis._renderErrorBubble(question, 'I could not come up with an answer just now.');\n\t\t\t} else {\n\t\t\t\tif (!started) this.$.thread.appendChild(streamEl);\n\t\t\t\tstreamEl.innerHTML = renderMarkdown(answer);\n\t\t\t\tthis.messages.push({ role: 'assistant', content: answer });\n\t\t\t\tthis._persistThread();\n\t\t\t\tthis._emit('message', { role: 'assistant', content: answer });\n\t\t\t}\n\t\t} catch (err) {\n\t\t\ttyping.remove();\n\t\t\tstreamEl.remove();\n\t\t\tif (err?.name !== 'AbortError') {\n\t\t\t\tconst friendly =\n\t\t\t\t\terr?.status === 429\n\t\t\t\t\t\t? 'I am getting a lot of questions right now, give me a few seconds and try again.'\n\t\t\t\t\t\t: 'Something went wrong reaching my brain. Check your connection and try again.';\n\t\t\t\tthis._renderErrorBubble(question, friendly);\n\t\t\t\tthis._emit('error', err instanceof Error ? err : new Error(String(err)));\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.busy = false;\n\t\t\tthis._abort = null;\n\t\t\tthis._syncInput();\n\t\t\tthis._scrollThread();\n\t\t\tthis.$.textarea.focus({ preventScroll: true });\n\t\t}\n\t\treturn answer;\n\t}\n\n\t_renderErrorBubble(question, message) {\n\t\tconst errEl = this._bubble('assistant', message, { error: true });\n\t\tthis.$.thread.appendChild(errEl);\n\t\tconst retry = document.createElement('button');\n\t\tretry.type = 'button';\n\t\tretry.className = 'tc-retry';\n\t\tretry.textContent = 'Try again';\n\t\tretry.addEventListener('click', () => {\n\t\t\t// Rewind the failed exchange (state + DOM) so the retry doesn't double it.\n\t\t\tretry.remove();\n\t\t\terrEl.remove();\n\t\t\tif (this.messages[this.messages.length - 1]?.role === 'user') {\n\t\t\t\tthis.messages.pop();\n\t\t\t\tthis._persistThread();\n\t\t\t\tconst bubbles = this.$.thread.querySelectorAll('.tc-msg.is-user');\n\t\t\t\tbubbles[bubbles.length - 1]?.remove();\n\t\t\t}\n\t\t\tthis.ask(question);\n\t\t});\n\t\tthis.$.thread.appendChild(retry);\n\t}\n\n\t/** Clear the conversation (UI + persistence). */\n\treset() {\n\t\tthis._abort?.abort();\n\t\tthis._narrator?.cancel();\n\t\tthis.messages = [];\n\t\tthis._persistThread();\n\t\tthis._renderThread();\n\t}\n\n\tdispose() {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\t\tthis._abort?.abort();\n\t\tthis._killTeaser();\n\t\tthis._mq?.removeEventListener?.('change', this._onScheme);\n\t\tthis._mic?.dispose();\n\t\tthis._narrator?.dispose();\n\t\tthis._stage?.dispose();\n\t\tthis.root?.remove();\n\t\tthis._listeners.clear();\n\t}\n}\n\nfunction getAvatarFrom(list, id) {\n\treturn list.find((a) => a.id === id) || list.find((a) => a.id === DEFAULT_AVATAR_ID) || list[0] || getAvatar(id);\n}\n\nfunction defaultSuggestions(siteName) {\n\tconst site = siteName || 'this site';\n\treturn [`What is ${site}?`, 'How do I get started?', 'What does it cost?'];\n}\n", "/**\n * <three-concierge> custom element: @three-ws/concierge\n * ======================================================\n *\n * Declarative wrapper around Concierge. The element itself is invisible (the\n * widget docks itself to the viewport corner); it exists so a site can add an\n * AI concierge with pure HTML:\n *\n * <three-concierge name=\"Atelier AI\" site-name=\"Atelier\"\n * suggestions=\"What is Atelier?|How much does it cost?\"\n * accent=\"#f97316\"></three-concierge>\n *\n * Attributes (all optional):\n * endpoint answer API (default: https://three.ws/api/concierge)\n * avatar initial catalog avatar id (sol | nova | vera | atlas | echo)\n * avatars comma-separated allow-list of catalog ids for the picker\n * custom-avatar URL of a rigged GLB to use instead of the catalog\n * asset-base override the GLB host\n * name assistant display name (default: the avatar's name)\n * site-name product/site name used in the greeting + grounding\n * greeting first line shown in the empty state and teaser\n * suggestions pipe-separated prompt chips (\"a|b|c\", max 4)\n * knowledge curated facts (FAQ, policies) the answers are grounded in\n * persona one-line tone instruction, e.g. \"warm, playful, concise\"\n * accent CSS color for the whole widget chrome\n * position bottom-right | bottom-left\n * theme auto | dark | light\n * lang BCP-47 hint for voice in/out\n * open present \u2192 start with the panel open\n * muted present \u2192 start with voice off\n * no-picker present \u2192 hide the avatar picker\n * no-teaser present \u2192 never show the proactive teaser bubble\n * z-index stacking override\n *\n * Methods proxy the controller: ask(text), open(), close(), reset(),\n * setAvatar(id), setMuted(bool). Events re-dispatch as DOM CustomEvents:\n * three-concierge:ready | :open | :close | :message | :agentchange | :error\n */\n\nimport { Concierge } from './widget.js';\n\nconst bool = (el, name) => el.hasAttribute(name);\n\nexport class ThreeConciergeElement extends HTMLElement {\n\tconnectedCallback() {\n\t\tif (this._widget) return;\n\t\tthis.style.display = 'none';\n\n\t\tthis._widget = new Concierge({\n\t\t\tendpoint: this.getAttribute('endpoint') || undefined,\n\t\t\tavatar: this.getAttribute('avatar') || undefined,\n\t\t\tavatars: this.getAttribute('avatars')?.split(',').map((s) => s.trim()).filter(Boolean),\n\t\t\tcustomAvatar: this.getAttribute('custom-avatar') || undefined,\n\t\t\tassetBase: this.getAttribute('asset-base') || undefined,\n\t\t\tname: this.getAttribute('name') || undefined,\n\t\t\tsiteName: this.getAttribute('site-name') || undefined,\n\t\t\tgreeting: this.getAttribute('greeting') || undefined,\n\t\t\tsuggestions: this.getAttribute('suggestions')?.split('|').map((s) => s.trim()).filter(Boolean),\n\t\t\tknowledge: this.getAttribute('knowledge') || undefined,\n\t\t\tpersona: this.getAttribute('persona') || undefined,\n\t\t\taccent: this.getAttribute('accent') || undefined,\n\t\t\tposition: this.getAttribute('position') || undefined,\n\t\t\ttheme: this.getAttribute('theme') || undefined,\n\t\t\tlang: this.getAttribute('lang') || undefined,\n\t\t\topen: bool(this, 'open'),\n\t\t\tmuted: bool(this, 'muted'),\n\t\t\tpicker: !bool(this, 'no-picker'),\n\t\t\tteaser: !bool(this, 'no-teaser'),\n\t\t\tzIndex: this.getAttribute('z-index') ? Number(this.getAttribute('z-index')) : undefined,\n\t\t});\n\n\t\tfor (const ev of ['ready', 'open', 'close', 'message', 'agentchange', 'error']) {\n\t\t\tthis._widget.on(ev, (detail) => {\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent(`three-concierge:${ev}`, { detail, bubbles: true, composed: true }),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis._widget?.dispose();\n\t\tthis._widget = null;\n\t}\n\n\t// \u2500\u2500 Imperative API proxy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\task(text) {\n\t\treturn this._widget?.ask(text);\n\t}\n\topen() {\n\t\tthis._widget?.setOpen(true);\n\t}\n\tclose() {\n\t\tthis._widget?.setOpen(false);\n\t}\n\treset() {\n\t\tthis._widget?.reset();\n\t}\n\tsetAvatar(id) {\n\t\treturn this._widget?.setAvatar(id);\n\t}\n\tsetMuted(muted) {\n\t\tthis._widget?.setMuted(muted);\n\t}\n\tget controller() {\n\t\treturn this._widget;\n\t}\n}\n\nexport function registerElement(tag = 'three-concierge') {\n\tif (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n\t\tcustomElements.define(tag, ThreeConciergeElement);\n\t}\n\treturn tag;\n}\n", "/**\n * CDN entry: @three-ws/concierge\n * ===============================\n *\n * The one-tag build: bundles the whole widget (three inlined), registers\n * <three-concierge>, runs the `data-concierge` script auto-init, and exposes\n * the API at window.ThreeWsConcierge for script consumers.\n */\n\nimport * as api from './index.js';\n\nif (typeof window !== 'undefined') {\n\twindow.ThreeWsConcierge = api;\n\twindow.Concierge = window.Concierge || api.Concierge;\n}\n"],
+ "mappings": ";sLAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,oBAAAE,KAAA,IAEIA,GAFJC,GAAAC,GAAA,KAEIF,IAAkB,UAAY,CAGjC,IAAIG,EACH,yvSACGC,EACH,28aAEGC,EAAW,IAAI,WAAW,CAC7B,EAAG,GAAI,IAAK,IAAK,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EAAG,EAAG,GAAI,GAAI,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,EAAG,IAAK,GAAI,EAAG,EAC3I,GAAI,EAAG,EAAG,GAAI,EAAG,IAAK,GAAI,GAAI,EAC/B,CAAC,EACGC,EAAW,IAAI,WAAW,CAC7B,GAAI,EAAG,GAAI,EAAG,EAAG,IAAK,GAAI,GAAI,EAAG,IAAK,GAAI,EAAG,GAAI,GAAI,EAAG,IAAK,GAAI,EAAG,GAAI,IAAK,IAAK,E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AAMA,EAAE,MAAQ,OAChB,SAAUA,EAAE,UAAY,OACxB,SAAUA,EAAE,UAAY,OACxB,YAAaA,EAAE,aAAa,MAAM,GAAG,EAAE,IAAKC,GAAMA,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO,EAC1E,UAAWD,EAAE,WAAa,OAC1B,QAASA,EAAE,SAAW,OACtB,OAAQA,EAAE,QAAU,OACpB,SAAUA,EAAE,UAAY,OACxB,MAAOA,EAAE,OAAS,OAClB,KAAMA,EAAE,MAAQ,OAChB,KAAM,SAAUA,EAChB,MAAO,UAAWA,EAClB,OAAQ,EAAE,aAAcA,GACxB,OAAQ,EAAE,aAAcA,GACxB,OAAQA,EAAE,OAAS,OAAOA,EAAE,MAAM,EAAI,MACvC,CAAC,CACF,CAEI,OAAO,OAAW,MACjB,SAAS,aAAe,UAC3B,SAAS,iBAAiB,mBAAoBF,GAAU,CAAE,KAAM,EAAK,CAAC,EAEtEA,GAAS,GAIX,IAAOI,GAAQL,GkB3FX,OAAO,OAAW,MACrB,OAAO,iBAAmBM,GAC1B,OAAO,UAAY,OAAO,WAAiBC",
+ "names": ["meshopt_decoder_module_exports", "__export", "MeshoptDecoder", "init_meshopt_decoder_module", "__esmMin", "wasm_base", "wasm_simd", "detector", "wasmpack", "wasm", "unpack", "instance", "ready", "result", "data", "i", "ch", "write", "decode", "fun", "target", "count", "size", "source", "filter", "sbrk", "count4", "tp", "sp", "heap", "res", "filters", "decoders", "workers", "requestId", "createWorker", "url", "worker", "event", "initWorkers", "workerProcess", "blob", "decodeWorker", "mode", "resolve", "reject", "id", "error", "index_exports", "__export", "AVATARS", "AvatarStage", "CSS", "Concierge", "DEFAULT_ASSET_BASE", "DEFAULT_AVATAR_ID", "DEFAULT_ENDPOINT", "MAX_CONTENT_CHARS", "MAX_HISTORY_TURNS", "MAX_KNOWLEDGE_CHARS", "SpeechNarrator", "ThreeConciergeElement", "VERSION", "askConcierge", "avatarUrl", "buildMorphMap", "buildSitePayload", "createLipsync", "createMic", "createSseBuffer", "customAvatarEntry", "index_default", "drainSentences", "ensureStyles", "escapeHtml", "estimateDurationMs", "getAvatar", "harvestSiteContext", "micSupported", "mount", "parseSseEvent", "registerElement", "renderMarkdown", "stripMarkdown", "CullFaceNone", "CullFaceBack", "CullFaceFront", "PCFShadowMap", "PCFSoftShadowMap", "VSMShadowMap", "FrontSide", "BackSide", "DoubleSide", "NoBlending", "NormalBlending", "AdditiveBlending", "SubtractiveBlending", "MultiplyBlending", "CustomBlending", "AddEquation", "SubtractEquation", "ReverseSubtractEquation", "MinEquation", "MaxEquation", "ZeroFactor", "OneFactor", "SrcColorFactor", "OneMinusSrcColorFactor", "SrcAlphaFactor", "OneMinusSrcAlphaFactor", "DstAlphaFactor", "OneMinusDstAlphaFactor", "DstColorFactor", "OneMinusDstColorFactor", "SrcAlphaSaturateFactor", "ConstantColorFactor", "OneMinusConstantColorFactor", "ConstantAlphaFactor", "OneMinusConstantAlphaFactor", "NeverDepth", "AlwaysDepth", "LessDepth", "LessEqualDepth", "EqualDepth", "GreaterEqualDepth", "GreaterDepth", "NotEqualDepth", "MultiplyOperation", "MixOperation", "AddOperation", "NoToneMapping", "LinearToneMapping", "ReinhardToneMapping", "CineonToneMapping", "ACESFilmicToneMapping", "CustomToneMapping", "AgXToneMapping", "NeutralToneMapping", "AttachedBindMode", "DetachedBindMode", "UVMapping", "CubeReflectionMapping", "CubeRefractionMapping", "EquirectangularReflectionMapping", "EquirectangularRefractionMapping", "CubeUVReflectionMapping", "RepeatWrapping", "ClampToEdgeWrapping", "MirroredRepeatWrapping", "NearestFilter", "NearestMipmapNearestFilter", "NearestMipmapLinearFilter", "LinearFilter", "LinearMipmapNearestFilter", "LinearMipmapLinearFilter", "UnsignedByteType", "ByteType", "ShortType", "UnsignedShortType", "IntType", "UnsignedIntType", "FloatType", "HalfFloatType", "UnsignedShort4444Type", "UnsignedShort5551Type", "UnsignedInt248Type", "UnsignedInt5999Type", "UnsignedInt101111Type", "AlphaFormat", "RGBFormat", "RGBAFormat", "DepthFormat", "DepthStencilFormat", "RedFormat", "RedIntegerFormat", "RGFormat", "RGIntegerFormat", "RGBAIntegerFormat", "RGB_S3TC_DXT1_Format", "RGBA_S3TC_DXT1_Format", "RGBA_S3TC_DXT3_Format", "RGBA_S3TC_DXT5_Format", "RGB_PVRTC_4BPPV1_Format", "RGB_PVRTC_2BPPV1_Format", "RGBA_PVRTC_4BPPV1_Format", "RGBA_PVRTC_2BPPV1_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "RGBA_ETC2_EAC_Format", "R11_EAC_Format", "SIGNED_R11_EAC_Format", "RG11_EAC_Format", "SIGNED_RG11_EAC_Format", "RGBA_ASTC_4x4_Format", "RGBA_ASTC_5x4_Format", "RGBA_ASTC_5x5_Format", "RGBA_ASTC_6x5_Format", "RGBA_ASTC_6x6_Format", "RGBA_ASTC_8x5_Format", "RGBA_ASTC_8x6_Format", "RGBA_ASTC_8x8_Format", "RGBA_ASTC_10x5_Format", "RGBA_ASTC_10x6_Format", "RGBA_ASTC_10x8_Format", "RGBA_ASTC_10x10_Format", "RGBA_ASTC_12x10_Format", "RGBA_ASTC_12x12_Format", "RGBA_BPTC_Format", "RGB_BPTC_SIGNED_Format", "RGB_BPTC_UNSIGNED_Format", "RED_RGTC1_Format", "SIGNED_RED_RGTC1_Format", "RED_GREEN_RGTC2_Format", "SIGNED_RED_GREEN_RGTC2_Format", "LoopOnce", "LoopRepeat", "LoopPingPong", "InterpolateDiscrete", "InterpolateLinear", "InterpolateSmooth", "InterpolateBezier", "ZeroCurvatureEnding", "ZeroSlopeEnding", "WrapAroundEnding", "NormalAnimationBlendMode", "AdditiveAnimationBlendMode", "TrianglesDrawMode", "TriangleStripDrawMode", "TriangleFanDrawMode", "BasicDepthPacking", "TangentSpaceNormalMap", "ObjectSpaceNormalMap", "NoColorSpace", "SRGBColorSpace", "LinearSRGBColorSpace", "LinearTransfer", "SRGBTransfer", "KeepStencilOp", "AlwaysStencilFunc", "NeverCompare", "LessCompare", "EqualCompare", "LessEqualCompare", "GreaterCompare", "NotEqualCompare", "GreaterEqualCompare", "AlwaysCompare", "StaticDrawUsage", "GLSL3", "WebGLCoordinateSystem", "WebGPUCoordinateSystem", "arrayNeedsUint32", "array", "i", "isTypedArray", "array", "createElementNS", "name", "createCanvasElement", "canvas", "_cache", "_setConsoleFunction", "log", "params", "message", "_setConsoleFunction", "enhanceLogMessage", "stackTrace", "warn", "error", "warnOnce", "_cache", "probeAsync", "gl", "sync", "interval", "resolve", "reject", "probe", "ReversedDepthFuncs", "NeverDepth", "AlwaysDepth", "LessDepth", "GreaterDepth", "EqualDepth", "NotEqualDepth", "LessEqualDepth", "GreaterEqualDepth", "EventDispatcher", "type", "listener", "listeners", "listenerArray", "index", "event", "array", "i", "l", "_lut", "_seed", "DEG2RAD", "RAD2DEG", "generateUUID", "d0", "d1", "d2", "d3", "clamp", "value", "min", "max", "euclideanModulo", "n", "m", "mapLinear", "x", "a1", "a2", "b1", "b2", "inverseLerp", "y", "lerp", "damp", "lambda", "dt", "pingpong", "length", "smoothstep", "smootherstep", "randInt", "low", "high", "randFloat", "randFloatSpread", "range", "seededRandom", "t", "degToRad", "degrees", "radToDeg", "radians", "isPowerOfTwo", "ceilPowerOfTwo", "floorPowerOfTwo", "setQuaternionFromProperEuler", "q", "a", "b", "c", "order", "cos", "sin", "c2", "s2", "c13", "s13", "c1_3", "s1_3", "c3_1", "s3_1", "warn", "denormalize", "normalize", "MathUtils", "_Vector2", "scalar", "v", "s", "e", "minVal", "maxVal", "denominator", "theta", "dx", "dy", "alpha", "v1", "v2", "offset", "attribute", "center", "angle", "Vector2", "Quaternion", "z", "w", "dst", "dstOffset", "src0", "srcOffset0", "src1", "srcOffset1", "x0", "y0", "z0", "w0", "x1", "y1", "z1", "w1", "dot", "f", "quaternion", "euler", "update", "c1", "c3", "s1", "s3", "axis", "halfAngle", "te", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "trace", "vFrom", "vTo", "r", "step", "qax", "qay", "qaz", "qaw", "qbx", "qby", "qbz", "qbw", "qb", "qa", "theta1", "theta2", "r1", "r2", "callback", "_Vector3", "_quaternion$5", "vx", "vy", "vz", "qx", "qy", "qz", "qw", "tx", "ty", "tz", "camera", "ax", "ay", "az", "bx", "by", "bz", "planeNormal", "_vector$c", "normal", "dz", "radius", "phi", "sinPhiRadius", "sx", "sy", "sz", "u", "Vector3", "_Matrix3", "n11", "n12", "n13", "n21", "n22", "n23", "n31", "n32", "n33", "me", "xAxis", "yAxis", "zAxis", "ae", "be", "a11", "a12", "a13", "a21", "a22", "a23", "a31", "a32", "a33", "b11", "b12", "b13", "b21", "b22", "b23", "b31", "b32", "b33", "d", "g", "h", "t11", "t12", "t13", "det", "detInv", "tmp", "matrix4", "rotation", "cx", "cy", "_m3", "matrix", "Matrix3", "LINEAR_REC709_TO_XYZ", "XYZ_TO_LINEAR_REC709", "createColorManagement", "ColorManagement", "LinearSRGBColorSpace", "color", "sourceColorSpace", "targetColorSpace", "SRGBTransfer", "SRGBToLinear", "LinearToSRGB", "colorSpace", "NoColorSpace", "LinearTransfer", "target", "colorSpaces", "targetMatrix", "warnOnce", "REC709_PRIMARIES", "REC709_LUMINANCE_COEFFICIENTS", "D65", "SRGBColorSpace", "_canvas", "ImageUtils", "image", "canvas", "createElementNS", "context", "imageData", "data", "_sourceId", "Source", "meta", "isRootObject", "output", "url", "serializeImage", "_textureId", "_tempVec3", "Texture", "_Texture", "mapping", "wrapS", "ClampToEdgeWrapping", "wrapT", "magFilter", "LinearFilter", "minFilter", "LinearMipmapLinearFilter", "format", "RGBAFormat", "UnsignedByteType", "anisotropy", "start", "count", "source", "values", "key", "newValue", "currentValue", "uv", "UVMapping", "RepeatWrapping", "MirroredRepeatWrapping", "_Vector4", "xx", "yy", "zz", "xy", "xz", "yz", "Vector4", "RenderTarget", "width", "height", "options", "texture", "current", "depth", "il", "WebGLRenderTarget", "DataArrayTexture", "NearestFilter", "layerIndex", "Data3DTexture", "Texture", "data", "width", "height", "depth", "NearestFilter", "ClampToEdgeWrapping", "_Matrix4", "n11", "n12", "n13", "n14", "n21", "n22", "n23", "n24", "n31", "n32", "n33", "n34", "n41", "n42", "n43", "n44", "te", "m", "me", "xAxis", "yAxis", "zAxis", "scaleX", "_v1$7", "scaleY", "scaleZ", "euler", "x", "y", "z", "b", "d", "e", "f", "ae", "af", "be", "bf", "ce", "cf", "de", "df", "ac", "ad", "bc", "bd", "q", "_zero", "_one", "eye", "target", "up", "_z", "_x", "_y", "a", "a11", "a12", "a13", "a14", "a21", "a22", "a23", "a24", "a31", "a32", "a33", "a34", "a41", "a42", "a43", "a44", "b11", "b12", "b13", "b14", "b21", "b22", "b23", "b24", "b31", "b32", "b33", "b34", "b41", "b42", "b43", "b44", "s", "t11", "t12", "t13", "t21", "t22", "t23", "tmp", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "t10", "det", "detInv", "v", "scaleXSq", "scaleYSq", "scaleZSq", "theta", "c", "axis", "angle", "t", "tx", "ty", "xy", "xz", "yx", "yz", "zx", "zy", "position", "quaternion", "scale", "w", "x2", "y2", "z2", "xx", "yy", "zz", "wx", "wy", "wz", "sx", "sy", "sz", "_m1$2", "invSX", "invSY", "invSZ", "left", "right", "top", "bottom", "near", "far", "coordinateSystem", "WebGLCoordinateSystem", "reversedDepth", "WebGPUCoordinateSystem", "matrix", "array", "offset", "i", "Matrix4", "Vector3", "_matrix$2", "_quaternion$4", "Quaternion", "Euler", "_Euler", "order", "value", "update", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "clamp", "warn", "newOrder", "callback", "Layers", "layer", "layers", "_object3DId", "_v1$6", "_q1", "_m1$1", "_target", "_position$4", "_scale$3", "_quaternion$3", "_xAxis", "_yAxis", "_zAxis", "_addedEvent", "_removedEvent", "_childaddedEvent", "_childremovedEvent", "Object3D", "_Object3D", "EventDispatcher", "generateUUID", "rotation", "onRotationChange", "onQuaternionChange", "Matrix3", "distance", "vector", "parent", "object", "error", "index", "id", "name", "l", "result", "children", "pivot", "px", "py", "pz", "force", "updateParents", "updateChildren", "meta", "isRootObject", "output", "info", "serialize", "library", "element", "parameters", "shapes", "shape", "uuids", "animation", "geometries", "extractFromCache", "materials", "textures", "images", "skeletons", "animations", "nodes", "cache", "values", "key", "data", "recursive", "source", "child", "Group", "_moveEvent", "WebXRController", "event", "inputSource", "hand", "inputjoint", "frame", "referenceSpace", "inputPose", "gripPose", "handPose", "targetRay", "grip", "jointPose", "joint", "indexTip", "thumbTip", "distanceToPinch", "threshold", "_colorKeywords", "_hslA", "_hslB", "hue2rgb", "p", "Color", "r", "g", "scalar", "hex", "colorSpace", "SRGBColorSpace", "ColorManagement", "h", "euclideanModulo", "style", "handleAlpha", "string", "color", "components", "size", "SRGBToLinear", "LinearToSRGB", "_color", "max", "min", "hue", "saturation", "lightness", "delta", "color1", "color2", "alpha", "lerp", "attribute", "Scene", "Object3D", "Euler", "source", "recursive", "meta", "data", "_v0$2", "Vector3", "_v1$5", "_v2$4", "_v3$2", "_vab", "_vac", "_vbc", "_vap", "_vbp", "_vcp", "_v40", "Vector4", "_v41", "_v42", "Triangle", "_Triangle", "a", "b", "c", "target", "targetLengthSq", "point", "dot00", "dot01", "dot02", "dot11", "dot12", "denom", "invDenom", "u", "v", "p1", "p2", "p3", "v1", "v2", "v3", "attr", "i1", "i2", "i3", "barycoord", "direction", "points", "i0", "attribute", "triangle", "box", "p", "w", "d1", "d2", "d3", "d4", "vc", "d5", "d6", "vb", "va", "Box3", "min", "max", "array", "i", "il", "_vector$b", "center", "size", "halfSize", "object", "precise", "vector", "scalar", "geometry", "positionAttribute", "l", "_box$4", "children", "sphere", "plane", "_center", "_extents", "_v0$1", "_v1$4", "_v2$3", "_f0", "_f1", "_f2", "axes", "satForAxes", "_triangleNormal", "matrix", "_points", "offset", "json", "_testAxis", "v0", "extents", "j", "r", "p0", "_vector$a", "Vector3", "_vector2$1", "Vector2", "_id$2", "BufferAttribute", "EventDispatcher", "array", "itemSize", "normalized", "StaticDrawUsage", "FloatType", "value", "start", "count", "source", "index1", "attribute", "index2", "l", "m", "i", "offset", "index", "component", "denormalize", "normalize", "x", "y", "z", "w", "callback", "data", "Uint16BufferAttribute", "BufferAttribute", "array", "itemSize", "normalized", "Uint32BufferAttribute", "BufferAttribute", "array", "itemSize", "normalized", "Float32BufferAttribute", "BufferAttribute", "array", "itemSize", "normalized", "_box$3", "Box3", "_v1$3", "Vector3", "_v2$2", "Sphere", "center", "radius", "points", "optionalCenter", "maxRadiusSq", "i", "il", "sphere", "point", "radiusSum", "box", "plane", "target", "deltaLengthSq", "matrix", "offset", "lengthSq", "length", "delta", "json", "_id$1", "_m1", "Matrix4", "_obj", "Object3D", "_offset", "_box$2", "_boxMorphTargets", "_vector$9", "BufferGeometry", "_BufferGeometry", "EventDispatcher", "generateUUID", "index", "arrayNeedsUint32", "Uint32BufferAttribute", "Uint16BufferAttribute", "indirect", "indirectOffset", "name", "attribute", "start", "count", "materialIndex", "position", "normal", "normalMatrix", "Matrix3", "tangent", "q", "angle", "x", "y", "z", "vector", "positionAttribute", "l", "warn", "morphAttributesPosition", "error", "morphAttribute", "morphTargetsRelative", "j", "jl", "attributes", "normalAttribute", "uvAttribute", "tangentAttribute", "tan1", "tan2", "vA", "vB", "vC", "uvA", "Vector2", "uvB", "uvC", "sdir", "tdir", "handleTriangle", "a", "b", "c", "r", "groups", "group", "tmp", "tmp2", "n", "n2", "handleVertex", "v", "t", "w", "pA", "pB", "pC", "nA", "nB", "nC", "cb", "ab", "normals", "convertBufferAttribute", "indices", "array2", "index2", "geometry2", "newAttribute", "morphAttributes", "morphArray", "data", "parameters", "key", "hasMorphAttributes", "attributeArray", "boundingSphere", "source", "boundingBox", "InterleavedBuffer", "stride", "StaticDrawUsage", "value", "index1", "interleavedBuffer", "ib", "callback", "_vector$8", "InterleavedBufferAttribute", "_InterleavedBufferAttribute", "m", "component", "denormalize", "normalize", "log", "_materialId", "Material", "NormalBlending", "FrontSide", "SrcAlphaFactor", "OneMinusSrcAlphaFactor", "AddEquation", "Color", "LessEqualDepth", "AlwaysStencilFunc", "KeepStencilOp", "values", "newValue", "currentValue", "meta", "isRootObject", "extractFromCache", "cache", "textures", "images", "srcPlanes", "dstPlanes", "_vector$7", "Vector3", "_segCenter", "_segDir", "_diff", "_edge1", "_edge2", "_normal$1", "Ray", "origin", "direction", "ray", "t", "target", "v", "point", "directionDistance", "v0", "v1", "optionalPointOnRay", "optionalPointOnSegment", "segExtent", "a01", "b0", "b1", "c", "det", "s0", "s1", "sqrDist", "extDet", "invDet", "sphere", "tca", "d2", "radius2", "thc", "t0", "t1", "plane", "denominator", "distToPoint", "box", "tmin", "tmax", "tymin", "tymax", "tzmin", "tzmax", "invdirx", "invdiry", "invdirz", "a", "b", "backfaceCulling", "DdN", "sign", "DdQxE2", "DdE1xQ", "QdN", "matrix4", "MeshBasicMaterial", "Material", "parameters", "Color", "Euler", "MultiplyOperation", "source", "_inverseMatrix$3", "Matrix4", "_ray$3", "_sphere$6", "Sphere", "_sphereHitAt", "_vA", "_vB", "_vC", "_tempA", "_morphA", "_intersectionPoint", "_intersectionPointWorld", "Mesh", "Object3D", "geometry", "BufferGeometry", "material", "recursive", "morphAttributes", "keys", "morphAttribute", "m", "ml", "name", "index", "position", "morphPosition", "morphTargetsRelative", "morphInfluences", "i", "il", "influence", "raycaster", "intersects", "matrixWorld", "rayLocalSpace", "intersection", "uv", "uv1", "normal", "groups", "drawRange", "group", "groupMaterial", "start", "end", "j", "jl", "checkGeometryIntersection", "checkIntersection$1", "object", "pA", "pB", "pC", "intersect", "BackSide", "FrontSide", "distance", "barycoord", "Triangle", "Vector2", "face", "_baseVector", "Vector4", "_skinIndex", "_skinWeight", "_vector4", "_matrix4", "_vertex", "_sphere$5", "_inverseMatrix$2", "_ray$2", "SkinnedMesh", "AttachedBindMode", "Box3", "positionAttribute", "skeleton", "bindMatrix", "vector", "skinWeight", "l", "scale", "force", "DetachedBindMode", "warn", "weight", "boneIndex", "Bone", "DataTexture", "Texture", "data", "width", "height", "format", "type", "mapping", "wrapS", "wrapT", "magFilter", "NearestFilter", "minFilter", "anisotropy", "colorSpace", "_offsetMatrix", "_identityMatrix", "Skeleton", "_Skeleton", "bones", "boneInverses", "generateUUID", "inverse", "bone", "boneMatrices", "boneTexture", "matrix", "size", "RGBAFormat", "FloatType", "json", "uuid", "boneInverse", "InstancedBufferAttribute", "BufferAttribute", "array", "itemSize", "normalized", "meshPerAttribute", "_instanceLocalMatrix", "_instanceWorldMatrix", "_instanceIntersects", "_box3", "_identity", "_mesh$1", "_sphere$4", "InstancedMesh", "count", "color", "objectInfluences", "len", "dataIndex", "raycastTimes", "instanceId", "RedFormat", "morphInfluencesSum", "morphBaseInfluence", "_vector1", "_vector2", "_normalMatrix", "Matrix3", "Plane", "constant", "x", "y", "z", "w", "inverseNormalLength", "line", "clampToLine", "startSign", "endSign", "optionalNormalMatrix", "normalMatrix", "referencePoint", "offset", "_sphere$3", "_defaultSpriteCenter", "_vector$6", "Frustum", "p0", "p1", "p2", "p3", "p4", "p5", "planes", "frustum", "coordinateSystem", "WebGLCoordinateSystem", "reversedDepth", "me", "me0", "me1", "me2", "me3", "me4", "me5", "me6", "me7", "me8", "me9", "me10", "me11", "me12", "me13", "me14", "me15", "WebGPUCoordinateSystem", "sprite", "center", "negRadius", "LineBasicMaterial", "Material", "parameters", "Color", "source", "_vStart", "Vector3", "_vEnd", "_inverseMatrix$1", "Matrix4", "_ray$1", "Ray", "_sphere$1", "Sphere", "_intersectPointOnRay", "_intersectPointOnSegment", "Line", "Object3D", "geometry", "BufferGeometry", "material", "recursive", "positionAttribute", "lineDistances", "l", "Float32BufferAttribute", "warn", "raycaster", "intersects", "matrixWorld", "threshold", "drawRange", "localThreshold", "localThresholdSq", "step", "index", "start", "end", "i", "a", "b", "intersect", "checkIntersection", "morphAttributes", "keys", "morphAttribute", "m", "ml", "name", "object", "ray", "thresholdSq", "distance", "_start", "_end", "LineSegments", "LineLoop", "PointsMaterial", "_inverseMatrix", "_ray", "_sphere", "_position$3", "Points", "il", "testPoint", "point", "rayPointDistanceSq", "intersectPoint", "CubeTexture", "Texture", "images", "mapping", "CubeReflectionMapping", "wrapS", "wrapT", "magFilter", "minFilter", "format", "type", "anisotropy", "colorSpace", "value", "DepthTexture", "Texture", "width", "height", "type", "UnsignedIntType", "mapping", "wrapS", "wrapT", "magFilter", "NearestFilter", "minFilter", "anisotropy", "format", "DepthFormat", "depth", "DepthStencilFormat", "image", "source", "Source", "meta", "data", "CubeDepthTexture", "size", "CubeReflectionMapping", "images", "value", "ExternalTexture", "sourceTexture", "BoxGeometry", "_BoxGeometry", "BufferGeometry", "widthSegments", "heightSegments", "depthSegments", "scope", "indices", "vertices", "normals", "uvs", "numberOfVertices", "groupStart", "buildPlane", "Float32BufferAttribute", "u", "v", "w", "udir", "vdir", "gridX", "gridY", "materialIndex", "segmentWidth", "segmentHeight", "widthHalf", "heightHalf", "depthHalf", "gridX1", "gridY1", "vertexCounter", "groupCount", "vector", "Vector3", "iy", "y", "ix", "x", "a", "b", "c", "d", "PlaneGeometry", "_PlaneGeometry", "BufferGeometry", "width", "height", "widthSegments", "heightSegments", "width_half", "height_half", "gridX", "gridY", "gridX1", "gridY1", "segment_width", "segment_height", "indices", "vertices", "normals", "uvs", "iy", "y", "ix", "x", "a", "b", "c", "d", "Float32BufferAttribute", "source", "data", "cloneUniforms", "src", "dst", "u", "p", "property", "isThreeObject", "warn", "clonedProperty", "i", "l", "mergeUniforms", "uniforms", "merged", "tmp", "cloneUniformsGroups", "getUnlitUniformColorSpace", "renderer", "currentRenderTarget", "ColorManagement", "UniformsUtils", "default_vertex", "default_fragment", "ShaderMaterial", "Material", "parameters", "source", "meta", "data", "name", "value", "extensions", "key", "RawShaderMaterial", "MeshStandardMaterial", "Color", "TangentSpaceNormalMap", "Vector2", "Euler", "MeshPhysicalMaterial", "clamp", "reflectivity", "MeshLambertMaterial", "Material", "parameters", "Color", "TangentSpaceNormalMap", "Vector2", "Euler", "MultiplyOperation", "source", "MeshDepthMaterial", "BasicDepthPacking", "MeshDistanceMaterial", "convertArray", "array", "type", "getKeyframeOrder", "times", "compareTime", "j", "n", "result", "sortedArray", "values", "stride", "order", "nValues", "i", "dstOffset", "srcOffset", "flattenJSON", "jsonKeys", "valuePropertyName", "key", "value", "Interpolant", "parameterPositions", "sampleValues", "sampleSize", "resultBuffer", "t", "pp", "i1", "t1", "t0", "validate_interval", "seek", "right", "linear_scan", "forward_scan", "giveUpAt", "t1global", "mid", "index", "result", "values", "stride", "offset", "i", "CubicInterpolant", "ZeroCurvatureEnding", "iPrev", "iNext", "tPrev", "tNext", "ZeroSlopeEnding", "WrapAroundEnding", "halfDt", "o1", "o0", "oP", "oN", "wP", "wN", "p", "ppp", "sP", "s0", "s1", "sN", "LinearInterpolant", "offset1", "offset0", "weight1", "weight0", "DiscreteInterpolant", "BezierInterpolant", "settings", "inTangents", "outTangents", "tangentStride", "i0", "v0", "v1", "outTangentOffset", "c0x", "c0y", "inTangentOffset", "c1x", "c1y", "s", "s2", "s3", "oneMinusS", "oneMinusS2", "oneMinusS3", "iter", "error", "dbx", "KeyframeTrack", "name", "times", "interpolation", "convertArray", "track", "trackType", "json", "interpolant", "factoryMethod", "InterpolateDiscrete", "InterpolateLinear", "InterpolateSmooth", "InterpolateBezier", "message", "warn", "timeOffset", "n", "timeScale", "startTime", "endTime", "nKeys", "from", "to", "valid", "valueSize", "prevTime", "currTime", "isTypedArray", "value", "smoothInterpolation", "lastIndex", "writeIndex", "keep", "time", "timeNext", "offsetP", "offsetN", "j", "readOffset", "writeOffset", "TypedKeyframeTrack", "BooleanKeyframeTrack", "ColorKeyframeTrack", "NumberKeyframeTrack", "QuaternionLinearInterpolant", "alpha", "end", "Quaternion", "QuaternionKeyframeTrack", "StringKeyframeTrack", "VectorKeyframeTrack", "AnimationClip", "duration", "tracks", "blendMode", "NormalAnimationBlendMode", "generateUUID", "jsonTracks", "frameTime", "parseKeyframeTrack", "clip", "clipTracks", "morphTargetSequence", "fps", "noLoop", "numMorphTargets", "order", "getKeyframeOrder", "sortedArray", "objectOrClipArray", "clipArray", "o", "morphTargets", "animationToMorphTargets", "pattern", "il", "morphTarget", "parts", "animationMorphTargets", "clips", "animation", "bones", "addNonemptyTrack", "trackName", "animationKeys", "propertyName", "destTracks", "flattenJSON", "clipName", "hierarchyTracks", "h", "morphTargetNames", "k", "m", "morphTargetName", "animationKey", "boneName", "getTrackTypeForValueTypeName", "typeName", "Cache", "key", "file", "isBlobURL", "urlString", "LoadingManager", "onLoad", "onProgress", "onError", "scope", "isLoading", "itemsLoaded", "itemsTotal", "urlModifier", "handlers", "url", "transform", "regex", "loader", "l", "DefaultLoadingManager", "Loader", "manager", "resolve", "reject", "crossOrigin", "path", "resourcePath", "requestHeader", "loading", "HttpError", "response", "FileLoader", "cached", "req", "mimeType", "responseType", "callbacks", "reader", "contentLength", "total", "lengthComputable", "loaded", "stream", "controller", "readData", "done", "event", "callback", "e", "text", "exec", "label", "decoder", "ab", "data", "err", "_loading", "ImageLoader", "Loader", "manager", "url", "onLoad", "onProgress", "onError", "scope", "cached", "Cache", "arr", "image", "createElementNS", "onImageLoad", "removeEventListeners", "callbacks", "i", "callback", "onImageError", "event", "TextureLoader", "Loader", "manager", "url", "onLoad", "onProgress", "onError", "texture", "Texture", "loader", "ImageLoader", "image", "Light", "Object3D", "color", "intensity", "Color", "source", "recursive", "meta", "data", "_projScreenMatrix", "Matrix4", "_lightPositionWorld", "Vector3", "_lookTarget", "LightShadow", "camera", "Vector2", "UnsignedByteType", "Frustum", "Vector4", "light", "shadowCamera", "shadowMatrix", "WebGPUCoordinateSystem", "viewportIndex", "source", "object", "_position$2", "_quaternion$2", "Quaternion", "_scale$2", "Camera", "Object3D", "WebGLCoordinateSystem", "recursive", "target", "force", "updateParents", "updateChildren", "_v3$1", "_minTarget", "_maxTarget", "PerspectiveCamera", "fov", "aspect", "near", "far", "focalLength", "vExtentSlope", "RAD2DEG", "DEG2RAD", "distance", "minTarget", "maxTarget", "fullWidth", "fullHeight", "x", "y", "width", "height", "top", "left", "view", "skew", "meta", "data", "SpotLightShadow", "SpotLight", "Light", "color", "intensity", "angle", "penumbra", "decay", "power", "PointLightShadow", "PointLight", "OrthographicCamera", "right", "bottom", "dx", "dy", "cx", "cy", "scaleW", "scaleH", "DirectionalLightShadow", "DirectionalLight", "AmbientLight", "LoaderUtils", "url", "index", "path", "_errorMap", "ImageBitmapLoader", "Loader", "manager", "warn", "options", "url", "onLoad", "onProgress", "onError", "scope", "cached", "Cache", "imageBitmap", "fetchOptions", "promise", "res", "blob", "e", "fov", "aspect", "CubeCamera", "Object3D", "near", "far", "renderTarget", "cameraPX", "PerspectiveCamera", "cameraNX", "cameraPY", "cameraNY", "cameraPZ", "cameraNZ", "coordinateSystem", "cameras", "camera", "WebGLCoordinateSystem", "WebGPUCoordinateSystem", "renderer", "scene", "activeMipmapLevel", "currentRenderTarget", "currentActiveCubeFace", "currentActiveMipmapLevel", "currentXrEnabled", "generateMipmaps", "reversedDepthBuffer", "ArrayCamera", "array", "PropertyMixer", "binding", "typeName", "valueSize", "mixFunction", "mixFunctionAdditive", "setIdentity", "accuIndex", "weight", "buffer", "stride", "offset", "currentWeight", "i", "mix", "weightAdditive", "originalValueOffset", "e", "startIndex", "endIndex", "targetIndex", "dstOffset", "srcOffset", "t", "Quaternion", "workOffset", "s", "j", "_RESERVED_CHARS_RE", "_reservedRe", "_wordChar", "_wordCharOrDot", "_directoryRe", "_nodeRe", "_objectRe", "_propertyRe", "_trackRe", "_supportedObjectNames", "Composite", "targetGroup", "path", "optionalParsedPath", "parsedPath", "PropertyBinding", "array", "firstValidIndex", "bindings", "n", "_PropertyBinding", "rootNode", "root", "name", "trackName", "matches", "results", "lastDot", "objectName", "nodeName", "bone", "searchNodeSubtree", "children", "childNode", "result", "subTreeNode", "source", "dest", "targetArray", "sourceArray", "targetObject", "propertyName", "propertyIndex", "warn", "objectIndex", "error", "nodeProperty", "versioning", "bindingType", "AnimationAction", "mixer", "clip", "localRoot", "blendMode", "tracks", "nTracks", "interpolants", "interpolantSettings", "ZeroCurvatureEnding", "i", "interpolant", "LoopRepeat", "time", "mode", "repetitions", "weight", "duration", "fadeOutAction", "warp", "fadeInDuration", "fadeOutDuration", "startEndRatio", "endStartRatio", "fadeInAction", "weightInterpolant", "timeScale", "action", "startTimeScale", "endTimeScale", "now", "times", "values", "timeScaleInterpolant", "deltaTime", "timeDirection", "accuIndex", "startTime", "timeRunning", "clipTime", "propertyMixers", "AdditiveAnimationBlendMode", "j", "m", "NormalAnimationBlendMode", "interpolantValue", "loop", "loopCount", "pingPong", "LoopPingPong", "LoopOnce", "handle_stop", "loopDelta", "pending", "atStart", "atEnd", "settings", "ZeroSlopeEnding", "WrapAroundEnding", "weightNow", "weightThen", "_controlInterpolantsResultBuffer", "AnimationMixer", "EventDispatcher", "root", "prototypeAction", "bindings", "rootUuid", "bindingsByRoot", "bindingsByName", "track", "trackName", "binding", "path", "PropertyMixer", "PropertyBinding", "clipUuid", "actionsForClip", "n", "scope", "index", "actions", "actionsByClip", "knownActions", "lastInactiveAction", "cacheIndex", "knownActionsForClip", "lastKnownAction", "byClipCacheIndex", "actionByRoot", "prevIndex", "lastActiveIndex", "firstInactiveAction", "firstInactiveIndex", "lastActiveAction", "bindingByName", "propBinding", "lastInactiveBinding", "firstInactiveBinding", "lastActiveBinding", "LinearInterpolant", "lastActiveInterpolant", "optionalRoot", "clipObject", "AnimationClip", "existingAction", "newAction", "nActions", "nBindings", "actionsToRemove", "Clock", "autoStart", "warn", "diff", "newTime", "_Matrix2", "n11", "n12", "n21", "n22", "array", "offset", "i", "te", "Matrix2", "getByteLength", "width", "height", "format", "type", "typeByteLength", "getTextureTypeByteLength", "AlphaFormat", "RedFormat", "RedIntegerFormat", "RGFormat", "RGIntegerFormat", "RGBFormat", "RGBAFormat", "RGBAIntegerFormat", "RGB_S3TC_DXT1_Format", "RGBA_S3TC_DXT1_Format", "RGBA_S3TC_DXT3_Format", "RGBA_S3TC_DXT5_Format", "RGB_PVRTC_2BPPV1_Format", "RGBA_PVRTC_2BPPV1_Format", "RGB_PVRTC_4BPPV1_Format", "RGBA_PVRTC_4BPPV1_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "R11_EAC_Format", "SIGNED_R11_EAC_Format", "RGBA_ETC2_EAC_Format", "RG11_EAC_Format", "SIGNED_RG11_EAC_Format", "RGBA_ASTC_4x4_Format", "RGBA_ASTC_5x4_Format", "RGBA_ASTC_5x5_Format", "RGBA_ASTC_6x5_Format", "RGBA_ASTC_6x6_Format", "RGBA_ASTC_8x5_Format", "RGBA_ASTC_8x6_Format", "RGBA_ASTC_8x8_Format", "RGBA_ASTC_10x5_Format", "RGBA_ASTC_10x6_Format", "RGBA_ASTC_10x8_Format", "RGBA_ASTC_10x10_Format", "RGBA_ASTC_12x10_Format", "RGBA_ASTC_12x12_Format", "RGBA_BPTC_Format", "RGB_BPTC_SIGNED_Format", "RGB_BPTC_UNSIGNED_Format", "RED_RGTC1_Format", "SIGNED_RED_RGTC1_Format", "RED_GREEN_RGTC2_Format", "SIGNED_RED_GREEN_RGTC2_Format", "UnsignedByteType", "ByteType", "UnsignedShortType", "ShortType", "HalfFloatType", "UnsignedShort4444Type", "UnsignedShort5551Type", "UnsignedIntType", "IntType", "FloatType", "UnsignedInt5999Type", "UnsignedInt101111Type", "warn", "WebGLAnimation", "context", "isAnimating", "animationLoop", "requestId", "onAnimationFrame", "time", "frame", "callback", "value", "WebGLAttributes", "gl", "buffers", "createBuffer", "attribute", "bufferType", "array", "usage", "size", "buffer", "type", "updateBuffer", "updateRanges", "a", "b", "mergeIndex", "i", "previousRange", "range", "l", "get", "remove", "data", "update", "cached", "alphahash_fragment", "alphahash_pars_fragment", "alphamap_fragment", "alphamap_pars_fragment", "alphatest_fragment", "alphatest_pars_fragment", "aomap_fragment", "aomap_pars_fragment", "batching_pars_vertex", "batching_vertex", "begin_vertex", "beginnormal_vertex", "bsdfs", "iridescence_fragment", "bumpmap_pars_fragment", "clipping_planes_fragment", "clipping_planes_pars_fragment", "clipping_planes_pars_vertex", "clipping_planes_vertex", "color_fragment", "color_pars_fragment", "color_pars_vertex", "color_vertex", "common", "cube_uv_reflection_fragment", "defaultnormal_vertex", "displacementmap_pars_vertex", "displacementmap_vertex", "emissivemap_fragment", "emissivemap_pars_fragment", "colorspace_fragment", "colorspace_pars_fragment", "envmap_fragment", "envmap_common_pars_fragment", "envmap_pars_fragment", "envmap_pars_vertex", "envmap_vertex", "fog_vertex", "fog_pars_vertex", "fog_fragment", "fog_pars_fragment", "gradientmap_pars_fragment", "lightmap_pars_fragment", "lights_lambert_fragment", "lights_lambert_pars_fragment", "lights_pars_begin", "envmap_physical_pars_fragment", "lights_toon_fragment", "lights_toon_pars_fragment", "lights_phong_fragment", "lights_phong_pars_fragment", "lights_physical_fragment", "lights_physical_pars_fragment", "lights_fragment_begin", "lights_fragment_maps", "lights_fragment_end", "lightprobes_pars_fragment", "logdepthbuf_fragment", "logdepthbuf_pars_fragment", "logdepthbuf_pars_vertex", "logdepthbuf_vertex", "map_fragment", "map_pars_fragment", "map_particle_fragment", "map_particle_pars_fragment", "metalnessmap_fragment", "metalnessmap_pars_fragment", "morphinstance_vertex", "morphcolor_vertex", "morphnormal_vertex", "morphtarget_pars_vertex", "morphtarget_vertex", "normal_fragment_begin", "normal_fragment_maps", "normal_pars_fragment", "normal_pars_vertex", "normal_vertex", "normalmap_pars_fragment", "clearcoat_normal_fragment_begin", "clearcoat_normal_fragment_maps", "clearcoat_pars_fragment", "iridescence_pars_fragment", "opaque_fragment", "packing", "premultiplied_alpha_fragment", "project_vertex", "dithering_fragment", "dithering_pars_fragment", "roughnessmap_fragment", "roughnessmap_pars_fragment", "shadowmap_pars_fragment", "shadowmap_pars_vertex", "shadowmap_vertex", "shadowmask_pars_fragment", "skinbase_vertex", "skinning_pars_vertex", "skinning_vertex", "skinnormal_vertex", "specularmap_fragment", "specularmap_pars_fragment", "tonemapping_fragment", "tonemapping_pars_fragment", "transmission_fragment", "transmission_pars_fragment", "uv_pars_fragment", "uv_pars_vertex", "uv_vertex", "worldpos_vertex", "vertex$h", "fragment$h", "vertex$g", "fragment$g", "vertex$f", "fragment$f", "vertex$e", "fragment$e", "vertex$d", "fragment$d", "vertex$c", "fragment$c", "vertex$b", "fragment$b", "vertex$a", "fragment$a", "vertex$9", "fragment$9", "vertex$8", "fragment$8", "vertex$7", "fragment$7", "vertex$6", "fragment$6", "vertex$5", "fragment$5", "vertex$4", "fragment$4", "vertex$3", "fragment$3", "vertex$2", "fragment$2", "vertex$1", "fragment$1", "ShaderChunk", "UniformsLib", "Color", "Matrix3", "Vector2", "Vector3", "ShaderLib", "mergeUniforms", "_rgb", "_m1$1", "Matrix4", "_m$1", "WebGLBackground", "renderer", "environments", "state", "objects", "alpha", "premultipliedAlpha", "clearColor", "clearAlpha", "planeMesh", "boxMesh", "currentBackground", "currentBackgroundVersion", "currentTonemapping", "getBackground", "scene", "background", "usePMREM", "render", "forceClear", "setClear", "environmentBlendMode", "addToRenderList", "renderList", "CubeUVReflectionMapping", "Mesh", "BoxGeometry", "ShaderMaterial", "cloneUniforms", "BackSide", "camera", "ColorManagement", "SRGBTransfer", "PlaneGeometry", "FrontSide", "color", "getUnlitUniformColorSpace", "dispose", "WebGLBindingStates", "attributes", "maxVertexAttributes", "bindingStates", "defaultState", "createBindingState", "currentState", "forceUpdate", "setup", "object", "material", "program", "geometry", "index", "updateBuffers", "getBindingState", "bindVertexArrayObject", "needsUpdate", "saveCache", "setupVertexAttributes", "createVertexArrayObject", "vao", "deleteVertexArrayObject", "wireframe", "objectMap", "objectId", "programMap", "stateMap", "newAttributes", "enabledAttributes", "attributeDivisors", "cachedAttributes", "geometryAttributes", "attributesNum", "programAttributes", "name", "cachedAttribute", "geometryAttribute", "cache", "initAttributes", "il", "enableAttribute", "enableAttributeAndDivisor", "meshPerAttribute", "disableUnusedAttributes", "vertexAttribPointer", "normalized", "stride", "offset", "integer", "materialDefaultAttributeValues", "programAttribute", "bytesPerElement", "IntType", "reset", "geometryId", "programId", "releaseStatesOfGeometry", "releaseStatesOfProgram", "releaseStatesOfObject", "resetDefaultState", "WebGLBufferRenderer", "extensions", "info", "mode", "setMode", "start", "count", "renderInstances", "primcount", "renderMultiDraw", "starts", "counts", "drawCount", "elementCount", "WebGLCapabilities", "parameters", "utils", "maxAnisotropy", "getMaxAnisotropy", "extension", "textureFormatReadable", "textureFormat", "RGBAFormat", "textureTypeReadable", "textureType", "halfFloatSupportedByExt", "HalfFloatType", "UnsignedByteType", "FloatType", "getMaxPrecision", "precision", "maxPrecision", "warn", "logarithmicDepthBuffer", "reversedDepthBuffer", "maxTextures", "maxVertexTextures", "maxTextureSize", "maxCubemapSize", "maxAttributes", "maxVertexUniforms", "maxVaryings", "maxFragmentUniforms", "maxSamples", "samples", "WebGLClipping", "properties", "scope", "globalState", "numGlobalPlanes", "localClippingEnabled", "renderingShadows", "plane", "Plane", "viewNormalMatrix", "uniform", "planes", "enableLocalClipping", "enabled", "projectPlanes", "useCache", "clipIntersection", "clipShadows", "materialProperties", "resetGlobalState", "nGlobal", "lGlobal", "dstArray", "dstOffset", "skipTransform", "nPlanes", "flatSize", "viewMatrix", "i4", "LOD_MIN", "EXTRA_LOD_SIGMA", "MAX_SAMPLES", "GGX_SAMPLES", "_flatCamera", "OrthographicCamera", "_clearColor", "_oldTarget", "_oldActiveCubeFace", "_oldActiveMipmapLevel", "_oldXrEnabled", "_origin", "PMREMGenerator", "sigma", "near", "far", "options", "position", "cubeUVRenderTarget", "equirectangular", "renderTarget", "cubemap", "_getCubemapMaterial", "_getEquirectMaterial", "cubeSize", "outputTarget", "_setViewport", "texture", "CubeReflectionMapping", "CubeRefractionMapping", "width", "height", "params", "LinearFilter", "LinearSRGBColorSpace", "_createRenderTarget", "_lodMax", "_createPlanes", "_getBlurShader", "_getGGXShader", "mesh", "BufferGeometry", "cubeCamera", "PerspectiveCamera", "upSign", "forwardSign", "originalAutoClear", "toneMapping", "NoToneMapping", "MeshBasicMaterial", "backgroundBox", "backgroundMaterial", "useSolidColor", "col", "isCubeTexture", "uniforms", "autoClear", "n", "lodIn", "lodOut", "pingPongRenderTarget", "ggxMaterial", "ggxMesh", "ggxUniforms", "targetRoughness", "sourceRoughness", "incrementalRoughness", "blurStrength", "adjustedRoughness", "outputSize", "x", "y", "poleAxis", "targetIn", "targetOut", "sigmaRadians", "direction", "blurMaterial", "error", "STANDARD_DEVIATIONS", "blurMesh", "blurUniforms", "pixels", "radiansPerPixel", "sigmaPixels", "weights", "sum", "weight", "lodMax", "sizeLods", "sigmas", "lodMeshes", "lod", "totalLods", "sizeLod", "texelSize", "min", "max", "uv1", "cubeFaces", "vertices", "positionSize", "uvSize", "faceIndexSize", "uv", "faceIndex", "face", "coordinates", "fill", "BufferAttribute", "WebGLRenderTarget", "target", "_getCommonVertexShader", "NoBlending", "WebGLCubeRenderTarget", "image", "images", "CubeTexture", "shader", "currentMinFilter", "LinearMipmapLinearFilter", "CubeCamera", "depth", "stencil", "currentRenderTarget", "WebGLEnvironments", "cubeMaps", "pmremMaps", "pmremGenerator", "getPMREM", "getCube", "mapping", "EquirectangularReflectionMapping", "EquirectangularRefractionMapping", "mapTextureMapping", "onCubemapDispose", "isEquirectMap", "isCubeMap", "currentPMREMVersion", "isCubeTextureComplete", "onPMREMDispose", "length", "event", "pmrem", "WebGLExtensions", "getExtension", "warnOnce", "WebGLGeometries", "geometries", "wireframeAttributes", "onGeometryDispose", "updateWireframeAttribute", "indices", "geometryIndex", "geometryPosition", "version", "c", "Uint32BufferAttribute", "Uint16BufferAttribute", "previousAttribute", "getWireframeAttribute", "currentAttribute", "WebGLIndexedBufferRenderer", "setIndex", "WebGLInfo", "memory", "instanceCount", "WebGLMorphtargets", "capabilities", "textures", "morphTextures", "morph", "Vector4", "objectInfluences", "morphAttribute", "morphTargetsCount", "entry", "disposeTexture", "hasMorphPosition", "hasMorphNormals", "hasMorphColors", "morphTargets", "morphNormals", "morphColors", "vertexDataCount", "DataArrayTexture", "vertexDataStride", "morphTarget", "morphNormal", "morphColor", "j", "morphInfluencesSum", "morphBaseInfluence", "WebGLObjects", "updateMap", "buffergeometry", "onInstancedMeshDispose", "skeleton", "instancedMesh", "toneMappingMap", "LinearToneMapping", "ReinhardToneMapping", "CineonToneMapping", "ACESFilmicToneMapping", "AgXToneMapping", "NeutralToneMapping", "CustomToneMapping", "WebGLOutput", "targetA", "DepthTexture", "targetB", "Float32BufferAttribute", "RawShaderMaterial", "_outputColorSpace", "_outputToneMapping", "_isCompositing", "_savedToneMapping", "_savedRenderTarget", "_effects", "_hasRenderPass", "effect", "effects", "deltaTime", "readBuffer", "writeBuffer", "temp", "emptyTexture", "Texture", "emptyShadowTexture", "emptyArrayTexture", "empty3dTexture", "Data3DTexture", "emptyCubeTexture", "arrayCacheF32", "arrayCacheI32", "mat4array", "mat3array", "mat2array", "flatten", "nBlocks", "blockSize", "firstElem", "arraysEqual", "copyArray", "allocTexUnits", "r", "setValueV1f", "v", "setValueV2f", "setValueV3f", "setValueV4f", "setValueM2", "elements", "setValueM3", "setValueM4", "setValueV1i", "setValueV2i", "setValueV3i", "setValueV4i", "setValueV1ui", "setValueV2ui", "setValueV3ui", "setValueV4ui", "setValueT1", "unit", "emptyTexture2D", "GreaterEqualCompare", "LessEqualCompare", "setValueT3D1", "setValueT6", "setValueT2DArray1", "getSingularSetter", "setValueV1fArray", "setValueV2fArray", "setValueV3fArray", "setValueV4fArray", "setValueM2Array", "setValueM3Array", "setValueM4Array", "setValueV1iArray", "setValueV2iArray", "setValueV3iArray", "setValueV4iArray", "setValueV1uiArray", "setValueV2uiArray", "setValueV3uiArray", "setValueV4uiArray", "setValueT1Array", "units", "setValueT3DArray", "setValueT6Array", "setValueT2DArrayArray", "getPureArraySetter", "SingleUniform", "id", "activeInfo", "addr", "PureArrayUniform", "StructuredUniform", "seq", "u", "RePathPart", "addUniform", "container", "uniformObject", "parseUniform", "path", "pathLength", "match", "matchEnd", "idIsIndex", "subscript", "next", "WebGLUniforms", "shadowSamplers", "otherUniforms", "values", "WebGLShader", "string", "COMPLETION_STATUS_KHR", "programIdCount", "handleSource", "errorLine", "lines", "lines2", "from", "to", "line", "_m0", "getEncodingComponents", "colorSpace", "encodingMatrix", "LinearTransfer", "getShaderErrors", "status", "errors", "errorMatches", "getTexelEncodingFunction", "functionName", "components", "toneMappingFunctions", "getToneMappingFunction", "toneMappingName", "_v0", "getLuminanceFunction", "g", "generateVertexExtensions", "filterEmptyLine", "generateDefines", "defines", "chunks", "fetchAttributeLocations", "locationSize", "replaceLightNums", "numSpotLightCoords", "replaceClippingPlaneNums", "includePattern", "resolveIncludes", "includeReplacer", "shaderChunkMap", "include", "newInclude", "unrollLoopPattern", "unrollLoops", "loopReplacer", "end", "snippet", "generatePrecision", "precisionstring", "shadowMapTypeDefines", "PCFShadowMap", "VSMShadowMap", "generateShadowMapTypeDefine", "envMapTypeDefines", "generateEnvMapTypeDefine", "envMapModeDefines", "generateEnvMapModeDefine", "envMapBlendingDefines", "MultiplyOperation", "MixOperation", "AddOperation", "generateEnvMapBlendingDefine", "generateCubeUVSize", "imageHeight", "maxMip", "texelHeight", "WebGLProgram", "cacheKey", "vertexShader", "fragmentShader", "shadowMapTypeDefine", "envMapTypeDefine", "envMapModeDefine", "envMapBlendingDefine", "envMapCubeUVSize", "customVertexExtensions", "customDefines", "prefixVertex", "prefixFragment", "versionString", "GLSL3", "vertexGlsl", "fragmentGlsl", "glVertexShader", "glFragmentShader", "onFirstUse", "self", "programInfoLog", "vertexShaderInfoLog", "fragmentShaderInfoLog", "programLog", "vertexLog", "fragmentLog", "runnable", "haveDiagnostics", "vertexErrors", "fragmentErrors", "cachedUniforms", "programReady", "_id", "WebGLShaderCache", "vertexShaderStage", "fragmentShaderStage", "materialShaders", "shaderStage", "set", "code", "stage", "WebGLShaderStage", "isPackedRGFormat", "format", "RGFormat", "RG11_EAC_Format", "RED_GREEN_RGTC2_Format", "WebGLPrograms", "clipping", "_programLayers", "Layers", "_customShaders", "_activeChannels", "programs", "programsMap", "shaderIDs", "getChannel", "getParameters", "lights", "shadows", "lightProbeGrids", "fog", "environment", "envMap", "envMapCubeUVHeight", "shaderID", "morphTextureStride", "customVertexShaderID", "customFragmentShaderID", "IS_INSTANCEDMESH", "IS_BATCHEDMESH", "HAS_MAP", "HAS_MATCAP", "HAS_ENVMAP", "HAS_AOMAP", "HAS_LIGHTMAP", "HAS_BUMPMAP", "HAS_NORMALMAP", "HAS_DISPLACEMENTMAP", "HAS_EMISSIVEMAP", "HAS_METALNESSMAP", "HAS_ROUGHNESSMAP", "HAS_ANISOTROPY", "HAS_CLEARCOAT", "HAS_DISPERSION", "HAS_IRIDESCENCE", "HAS_SHEEN", "HAS_TRANSMISSION", "HAS_ANISOTROPYMAP", "HAS_CLEARCOATMAP", "HAS_CLEARCOAT_NORMALMAP", "HAS_CLEARCOAT_ROUGHNESSMAP", "HAS_IRIDESCENCEMAP", "HAS_IRIDESCENCE_THICKNESSMAP", "HAS_SHEEN_COLORMAP", "HAS_SHEEN_ROUGHNESSMAP", "HAS_SPECULARMAP", "HAS_SPECULAR_COLORMAP", "HAS_SPECULAR_INTENSITYMAP", "HAS_TRANSMISSIONMAP", "HAS_THICKNESSMAP", "HAS_GRADIENTMAP", "HAS_ALPHAMAP", "HAS_ALPHATEST", "HAS_ALPHAHASH", "HAS_EXTENSIONS", "ObjectSpaceNormalMap", "TangentSpaceNormalMap", "NormalBlending", "DoubleSide", "getProgramCacheKey", "getProgramCacheKeyParameters", "getProgramCacheKeyBooleans", "getUniforms", "UniformsUtils", "acquireProgram", "releaseProgram", "releaseShaderCache", "WebGLProperties", "has", "map", "key", "painterSortStable", "reversePainterSortStable", "WebGLRenderList", "renderItems", "renderItemsIndex", "opaque", "transmissive", "transparent", "init", "materialVariant", "variant", "getNextRenderItem", "groupOrder", "z", "group", "renderItem", "push", "unshift", "sort", "customOpaqueSort", "customTransparentSort", "finish", "WebGLRenderLists", "lists", "renderCallDepth", "listArray", "list", "UniformsCache", "light", "ShadowUniformsCache", "nextVersion", "shadowCastingAndTexturingLightsFirst", "lightA", "lightB", "WebGLLights", "shadowCache", "vector3", "matrix4", "matrix42", "directionalLength", "pointLength", "spotLength", "rectAreaLength", "hemiLength", "numDirectionalShadows", "numPointShadows", "numSpotShadows", "numSpotMaps", "numSpotShadowsWithMaps", "numLightProbes", "intensity", "distance", "shadowMap", "shadow", "shadowUniforms", "hash", "setupView", "WebGLRenderState", "lightsArray", "shadowsArray", "lightProbeGridArray", "pushLight", "pushShadow", "shadowLight", "pushLightProbeGrid", "volume", "setupLights", "setupLightsView", "WebGLRenderStates", "renderStates", "renderStateArray", "renderState", "vertex", "fragment", "_cubeDirections", "_cubeUps", "_projScreenMatrix", "_lightPositionWorld", "_lookTarget", "WebGLShadowMap", "_frustum", "Frustum", "_shadowMapSize", "_viewportSize", "_viewport", "_depthMaterial", "MeshDepthMaterial", "_distanceMaterial", "MeshDistanceMaterial", "_materialCache", "_maxTextureSize", "shadowSide", "shadowMaterialVertical", "shadowMaterialHorizontal", "fullScreenTri", "fullScreenMesh", "_previousType", "PCFSoftShadowMap", "activeCubeFace", "activeMipmapLevel", "_state", "typeChanged", "mat", "shadowFrameExtents", "DepthFormat", "NearestFilter", "CubeDepthTexture", "UnsignedIntType", "faceCount", "viewport", "shadowMatrix", "renderObject", "VSMPass", "getDepthMaterial", "result", "customMaterial", "keyA", "keyB", "materialsForVariant", "cachedMaterial", "onMaterialDispose", "shadowCamera", "groups", "k", "kl", "groupMaterial", "depthMaterial", "children", "uuid", "WebGLState", "ColorBuffer", "locked", "currentColorMask", "currentColorClear", "colorMask", "lock", "DepthBuffer", "currentReversed", "currentDepthMask", "currentDepthFunc", "currentDepthClear", "reversed", "ext", "oldDepth", "depthTest", "enable", "disable", "depthMask", "depthFunc", "ReversedDepthFuncs", "NeverDepth", "AlwaysDepth", "LessDepth", "LessEqualDepth", "EqualDepth", "GreaterEqualDepth", "GreaterDepth", "NotEqualDepth", "StencilBuffer", "currentStencilMask", "currentStencilFunc", "currentStencilRef", "currentStencilFuncMask", "currentStencilFail", "currentStencilZFail", "currentStencilZPass", "currentStencilClear", "stencilTest", "stencilMask", "stencilFunc", "stencilRef", "stencilFail", "stencilZFail", "stencilZPass", "colorBuffer", "depthBuffer", "stencilBuffer", "uboBindings", "uboProgramMap", "enabledCapabilities", "currentBoundFramebuffers", "currentDrawbuffers", "defaultDrawbuffers", "currentProgram", "currentBlendingEnabled", "currentBlending", "currentBlendEquation", "currentBlendSrc", "currentBlendDst", "currentBlendEquationAlpha", "currentBlendSrcAlpha", "currentBlendDstAlpha", "currentBlendColor", "currentBlendAlpha", "currentPremultipledAlpha", "currentFlipSided", "currentCullFace", "currentLineWidth", "currentPolygonOffsetFactor", "currentPolygonOffsetUnits", "lineWidthAvailable", "glVersion", "currentTextureSlot", "currentBoundTextures", "scissorParam", "viewportParam", "currentScissor", "currentViewport", "createTexture", "dimensions", "emptyTextures", "setFlipSided", "setCullFace", "CullFaceBack", "setBlending", "bindFramebuffer", "framebuffer", "drawBuffers", "useProgram", "equationToGL", "AddEquation", "SubtractEquation", "ReverseSubtractEquation", "MinEquation", "MaxEquation", "factorToGL", "ZeroFactor", "OneFactor", "SrcColorFactor", "SrcAlphaFactor", "SrcAlphaSaturateFactor", "DstColorFactor", "DstAlphaFactor", "OneMinusSrcColorFactor", "OneMinusSrcAlphaFactor", "OneMinusDstColorFactor", "OneMinusDstAlphaFactor", "ConstantColorFactor", "OneMinusConstantColorFactor", "ConstantAlphaFactor", "OneMinusConstantAlphaFactor", "blending", "blendEquation", "blendSrc", "blendDst", "blendEquationAlpha", "blendSrcAlpha", "blendDstAlpha", "blendColor", "blendAlpha", "CustomBlending", "AdditiveBlending", "SubtractiveBlending", "MultiplyBlending", "setMaterial", "frontFaceCW", "flipSided", "stencilWrite", "setPolygonOffset", "cullFace", "CullFaceNone", "CullFaceFront", "setLineWidth", "polygonOffset", "factor", "setScissorTest", "scissorTest", "activeTexture", "webglSlot", "bindTexture", "webglType", "webglTexture", "boundTexture", "unbindTexture", "compressedTexImage2D", "e", "compressedTexImage3D", "texSubImage2D", "texSubImage3D", "compressedTexSubImage2D", "compressedTexSubImage3D", "texStorage2D", "texStorage3D", "texImage2D", "texImage3D", "getParameter", "pixelStorei", "scissor", "updateUBOMapping", "uniformsGroup", "blockIndex", "uniformBlockBinding", "WebGLTextures", "_gl", "multisampledRTTExt", "supportsInvalidateFramebuffer", "_imageDimensions", "_videoTextures", "_htmlTextures", "_canvas", "_sources", "useOffscreenCanvas", "createCanvas", "createElementNS", "resizeImage", "needsNewCanvas", "maxSize", "scale", "getDimensions", "canvas", "textureNeedsGenerateMipmaps", "generateMipmap", "getTargetType", "getInternalFormat", "internalFormatName", "glFormat", "glType", "forceLinearTransfer", "ext_texture_norm16", "internalFormat", "transfer", "getInternalDepthFormat", "useStencil", "depthType", "glInternalFormat", "UnsignedInt248Type", "UnsignedShortType", "getMipLevels", "onTextureDispose", "deallocateTexture", "onRenderTargetDispose", "deallocateRenderTarget", "textureProperties", "source", "webglTextures", "deleteTexture", "renderTargetProperties", "level", "attachmentProperties", "textureUnits", "resetTextureUnits", "getTextureUnits", "setTextureUnits", "allocateTextureUnit", "textureUnit", "getTextureCacheKey", "setTexture2D", "slot", "updateVideoTexture", "uploadTexture", "setTexture2DArray", "setTexture3D", "setTextureCube", "uploadCubeTexture", "wrappingToGL", "RepeatWrapping", "ClampToEdgeWrapping", "MirroredRepeatWrapping", "filterToGL", "NearestMipmapNearestFilter", "NearestMipmapLinearFilter", "LinearMipmapNearestFilter", "compareToGL", "NeverCompare", "AlwaysCompare", "LessCompare", "EqualCompare", "GreaterCompare", "NotEqualCompare", "setTextureParameters", "initTexture", "forceUpload", "textureCacheKey", "getRow", "rowLength", "componentStride", "updateTexture", "previousEnd", "currentRow", "previousRow", "currentUnpackRowLen", "currentUnpackSkipPixels", "currentUnpackSkipRows", "pixelStart", "pixelCount", "sourceProperties", "workingPrimaries", "texturePrimaries", "NoColorSpace", "unpackConversion", "verifyColorSpace", "mipmap", "mipmaps", "useTexStorage", "allocateMemory", "dataReady", "levels", "DepthStencilFormat", "layerByteLength", "getByteLength", "layerIndex", "layerData", "changed", "t", "srcFormat", "srcType", "isCompressed", "isDataTexture", "cubeImage", "mipmapImage", "setupFrameBufferTexture", "attachment", "textureTarget", "useMultisampledRTT", "getRenderTargetSamples", "setupRenderBufferStorage", "renderbuffer", "useMultisample", "depthTexture", "glAttachmentType", "setupDepthTexture", "cubeFace", "isCube", "webglDepthTexture", "glTextureType", "setupDepthRenderbuffer", "disposeEvent", "rebindTextures", "colorTexture", "setupRenderTarget", "isMultipleRenderTargets", "updateRenderTargetMipmap", "targetType", "invalidationArrayRead", "invalidationArrayDraw", "updateMultisampleRenderTarget", "mask", "depthStyle", "WebGLUtils", "convert", "p", "UnsignedShort4444Type", "UnsignedShort5551Type", "UnsignedInt5999Type", "UnsignedInt101111Type", "ByteType", "ShortType", "AlphaFormat", "RGBFormat", "RedFormat", "RedIntegerFormat", "RGIntegerFormat", "RGBAIntegerFormat", "RGB_S3TC_DXT1_Format", "RGBA_S3TC_DXT1_Format", "RGBA_S3TC_DXT3_Format", "RGBA_S3TC_DXT5_Format", "RGB_PVRTC_4BPPV1_Format", "RGB_PVRTC_2BPPV1_Format", "RGBA_PVRTC_4BPPV1_Format", "RGBA_PVRTC_2BPPV1_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "RGBA_ETC2_EAC_Format", "R11_EAC_Format", "SIGNED_R11_EAC_Format", "SIGNED_RG11_EAC_Format", "RGBA_ASTC_4x4_Format", "RGBA_ASTC_5x4_Format", "RGBA_ASTC_5x5_Format", "RGBA_ASTC_6x5_Format", "RGBA_ASTC_6x6_Format", "RGBA_ASTC_8x5_Format", "RGBA_ASTC_8x6_Format", "RGBA_ASTC_8x8_Format", "RGBA_ASTC_10x5_Format", "RGBA_ASTC_10x6_Format", "RGBA_ASTC_10x8_Format", "RGBA_ASTC_10x10_Format", "RGBA_ASTC_12x10_Format", "RGBA_ASTC_12x12_Format", "RGBA_BPTC_Format", "RGB_BPTC_SIGNED_Format", "RGB_BPTC_UNSIGNED_Format", "RED_RGTC1_Format", "SIGNED_RED_RGTC1_Format", "SIGNED_RED_GREEN_RGTC2_Format", "_occlusion_vertex", "_occlusion_fragment", "WebXRDepthSensing", "depthData", "ExternalTexture", "cameraXR", "WebXRManager", "EventDispatcher", "session", "framebufferScaleFactor", "referenceSpace", "referenceSpaceType", "foveation", "customReferenceSpace", "pose", "glBinding", "glProjLayer", "glBaseLayer", "xrFrame", "supportsGlBinding", "depthSensing", "cameraAccessTextures", "initialRenderTarget", "newRenderTarget", "controllers", "controllerInputSources", "currentSize", "currentPixelRatio", "cameraL", "cameraR", "cameras", "ArrayCamera", "_currentDepthNear", "_currentDepthFar", "controller", "WebXRController", "onSessionEvent", "controllerIndex", "onSessionEnd", "onInputSourcesChange", "inputSource", "animation", "space", "depthFormat", "glDepthFormat", "projectionlayerInit", "layerInit", "cameraLPos", "cameraRPos", "setProjectionFromUnion", "ipd", "projL", "projR", "topFov", "bottomFov", "leftFov", "rightFov", "left", "right", "zOffset", "xOffset", "near2", "far2", "left2", "right2", "top2", "bottom2", "updateCamera", "parent", "depthNear", "depthFar", "updateUserCamera", "RAD2DEG", "xrCamera", "onAnimationFrameCallback", "views", "cameraXRNeedsUpdate", "view", "glSubImage", "enabledFeatures", "cameraTex", "glTexture", "_m1", "_m", "WebGLMaterials", "refreshTransformUniform", "refreshFogUniforms", "refreshMaterialUniforms", "pixelRatio", "transmissionRenderTarget", "refreshUniformsCommon", "refreshUniformsToon", "refreshUniformsPhong", "refreshUniformsStandard", "refreshUniformsPhysical", "refreshUniformsMatcap", "refreshUniformsDistance", "refreshUniformsLine", "refreshUniformsDash", "refreshUniformsPoints", "refreshUniformsSprites", "envMapRotation", "WebGLUniformsGroups", "updateList", "allocatedBindingPoints", "maxBindingPoints", "bind", "webglProgram", "prepareUniformsGroup", "onUniformsGroupsDispose", "updateBufferData", "bindingPointIndex", "allocateBindingPointIndex", "uniformArray", "jl", "hasUniformChanged", "arrayOffset", "getUniformSize", "indexArray", "indexString", "cachedObject", "chunkSize", "chunkOffset", "chunkPadding", "chunkStart", "DATA", "lut", "getDFGLUT", "DataTexture", "WebGLRenderer", "createCanvasElement", "antialias", "preserveDrawingBuffer", "powerPreference", "failIfMajorPerformanceCaveat", "outputBufferType", "_alpha", "_outputBufferType", "INTEGER_FORMATS", "UNSIGNED_TYPES", "uintClearColor", "intClearColor", "objectPosition", "currentRenderList", "currentRenderState", "renderListStack", "renderStateStack", "output", "_this", "_isContextLost", "_nodesHandler", "SRGBColorSpace", "_currentActiveCubeFace", "_currentActiveMipmapLevel", "_currentRenderTarget", "_currentMaterialId", "_currentCamera", "_currentViewport", "_currentScissor", "_currentScissorTest", "_currentClearColor", "_currentClearAlpha", "_width", "_height", "_pixelRatio", "_opaqueSort", "_transparentSort", "_scissor", "_scissorTest", "_clippingEnabled", "_localClippingEnabled", "_vector3", "_vector4", "_emptyScene", "_renderBackground", "getTargetPixelRatio", "getContext", "contextName", "contextAttributes", "onContextLost", "onContextRestore", "onContextCreationError", "programCache", "materials", "renderLists", "morphtargets", "bufferRenderer", "indexedBufferRenderer", "uniformsGroups", "initGLContext", "xr", "updateStyle", "boolean", "method", "bits", "isIntegerFormat", "targetFormat", "isUnsignedType", "nodesHandler", "onXRSessionStart", "onXRSessionEnd", "log", "infoAutoReset", "shadowMapEnabled", "shadowMapAutoUpdate", "shadowMapNeedsUpdate", "shadowMapType", "deallocateMaterial", "releaseMaterialProgramReferences", "setProgram", "rangeFactor", "drawRange", "drawStart", "drawEnd", "lineWidth", "maxInstanceCount", "prepareMaterial", "getProgram", "targetScene", "material2", "resolve", "checkMaterialsReady", "isXRPresenting", "useOutput", "WebGLCoordinateSystem", "depthSensingMesh", "projectObject", "opaqueObjects", "transmissiveObjects", "camera2", "renderTransmissionPass", "renderScene", "sortObjects", "transparentObjects", "renderObjects", "hasHalfFloatSupport", "activeViewport", "currentActiveCubeFace", "currentActiveMipmapLevel", "currentToneMapping", "currentCameraViewport", "renderTargetNeedsUpdate", "currentSide", "overrideMaterial", "lightsStateVersion", "programCacheKey", "updateCommonMaterialProperties", "materialNeedsLights", "getUniformList", "progUniforms", "findLightProbeGrid", "volumes", "vertexAlphas", "vertexTangents", "needsProgramChange", "refreshProgram", "refreshMaterial", "refreshLights", "p_uniforms", "m_uniforms", "objectVolume", "uCamPos", "morphAttributes", "markUniformsLightsNeedsUpdate", "defaultFramebuffer", "_scratchFrameBuffer", "isRenderTarget3D", "__webglFramebuffer", "layer", "activeCubeFaceIndex", "textureIndex", "glBuffer", "currFramebuffer", "sync", "probeAsync", "levelScale", "_srcFramebuffer", "_dstFramebuffer", "srcTexture", "dstTexture", "srcRegion", "dstPosition", "srcLevel", "dstLevel", "minX", "minY", "minZ", "dstX", "dstY", "dstZ", "glTarget", "currentUnpackImageHeight", "currentUnpackSkipImages", "isSrc3D", "isDst3D", "srcTextureProperties", "dstTextureProperties", "srcRenderTargetProperties", "dstRenderTargetProperties", "toTrianglesDrawMode", "geometry", "drawMode", "TrianglesDrawMode", "TriangleFanDrawMode", "TriangleStripDrawMode", "index", "indices", "position", "i", "numberOfTriangles", "newIndices", "newGeometry", "clone", "source", "sourceLookup", "cloneLookup", "parallelTraverse", "sourceNode", "clonedNode", "node", "clonedMesh", "sourceMesh", "sourceBones", "bone", "parallelTraverse", "a", "b", "callback", "i", "GLTFLoader", "Loader", "manager", "parser", "GLTFMaterialsClearcoatExtension", "GLTFMaterialsDispersionExtension", "GLTFTextureBasisUExtension", "GLTFTextureWebPExtension", "GLTFTextureAVIFExtension", "GLTFMaterialsSheenExtension", "GLTFMaterialsTransmissionExtension", "GLTFMaterialsVolumeExtension", "GLTFMaterialsIorExtension", "GLTFMaterialsEmissiveStrengthExtension", "GLTFMaterialsSpecularExtension", "GLTFMaterialsIridescenceExtension", "GLTFMaterialsAnisotropyExtension", "GLTFMaterialsBumpExtension", "GLTFLightsExtension", "GLTFMeshoptCompression", "EXTENSIONS", "GLTFMeshGpuInstancing", "url", "onLoad", "onProgress", "onError", "scope", "resourcePath", "relativeUrl", "LoaderUtils", "_onError", "e", "loader", "FileLoader", "data", "gltf", "dracoLoader", "ktx2Loader", "meshoptDecoder", "callback", "path", "json", "extensions", "plugins", "textDecoder", "BINARY_EXTENSION_HEADER_MAGIC", "GLTFBinaryExtension", "error", "GLTFParser", "i", "plugin", "extensionName", "extensionsRequired", "GLTFMaterialsUnlitExtension", "GLTFDracoMeshCompressionExtension", "GLTFTextureTransformExtension", "GLTFMeshQuantizationExtension", "resolve", "reject", "GLTFRegistry", "objects", "key", "object", "getMaterialExtension", "materialIndex", "materialDef", "nodeDefs", "nodeIndex", "nodeLength", "nodeDef", "lightIndex", "cacheKey", "dependency", "lightDef", "lightNode", "color", "Color", "LinearSRGBColorSpace", "range", "DirectionalLight", "PointLight", "SpotLight", "assignExtrasToUserData", "type", "index", "self", "light", "MeshBasicMaterial", "materialParams", "pending", "metallicRoughness", "array", "SRGBColorSpace", "extension", "MeshPhysicalMaterial", "scale", "Vector2", "colorFactor", "colorArray", "textureIndex", "textureDef", "name", "source", "handler", "bufferView", "extensionDef", "buffer", "decoder", "res", "byteOffset", "byteLength", "count", "stride", "result", "meshDef", "primitive", "WEBGL_CONSTANTS", "attributesDef", "attributes", "accessor", "results", "nodeObject", "meshes", "instancedMeshes", "mesh", "m", "Matrix4", "p", "Vector3", "q", "Quaternion", "s", "instancedMesh", "InstancedMesh", "attributeName", "attr", "InstancedBufferAttribute", "Object3D", "BINARY_EXTENSION_HEADER_LENGTH", "BINARY_EXTENSION_CHUNK_TYPES", "headerView", "chunkContentsLength", "chunkView", "chunkIndex", "chunkLength", "chunkType", "contentArray", "bufferViewIndex", "gltfAttributeMap", "threeAttributeMap", "attributeNormalizedMap", "attributeTypeMap", "threeAttributeName", "ATTRIBUTES", "accessorDef", "componentType", "WEBGL_COMPONENT_TYPES", "geometry", "attribute", "normalized", "texture", "transform", "GLTFCubicSplineInterpolant", "Interpolant", "parameterPositions", "sampleValues", "sampleSize", "resultBuffer", "values", "valueSize", "offset", "i1", "t0", "t", "t1", "stride2", "stride3", "td", "pp", "ppp", "offset1", "offset0", "s2", "s3", "s0", "s1", "p0", "m0", "p1", "m1", "_quaternion", "GLTFCubicSplineQuaternionInterpolant", "WEBGL_FILTERS", "NearestFilter", "LinearFilter", "NearestMipmapNearestFilter", "LinearMipmapNearestFilter", "NearestMipmapLinearFilter", "LinearMipmapLinearFilter", "WEBGL_WRAPPINGS", "ClampToEdgeWrapping", "MirroredRepeatWrapping", "RepeatWrapping", "WEBGL_TYPE_SIZES", "PATH_PROPERTIES", "INTERPOLATION", "InterpolateLinear", "InterpolateDiscrete", "ALPHA_MODES", "createDefaultMaterial", "cache", "MeshStandardMaterial", "FrontSide", "addUnknownExtensionsToUserData", "knownExtensions", "objectDef", "gltfDef", "addMorphTargets", "targets", "hasMorphPosition", "hasMorphNormal", "hasMorphColor", "il", "target", "pendingPositionAccessors", "pendingNormalAccessors", "pendingColorAccessors", "pendingAccessor", "accessors", "morphPositions", "morphNormals", "morphColors", "updateMorphTargets", "targetNames", "createPrimitiveKey", "primitiveDef", "geometryKey", "dracoExtension", "createAttributesKey", "attributesKey", "keys", "getNormalizedComponentScale", "constructor", "getImageURIMimeType", "uri", "_identityMatrix", "options", "isSafari", "safariVersion", "isFirefox", "firefoxVersion", "userAgent", "safariMatch", "TextureLoader", "ImageBitmapLoader", "ext", "dependencies", "scene", "skinDefs", "meshDefs", "skinIndex", "skinLength", "joints", "ref", "updateMappings", "original", "clone", "mappings", "child", "func", "defs", "def", "bufferIndex", "bufferDef", "bufferViewDef", "accessorIndex", "itemSize", "TypedArray", "BufferAttribute", "pendingBufferViews", "bufferViews", "elementBytes", "itemBytes", "byteStride", "bufferAttribute", "ibSlice", "ibCacheKey", "ib", "InterleavedBuffer", "InterleavedBufferAttribute", "itemSizeIndices", "TypedArrayIndices", "byteOffsetIndices", "byteOffsetValues", "sparseIndices", "sparseValues", "sourceIndex", "sourceDef", "promise", "sampler", "URL", "sourceURI", "isObjectURL", "blob", "imageBitmap", "Texture", "mapName", "mapDef", "colorSpace", "gltfReference", "material", "useDerivativeTangents", "useVertexColors", "useFlatShading", "pointsMaterial", "PointsMaterial", "Material", "lineMaterial", "LineBasicMaterial", "cachedMaterial", "materialType", "materialExtensions", "kmuExtension", "DoubleSide", "alphaMode", "emissiveFactor", "originalName", "sanitizedName", "PropertyBinding", "primitives", "createDracoPrimitive", "addPrimitiveAttributes", "cached", "geometryPromise", "BufferGeometry", "meshIndex", "materials", "geometries", "SkinnedMesh", "Mesh", "toTrianglesDrawMode", "TriangleStripDrawMode", "TriangleFanDrawMode", "LineSegments", "Line", "LineLoop", "Points", "group", "Group", "cameraIndex", "camera", "cameraDef", "params", "PerspectiveCamera", "MathUtils", "OrthographicCamera", "skinDef", "inverseBindMatrices", "jointNodes", "bones", "boneInverses", "jointNode", "mat", "Skeleton", "animationIndex", "animationDef", "animationName", "pendingNodes", "pendingInputAccessors", "pendingOutputAccessors", "pendingSamplers", "pendingTargets", "channel", "input", "output", "nodes", "inputAccessors", "outputAccessors", "samplers", "tracks", "node", "inputAccessor", "outputAccessor", "createdTracks", "k", "animation", "AnimationClip", "nodePending", "childPending", "childrenDef", "skeletonPending", "children", "skeleton", "pivot", "pivotChild", "nodeName", "meshPromise", "Bone", "matrix", "mapping", "sceneIndex", "sceneDef", "nodeIds", "reduceAssociations", "reducedAssociations", "value", "targetName", "collectMorphTargets", "TypedKeyframeTrack", "NumberKeyframeTrack", "QuaternionKeyframeTrack", "VectorKeyframeTrack", "interpolation", "outputArray", "j", "jl", "track", "scaled", "interpolantType", "computeBounds", "box", "Box3", "min", "max", "boxScale", "maxDisplacement", "vector", "sphere", "Sphere", "assignAttributeAccessor", "gltfAttributeName", "ColorManagement", "RoomEnvironment", "Scene", "geometry", "BoxGeometry", "roomMaterial", "MeshStandardMaterial", "BackSide", "boxMaterial", "mainLight", "PointLight", "room", "Mesh", "boxes", "InstancedMesh", "transform", "Object3D", "light1", "createAreaLightMaterial", "light2", "light3", "light4", "light5", "light6", "resources", "object", "resource", "intensity", "MeshLambertMaterial", "ARKIT_VISEMES", "JAW_FALLBACKS", "CHAR_TO_VISEME", "DIGRAPH_TO_VISEME", "MS_PER_PHONEME", "WORD_GAP_MS", "PUNCT_GAP_MS", "LERP", "buildMorphMap", "root", "arkit", "jaw", "node", "dict", "name", "tokenize", "text", "seq", "lower", "t", "pair", "ch", "estimateDurationMs", "createLipsync", "morph", "opts", "rate", "totalMs", "startMs", "done", "current", "k", "apply", "value", "entries", "mesh", "index", "tick", "nowMs", "elapsed", "active", "ph", "target", "next", "stop", "_meshoptPromise", "getMeshoptDecoder", "m", "FRAMING", "BLINK_MORPHS", "AvatarStage", "container", "opts", "Scene", "w", "h", "PerspectiveCamera", "WebGLRenderer", "SRGBColorSpace", "ACESFilmicToneMapping", "pmrem", "PMREMGenerator", "RoomEnvironment", "AmbientLight", "key", "DirectionalLight", "rim", "Clock", "entries", "e", "fn", "url", "token", "loader", "GLTFLoader", "gltf", "buildMorphMap", "AnimationMixer", "idle", "pickClip", "talk", "LoopRepeat", "on", "root", "node", "name", "idx", "framing", "conf", "box", "Box3", "size", "Vector3", "center", "height", "focusY", "focusX", "maxDim", "fov", "dist", "t", "breathe", "sway", "nod", "dt", "dur", "v", "MathUtils", "mesh", "index", "nowMs", "value", "Color", "obj", "n", "clips", "hints", "hint", "found", "c", "hasTTS", "SpeechNarrator", "stage", "opts", "dt", "nowMs", "agent", "muted", "text", "clean", "resolve", "item", "rate", "lipsync", "createLipsync", "active", "utter", "v", "clamp", "e", "guardMs", "estimateDurationMs", "err", "ms", "silent", "prof", "voices", "needle", "x", "n", "lo", "hi", "DEFAULT_ASSET_BASE", "AVATARS", "DEFAULT_AVATAR_ID", "getAvatar", "id", "a", "avatarUrl", "entry", "assetBase", "customAvatarEntry", "urlOrEntry", "MAX_CONTENT_CHARS", "MAX_KNOWLEDGE_CHARS", "SKIP_SELECTOR", "cleanText", "harvestText", "root", "budget", "clone", "el", "harvestSiteContext", "doc", "opts", "title", "description", "headings", "t", "nav", "a", "uniqueNav", "main", "content", "name", "buildSitePayload", "ctx", "knowledge", "remaining", "DEFAULT_ENDPOINT", "MAX_HISTORY_TURNS", "parseSseEvent", "raw", "s", "evt", "createSseBuffer", "onEvent", "buf", "text", "idx", "frame", "data", "l", "askConcierge", "opts", "endpoint", "DEFAULT_ENDPOINT", "history", "m", "res", "detail", "body", "err", "meta", "streamError", "sse", "reader", "decoder", "done", "value", "ESC", "escapeHtml", "c", "safeHref", "url", "u", "inline", "md", "out", "m", "label", "href", "renderMarkdown", "text", "src", "blocks", "lines", "line", "buf", "items", "stripMarkdown", "RecognitionCtor", "micSupported", "createMic", "opts", "Ctor", "rec", "finalText", "resolveDone", "stopInternal", "resolve", "e", "interim", "i", "r", "out", "err", "CSS", "injected", "ensureStyles", "doc", "style", "LS_AVATAR", "LS_MUTED", "SS_THREAD", "SS_TEASED", "ICONS", "storageGet", "store", "key", "storageSet", "value", "drainSentences", "buffer", "sentences", "rest", "m", "re", "consumed", "s", "Concierge", "config", "DEFAULT_ENDPOINT", "DEFAULT_ASSET_BASE", "AVATARS", "a", "customAvatarEntry", "savedId", "getAvatarFrom", "event", "fn", "detail", "ensureStyles", "root", "name", "escapeHtml", "micSupported", "e", "createMic", "t", "err", "theme", "open", "panel", "compact", "teaser", "site", "AvatarStage", "SpeechNarrator", "text", "avatarUrl", "el", "id", "entry", "force", "grid", "card", "muted", "btn", "transcript", "raw", "arr", "thread", "empty", "title", "suggestions", "defaultSuggestions", "chips", "chip", "role", "content", "error", "renderMarkdown", "smooth", "ta", "question", "typing", "streamEl", "streamed", "spoken", "started", "answer", "askConcierge", "buildSitePayload", "chunk", "speakable", "stripMarkdown", "tail", "friendly", "message", "errEl", "retry", "bubbles", "list", "DEFAULT_AVATAR_ID", "getAvatar", "siteName", "bool", "el", "name", "ThreeConciergeElement", "Concierge", "s", "ev", "detail", "text", "id", "muted", "registerElement", "tag", "VERSION", "registerElement", "mount", "config", "Concierge", "autoInit", "tag", "d", "s", "index_default", "index_exports", "Concierge"]
+}
diff --git a/public/features.json b/public/features.json
index ab74eb810..e75791ea1 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-18T21:09:18.373Z",
+ "generated_at": "2026-07-18T22:36:12.061Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -285,6 +285,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/concierge",
+ "title": "Concierge: AI Chat Widget",
+ "description": "Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.",
+ "added": "2026-07-18",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/feed",
"title": "Feed",
@@ -3584,6 +3594,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/blog/concierge-3d-chat-widget",
+ "title": "Concierge: We Gave the Site Chatbot a Face",
+ "description": "Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.",
+ "added": "2026-07-18",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/blog/inside-the-forge",
"title": "Inside the Forge: How a Prompt Becomes a 3D Model",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index ee2602fda..560958bb3 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -175,6 +175,12 @@ URL: https://three.ws/walk
Your 3D avatar walks anywhere on the web. Live demos across six environments, a Chrome extension, one-tag embeds, and a global distance leaderboard.
+### Concierge: AI Chat Widget
+
+URL: https://three.ws/concierge
+
+Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.
+
### Feed
URL: https://three.ws/feed
@@ -2180,6 +2186,12 @@ URL: https://three.ws/blog
Editorial index of three.ws launches and long-form posts.
+### Concierge: We Gave the Site Chatbot a Face
+
+URL: https://three.ws/blog/concierge-3d-chat-widget
+
+Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.
+
### Inside the Forge: How a Prompt Becomes a 3D Model
URL: https://three.ws/blog/inside-the-forge
diff --git a/public/llms.txt b/public/llms.txt
index 337411858..44f11577b 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -38,6 +38,7 @@ Entry points into the product.
- [Pitch Deck](https://three.ws/pitch): The three.ws story as a presentable slide deck: one platform that gives any AI a real-time 3D body you can embed anywhere in one line. Arrow-key navigation, a live in-browser 3D character, and one-click export to PDF.
- [Guided Tour](https://three.ws/tour): A 3D guide walks across the live site, points at every feature, and narrates what each one does and how to use it — voice plus an on-screen chat bubble, paced by you.
- [Walk Anywhere on the Web](https://three.ws/walk): Your 3D avatar walks anywhere on the web. Live demos across six environments, a Chrome extension, one-tag embeds, and a global distance leaderboard.
+- [Concierge: AI Chat Widget](https://three.ws/concierge): Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.
- [Feed](https://three.ws/feed): Live avatars, agents, 3D models, worlds, and launches across three.ws — filter to everyone or just the people you follow.
- [Partner Ecosystem](https://three.ws/partners): three.ws partner ecosystem — AWS, IBM, Google Cloud, Alibaba Cloud, Intel, NVIDIA, Microsoft, Oracle, Quicknode. The cloud, AI, and blockchain infrastructure platforms powering 3D AI agents at enterprise scale.
- [Pricing](https://three.ws/pricing): Plans and pricing for three.ws: free forge quota, premium passes, and pay-per-use API surfaces.
@@ -384,6 +385,7 @@ Docs, tutorials, and reference.
Long-form announcements, launches, and writing from three.ws.
- [Blog](https://three.ws/blog): Editorial index of three.ws launches and long-form posts.
+- [Concierge: We Gave the Site Chatbot a Face](https://three.ws/blog/concierge-3d-chat-widget): Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.
- [Inside the Forge: How a Prompt Becomes a 3D Model](https://three.ws/blog/inside-the-forge): What actually happens between typing a prompt on three.ws and downloading a textured 3D model: the reference image, the engine grid, self-healing failover, quality tiers, and what your model can do next.
- [three.ws Joins the Quicknode Startup Program](https://three.ws/blog/three-ws-quicknode-startup-program): three.ws has been accepted into the Quicknode Startup Program and approved for free infrastructure credits, expanding the RPC backbone behind its Solana-first agent economy.
- [three.ws Joins the Alibaba Cloud Partner Network](https://three.ws/blog/three-ws-alibaba-cloud-partnership): three.ws is now an Alibaba Cloud Partner, bringing Qwen foundation models and Asia-Pacific cloud infrastructure to the three.ws 3D AI agent platform.
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index feadace12..e44a0310a 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -58,7 +58,7 @@
<main class="sm-wrap">
<div class="sm-hero">
<h1>Sitemap</h1>
- <p>All 505 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 507 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
<div class="sm-formats">
<a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a>
<a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>
@@ -70,7 +70,7 @@
</div>
<div class="sm-filter">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
- <input id="sm-filter-input" type="search" placeholder="Filter 505 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 507 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
<kbd aria-hidden="true">/</kbd>
</div>
<p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>
@@ -89,7 +89,7 @@
</nav>
<section class="sm-section" id="main">
<header>
- <h2>Main<span class="sm-count" data-count>32</span></h2>
+ <h2>Main<span class="sm-count" data-count>33</span></h2>
<p class="sm-section-desc">Entry points into the product.</p>
</header>
<ul class="sm-list">
@@ -282,6 +282,13 @@
<span class="sm-desc">Your 3D avatar walks anywhere on the web. Live demos across six environments, a Chrome extension, one-tag embeds, and a global distance leaderboard.</span>
</a>
</li>
+ <li>
+ <a href="/concierge">
+ <span class="sm-title">Concierge: AI Chat Widget</span>
+ <span class="sm-path">/concierge</span>
+ <span class="sm-desc">Give any website an AI concierge with a talking 3D avatar: one-tag embed, streaming answers grounded in the live page, voice in and out, themes, and an avatar picker. Free and open source.</span>
+ </a>
+ </li>
<li>
<a href="/feed">
<span class="sm-title">Feed</span>
@@ -2609,7 +2616,7 @@
<section class="sm-section" id="blog">
<header>
- <h2>Blog<span class="sm-count" data-count>32</span></h2>
+ <h2>Blog<span class="sm-count" data-count>33</span></h2>
<p class="sm-section-desc">Long-form announcements, launches, and writing from three.ws.</p>
</header>
<ul class="sm-list">
@@ -2620,6 +2627,13 @@
<span class="sm-desc">Editorial index of three.ws launches and long-form posts.</span>
</a>
</li>
+ <li>
+ <a href="/blog/concierge-3d-chat-widget">
+ <span class="sm-title">Concierge: We Gave the Site Chatbot a Face</span>
+ <span class="sm-path">/blog/concierge-3d-chat-widget</span>
+ <span class="sm-desc">Launch post for Concierge, the embeddable support chat with a rigged, lipsyncing 3D avatar: how it grounds streaming answers in the live page and how it was built by remixing the Walk and page-agent stack.</span>
+ </a>
+ </li>
<li>
<a href="/blog/inside-the-forge">
<span class="sm-title">Inside the Forge: How a Prompt Becomes a 3D Model</span>
diff --git a/src/assistant-frame.js b/src/assistant-frame.js
new file mode 100644
index 000000000..9081e8f78
--- /dev/null
+++ b/src/assistant-frame.js
@@ -0,0 +1,881 @@
+// /assistant-frame — the assistant widget's iframe surface.
+//
+// Loaded by public/assistant/v1.js inside a floating panel on third-party
+// sites (or standalone for testing). One standing 3D avatar + a composer with
+// two modes:
+// • Chat — messages go to an LLM (free platform chain via /api/chat, or
+// the visitor's own Groq/OpenRouter key straight from the
+// browser) and the reply streams into a speech bubble above the
+// avatar's head, optionally spoken aloud.
+// • Speak — the avatar repeats exactly what you typed: speech bubble +
+// Web Speech API audio + talking animation. No model involved.
+//
+// Query params (every one validated in src/assistant-widget-core.js):
+// ?avatar=<id|url> | ?agent=<id> which body to load
+// ?bg=transparent|#hex|<preset>|gradient:#a,#b[,angle]
+// ?mode=chat|speak|both default both (segmented control)
+// ?accent=#hex ?name= ?greeting= ?context= ?voice=false ?badge=false
+// ?targetOrigin=<origin> pins outbound postMessage
+//
+// Duplicated stage plumbing from src/walk-embed.js on purpose — embeds evolve
+// independently so a fix here can't destabilize /walk-embed (same reasoning
+// as the header of that file).
+
+import {
+ AmbientLight,
+ Box3,
+ CircleGeometry,
+ Color,
+ DirectionalLight,
+ HemisphereLight,
+ Mesh,
+ PCFShadowMap,
+ PerspectiveCamera,
+ PMREMGenerator,
+ Scene,
+ ShadowMaterial,
+ Timer,
+ Vector3,
+ WebGLRenderer,
+} from 'three';
+import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
+import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
+import { getMeshoptDecoder } from './viewer/internal.js';
+import { AnimationManager } from './animation-manager.js';
+import { log } from './shared/log.js';
+import {
+ parseBackground,
+ normalizeMode,
+ normalizeLane,
+ sanitizeAccent,
+ estimateSpeechMs,
+ BYOK_DEFAULT_MODELS,
+ BYOK_ENDPOINTS,
+} from './assistant-widget-core.js';
+
+const AVATAR_URL_DEFAULT = '/avatars/default.glb';
+const ANIMATIONS_MANIFEST_URL = '/animations/manifest.json';
+const CLIP_IDLE = 'idle';
+const CLIP_TALK = 'av-vtubing';
+const CLIP_GREET = 'wave';
+const REQUIRED_CLIPS = new Set([CLIP_IDLE, CLIP_TALK, CLIP_GREET]);
+
+const CHANNEL = 'three-assistant';
+const PROTOCOL_VERSION = 1;
+const STORAGE_KEY = 'threeAssistant.settings.v1';
+const MAX_HISTORY_TURNS = 10; // ×2 messages — matches /api/chat's history max of 20
+
+// ── Params ────────────────────────────────────────────────────────────────
+const params = new URLSearchParams(location.search);
+const BG = parseBackground(params.get('bg'));
+const MODE = normalizeMode(params.get('mode'));
+const ACCENT = sanitizeAccent(params.get('accent'));
+const NAME = (params.get('name') || 'Assistant').slice(0, 60);
+const GREETING = (params.get('greeting') || '').slice(0, 200);
+const CONTEXT = (params.get('context') || '').slice(0, 500);
+const VOICE_DEFAULT = params.get('voice') !== 'false' && params.get('voice') !== '0';
+const SHOW_BADGE = params.get('badge') !== 'false' && params.get('badge') !== '0';
+const TARGET_ORIGIN = params.get('targetOrigin') || '*';
+const AGENT_PARAM = params.get('agent');
+const PREFERS_REDUCED_MOTION =
+ typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
+const HAS_HOVER =
+ typeof matchMedia === 'function' && matchMedia('(hover: hover) and (pointer: fine)').matches;
+
+// ── DOM ───────────────────────────────────────────────────────────────────
+const rootEl = document.getElementById('assistant-root');
+const stageEl = document.getElementById('assistant-stage');
+const canvas = document.getElementById('assistant-canvas');
+const posterEl = document.getElementById('assistant-poster');
+const bubbleEl = document.getElementById('assistant-bubble');
+const bubbleTextEl = bubbleEl.querySelector('.bubble-text');
+const badgeEl = document.getElementById('assistant-badge');
+const statusEl = document.getElementById('assistant-status');
+const titleLabelEl = document.querySelector('#assistant-title .label');
+const voiceBtn = document.getElementById('assistant-voice-btn');
+const settingsBtn = document.getElementById('assistant-settings-btn');
+const closeBtn = document.getElementById('assistant-close-btn');
+const modesEl = document.getElementById('assistant-modes');
+const inputEl = document.getElementById('assistant-input');
+const sendBtn = document.getElementById('assistant-send');
+const hintTextEl = document.getElementById('assistant-hint-text');
+const lanePillEl = document.getElementById('assistant-lane-pill');
+const settingsEl = document.getElementById('assistant-settings');
+const settingsCloseBtn = document.getElementById('assistant-settings-close');
+const byokFieldsEl = document.getElementById('assistant-byok-fields');
+const byokKeyEl = document.getElementById('assistant-byok-key');
+const byokModelEl = document.getElementById('assistant-byok-model');
+const voiceSelectEl = document.getElementById('assistant-voice-select');
+
+// ── Chrome from params ────────────────────────────────────────────────────
+document.documentElement.style.setProperty('--accent', ACCENT);
+titleLabelEl.textContent = NAME;
+if (BG.css) document.body.style.background = BG.css;
+if (!SHOW_BADGE) badgeEl.remove();
+rootEl.dataset.modeSwitch = String(MODE === 'both');
+
+let activeMode = MODE === 'speak' ? 'speak' : 'chat';
+
+function applyModeChrome() {
+ for (const btn of modesEl.querySelectorAll('.mode-btn')) {
+ btn.setAttribute('aria-pressed', String(btn.dataset.mode === activeMode));
+ }
+ if (activeMode === 'speak') {
+ inputEl.placeholder = 'Type something for me to say...';
+ hintTextEl.textContent = 'I repeat exactly what you type, out loud.';
+ } else {
+ inputEl.placeholder = 'Type a question...';
+ hintTextEl.textContent = CONTEXT ? `Ask anything about ${NAME}.` : 'Ask anything.';
+ }
+ lanePillEl.hidden = activeMode === 'speak';
+}
+
+// ── Settings (persisted per-browser, never sent to the host page) ─────────
+function loadSettings() {
+ try {
+ const raw = localStorage.getItem(STORAGE_KEY);
+ if (!raw) return {};
+ const parsed = JSON.parse(raw);
+ return parsed && typeof parsed === 'object' ? parsed : {};
+ } catch {
+ return {};
+ }
+}
+
+function saveSettings() {
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
+ } catch {
+ /* private mode / storage disabled — settings just don't persist */
+ }
+}
+
+const settings = loadSettings();
+settings.lane = normalizeLane(settings.lane);
+settings.keys = settings.keys && typeof settings.keys === 'object' ? settings.keys : {};
+settings.models = settings.models && typeof settings.models === 'object' ? settings.models : {};
+
+let voiceEnabled = typeof settings.voiceEnabled === 'boolean' ? settings.voiceEnabled : VOICE_DEFAULT;
+
+function laneReady(lane) {
+ return lane === 'free' || Boolean(settings.keys[lane]);
+}
+
+function effectiveLane() {
+ return laneReady(settings.lane) ? settings.lane : 'free';
+}
+
+function applyLaneChrome() {
+ const lane = effectiveLane();
+ lanePillEl.textContent = lane === 'free' ? 'free' : `byok:${lane}`;
+ for (const radio of settingsEl.querySelectorAll('input[name="assistant-lane"]')) {
+ radio.checked = radio.value === settings.lane;
+ }
+ const byok = settings.lane !== 'free';
+ byokFieldsEl.classList.toggle('is-visible', byok);
+ if (byok) {
+ byokKeyEl.value = settings.keys[settings.lane] || '';
+ byokModelEl.value = settings.models[settings.lane] || BYOK_DEFAULT_MODELS[settings.lane];
+ byokKeyEl.placeholder = settings.lane === 'groq' ? 'gsk_...' : 'sk-or-...';
+ }
+}
+
+function applyVoiceChrome() {
+ voiceBtn.setAttribute('aria-pressed', String(voiceEnabled));
+ voiceBtn.title = voiceEnabled ? 'Voice on' : 'Voice off';
+}
+
+// ── Status pill ───────────────────────────────────────────────────────────
+function setStatus(text, { error = false, sticky = false } = {}) {
+ statusEl.textContent = text;
+ statusEl.classList.toggle('is-error', error);
+ statusEl.classList.remove('is-hidden');
+ clearTimeout(setStatus._t);
+ if (!sticky) setStatus._t = setTimeout(() => statusEl.classList.add('is-hidden'), 2600);
+}
+
+// ── postMessage bridge ────────────────────────────────────────────────────
+function post(type, payload = {}) {
+ if (window.parent === window) return;
+ try {
+ window.parent.postMessage({ channel: CHANNEL, v: PROTOCOL_VERSION, type, payload }, TARGET_ORIGIN);
+ } catch {
+ /* host gone mid-navigation */
+ }
+}
+
+window.addEventListener('message', (event) => {
+ const msg = event.data;
+ if (!msg || typeof msg !== 'object' || msg.channel !== CHANNEL) return;
+ if (msg.type === 'say') {
+ const text = String(msg.payload?.text || '').slice(0, 600);
+ if (text) speakLine(text);
+ } else if (msg.type === 'setMode') {
+ const mode = normalizeMode(msg.payload?.mode);
+ if (MODE === 'both' && (mode === 'chat' || mode === 'speak')) {
+ activeMode = mode;
+ applyModeChrome();
+ }
+ }
+});
+
+// ── Avatar resolution (same allowlist contract as walk-embed) ─────────────
+const AVATAR_HOST_ALLOWLIST = [
+ /^([a-z0-9-]+\.)*three\.ws$/i,
+ /^([a-z0-9-]+\.)*r2\.cloudflarestorage\.com$/i,
+ /^([a-z0-9-]+\.)*r2\.dev$/i,
+ /(^|\.)readyplayer\.me$/i,
+ /(^|\.)models\.readyplayer\.me$/i,
+];
+const GLB_PATH_RE = /\.(glb|gltf|vrm)(\?|#|$)/i;
+
+function validateAvatarUrl(raw) {
+ if (raw.startsWith('/')) return raw;
+ let u;
+ try {
+ u = new URL(raw, location.origin);
+ } catch {
+ return null;
+ }
+ if (u.protocol !== 'https:' && u.protocol !== 'http:') return null;
+ if (u.origin === location.origin) return u.href;
+ if (!AVATAR_HOST_ALLOWLIST.some((re) => re.test(u.hostname))) return null;
+ if (!GLB_PATH_RE.test(u.pathname)) return null;
+ return u.href;
+}
+
+async function resolveAgentAvatarUrl(agentId) {
+ const r = await fetch(`/api/agents/${encodeURIComponent(agentId)}`, {
+ headers: { accept: 'application/json' },
+ });
+ if (!r.ok) throw new Error(`HTTP ${r.status} resolving agent avatar`);
+ const body = await r.json();
+ const rec = body?.agent || body;
+ const direct = rec?.avatar_model_url || rec?.avatar_glb_url || rec?.glb_url;
+ if (typeof direct === 'string' && GLB_PATH_RE.test(direct)) {
+ return validateAvatarUrl(direct) || `/api/avatars/${encodeURIComponent(rec.avatar_id)}/glb`;
+ }
+ if (rec?.avatar_id) return `/api/avatars/${encodeURIComponent(rec.avatar_id)}/glb`;
+ return AVATAR_URL_DEFAULT;
+}
+
+async function resolveAvatarUrl() {
+ const id = params.get('avatar');
+ if (id) {
+ if (/^https?:\/\//i.test(id) || id.startsWith('/')) {
+ const safe = validateAvatarUrl(id);
+ if (safe) return safe;
+ log.warn('[assistant-frame] rejected ?avatar= URL (origin/host not allowed):', id);
+ return AVATAR_URL_DEFAULT;
+ }
+ return `/api/avatars/${encodeURIComponent(id)}/glb`;
+ }
+ if (AGENT_PARAM) {
+ try {
+ return await resolveAgentAvatarUrl(AGENT_PARAM);
+ } catch (err) {
+ log.warn('[assistant-frame] agent avatar resolve failed, using default:', err?.message || err);
+ return AVATAR_URL_DEFAULT;
+ }
+ }
+ return AVATAR_URL_DEFAULT;
+}
+
+// ── Renderer / scene ──────────────────────────────────────────────────────
+const renderer = new WebGLRenderer({ canvas, antialias: true, alpha: true });
+renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+if (BG.kind === 'solid') renderer.setClearColor(new Color(BG.css), 1);
+else renderer.setClearColor(0x000000, 0); // transparent + gradient: body paints, canvas stays clear
+renderer.shadowMap.enabled = true;
+renderer.shadowMap.type = PCFShadowMap;
+
+const scene = new Scene();
+const pmrem = new PMREMGenerator(renderer);
+scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
+
+scene.add(new AmbientLight(0xffffff, 0.55));
+const hemi = new HemisphereLight(0xbcd6ff, 0x202830, 0.6);
+hemi.position.set(0, 5, 0);
+scene.add(hemi);
+const sun = new DirectionalLight(0xffffff, 1.35);
+sun.position.set(3, 7, 5);
+sun.castShadow = true;
+sun.shadow.mapSize.set(1024, 1024);
+sun.shadow.camera.near = 0.5;
+sun.shadow.camera.far = 25;
+sun.shadow.camera.left = -4;
+sun.shadow.camera.right = 4;
+sun.shadow.camera.top = 4;
+sun.shadow.camera.bottom = -4;
+sun.shadow.bias = -0.0005;
+scene.add(sun);
+
+// Soft shadow blob grounds the avatar on any host background (look2.png).
+const shadowCatcher = new Mesh(new CircleGeometry(1.6, 48), new ShadowMaterial({ opacity: 0.3 }));
+shadowCatcher.rotation.x = -Math.PI / 2;
+shadowCatcher.receiveShadow = true;
+scene.add(shadowCatcher);
+
+const camera = new PerspectiveCamera(38, 1, 0.05, 100);
+
+function sizeToStage() {
+ const w = stageEl.clientWidth || 1;
+ const h = stageEl.clientHeight || 1;
+ renderer.setSize(w, h, false);
+ camera.aspect = w / h;
+ camera.updateProjectionMatrix();
+}
+new ResizeObserver(sizeToStage).observe(stageEl);
+sizeToStage();
+
+// ── Avatar + animation ────────────────────────────────────────────────────
+const animationManager = new AnimationManager();
+let avatar = null;
+let avatarHeight = 1.7;
+let avatarYaw = 0;
+let glance = { active: false, targetYaw: 0 };
+const headAnchor = new Vector3();
+const GLANCE_MAX_RAD = 0.35;
+const GLANCE_LERP = 0.045;
+
+let _loaderPromise = null;
+function getAvatarLoader() {
+ if (!_loaderPromise) {
+ _loaderPromise = getMeshoptDecoder().then((decoder) => {
+ const loader = new GLTFLoader();
+ loader.setMeshoptDecoder(decoder);
+ return loader;
+ });
+ }
+ return _loaderPromise;
+}
+
+function frameAvatar() {
+ camera.position.set(0, avatarHeight * 0.92, avatarHeight * 2.05);
+ camera.lookAt(0, avatarHeight * 0.55, 0);
+}
+
+async function loadAvatar() {
+ const requestedUrl = await resolveAvatarUrl();
+ const loader = await getAvatarLoader();
+
+ let gltf;
+ let usedFallback = false;
+ try {
+ gltf = await loader.loadAsync(requestedUrl);
+ } catch (err) {
+ if (requestedUrl === AVATAR_URL_DEFAULT) throw err;
+ log.warn('[assistant-frame] avatar load failed, falling back to default:', err?.message || err);
+ usedFallback = true;
+ gltf = await loader.loadAsync(AVATAR_URL_DEFAULT);
+ }
+
+ avatar = gltf.scene;
+ avatar.traverse((n) => {
+ if (n.isMesh) {
+ n.castShadow = true;
+ n.receiveShadow = false;
+ if (n.material && 'envMapIntensity' in n.material) n.material.envMapIntensity = 0.85;
+ }
+ });
+ const box = new Box3().setFromObject(avatar);
+ avatar.position.y -= box.min.y;
+ avatarHeight = Math.max(0.5, box.max.y - box.min.y);
+ scene.add(avatar);
+ frameAvatar();
+
+ animationManager.attach(avatar);
+ const manifest = await fetch(ANIMATIONS_MANIFEST_URL, { cache: 'force-cache' }).then((r) => {
+ if (!r.ok) throw new Error(`HTTP ${r.status} fetching animation manifest`);
+ return r.json();
+ });
+ const needed = manifest.filter((d) => REQUIRED_CLIPS.has(d.name));
+ if (!needed.some((d) => d.name === CLIP_IDLE)) {
+ throw new Error('Animation manifest missing idle clip');
+ }
+ animationManager.setAnimationDefs(needed);
+ await animationManager.loadAll();
+ await animationManager.crossfadeTo(CLIP_IDLE, 0.0);
+
+ if (!PREFERS_REDUCED_MOTION && animationManager.supportsCanonicalClips?.() !== false) {
+ animationManager.playOnce(CLIP_GREET, { settleTo: CLIP_IDLE, fade: 0.2 });
+ }
+ if (usedFallback) setStatus("couldn't load that avatar — showing the default", { sticky: true });
+ return usedFallback;
+}
+
+let talking = false;
+function setTalking(on) {
+ if (talking === on || !avatar) return;
+ talking = on;
+ if (animationManager.supportsCanonicalClips?.() === false) return;
+ animationManager.crossfadeTo(on ? CLIP_TALK : CLIP_IDLE, 0.3);
+}
+
+// Idle cursor-glance so the avatar notices the visitor (desktop only).
+if (HAS_HOVER && !PREFERS_REDUCED_MOTION) {
+ canvas.addEventListener('pointermove', (e) => {
+ if (e.pointerType && e.pointerType !== 'mouse') return;
+ const rect = canvas.getBoundingClientRect();
+ if (!rect.width) return;
+ const ndcX = ((e.clientX - rect.left) / rect.width) * 2 - 1;
+ glance.targetYaw = -ndcX * GLANCE_MAX_RAD;
+ glance.active = true;
+ });
+ canvas.addEventListener('pointerleave', () => {
+ glance.active = false;
+ });
+}
+
+// ── Speech bubble ─────────────────────────────────────────────────────────
+let bubbleHideTimer = 0;
+
+function showBubble(text, { streaming = false, thinking = false, error = false, holdMs = 0 } = {}) {
+ clearTimeout(bubbleHideTimer);
+ bubbleTextEl.textContent = text;
+ bubbleEl.classList.toggle('is-streaming', streaming && !thinking);
+ bubbleEl.classList.toggle('is-thinking', thinking);
+ bubbleEl.classList.toggle('is-error', error);
+ bubbleEl.classList.add('is-visible');
+ if (holdMs > 0) bubbleHideTimer = setTimeout(hideBubble, holdMs);
+}
+
+function hideBubble() {
+ clearTimeout(bubbleHideTimer);
+ bubbleEl.classList.remove('is-visible', 'is-streaming', 'is-thinking');
+}
+
+function positionBubble() {
+ if (!avatar || !bubbleEl.classList.contains('is-visible')) return;
+ headAnchor.set(0, avatarHeight + 0.12, 0).applyMatrix4(avatar.matrixWorld);
+ headAnchor.project(camera);
+ const w = stageEl.clientWidth;
+ const h = stageEl.clientHeight;
+ const x = ((headAnchor.x + 1) / 2) * w;
+ const y = ((1 - headAnchor.y) / 2) * h;
+ const half = bubbleEl.offsetWidth / 2 + 8;
+ bubbleEl.style.left = `${Math.min(Math.max(x, half), w - half)}px`;
+ bubbleEl.style.top = `${Math.max(y - 14, bubbleEl.offsetHeight + 10)}px`;
+}
+
+// ── Web Speech TTS ────────────────────────────────────────────────────────
+const hasTTS = typeof window !== 'undefined' && 'speechSynthesis' in window;
+let voices = [];
+let currentUtterance = null;
+let speechGuardTimer = 0;
+
+function loadVoices() {
+ if (!hasTTS) return;
+ voices = window.speechSynthesis.getVoices() || [];
+ const previous = settings.voiceName || '';
+ while (voiceSelectEl.options.length > 1) voiceSelectEl.remove(1);
+ for (const v of voices) {
+ const opt = document.createElement('option');
+ opt.value = v.name;
+ opt.textContent = `${v.name} (${v.lang})`;
+ voiceSelectEl.appendChild(opt);
+ }
+ voiceSelectEl.value = previous && voices.some((v) => v.name === previous) ? previous : '';
+}
+if (hasTTS) {
+ loadVoices();
+ window.speechSynthesis.addEventListener?.('voiceschanged', loadVoices);
+}
+
+function pickVoice() {
+ if (!voices.length) loadVoices();
+ if (settings.voiceName) {
+ const v = voices.find((x) => x.name === settings.voiceName);
+ if (v) return v;
+ }
+ return voices.find((v) => v.localService && v.lang?.startsWith('en')) || voices[0] || null;
+}
+
+function stopSpeaking() {
+ clearTimeout(speechGuardTimer);
+ if (hasTTS) window.speechSynthesis.cancel();
+ currentUtterance = null;
+ setTalking(false);
+}
+
+/**
+ * Speak `text` aloud (bubble is managed by the caller). Resolves when audio
+ * ends. Muted or TTS-less browsers resolve after the estimated read time so
+ * the talking animation and bubble still track the "speech".
+ */
+function speakAloud(text) {
+ stopSpeaking();
+ setTalking(true);
+ post('speak:start', { text });
+ return new Promise((resolve) => {
+ const finish = () => {
+ clearTimeout(speechGuardTimer);
+ if (currentUtterance === utter) currentUtterance = null;
+ setTalking(false);
+ post('speak:end', {});
+ resolve();
+ };
+ let utter = null;
+ if (hasTTS && voiceEnabled) {
+ utter = new SpeechSynthesisUtterance(text);
+ const v = pickVoice();
+ if (v) {
+ utter.voice = v;
+ utter.lang = v.lang;
+ }
+ utter.onend = finish;
+ utter.onerror = (e) => {
+ if (e?.error && !/interrupt|cancel/i.test(e.error)) {
+ log.warn('[assistant-frame] speech synthesis error:', e.error);
+ }
+ finish();
+ };
+ currentUtterance = utter;
+ // Safety net for engines that never fire onend (flaky on mobile).
+ speechGuardTimer = setTimeout(finish, estimateSpeechMs(text) + 2500);
+ try {
+ window.speechSynthesis.speak(utter);
+ return;
+ } catch (err) {
+ log.warn('[assistant-frame] speechSynthesis.speak failed:', err?.message || err);
+ }
+ }
+ // No TTS / muted: hold the talking animation for the estimated duration.
+ speechGuardTimer = setTimeout(finish, estimateSpeechMs(text));
+ });
+}
+
+/** Speak-mode line (also the postMessage `say` handler): bubble + audio. */
+async function speakLine(text) {
+ showBubble(text);
+ await speakAloud(text);
+ bubbleHideTimer = setTimeout(hideBubble, 1200);
+}
+
+// ── Chat ──────────────────────────────────────────────────────────────────
+const history = [];
+let busy = false;
+
+function systemPrompt() {
+ const lines = [
+ `You are ${NAME}, a friendly 3D avatar assistant embedded on a website.`,
+ 'Answer in plain conversational text — no markdown, no lists, no code blocks.',
+ 'Keep replies under 80 words unless the visitor asks for depth.',
+ ];
+ if (CONTEXT) lines.push(`About this website: ${CONTEXT}`);
+ return lines.join('\n');
+}
+
+function pushHistory(role, content) {
+ history.push({ role, content });
+ while (history.length > MAX_HISTORY_TURNS * 2) history.shift();
+}
+
+/** Stream a reply from /api/chat (platform free chain). */
+async function chatFree(message, onChunk) {
+ const res = await fetch('/api/chat', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ message, history: history.slice(0, -1), system_prompt: systemPrompt() }),
+ });
+ if (!res.ok || !res.body) {
+ if (res.status === 429) throw new Error('Too many messages — give it a moment.');
+ throw new Error(`Chat failed (HTTP ${res.status}).`);
+ }
+ const reader = res.body.getReader();
+ const decoder = new TextDecoder();
+ let buffer = '';
+ let accumulated = '';
+ let finalReply = '';
+ let streamError = '';
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ buffer += decoder.decode(value, { stream: true });
+ let sep;
+ while ((sep = buffer.indexOf('\n\n')) !== -1) {
+ const frame = buffer.slice(0, sep);
+ buffer = buffer.slice(sep + 2);
+ const line = frame.split('\n').find((l) => l.startsWith('data:'));
+ if (!line) continue;
+ let evt;
+ try {
+ evt = JSON.parse(line.slice(5).trim());
+ } catch {
+ continue;
+ }
+ if (evt.type === 'chunk' && typeof evt.text === 'string') {
+ accumulated += evt.text;
+ onChunk(accumulated);
+ } else if (evt.type === 'done') {
+ finalReply = (evt.reply || accumulated || '').trim();
+ } else if (evt.type === 'error') {
+ streamError = evt.message || 'stream error';
+ }
+ }
+ }
+ if (streamError && !finalReply && !accumulated) throw new Error(streamError);
+ return (finalReply || accumulated).trim();
+}
+
+/** Stream a reply straight from the visitor's own provider (BYOK). */
+async function chatByok(lane, message, onChunk) {
+ const key = settings.keys[lane];
+ const model = settings.models[lane] || BYOK_DEFAULT_MODELS[lane];
+ const messages = [
+ { role: 'system', content: systemPrompt() },
+ ...history.slice(0, -1),
+ { role: 'user', content: message },
+ ];
+ const headers = { 'content-type': 'application/json', authorization: `Bearer ${key}` };
+ if (lane === 'openrouter') {
+ headers['HTTP-Referer'] = 'https://three.ws';
+ headers['X-Title'] = 'three.ws assistant widget';
+ }
+ const res = await fetch(BYOK_ENDPOINTS[lane], {
+ method: 'POST',
+ headers,
+ body: JSON.stringify({ model, messages, stream: true, max_tokens: 1024 }),
+ });
+ if (!res.ok || !res.body) {
+ if (res.status === 401 || res.status === 403) {
+ throw new Error(`Your ${lane} key was rejected — check it in settings.`);
+ }
+ if (res.status === 429) throw new Error(`${lane} rate limit hit — give it a moment.`);
+ throw new Error(`Chat failed (HTTP ${res.status}).`);
+ }
+ const reader = res.body.getReader();
+ const decoder = new TextDecoder();
+ let buffer = '';
+ let accumulated = '';
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ buffer += decoder.decode(value, { stream: true });
+ let nl;
+ while ((nl = buffer.indexOf('\n')) !== -1) {
+ const line = buffer.slice(0, nl).trim();
+ buffer = buffer.slice(nl + 1);
+ if (!line.startsWith('data:')) continue;
+ const payload = line.slice(5).trim();
+ if (payload === '[DONE]') continue;
+ let evt;
+ try {
+ evt = JSON.parse(payload);
+ } catch {
+ continue;
+ }
+ const delta = evt?.choices?.[0]?.delta?.content;
+ if (typeof delta === 'string' && delta) {
+ accumulated += delta;
+ onChunk(accumulated);
+ }
+ }
+ }
+ return accumulated.trim();
+}
+
+async function handleChat(message) {
+ pushHistory('user', message);
+ showBubble('', { thinking: true });
+ setTalking(true);
+ const lane = effectiveLane();
+ try {
+ const onChunk = (text) => showBubble(text, { streaming: true });
+ const reply = lane === 'free' ? await chatFree(message, onChunk) : await chatByok(lane, message, onChunk);
+ if (!reply) throw new Error('The model returned an empty reply — try again.');
+ pushHistory('assistant', reply);
+ post('message', { role: 'assistant', content: reply });
+ showBubble(reply);
+ if (voiceEnabled) {
+ await speakAloud(reply);
+ bubbleHideTimer = setTimeout(hideBubble, 6000);
+ } else {
+ setTalking(false);
+ bubbleHideTimer = setTimeout(hideBubble, Math.max(6000, estimateSpeechMs(reply)));
+ }
+ } catch (err) {
+ history.pop(); // failed turn doesn't poison the next one
+ setTalking(false);
+ showBubble(err?.message || 'Something went wrong — try again.', { error: true, holdMs: 6000 });
+ }
+}
+
+// ── Composer wiring ───────────────────────────────────────────────────────
+function autoGrow() {
+ inputEl.style.height = 'auto';
+ inputEl.style.height = `${Math.min(inputEl.scrollHeight, 96)}px`;
+}
+inputEl.addEventListener('input', autoGrow);
+
+async function submit() {
+ const text = inputEl.value.trim();
+ if (!text || busy) return;
+ inputEl.value = '';
+ autoGrow();
+ busy = true;
+ sendBtn.disabled = true;
+ try {
+ post('message', { role: 'user', content: text, mode: activeMode });
+ if (activeMode === 'speak') await speakLine(text);
+ else await handleChat(text);
+ } finally {
+ busy = false;
+ sendBtn.disabled = false;
+ inputEl.focus();
+ }
+}
+
+sendBtn.addEventListener('click', submit);
+inputEl.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter' && !e.shiftKey) {
+ e.preventDefault();
+ submit();
+ }
+});
+
+for (const btn of modesEl.querySelectorAll('.mode-btn')) {
+ btn.addEventListener('click', () => {
+ if (activeMode === btn.dataset.mode) return;
+ activeMode = btn.dataset.mode;
+ stopSpeaking();
+ hideBubble();
+ applyModeChrome();
+ inputEl.focus();
+ });
+}
+
+voiceBtn.addEventListener('click', () => {
+ voiceEnabled = !voiceEnabled;
+ if (!voiceEnabled) stopSpeaking();
+ settings.voiceEnabled = voiceEnabled;
+ saveSettings();
+ applyVoiceChrome();
+ setStatus(voiceEnabled ? 'voice on' : 'voice off');
+});
+
+closeBtn.addEventListener('click', () => post('close', {}));
+window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ if (settingsEl.classList.contains('is-open')) toggleSettings(false);
+ else post('close', {});
+ }
+});
+
+// ── Settings wiring ───────────────────────────────────────────────────────
+function toggleSettings(open) {
+ const willOpen = open ?? !settingsEl.classList.contains('is-open');
+ settingsEl.classList.toggle('is-open', willOpen);
+ settingsBtn.setAttribute('aria-expanded', String(willOpen));
+ if (willOpen) applyLaneChrome();
+}
+settingsBtn.addEventListener('click', () => toggleSettings());
+settingsCloseBtn.addEventListener('click', () => toggleSettings(false));
+
+for (const radio of settingsEl.querySelectorAll('input[name="assistant-lane"]')) {
+ radio.addEventListener('change', () => {
+ settings.lane = normalizeLane(radio.value);
+ saveSettings();
+ applyLaneChrome();
+ });
+}
+
+byokKeyEl.addEventListener('input', () => {
+ if (settings.lane === 'free') return;
+ settings.keys[settings.lane] = byokKeyEl.value.trim();
+ saveSettings();
+ lanePillEl.textContent = effectiveLane() === 'free' ? 'free' : `byok:${effectiveLane()}`;
+});
+
+byokModelEl.addEventListener('input', () => {
+ if (settings.lane === 'free') return;
+ settings.models[settings.lane] = byokModelEl.value.trim();
+ saveSettings();
+});
+
+voiceSelectEl.addEventListener('change', () => {
+ settings.voiceName = voiceSelectEl.value;
+ saveSettings();
+});
+
+// ── Render loop with visibility gating ────────────────────────────────────
+const clock = new Timer();
+let loopRunning = false;
+let rafHandle = 0;
+let canRender = false;
+let onScreen = true;
+
+function tick() {
+ clock.update();
+ const dt = Math.min(clock.getDelta(), 0.05);
+ if (avatar && HAS_HOVER && !PREFERS_REDUCED_MOTION) {
+ const targetYaw = glance.active ? glance.targetYaw : 0;
+ let diff = ((targetYaw - avatarYaw + Math.PI) % (Math.PI * 2)) - Math.PI;
+ if (diff < -Math.PI) diff += Math.PI * 2;
+ avatarYaw += diff * GLANCE_LERP;
+ avatar.rotation.y = avatarYaw;
+ }
+ animationManager.update(dt);
+ positionBubble();
+ renderer.render(scene, camera);
+ if (loopRunning) rafHandle = requestAnimationFrame(tick);
+}
+
+function startLoop() {
+ if (loopRunning || !canRender) return;
+ loopRunning = true;
+ clock.update();
+ rafHandle = requestAnimationFrame(tick);
+}
+function stopLoop() {
+ loopRunning = false;
+ if (rafHandle) {
+ cancelAnimationFrame(rafHandle);
+ rafHandle = 0;
+ }
+}
+function syncLoop() {
+ if (canRender && onScreen && !document.hidden) startLoop();
+ else stopLoop();
+}
+document.addEventListener('visibilitychange', syncLoop);
+if (typeof IntersectionObserver === 'function') {
+ const io = new IntersectionObserver((entries) => {
+ onScreen = entries.some((en) => en.isIntersecting);
+ syncLoop();
+ }, { threshold: 0 });
+ io.observe(stageEl);
+}
+
+function hidePoster() {
+ posterEl.classList.add('is-hidden');
+ setTimeout(() => posterEl.remove(), 500);
+}
+
+// ── Boot ──────────────────────────────────────────────────────────────────
+applyModeChrome();
+applyLaneChrome();
+applyVoiceChrome();
+
+loadAvatar()
+ .then((usedFallback) => {
+ canRender = true;
+ syncLoop();
+ hidePoster();
+ post('ready', { mode: activeMode, fallback: usedFallback });
+ const greeting =
+ GREETING ||
+ (MODE === 'speak'
+ ? "Type below and I'll say it out loud."
+ : `Hi! I'm ${NAME} — ask me anything.`);
+ showBubble(greeting, { holdMs: 7000 });
+ inputEl.focus();
+ })
+ .catch((err) => {
+ log.error('[assistant-frame] failed to load avatar:', err);
+ hidePoster();
+ canRender = true;
+ syncLoop();
+ setStatus(`failed to load avatar: ${err?.message ?? err}`, { error: true, sticky: true });
+ post('error', { code: 'avatar_load_failed', message: String(err?.message || err) });
+ });
diff --git a/src/assistant-page.js b/src/assistant-page.js
new file mode 100644
index 000000000..d6fb2d86f
--- /dev/null
+++ b/src/assistant-page.js
@@ -0,0 +1,159 @@
+// /assistant — builder page for the assistant widget.
+//
+// Left card edits a config object; the right card renders the copy-paste
+// script snippet; and the page itself runs the REAL loader
+// (public/assistant/v1.js) so every change re-inits the live widget in the
+// corner. No mock preview — what you see is the shipped widget.
+
+import { sanitizeAccent, normalizeMode } from './assistant-widget-core.js';
+
+const config = {
+ avatar: '',
+ bg: '',
+ mode: 'both',
+ name: '',
+ greeting: '',
+ context: '',
+ accent: '#f97316',
+ position: 'right',
+};
+
+const snippetEl = document.getElementById('snippet');
+const copyBtn = document.getElementById('copy-btn');
+const avatarSelect = document.getElementById('cfg-avatar');
+const avatarUrlInput = document.getElementById('cfg-avatar-url');
+const bgColorInput = document.getElementById('cfg-bg-color');
+const nameInput = document.getElementById('cfg-name');
+const greetingInput = document.getElementById('cfg-greeting');
+const contextInput = document.getElementById('cfg-context');
+const accentInput = document.getElementById('cfg-accent');
+
+// ── Snippet rendering ─────────────────────────────────────────────────────
+function escapeAttr(value) {
+ return String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
+}
+
+function snippetAttrs() {
+ const attrs = [];
+ if (config.avatar) attrs.push(['data-avatar', config.avatar]);
+ if (config.bg) attrs.push(['data-bg', config.bg]);
+ if (config.mode !== 'both') attrs.push(['data-mode', config.mode]);
+ if (config.name) attrs.push(['data-name', config.name]);
+ if (config.greeting) attrs.push(['data-greeting', config.greeting]);
+ if (config.context) attrs.push(['data-context', config.context]);
+ if (config.accent.toLowerCase() !== '#f97316') attrs.push(['data-accent', config.accent]);
+ if (config.position !== 'right') attrs.push(['data-position', config.position]);
+ return attrs;
+}
+
+function renderSnippet() {
+ const attrs = snippetAttrs();
+ const lines = [`<span class="tag">&lt;script</span> <span class="attr">src</span>=<span class="val">"https://three.ws/assistant/v1.js"</span> <span class="attr">async</span>`];
+ for (const [key, value] of attrs) {
+ lines.push(` <span class="attr">${key}</span>=<span class="val">"${escapeAttr(value)}"</span>`);
+ }
+ lines[lines.length - 1] += `<span class="tag">&gt;&lt;/script&gt;</span>`;
+ snippetEl.innerHTML = lines.join('\n');
+}
+
+function snippetText() {
+ const attrs = snippetAttrs()
+ .map(([key, value]) => `\n ${key}="${String(value).replace(/"/g, '&quot;')}"`)
+ .join('');
+ return `<script src="https://three.ws/assistant/v1.js" async${attrs}><\/script>`;
+}
+
+// ── Live widget (the real loader, re-inited on every change) ──────────────
+let loaderReady = null;
+function ensureLoader() {
+ if (loaderReady) return loaderReady;
+ loaderReady = new Promise((resolve, reject) => {
+ const s = document.createElement('script');
+ s.src = '/assistant/v1.js';
+ s.setAttribute('data-manual', ''); // we drive init ourselves
+ s.onload = resolve;
+ s.onerror = () => reject(new Error('assistant loader failed to load'));
+ document.head.appendChild(s);
+ });
+ return loaderReady;
+}
+
+let applyTimer = 0;
+function applyLive() {
+ clearTimeout(applyTimer);
+ applyTimer = setTimeout(async () => {
+ await ensureLoader();
+ const wasOpen = Boolean(window.ThreeAssistant?.instance?.isOpen);
+ window.ThreeAssistant.init({ ...config, open: wasOpen });
+ }, 250);
+}
+
+function update(patch) {
+ Object.assign(config, patch);
+ renderSnippet();
+ applyLive();
+}
+
+// ── Control wiring ────────────────────────────────────────────────────────
+avatarSelect.addEventListener('change', () => {
+ const custom = avatarSelect.value === 'custom';
+ avatarUrlInput.hidden = !custom;
+ update({ avatar: custom ? avatarUrlInput.value.trim() : avatarSelect.value });
+ if (custom) avatarUrlInput.focus();
+});
+avatarUrlInput.addEventListener('input', () => update({ avatar: avatarUrlInput.value.trim() }));
+
+for (const swatch of document.querySelectorAll('.swatch')) {
+ swatch.addEventListener('click', () => {
+ for (const s of document.querySelectorAll('.swatch')) s.setAttribute('aria-pressed', 'false');
+ swatch.setAttribute('aria-pressed', 'true');
+ const isCustom = swatch.dataset.bg === 'custom-color';
+ bgColorInput.hidden = !isCustom;
+ update({ bg: isCustom ? bgColorInput.value : swatch.dataset.bg });
+ });
+}
+bgColorInput.addEventListener('input', () => update({ bg: bgColorInput.value }));
+
+for (const btn of document.querySelectorAll('[data-mode]')) {
+ btn.addEventListener('click', () => {
+ for (const b of document.querySelectorAll('[data-mode]')) b.setAttribute('aria-pressed', 'false');
+ btn.setAttribute('aria-pressed', 'true');
+ update({ mode: normalizeMode(btn.dataset.mode) });
+ });
+}
+
+for (const btn of document.querySelectorAll('[data-pos]')) {
+ btn.addEventListener('click', () => {
+ for (const b of document.querySelectorAll('[data-pos]')) b.setAttribute('aria-pressed', 'false');
+ btn.setAttribute('aria-pressed', 'true');
+ update({ position: btn.dataset.pos });
+ });
+}
+
+nameInput.addEventListener('input', () => update({ name: nameInput.value.trim() }));
+greetingInput.addEventListener('input', () => update({ greeting: greetingInput.value.trim() }));
+contextInput.addEventListener('input', () => update({ context: contextInput.value.trim() }));
+accentInput.addEventListener('input', () => update({ accent: sanitizeAccent(accentInput.value) }));
+
+copyBtn.addEventListener('click', async () => {
+ try {
+ await navigator.clipboard.writeText(snippetText());
+ copyBtn.textContent = 'Copied!';
+ } catch {
+ // Clipboard API blocked (permissions / http) — select the snippet so
+ // the user can copy manually.
+ const range = document.createRange();
+ range.selectNodeContents(snippetEl);
+ const sel = getSelection();
+ sel.removeAllRanges();
+ sel.addRange(range);
+ copyBtn.textContent = 'Press Ctrl+C';
+ }
+ setTimeout(() => {
+ copyBtn.textContent = 'Copy snippet';
+ }, 1600);
+});
+
+// ── Boot ──────────────────────────────────────────────────────────────────
+renderSnippet();
+applyLive();
diff --git a/tests/api-concierge.test.js b/tests/api-concierge.test.js
new file mode 100644
index 000000000..4b4b3fae9
--- /dev/null
+++ b/tests/api-concierge.test.js
@@ -0,0 +1,264 @@
+// POST /api/concierge, the embeddable widget's answer engine. Covers: CORS is
+// any-origin (the whole point of the route), method/body validation, its own
+// rate buckets, fail-open moderation with an in-band refusal, provider
+// fallover with cooldown marking on billing/auth failures, and the SSE
+// chunk→done stream a healthy rung produces.
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+
+const conciergeIpMock = vi.fn(async () => ({ success: true }));
+const conciergeGlobalMock = vi.fn(async () => ({ success: true }));
+vi.mock('../api/_lib/rate-limit.js', () => ({
+ limits: {
+ conciergeIp: (...a) => conciergeIpMock(...a),
+ conciergeGlobal: (...a) => conciergeGlobalMock(...a),
+ },
+ clientIp: () => '203.0.113.9',
+}));
+
+const moderateMock = vi.fn(async () => ({ checked: true, flagged: false }));
+vi.mock('../api/_lib/moderation.js', () => ({
+ moderateAnonInput: (...a) => moderateMock(...a),
+ refusalReply: () => 'I can’t help with that, but I’m happy to answer questions about this site.',
+}));
+
+const providerChainMock = vi.fn(() => []);
+vi.mock('../api/_lib/llm.js', () => ({
+ providerChain: (...a) => providerChainMock(...a),
+ LlmUnavailableError: class extends Error {
+ constructor() {
+ super('no provider');
+ this.status = 503;
+ }
+ },
+}));
+
+const cooldownMock = vi.fn(async () => {});
+vi.mock('../api/_lib/provider-health.js', () => ({
+ markProviderCooldown: (...a) => cooldownMock(...a),
+ providersInCooldown: async () => new Map(),
+ AUTH_COOLDOWN_SECONDS: 3600,
+}));
+
+const recordEventMock = vi.fn();
+vi.mock('../api/_lib/usage.js', () => ({ recordEvent: (...a) => recordEventMock(...a) }));
+vi.mock('../api/_lib/sentry.js', () => ({ captureException: vi.fn() }));
+vi.mock('../api/_lib/env.js', () => ({ env: { APP_ORIGIN: 'http://localhost:3000' } }));
+
+const { default: handler } = await import('../api/concierge.js');
+
+function mkReq({ method = 'POST', body = null, origin = 'https://customer-site.example' } = {}) {
+ const headers = { origin };
+ if (body != null) headers['content-type'] = 'application/json';
+ return {
+ method,
+ url: '/api/concierge',
+ headers,
+ on(event, cb) {
+ if (event === 'data' && body != null) {
+ const buf = Buffer.from(typeof body === 'string' ? body : JSON.stringify(body));
+ queueMicrotask(() => {
+ cb(buf);
+ this._endCb?.();
+ });
+ } else if (event === 'end') {
+ this._endCb = cb;
+ if (body == null) queueMicrotask(() => cb());
+ }
+ },
+ };
+}
+
+function mkRes() {
+ return {
+ statusCode: 200,
+ headers: {},
+ chunks: [],
+ writableEnded: false,
+ setHeader(k, v) {
+ this.headers[k.toLowerCase()] = v;
+ },
+ writeHead(code, headers = {}) {
+ this.statusCode = code;
+ for (const [k, v] of Object.entries(headers)) this.setHeader(k, v);
+ },
+ write(s) {
+ this.chunks.push(String(s));
+ return true;
+ },
+ end(b) {
+ if (b) this.chunks.push(String(b));
+ this.writableEnded = true;
+ },
+ get body() {
+ return this.chunks.join('');
+ },
+ };
+}
+
+function sseEvents(res) {
+ return res.body
+ .split('\n\n')
+ .filter((f) => f.startsWith('data:'))
+ .map((f) => JSON.parse(f.slice(5)));
+}
+
+function fakeStreamBody(deltas) {
+ const frames = deltas.map((d) =>
+ Buffer.from(`data: ${JSON.stringify({ choices: [{ delta: { content: d } }] })}\n`),
+ );
+ frames.push(Buffer.from('data: [DONE]\n'));
+ return (async function* () {
+ yield* frames;
+ })();
+}
+
+const VALID_BODY = {
+ message: 'What does the Pro plan cost?',
+ history: [{ role: 'user', content: 'hi' }, { role: 'assistant', content: 'Hello!' }],
+ site: {
+ url: 'https://customer-site.example/pricing',
+ name: 'Acme',
+ title: 'Pricing, Acme',
+ description: 'Plans for every team.',
+ headings: ['Pricing', 'FAQ'],
+ nav: ['Home', 'Pricing', 'Docs'],
+ knowledge: 'Pro plan costs $20/month.',
+ content: 'Pro $20/month. Free plan available.',
+ },
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ conciergeIpMock.mockResolvedValue({ success: true });
+ conciergeGlobalMock.mockResolvedValue({ success: true });
+ moderateMock.mockResolvedValue({ checked: true, flagged: false });
+});
+
+describe('/api/concierge', () => {
+ it('answers OPTIONS preflight with any-origin CORS', async () => {
+ const res = mkRes();
+ await handler(mkReq({ method: 'OPTIONS' }), res);
+ expect(res.statusCode).toBe(204);
+ expect(res.headers['access-control-allow-origin']).toBe('*');
+ });
+
+ it('rejects GET', async () => {
+ const res = mkRes();
+ await handler(mkReq({ method: 'GET' }), res);
+ expect(res.statusCode).toBe(405);
+ });
+
+ it('400s a malformed body', async () => {
+ const res = mkRes();
+ await handler(mkReq({ body: { message: '' } }), res);
+ expect(res.statusCode).toBe(400);
+ });
+
+ it('429s when the per-IP bucket is exhausted', async () => {
+ conciergeIpMock.mockResolvedValue({ success: false, limit: 20, remaining: 0, reset: Date.now() + 1000 });
+ const res = mkRes();
+ await handler(mkReq({ body: VALID_BODY }), res);
+ expect(res.statusCode).toBe(429);
+ });
+
+ it('flagged input gets an in-band SSE refusal, never an HTTP error', async () => {
+ moderateMock.mockResolvedValue({ checked: true, flagged: true });
+ const res = mkRes();
+ await handler(mkReq({ body: VALID_BODY }), res);
+ expect(res.statusCode).toBe(200);
+ const events = sseEvents(res);
+ expect(events[0].type).toBe('chunk');
+ expect(events[0].text).toMatch(/can’t help/);
+ expect(events.at(-1)).toMatchObject({ type: 'done', moderated: true });
+ expect(providerChainMock).not.toHaveBeenCalled();
+ });
+
+ it('streams chunk→done from a healthy provider, grounded system prompt included', async () => {
+ let capturedBody = null;
+ providerChainMock.mockReturnValue([
+ {
+ name: 'groq',
+ model: 'llama-3.3-70b',
+ url: 'https://groq.test/v1/chat/completions',
+ headers: { 'content-type': 'application/json' },
+ },
+ ]);
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async (url, opts) => {
+ capturedBody = JSON.parse(opts.body);
+ return { ok: true, body: fakeStreamBody(['The Pro plan ', 'costs $20/month.']) };
+ }),
+ );
+
+ const res = mkRes();
+ await handler(mkReq({ body: VALID_BODY }), res);
+ vi.unstubAllGlobals();
+
+ expect(res.headers['content-type']).toMatch(/text\/event-stream/);
+ const events = sseEvents(res);
+ expect(events.filter((e) => e.type === 'chunk').map((e) => e.text).join('')).toBe(
+ 'The Pro plan costs $20/month.',
+ );
+ expect(events.at(-1)).toMatchObject({ type: 'done', provider: 'groq', model: 'llama-3.3-70b' });
+
+ // The upstream request carried streaming + the grounded system prompt +
+ // the running history + the visitor's question.
+ expect(capturedBody.stream).toBe(true);
+ expect(capturedBody.messages[0].role).toBe('system');
+ expect(capturedBody.messages[0].content).toContain('Pro plan costs $20/month');
+ expect(capturedBody.messages[0].content).toContain('Acme');
+ expect(capturedBody.messages.at(-1)).toEqual({ role: 'user', content: VALID_BODY.message });
+ expect(capturedBody.messages).toHaveLength(4);
+
+ expect(recordEventMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ kind: 'chat',
+ tool: 'concierge',
+ meta: expect.objectContaining({ provider: 'groq', site: 'customer-site.example' }),
+ }),
+ );
+ });
+
+ it('fails over past a billing-dead rung (with auth cooldown) to the next provider', async () => {
+ providerChainMock.mockReturnValue([
+ { name: 'openrouter', model: 'oss-120b', url: 'https://or.test/v1', headers: {} },
+ { name: 'groq', model: 'llama-3.3-70b', url: 'https://groq.test/v1', headers: {} },
+ ]);
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async (url) => {
+ if (String(url).startsWith('https://or.test')) {
+ return { ok: false, status: 402, text: async () => 'insufficient credits' };
+ }
+ return { ok: true, body: fakeStreamBody(['fallback answer']) };
+ }),
+ );
+
+ const res = mkRes();
+ await handler(mkReq({ body: VALID_BODY }), res);
+ vi.unstubAllGlobals();
+
+ const events = sseEvents(res);
+ expect(events.at(-1)).toMatchObject({ type: 'done', provider: 'groq' });
+ expect(cooldownMock).toHaveBeenCalledWith('openrouter', 3600, 'auth');
+ });
+
+ it('503s with Retry-After when every rung fails before a byte streams', async () => {
+ providerChainMock.mockReturnValue([
+ { name: 'groq', model: 'm', url: 'https://groq.test/v1', headers: {} },
+ ]);
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => ({ ok: false, status: 429, text: async () => 'rate limited' })),
+ );
+
+ const res = mkRes();
+ await handler(mkReq({ body: VALID_BODY }), res);
+ vi.unstubAllGlobals();
+
+ expect(res.statusCode).toBe(503);
+ expect(res.headers['retry-after']).toBe('15');
+ expect(cooldownMock).toHaveBeenCalledWith('groq');
+ });
+});
diff --git a/vercel.json b/vercel.json
index 3888448c0..01fa34cc0 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1523,6 +1523,32 @@
},
"dest": "/embed/v1.js"
},
+ {
+ "src": "/assistant/v1.js",
+ "headers": {
+ "content-type": "application/javascript; charset=utf-8",
+ "cache-control": "public, max-age=300, s-maxage=86400, stale-while-revalidate=604800",
+ "access-control-allow-origin": "*",
+ "cross-origin-resource-policy": "cross-origin",
+ "x-content-type-options": "nosniff"
+ },
+ "dest": "/assistant/v1.js"
+ },
+ {
+ "src": "/assistant-frame/?",
+ "headers": {
+ "content-security-policy": "frame-ancestors *; base-uri 'self'; object-src 'none'; report-uri /api/client-errors",
+ "x-content-type-options": "nosniff",
+ "referrer-policy": "strict-origin-when-cross-origin",
+ "permissions-policy": "autoplay=*",
+ "cross-origin-resource-policy": "cross-origin"
+ },
+ "dest": "/assistant-frame.html"
+ },
+ {
+ "src": "/assistant/?",
+ "dest": "/assistant.html"
+ },
{
"src": "/embed/v1/preview/?",
"dest": "/embed/v1/preview.html"
@@ -4679,6 +4705,14 @@
"src": "/tour/",
"dest": "/tour.html"
},
+ {
+ "src": "/concierge",
+ "dest": "/concierge.html"
+ },
+ {
+ "src": "/concierge/",
+ "dest": "/concierge.html"
+ },
{
"src": "/tour-builder",
"dest": "/tour-builder.html"
diff --git a/vite.config.js b/vite.config.js
index 15974ade4..6e8d9b41c 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -330,6 +330,7 @@ const appConfig = {
home: resolve(__dirname, 'pages/home.html'),
'what-is': resolve(__dirname, 'pages/what-is.html'),
tour: resolve(__dirname, 'pages/tour.html'),
+ concierge: resolve(__dirname, 'pages/concierge.html'),
'tour-builder': resolve(__dirname, 'pages/tour-builder.html'),
'agent-identities': resolve(__dirname, 'pages/agent-identities.html'),
pitch: resolve(__dirname, 'pages/pitch.html'),
@@ -352,6 +353,8 @@ const appConfig = {
constellation: resolve(__dirname, 'pages/constellation.html'),
embed: resolve(__dirname, 'pages/embed.html'),
'embed-demo': resolve(__dirname, 'pages/embed-demo.html'),
+ assistant: resolve(__dirname, 'pages/assistant.html'),
+ 'assistant-frame': resolve(__dirname, 'pages/assistant-frame.html'),
// Embodiment embed: a living, rigged agent body (lip-sync + emotion
// + idle) that renders inline in ChatGPT/Claude. Registered as an
// input so its inline module graph — /apps-sdk/embodiment/* → three
@@ -1177,6 +1180,10 @@ support: resolve(__dirname, 'pages/support.html'),
'/guardian/': resolve(root, 'pages/guardian.html'),
'/walk-embed': resolve(root, 'pages/walk-embed.html'),
'/walk-embed/': resolve(root, 'pages/walk-embed.html'),
+ '/assistant': resolve(root, 'pages/assistant.html'),
+ '/assistant/': resolve(root, 'pages/assistant.html'),
+ '/assistant-frame': resolve(root, 'pages/assistant-frame.html'),
+ '/assistant-frame/': resolve(root, 'pages/assistant-frame.html'),
'/walk': resolve(root, 'pages/walk-landing.html'),
'/walk/': resolve(root, 'pages/walk-landing.html'),
'/walk/app': resolve(root, 'pages/walk-embed.html'),